repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gabstopper/smc-python | smc/examples/ip_lists.py | create_iplist_with_data | def create_iplist_with_data(name, iplist):
"""
Create an IPList with initial list contents.
:param str name: name of IPList
:param list iplist: list of IPList IP's, networks, etc
:return: href of list location
"""
iplist = IPList.create(name=name, iplist=iplist)
return iplist | python | def create_iplist_with_data(name, iplist):
"""
Create an IPList with initial list contents.
:param str name: name of IPList
:param list iplist: list of IPList IP's, networks, etc
:return: href of list location
"""
iplist = IPList.create(name=name, iplist=iplist)
return iplist | [
"def",
"create_iplist_with_data",
"(",
"name",
",",
"iplist",
")",
":",
"iplist",
"=",
"IPList",
".",
"create",
"(",
"name",
"=",
"name",
",",
"iplist",
"=",
"iplist",
")",
"return",
"iplist"
] | Create an IPList with initial list contents.
:param str name: name of IPList
:param list iplist: list of IPList IP's, networks, etc
:return: href of list location | [
"Create",
"an",
"IPList",
"with",
"initial",
"list",
"contents",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ip_lists.py#L139-L148 | train |
gabstopper/smc-python | smc/routing/ospf.py | OSPF.enable | def enable(self, ospf_profile=None, router_id=None):
"""
Enable OSPF on this engine. For master engines, enable
OSPF on the virtual firewall.
Once enabled on the engine, add an OSPF area to an interface::
engine.dynamic_routing.ospf.enable()
interface = engine.r... | python | def enable(self, ospf_profile=None, router_id=None):
"""
Enable OSPF on this engine. For master engines, enable
OSPF on the virtual firewall.
Once enabled on the engine, add an OSPF area to an interface::
engine.dynamic_routing.ospf.enable()
interface = engine.r... | [
"def",
"enable",
"(",
"self",
",",
"ospf_profile",
"=",
"None",
",",
"router_id",
"=",
"None",
")",
":",
"ospf_profile",
"=",
"element_resolver",
"(",
"ospf_profile",
")",
"if",
"ospf_profile",
"else",
"OSPFProfile",
"(",
"'Default OSPFv2 Profile'",
")",
".",
... | Enable OSPF on this engine. For master engines, enable
OSPF on the virtual firewall.
Once enabled on the engine, add an OSPF area to an interface::
engine.dynamic_routing.ospf.enable()
interface = engine.routing.get(0)
interface.add_ospf_area(OSPFArea('myarea'))
... | [
"Enable",
"OSPF",
"on",
"this",
"engine",
".",
"For",
"master",
"engines",
"enable",
"OSPF",
"on",
"the",
"virtual",
"firewall",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L100-L123 | train |
gabstopper/smc-python | smc/routing/ospf.py | OSPFArea.create | def create(cls, name, interface_settings_ref=None, area_id=1,
area_type='normal', outbound_filters=None,
inbound_filters=None, shortcut_capable_area=False,
ospfv2_virtual_links_endpoints_container=None,
ospf_abr_substitute_container=None, comment=None, **kwarg... | python | def create(cls, name, interface_settings_ref=None, area_id=1,
area_type='normal', outbound_filters=None,
inbound_filters=None, shortcut_capable_area=False,
ospfv2_virtual_links_endpoints_container=None,
ospf_abr_substitute_container=None, comment=None, **kwarg... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"interface_settings_ref",
"=",
"None",
",",
"area_id",
"=",
"1",
",",
"area_type",
"=",
"'normal'",
",",
"outbound_filters",
"=",
"None",
",",
"inbound_filters",
"=",
"None",
",",
"shortcut_capable_area",
"=",
"... | Create a new OSPF Area
:param str name: name of OSPFArea configuration
:param str,OSPFInterfaceSetting interface_settings_ref: an OSPFInterfaceSetting
element or href. If None, uses the default system profile
:param str name: area id
:param str area_type: \|normal\|stub\|not... | [
"Create",
"a",
"new",
"OSPF",
"Area"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L210-L257 | train |
gabstopper/smc-python | smc/routing/ospf.py | OSPFInterfaceSetting.create | def create(cls, name, dead_interval=40, hello_interval=10,
hello_interval_type='normal', dead_multiplier=1,
mtu_mismatch_detection=True, retransmit_interval=5,
router_priority=1, transmit_delay=1,
authentication_type=None, password=None,
key_cha... | python | def create(cls, name, dead_interval=40, hello_interval=10,
hello_interval_type='normal', dead_multiplier=1,
mtu_mismatch_detection=True, retransmit_interval=5,
router_priority=1, transmit_delay=1,
authentication_type=None, password=None,
key_cha... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"dead_interval",
"=",
"40",
",",
"hello_interval",
"=",
"10",
",",
"hello_interval_type",
"=",
"'normal'",
",",
"dead_multiplier",
"=",
"1",
",",
"mtu_mismatch_detection",
"=",
"True",
",",
"retransmit_interval",
... | Create custom OSPF interface settings profile
:param str name: name of interface settings
:param int dead_interval: in seconds
:param str hello_interval: in seconds
:param str hello_interval_type: \|normal\|fast_hello
:param int dead_multipler: fast hello packet multipler
... | [
"Create",
"custom",
"OSPF",
"interface",
"settings",
"profile"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L297-L337 | train |
gabstopper/smc-python | smc/routing/ospf.py | OSPFKeyChain.create | def create(cls, name, key_chain_entry):
"""
Create a key chain with list of keys
Key_chain_entry format is::
[{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}]
:param str name: Name of key chain
:param list key_chain_entry: list of key chain entries
... | python | def create(cls, name, key_chain_entry):
"""
Create a key chain with list of keys
Key_chain_entry format is::
[{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}]
:param str name: Name of key chain
:param list key_chain_entry: list of key chain entries
... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"key_chain_entry",
")",
":",
"key_chain_entry",
"=",
"key_chain_entry",
"or",
"[",
"]",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'ospfv2_key_chain_entry'",
":",
"key_chain_entry",
"}",
"return",
"ElementCrea... | Create a key chain with list of keys
Key_chain_entry format is::
[{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}]
:param str name: Name of key chain
:param list key_chain_entry: list of key chain entries
:raises CreateElementFailed: create failed with reason
... | [
"Create",
"a",
"key",
"chain",
"with",
"list",
"of",
"keys"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L359-L377 | train |
gabstopper/smc-python | smc/routing/ospf.py | OSPFDomainSetting.create | def create(cls, name, abr_type='cisco', auto_cost_bandwidth=100,
deprecated_algorithm=False, initial_delay=200,
initial_hold_time=1000, max_hold_time=10000,
shutdown_max_metric_lsa=0, startup_max_metric_lsa=0):
"""
Create custom Domain Settings
Domai... | python | def create(cls, name, abr_type='cisco', auto_cost_bandwidth=100,
deprecated_algorithm=False, initial_delay=200,
initial_hold_time=1000, max_hold_time=10000,
shutdown_max_metric_lsa=0, startup_max_metric_lsa=0):
"""
Create custom Domain Settings
Domai... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"abr_type",
"=",
"'cisco'",
",",
"auto_cost_bandwidth",
"=",
"100",
",",
"deprecated_algorithm",
"=",
"False",
",",
"initial_delay",
"=",
"200",
",",
"initial_hold_time",
"=",
"1000",
",",
"max_hold_time",
"=",
... | Create custom Domain Settings
Domain settings are referenced by an OSPFProfile
:param str name: name of custom domain settings
:param str abr_type: cisco|shortcut|standard
:param int auto_cost_bandwidth: Mbits/s
:param bool deprecated_algorithm: RFC 1518 compatibility
:... | [
"Create",
"custom",
"Domain",
"Settings"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/ospf.py#L519-L551 | train |
gabstopper/smc-python | smc/base/decorators.py | exception | def exception(function):
"""
If exception was specified for prepared_request,
inject this into SMCRequest so it can be used for
return if needed.
"""
@functools.wraps(function)
def wrapper(*exception, **kwargs):
result = function(**kwargs)
if exception:
result.exc... | python | def exception(function):
"""
If exception was specified for prepared_request,
inject this into SMCRequest so it can be used for
return if needed.
"""
@functools.wraps(function)
def wrapper(*exception, **kwargs):
result = function(**kwargs)
if exception:
result.exc... | [
"def",
"exception",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"*",
"exception",
",",
"**",
"kwargs",
")",
":",
"result",
"=",
"function",
"(",
"**",
"kwargs",
")",
"if",
"exception",
":",
... | If exception was specified for prepared_request,
inject this into SMCRequest so it can be used for
return if needed. | [
"If",
"exception",
"was",
"specified",
"for",
"prepared_request",
"inject",
"this",
"into",
"SMCRequest",
"so",
"it",
"can",
"be",
"used",
"for",
"return",
"if",
"needed",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/decorators.py#L107-L119 | train |
gabstopper/smc-python | smc/core/engines.py | Layer2Firewall.create | def create(cls, name, mgmt_ip, mgmt_network,
mgmt_interface=0,
inline_interface='1-2',
logical_interface='default_eth',
log_server_ref=None,
domain_server_address=None, zone_ref=None,
enable_antivirus=False, enable_gti=False, comm... | python | def create(cls, name, mgmt_ip, mgmt_network,
mgmt_interface=0,
inline_interface='1-2',
logical_interface='default_eth',
log_server_ref=None,
domain_server_address=None, zone_ref=None,
enable_antivirus=False, enable_gti=False, comm... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"mgmt_ip",
",",
"mgmt_network",
",",
"mgmt_interface",
"=",
"0",
",",
"inline_interface",
"=",
"'1-2'",
",",
"logical_interface",
"=",
"'default_eth'",
",",
"log_server_ref",
"=",
"None",
",",
"domain_server_address... | Create a single layer 2 firewall with management interface and inline pair
:param str name: name of firewall engine
:param str mgmt_ip: ip address of management interface
:param str mgmt_network: management network in cidr format
:param int mgmt_interface: (optional) interface for manag... | [
"Create",
"a",
"single",
"layer",
"2",
"firewall",
"with",
"management",
"interface",
"and",
"inline",
"pair"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L258-L317 | train |
gabstopper/smc-python | smc/core/engines.py | MasterEngine.create | def create(cls, name, master_type, mgmt_ip, mgmt_network,
mgmt_interface=0,
log_server_ref=None, zone_ref=None,
domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None):
"""
Create a Master Engine with management inte... | python | def create(cls, name, master_type, mgmt_ip, mgmt_network,
mgmt_interface=0,
log_server_ref=None, zone_ref=None,
domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None):
"""
Create a Master Engine with management inte... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"master_type",
",",
"mgmt_ip",
",",
"mgmt_network",
",",
"mgmt_interface",
"=",
"0",
",",
"log_server_ref",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"enable_gti"... | Create a Master Engine with management interface
:param str name: name of master engine engine
:param str master_type: firewall|
:param str mgmt_ip: ip address for management interface
:param str mgmt_network: full netmask for management
:param str mgmt_interface: interface to u... | [
"Create",
"a",
"Master",
"Engine",
"with",
"management",
"interface"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L705-L749 | train |
gabstopper/smc-python | smc/core/engines.py | MasterEngineCluster.create | def create(cls, name, master_type, macaddress, nodes, mgmt_interface=0,
log_server_ref=None, domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None, **kw):
"""
Create Master Engine Cluster
:param str name: name of master engine engine
:param s... | python | def create(cls, name, master_type, macaddress, nodes, mgmt_interface=0,
log_server_ref=None, domain_server_address=None, enable_gti=False,
enable_antivirus=False, comment=None, **kw):
"""
Create Master Engine Cluster
:param str name: name of master engine engine
:param s... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"master_type",
",",
"macaddress",
",",
"nodes",
",",
"mgmt_interface",
"=",
"0",
",",
"log_server_ref",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"enable_gti",
"=",
"False",
",",
"enable_antiv... | Create Master Engine Cluster
:param str name: name of master engine engine
:param str master_type: firewall|
:param str mgmt_ip: ip address for management interface
:param str mgmt_netmask: full netmask for management
:param str mgmt_interface: interface to use for mgmt (default... | [
"Create",
"Master",
"Engine",
"Cluster"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engines.py#L761-L821 | train |
gabstopper/smc-python | smc/core/collection.py | get_all_loopbacks | def get_all_loopbacks(engine):
"""
Get all loopback interfaces for a given engine
"""
data = []
if 'fw_cluster' in engine.type:
for cvi in engine.data.get('loopback_cluster_virtual_interface', []):
data.append(
LoopbackClusterInterface(cvi, engine))
for node ... | python | def get_all_loopbacks(engine):
"""
Get all loopback interfaces for a given engine
"""
data = []
if 'fw_cluster' in engine.type:
for cvi in engine.data.get('loopback_cluster_virtual_interface', []):
data.append(
LoopbackClusterInterface(cvi, engine))
for node ... | [
"def",
"get_all_loopbacks",
"(",
"engine",
")",
":",
"data",
"=",
"[",
"]",
"if",
"'fw_cluster'",
"in",
"engine",
".",
"type",
":",
"for",
"cvi",
"in",
"engine",
".",
"data",
".",
"get",
"(",
"'loopback_cluster_virtual_interface'",
",",
"[",
"]",
")",
":... | Get all loopback interfaces for a given engine | [
"Get",
"all",
"loopback",
"interfaces",
"for",
"a",
"given",
"engine"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L107-L119 | train |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add | def add(self, interface_id, virtual_mapping=None,
virtual_resource_name=None, zone_ref=None, comment=None):
"""
Add single physical interface with interface_id. Use other methods
to fully add an interface configuration based on engine type.
Virtual mapping and resource are on... | python | def add(self, interface_id, virtual_mapping=None,
virtual_resource_name=None, zone_ref=None, comment=None):
"""
Add single physical interface with interface_id. Use other methods
to fully add an interface configuration based on engine type.
Virtual mapping and resource are on... | [
"def",
"add",
"(",
"self",
",",
"interface_id",
",",
"virtual_mapping",
"=",
"None",
",",
"virtual_resource_name",
"=",
"None",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"interface",
"=",
"Layer3PhysicalInterface",
"(",
"engine",
"... | Add single physical interface with interface_id. Use other methods
to fully add an interface configuration based on engine type.
Virtual mapping and resource are only used in Virtual Engines.
:param str,int interface_id: interface identifier
:param int virtual_mapping: virtual firewall ... | [
"Add",
"single",
"physical",
"interface",
"with",
"interface_id",
".",
"Use",
"other",
"methods",
"to",
"fully",
"add",
"an",
"interface",
"configuration",
"based",
"on",
"engine",
"type",
".",
"Virtual",
"mapping",
"and",
"resource",
"are",
"only",
"used",
"i... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L377-L397 | train |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_layer3_vlan_cluster_interface | def add_layer3_vlan_cluster_interface(self, interface_id, vlan_id,
nodes=None, cluster_virtual=None, network_value=None, macaddress=None,
cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw):
"""
Add IP addresses to VLANs on a firewall cluster. The minimum params
... | python | def add_layer3_vlan_cluster_interface(self, interface_id, vlan_id,
nodes=None, cluster_virtual=None, network_value=None, macaddress=None,
cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw):
"""
Add IP addresses to VLANs on a firewall cluster. The minimum params
... | [
"def",
"add_layer3_vlan_cluster_interface",
"(",
"self",
",",
"interface_id",
",",
"vlan_id",
",",
"nodes",
"=",
"None",
",",
"cluster_virtual",
"=",
"None",
",",
"network_value",
"=",
"None",
",",
"macaddress",
"=",
"None",
",",
"cvi_mode",
"=",
"'packetdispatc... | Add IP addresses to VLANs on a firewall cluster. The minimum params
required are ``interface_id`` and ``vlan_id``.
To create a VLAN interface with a CVI, specify ``cluster_virtual``,
``cluster_mask`` and ``macaddress``.
To create a VLAN with only NDI, specify ``nodes`` parameter.
... | [
"Add",
"IP",
"addresses",
"to",
"VLANs",
"on",
"a",
"firewall",
"cluster",
".",
"The",
"minimum",
"params",
"required",
"are",
"interface_id",
"and",
"vlan_id",
".",
"To",
"create",
"a",
"VLAN",
"interface",
"with",
"a",
"CVI",
"specify",
"cluster_virtual",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L601-L665 | train |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_dhcp_interface | def add_dhcp_interface(self, interface_id, dynamic_index, zone_ref=None,
vlan_id=None, comment=None):
"""
Add a DHCP interface on a single FW
:param int interface_id: interface id
:param int dynamic_index: index number for dhcp interface
:param bool primary_mgt: whet... | python | def add_dhcp_interface(self, interface_id, dynamic_index, zone_ref=None,
vlan_id=None, comment=None):
"""
Add a DHCP interface on a single FW
:param int interface_id: interface id
:param int dynamic_index: index number for dhcp interface
:param bool primary_mgt: whet... | [
"def",
"add_dhcp_interface",
"(",
"self",
",",
"interface_id",
",",
"dynamic_index",
",",
"zone_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"_interface",
"=",
"{",
"'interface_id'",
":",
"interface_id",
",",
"'inter... | Add a DHCP interface on a single FW
:param int interface_id: interface id
:param int dynamic_index: index number for dhcp interface
:param bool primary_mgt: whether to make this primary mgt
:param str zone_ref: zone reference, can be name, href or Zone
:raises EngineCommandFaile... | [
"Add",
"a",
"DHCP",
"interface",
"on",
"a",
"single",
"FW"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L794-L825 | train |
gabstopper/smc-python | smc/core/collection.py | PhysicalInterfaceCollection.add_cluster_interface_on_master_engine | def add_cluster_interface_on_master_engine(self, interface_id, macaddress,
nodes, zone_ref=None, vlan_id=None, comment=None):
"""
Add a cluster address specific to a master engine. Master engine
clusters will not use "CVI" interfaces like normal layer 3 FW clusters,
instead e... | python | def add_cluster_interface_on_master_engine(self, interface_id, macaddress,
nodes, zone_ref=None, vlan_id=None, comment=None):
"""
Add a cluster address specific to a master engine. Master engine
clusters will not use "CVI" interfaces like normal layer 3 FW clusters,
instead e... | [
"def",
"add_cluster_interface_on_master_engine",
"(",
"self",
",",
"interface_id",
",",
"macaddress",
",",
"nodes",
",",
"zone_ref",
"=",
"None",
",",
"vlan_id",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"_interface",
"=",
"{",
"'interface_id'",
":",... | Add a cluster address specific to a master engine. Master engine
clusters will not use "CVI" interfaces like normal layer 3 FW clusters,
instead each node has a unique address and share a common macaddress.
Adding multiple addresses to an interface is not supported with this
method.
... | [
"Add",
"a",
"cluster",
"address",
"specific",
"to",
"a",
"master",
"engine",
".",
"Master",
"engine",
"clusters",
"will",
"not",
"use",
"CVI",
"interfaces",
"like",
"normal",
"layer",
"3",
"FW",
"clusters",
"instead",
"each",
"node",
"has",
"a",
"unique",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L827-L859 | train |
gabstopper/smc-python | smc/core/collection.py | VirtualPhysicalInterfaceCollection.add_tunnel_interface | def add_tunnel_interface(self, interface_id, address, network_value,
zone_ref=None, comment=None):
"""
Creates a tunnel interface for a virtual engine.
:param str,int interface_id: the tunnel id for the interface, used as nicid also
:param str address: ip ad... | python | def add_tunnel_interface(self, interface_id, address, network_value,
zone_ref=None, comment=None):
"""
Creates a tunnel interface for a virtual engine.
:param str,int interface_id: the tunnel id for the interface, used as nicid also
:param str address: ip ad... | [
"def",
"add_tunnel_interface",
"(",
"self",
",",
"interface_id",
",",
"address",
",",
"network_value",
",",
"zone_ref",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"interfaces",
"=",
"[",
"{",
"'nodes'",
":",
"[",
"{",
"'address'",
":",
"address",
... | Creates a tunnel interface for a virtual engine.
:param str,int interface_id: the tunnel id for the interface, used as nicid also
:param str address: ip address of interface
:param str network_value: network cidr for interface; format: 1.1.1.0/24
:param str zone_ref: zone reference for ... | [
"Creates",
"a",
"tunnel",
"interface",
"for",
"a",
"virtual",
"engine",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/collection.py#L903-L919 | train |
gabstopper/smc-python | smc/api/configloader.py | transform_login | def transform_login(config):
"""
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent ... | python | def transform_login(config):
"""
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent ... | [
"def",
"transform_login",
"(",
"config",
")",
":",
"verify",
"=",
"True",
"if",
"config",
".",
"pop",
"(",
"'smc_ssl'",
",",
"None",
")",
":",
"scheme",
"=",
"'https'",
"verify",
"=",
"config",
".",
"pop",
"(",
"'ssl_cert_file'",
",",
"None",
")",
"if"... | Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent into session.login | [
"Parse",
"login",
"data",
"as",
"dict",
".",
"Called",
"from",
"load_from_file",
"and",
"also",
"can",
"be",
"used",
"when",
"collecting",
"information",
"from",
"other",
"sources",
"as",
"well",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/configloader.py#L191-L249 | train |
gabstopper/smc-python | smc/administration/updates.py | PackageMixin.download | def download(self, timeout=5, wait_for_finish=False):
"""
Download Package or Engine Update
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during task status
:rtype: TaskOperationPoller
"""
return Task.execute(self, 'download', timeout... | python | def download(self, timeout=5, wait_for_finish=False):
"""
Download Package or Engine Update
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during task status
:rtype: TaskOperationPoller
"""
return Task.execute(self, 'download', timeout... | [
"def",
"download",
"(",
"self",
",",
"timeout",
"=",
"5",
",",
"wait_for_finish",
"=",
"False",
")",
":",
"return",
"Task",
".",
"execute",
"(",
"self",
",",
"'download'",
",",
"timeout",
"=",
"timeout",
",",
"wait_for_finish",
"=",
"wait_for_finish",
")"
... | Download Package or Engine Update
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during task status
:rtype: TaskOperationPoller | [
"Download",
"Package",
"or",
"Engine",
"Update"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/updates.py#L15-L24 | train |
gabstopper/smc-python | smc/administration/updates.py | PackageMixin.activate | def activate(self, resource=None, timeout=3, wait_for_finish=False):
"""
Activate this package on the SMC
:param list resource: node href's to activate on. Resource is only
required for software upgrades
:param int timeout: timeout between queries
:raises TaskRunF... | python | def activate(self, resource=None, timeout=3, wait_for_finish=False):
"""
Activate this package on the SMC
:param list resource: node href's to activate on. Resource is only
required for software upgrades
:param int timeout: timeout between queries
:raises TaskRunF... | [
"def",
"activate",
"(",
"self",
",",
"resource",
"=",
"None",
",",
"timeout",
"=",
"3",
",",
"wait_for_finish",
"=",
"False",
")",
":",
"return",
"Task",
".",
"execute",
"(",
"self",
",",
"'activate'",
",",
"json",
"=",
"{",
"'resource'",
":",
"resourc... | Activate this package on the SMC
:param list resource: node href's to activate on. Resource is only
required for software upgrades
:param int timeout: timeout between queries
:raises TaskRunFailed: failure during activation (downloading, etc)
:rtype: TaskOperationPoller | [
"Activate",
"this",
"package",
"on",
"the",
"SMC"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/updates.py#L26-L37 | train |
gabstopper/smc-python | smc/elements/profiles.py | SandboxService.create | def create(cls, name, sandbox_data_center, portal_username=None, comment=None):
"""
Create a Sandbox Service element
"""
json = {
'name': name,
'sandbox_data_center': element_resolver(sandbox_data_center),
'portal_username': portal_username if portal_u... | python | def create(cls, name, sandbox_data_center, portal_username=None, comment=None):
"""
Create a Sandbox Service element
"""
json = {
'name': name,
'sandbox_data_center': element_resolver(sandbox_data_center),
'portal_username': portal_username if portal_u... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"sandbox_data_center",
",",
"portal_username",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'sandbox_data_center'",
":",
"element_resolver",
"(",
"sandbox_da... | Create a Sandbox Service element | [
"Create",
"a",
"Sandbox",
"Service",
"element"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/profiles.py#L259-L268 | train |
gabstopper/smc-python | smc/api/session.py | available_api_versions | def available_api_versions(base_url, timeout=10, verify=True):
"""
Get all available API versions for this SMC
:return version numbers
:rtype: list
"""
try:
r = requests.get('%s/api' % base_url, timeout=timeout,
verify=verify) # no session required
... | python | def available_api_versions(base_url, timeout=10, verify=True):
"""
Get all available API versions for this SMC
:return version numbers
:rtype: list
"""
try:
r = requests.get('%s/api' % base_url, timeout=timeout,
verify=verify) # no session required
... | [
"def",
"available_api_versions",
"(",
"base_url",
",",
"timeout",
"=",
"10",
",",
"verify",
"=",
"True",
")",
":",
"try",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s/api'",
"%",
"base_url",
",",
"timeout",
"=",
"timeout",
",",
"verify",
"=",
"veri... | Get all available API versions for this SMC
:return version numbers
:rtype: list | [
"Get",
"all",
"available",
"API",
"versions",
"for",
"this",
"SMC"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L765-L788 | train |
gabstopper/smc-python | smc/api/session.py | get_api_version | def get_api_version(base_url, api_version=None, timeout=10, verify=True):
"""
Get the API version specified or resolve the latest version
:return api version
:rtype: float
"""
versions = available_api_versions(base_url, timeout, verify)
newest_version = max([float(i) for i in versions]... | python | def get_api_version(base_url, api_version=None, timeout=10, verify=True):
"""
Get the API version specified or resolve the latest version
:return api version
:rtype: float
"""
versions = available_api_versions(base_url, timeout, verify)
newest_version = max([float(i) for i in versions]... | [
"def",
"get_api_version",
"(",
"base_url",
",",
"api_version",
"=",
"None",
",",
"timeout",
"=",
"10",
",",
"verify",
"=",
"True",
")",
":",
"versions",
"=",
"available_api_versions",
"(",
"base_url",
",",
"timeout",
",",
"verify",
")",
"newest_version",
"="... | Get the API version specified or resolve the latest version
:return api version
:rtype: float | [
"Get",
"the",
"API",
"version",
"specified",
"or",
"resolve",
"the",
"latest",
"version"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L791-L807 | train |
gabstopper/smc-python | smc/api/session.py | SessionManager._register | def _register(self, session):
"""
Register a session
"""
if session.session_id:
self._sessions[session.name] = session | python | def _register(self, session):
"""
Register a session
"""
if session.session_id:
self._sessions[session.name] = session | [
"def",
"_register",
"(",
"self",
",",
"session",
")",
":",
"if",
"session",
".",
"session_id",
":",
"self",
".",
"_sessions",
"[",
"session",
".",
"name",
"]",
"=",
"session"
] | Register a session | [
"Register",
"a",
"session"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L195-L200 | train |
gabstopper/smc-python | smc/api/session.py | SessionManager._deregister | def _deregister(self, session):
"""
Deregister a session.
"""
if session in self:
self._sessions.pop(self._get_session_key(session), None) | python | def _deregister(self, session):
"""
Deregister a session.
"""
if session in self:
self._sessions.pop(self._get_session_key(session), None) | [
"def",
"_deregister",
"(",
"self",
",",
"session",
")",
":",
"if",
"session",
"in",
"self",
":",
"self",
".",
"_sessions",
".",
"pop",
"(",
"self",
".",
"_get_session_key",
"(",
"session",
")",
",",
"None",
")"
] | Deregister a session. | [
"Deregister",
"a",
"session",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L202-L207 | train |
gabstopper/smc-python | smc/api/session.py | Session.login | def login(self, url=None, api_key=None, login=None, pwd=None,
api_version=None, timeout=None, verify=True, alt_filepath=None,
domain=None, **kwargs):
"""
Login to SMC API and retrieve a valid session.
Sessions use a pool connection manager to provide dynamic scalability
... | python | def login(self, url=None, api_key=None, login=None, pwd=None,
api_version=None, timeout=None, verify=True, alt_filepath=None,
domain=None, **kwargs):
"""
Login to SMC API and retrieve a valid session.
Sessions use a pool connection manager to provide dynamic scalability
... | [
"def",
"login",
"(",
"self",
",",
"url",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"login",
"=",
"None",
",",
"pwd",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"verify",
"=",
"True",
",",
"alt_filepath",
"=... | Login to SMC API and retrieve a valid session.
Sessions use a pool connection manager to provide dynamic scalability
during times of increased load. Each session is managed by a global
session manager making it possible to have more than one session per
interpreter.
An example l... | [
"Login",
"to",
"SMC",
"API",
"and",
"retrieve",
"a",
"valid",
"session",
".",
"Sessions",
"use",
"a",
"pool",
"connection",
"manager",
"to",
"provide",
"dynamic",
"scalability",
"during",
"times",
"of",
"increased",
"load",
".",
"Each",
"session",
"is",
"man... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L404-L516 | train |
gabstopper/smc-python | smc/api/session.py | Session._build_auth_request | def _build_auth_request(self, verify=False, **kwargs):
"""
Build the authentication request to SMC
"""
json = {
'domain': self.domain
}
credential = self.credential
params = {}
if credential.provider_name.startswith('lms'):
... | python | def _build_auth_request(self, verify=False, **kwargs):
"""
Build the authentication request to SMC
"""
json = {
'domain': self.domain
}
credential = self.credential
params = {}
if credential.provider_name.startswith('lms'):
... | [
"def",
"_build_auth_request",
"(",
"self",
",",
"verify",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"json",
"=",
"{",
"'domain'",
":",
"self",
".",
"domain",
"}",
"credential",
"=",
"self",
".",
"credential",
"params",
"=",
"{",
"}",
"if",
"credenti... | Build the authentication request to SMC | [
"Build",
"the",
"authentication",
"request",
"to",
"SMC"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/session.py#L521-L550 | train |
gabstopper/smc-python | smc/policy/rule_elements.py | RuleElement.add | def add(self, data):
"""
Add a single entry to field.
Entries can be added to a rule using the href of the element
or by loading the element directly. Element should be of type
:py:mod:`smc.elements.network`.
After modifying rule, call :py:meth:`~.save`.
Example... | python | def add(self, data):
"""
Add a single entry to field.
Entries can be added to a rule using the href of the element
or by loading the element directly. Element should be of type
:py:mod:`smc.elements.network`.
After modifying rule, call :py:meth:`~.save`.
Example... | [
"def",
"add",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"is_none",
"or",
"self",
".",
"is_any",
":",
"self",
".",
"clear",
"(",
")",
"self",
".",
"data",
"[",
"self",
".",
"typeof",
"]",
"=",
"[",
"]",
"try",
":",
"self",
".",
"g... | Add a single entry to field.
Entries can be added to a rule using the href of the element
or by loading the element directly. Element should be of type
:py:mod:`smc.elements.network`.
After modifying rule, call :py:meth:`~.save`.
Example of adding entry by element::
... | [
"Add",
"a",
"single",
"entry",
"to",
"field",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L44-L74 | train |
gabstopper/smc-python | smc/policy/rule_elements.py | RuleElement.all | def all(self):
"""
Return all destinations for this rule. Elements returned
are of the object type for the given element for further
introspection.
Search the fields in rule::
for sources in rule.sources.all():
print('My source: %s' % sources)
... | python | def all(self):
"""
Return all destinations for this rule. Elements returned
are of the object type for the given element for further
introspection.
Search the fields in rule::
for sources in rule.sources.all():
print('My source: %s' % sources)
... | [
"def",
"all",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_any",
"and",
"not",
"self",
".",
"is_none",
":",
"return",
"[",
"Element",
".",
"from_href",
"(",
"href",
")",
"for",
"href",
"in",
"self",
".",
"get",
"(",
"self",
".",
"typeof",
... | Return all destinations for this rule. Elements returned
are of the object type for the given element for further
introspection.
Search the fields in rule::
for sources in rule.sources.all():
print('My source: %s' % sources)
:return: elements by resolved ob... | [
"Return",
"all",
"destinations",
"for",
"this",
"rule",
".",
"Elements",
"returned",
"are",
"of",
"the",
"object",
"type",
"for",
"the",
"given",
"element",
"for",
"further",
"introspection",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L162-L179 | train |
gabstopper/smc-python | smc/policy/rule_elements.py | MatchExpression.create | def create(cls, name, user=None, network_element=None, domain_name=None,
zone=None, executable=None):
"""
Create a match expression
:param str name: name of match expression
:param str user: name of user or user group
:param Element network_element: valid network ... | python | def create(cls, name, user=None, network_element=None, domain_name=None,
zone=None, executable=None):
"""
Create a match expression
:param str name: name of match expression
:param str user: name of user or user group
:param Element network_element: valid network ... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"user",
"=",
"None",
",",
"network_element",
"=",
"None",
",",
"domain_name",
"=",
"None",
",",
"zone",
"=",
"None",
",",
"executable",
"=",
"None",
")",
":",
"ref_list",
"=",
"[",
"]",
"if",
"user",
"... | Create a match expression
:param str name: name of match expression
:param str user: name of user or user group
:param Element network_element: valid network element type, i.e. host, network, etc
:param DomainName domain_name: domain name network element
:param Zone zone: zone t... | [
"Create",
"a",
"match",
"expression"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule_elements.py#L836-L866 | train |
gabstopper/smc-python | smc/core/addon.py | AntiVirus.enable | def enable(self):
"""
Enable antivirus on the engine
"""
self.update(antivirus_enabled=True,
virus_mirror='update.nai.com/Products/CommonUpdater' if \
not self.get('virus_mirror') else self.virus_mirror,
antivirus_update_tim... | python | def enable(self):
"""
Enable antivirus on the engine
"""
self.update(antivirus_enabled=True,
virus_mirror='update.nai.com/Products/CommonUpdater' if \
not self.get('virus_mirror') else self.virus_mirror,
antivirus_update_tim... | [
"def",
"enable",
"(",
"self",
")",
":",
"self",
".",
"update",
"(",
"antivirus_enabled",
"=",
"True",
",",
"virus_mirror",
"=",
"'update.nai.com/Products/CommonUpdater'",
"if",
"not",
"self",
".",
"get",
"(",
"'virus_mirror'",
")",
"else",
"self",
".",
"virus_... | Enable antivirus on the engine | [
"Enable",
"antivirus",
"on",
"the",
"engine"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L133-L141 | train |
gabstopper/smc-python | smc/core/addon.py | Sandbox.disable | def disable(self):
"""
Disable the sandbox on this engine.
"""
self.engine.data.update(sandbox_type='none')
self.pop('cloud_sandbox_settings', None) #pre-6.3
self.pop('sandbox_settings', None) | python | def disable(self):
"""
Disable the sandbox on this engine.
"""
self.engine.data.update(sandbox_type='none')
self.pop('cloud_sandbox_settings', None) #pre-6.3
self.pop('sandbox_settings', None) | [
"def",
"disable",
"(",
"self",
")",
":",
"self",
".",
"engine",
".",
"data",
".",
"update",
"(",
"sandbox_type",
"=",
"'none'",
")",
"self",
".",
"pop",
"(",
"'cloud_sandbox_settings'",
",",
"None",
")",
"self",
".",
"pop",
"(",
"'sandbox_settings'",
","... | Disable the sandbox on this engine. | [
"Disable",
"the",
"sandbox",
"on",
"this",
"engine",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/addon.py#L348-L354 | train |
gabstopper/smc-python | smc/core/node.py | Node.bind_license | def bind_license(self, license_item_id=None):
"""
Auto bind license, uses dynamic if POS is not found
:param str license_item_id: license id
:raises LicenseError: binding license failed, possibly no licenses
:return: None
"""
params = {'license_item_id': license_... | python | def bind_license(self, license_item_id=None):
"""
Auto bind license, uses dynamic if POS is not found
:param str license_item_id: license id
:raises LicenseError: binding license failed, possibly no licenses
:return: None
"""
params = {'license_item_id': license_... | [
"def",
"bind_license",
"(",
"self",
",",
"license_item_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'license_item_id'",
":",
"license_item_id",
"}",
"self",
".",
"make_request",
"(",
"LicenseError",
",",
"method",
"=",
"'create'",
",",
"resource",
"=",
"... | Auto bind license, uses dynamic if POS is not found
:param str license_item_id: license id
:raises LicenseError: binding license failed, possibly no licenses
:return: None | [
"Auto",
"bind",
"license",
"uses",
"dynamic",
"if",
"POS",
"is",
"not",
"found"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L132-L145 | train |
gabstopper/smc-python | smc/core/node.py | Node.initial_contact | def initial_contact(self, enable_ssh=True, time_zone=None,
keyboard=None,
install_on_server=None,
filename=None,
as_base64=False):
"""
Allows to save the initial contact for for the specified node
:p... | python | def initial_contact(self, enable_ssh=True, time_zone=None,
keyboard=None,
install_on_server=None,
filename=None,
as_base64=False):
"""
Allows to save the initial contact for for the specified node
:p... | [
"def",
"initial_contact",
"(",
"self",
",",
"enable_ssh",
"=",
"True",
",",
"time_zone",
"=",
"None",
",",
"keyboard",
"=",
"None",
",",
"install_on_server",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"as_base64",
"=",
"False",
")",
":",
"result",
"... | Allows to save the initial contact for for the specified node
:param bool enable_ssh: flag to know if we allow the ssh daemon on the
specified node
:param str time_zone: optional time zone to set on the specified node
:param str keyboard: optional keyboard to set on the specified... | [
"Allows",
"to",
"save",
"the",
"initial",
"contact",
"for",
"for",
"the",
"specified",
"node"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L171-L211 | train |
gabstopper/smc-python | smc/core/node.py | Node.go_offline | def go_offline(self, comment=None):
"""
Executes a Go-Offline operation on the specified node
:param str comment: optional comment to audit
:raises NodeCommandFailed: offline not available
:return: None
"""
self.make_request(
NodeCommandFailed,
... | python | def go_offline(self, comment=None):
"""
Executes a Go-Offline operation on the specified node
:param str comment: optional comment to audit
:raises NodeCommandFailed: offline not available
:return: None
"""
self.make_request(
NodeCommandFailed,
... | [
"def",
"go_offline",
"(",
"self",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"make_request",
"(",
"NodeCommandFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'go_offline'",
",",
"params",
"=",
"{",
"'comment'",
":",
"comment",
"}",... | Executes a Go-Offline operation on the specified node
:param str comment: optional comment to audit
:raises NodeCommandFailed: offline not available
:return: None | [
"Executes",
"a",
"Go",
"-",
"Offline",
"operation",
"on",
"the",
"specified",
"node"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L333-L345 | train |
gabstopper/smc-python | smc/core/node.py | Node.lock_online | def lock_online(self, comment=None):
"""
Executes a Lock-Online operation on the specified node
:param str comment: comment for audit
:raises NodeCommandFailed: cannot lock online
:return: None
"""
self.make_request(
NodeCommandFailed,
met... | python | def lock_online(self, comment=None):
"""
Executes a Lock-Online operation on the specified node
:param str comment: comment for audit
:raises NodeCommandFailed: cannot lock online
:return: None
"""
self.make_request(
NodeCommandFailed,
met... | [
"def",
"lock_online",
"(",
"self",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"make_request",
"(",
"NodeCommandFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'lock_online'",
",",
"params",
"=",
"{",
"'comment'",
":",
"comment",
"}... | Executes a Lock-Online operation on the specified node
:param str comment: comment for audit
:raises NodeCommandFailed: cannot lock online
:return: None | [
"Executes",
"a",
"Lock",
"-",
"Online",
"operation",
"on",
"the",
"specified",
"node"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L362-L374 | train |
gabstopper/smc-python | smc/core/node.py | Node.reset_user_db | def reset_user_db(self, comment=None):
"""
Executes a Send Reset LDAP User DB Request operation on this
node.
:param str comment: comment to audit
:raises NodeCommandFailed: failure resetting db
:return: None
"""
self.make_request(
NodeCommand... | python | def reset_user_db(self, comment=None):
"""
Executes a Send Reset LDAP User DB Request operation on this
node.
:param str comment: comment to audit
:raises NodeCommandFailed: failure resetting db
:return: None
"""
self.make_request(
NodeCommand... | [
"def",
"reset_user_db",
"(",
"self",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"make_request",
"(",
"NodeCommandFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'reset_user_db'",
",",
"params",
"=",
"{",
"'comment'",
":",
"comment",
... | Executes a Send Reset LDAP User DB Request operation on this
node.
:param str comment: comment to audit
:raises NodeCommandFailed: failure resetting db
:return: None | [
"Executes",
"a",
"Send",
"Reset",
"LDAP",
"User",
"DB",
"Request",
"operation",
"on",
"this",
"node",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L391-L404 | train |
gabstopper/smc-python | smc/core/node.py | Node.reboot | def reboot(self, comment=None):
"""
Send reboot command to this node.
:param str comment: comment to audit
:raises NodeCommandFailed: reboot failed with reason
:return: None
"""
self.make_request(
NodeCommandFailed,
method='update',
... | python | def reboot(self, comment=None):
"""
Send reboot command to this node.
:param str comment: comment to audit
:raises NodeCommandFailed: reboot failed with reason
:return: None
"""
self.make_request(
NodeCommandFailed,
method='update',
... | [
"def",
"reboot",
"(",
"self",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"make_request",
"(",
"NodeCommandFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'reboot'",
",",
"params",
"=",
"{",
"'comment'",
":",
"comment",
"}",
")"
] | Send reboot command to this node.
:param str comment: comment to audit
:raises NodeCommandFailed: reboot failed with reason
:return: None | [
"Send",
"reboot",
"command",
"to",
"this",
"node",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L446-L458 | train |
gabstopper/smc-python | smc/core/node.py | Node.ssh | def ssh(self, enable=True, comment=None):
"""
Enable or disable SSH
:param bool enable: enable or disable SSH daemon
:param str comment: optional comment for audit
:raises NodeCommandFailed: cannot enable SSH daemon
:return: None
"""
self.make_request(
... | python | def ssh(self, enable=True, comment=None):
"""
Enable or disable SSH
:param bool enable: enable or disable SSH daemon
:param str comment: optional comment for audit
:raises NodeCommandFailed: cannot enable SSH daemon
:return: None
"""
self.make_request(
... | [
"def",
"ssh",
"(",
"self",
",",
"enable",
"=",
"True",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"make_request",
"(",
"NodeCommandFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'ssh'",
",",
"params",
"=",
"{",
"'enable'",
":"... | Enable or disable SSH
:param bool enable: enable or disable SSH daemon
:param str comment: optional comment for audit
:raises NodeCommandFailed: cannot enable SSH daemon
:return: None | [
"Enable",
"or",
"disable",
"SSH"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L517-L530 | train |
gabstopper/smc-python | smc/core/node.py | Node.change_ssh_pwd | def change_ssh_pwd(self, pwd=None, comment=None):
"""
Executes a change SSH password operation on the specified node
:param str pwd: changed password value
:param str comment: optional comment for audit log
:raises NodeCommandFailed: cannot change ssh password
:return: N... | python | def change_ssh_pwd(self, pwd=None, comment=None):
"""
Executes a change SSH password operation on the specified node
:param str pwd: changed password value
:param str comment: optional comment for audit log
:raises NodeCommandFailed: cannot change ssh password
:return: N... | [
"def",
"change_ssh_pwd",
"(",
"self",
",",
"pwd",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"make_request",
"(",
"NodeCommandFailed",
",",
"method",
"=",
"'update'",
",",
"resource",
"=",
"'change_ssh_pwd'",
",",
"params",
"=",
"{",
... | Executes a change SSH password operation on the specified node
:param str pwd: changed password value
:param str comment: optional comment for audit log
:raises NodeCommandFailed: cannot change ssh password
:return: None | [
"Executes",
"a",
"change",
"SSH",
"password",
"operation",
"on",
"the",
"specified",
"node"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/node.py#L532-L546 | train |
gabstopper/smc-python | smc/routing/access_list.py | AccessList.create | def create(cls, name, entries=None, comment=None, **kw):
"""
Create an Access List Entry.
Depending on the access list type you are creating (IPAccessList,
IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList,
ExtendedCommunityAccessList), entries will define a dict... | python | def create(cls, name, entries=None, comment=None, **kw):
"""
Create an Access List Entry.
Depending on the access list type you are creating (IPAccessList,
IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList,
ExtendedCommunityAccessList), entries will define a dict... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"entries",
"=",
"None",
",",
"comment",
"=",
"None",
",",
"**",
"kw",
")",
":",
"access_list_entry",
"=",
"[",
"]",
"if",
"entries",
":",
"for",
"entry",
"in",
"entries",
":",
"access_list_entry",
".",
"... | Create an Access List Entry.
Depending on the access list type you are creating (IPAccessList,
IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList,
ExtendedCommunityAccessList), entries will define a dict of the
valid attributes for that ACL type. Each class has a defined ... | [
"Create",
"an",
"Access",
"List",
"Entry",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L34-L65 | train |
gabstopper/smc-python | smc/routing/access_list.py | AccessList.add_entry | def add_entry(self, **kw):
"""
Add an entry to an AccessList. Use the supported arguments
for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failure to modify with reason
:return: None
"""
self.data.setdefault('entries', []).append(
... | python | def add_entry(self, **kw):
"""
Add an entry to an AccessList. Use the supported arguments
for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failure to modify with reason
:return: None
"""
self.data.setdefault('entries', []).append(
... | [
"def",
"add_entry",
"(",
"self",
",",
"**",
"kw",
")",
":",
"self",
".",
"data",
".",
"setdefault",
"(",
"'entries'",
",",
"[",
"]",
")",
".",
"append",
"(",
"{",
"'{}_entry'",
".",
"format",
"(",
"self",
".",
"typeof",
")",
":",
"kw",
"}",
")"
] | Add an entry to an AccessList. Use the supported arguments
for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failure to modify with reason
:return: None | [
"Add",
"an",
"entry",
"to",
"an",
"AccessList",
".",
"Use",
"the",
"supported",
"arguments",
"for",
"the",
"inheriting",
"class",
"for",
"keyword",
"arguments",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L78-L87 | train |
gabstopper/smc-python | smc/routing/access_list.py | AccessList.remove_entry | def remove_entry(self, **field_value):
"""
Remove an AccessList entry by field specified. Use the supported
arguments for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failed to modify with reason
:return: None
"""
field, value = next(i... | python | def remove_entry(self, **field_value):
"""
Remove an AccessList entry by field specified. Use the supported
arguments for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failed to modify with reason
:return: None
"""
field, value = next(i... | [
"def",
"remove_entry",
"(",
"self",
",",
"**",
"field_value",
")",
":",
"field",
",",
"value",
"=",
"next",
"(",
"iter",
"(",
"field_value",
".",
"items",
"(",
")",
")",
")",
"self",
".",
"data",
"[",
"'entries'",
"]",
"[",
":",
"]",
"=",
"[",
"e... | Remove an AccessList entry by field specified. Use the supported
arguments for the inheriting class for keyword arguments.
:raises UpdateElementFailed: failed to modify with reason
:return: None | [
"Remove",
"an",
"AccessList",
"entry",
"by",
"field",
"specified",
".",
"Use",
"the",
"supported",
"arguments",
"for",
"the",
"inheriting",
"class",
"for",
"keyword",
"arguments",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/access_list.py#L89-L101 | train |
gabstopper/smc-python | smc/administration/tasks.py | Task.update_status | def update_status(self):
"""
Gets the current status of this task and returns a
new task object.
:raises TaskRunFailed: fail to update task status
"""
task = self.make_request(
TaskRunFailed,
href=self.href)
return Task(task) | python | def update_status(self):
"""
Gets the current status of this task and returns a
new task object.
:raises TaskRunFailed: fail to update task status
"""
task = self.make_request(
TaskRunFailed,
href=self.href)
return Task(task) | [
"def",
"update_status",
"(",
"self",
")",
":",
"task",
"=",
"self",
".",
"make_request",
"(",
"TaskRunFailed",
",",
"href",
"=",
"self",
".",
"href",
")",
"return",
"Task",
"(",
"task",
")"
] | Gets the current status of this task and returns a
new task object.
:raises TaskRunFailed: fail to update task status | [
"Gets",
"the",
"current",
"status",
"of",
"this",
"task",
"and",
"returns",
"a",
"new",
"task",
"object",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L146-L157 | train |
gabstopper/smc-python | smc/administration/tasks.py | TaskOperationPoller.add_done_callback | def add_done_callback(self, callback):
"""
Add a callback to run after the task completes.
The callable must take 1 argument which will be
the completed Task.
:param callback: a callable that takes a single argument which
will be the completed Task.
"""
... | python | def add_done_callback(self, callback):
"""
Add a callback to run after the task completes.
The callable must take 1 argument which will be
the completed Task.
:param callback: a callable that takes a single argument which
will be the completed Task.
"""
... | [
"def",
"add_done_callback",
"(",
"self",
",",
"callback",
")",
":",
"if",
"self",
".",
"_done",
"is",
"None",
"or",
"self",
".",
"_done",
".",
"is_set",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'Task has already finished'",
")",
"if",
"callable",
"(",
... | Add a callback to run after the task completes.
The callable must take 1 argument which will be
the completed Task.
:param callback: a callable that takes a single argument which
will be the completed Task. | [
"Add",
"a",
"callback",
"to",
"run",
"after",
"the",
"task",
"completes",
".",
"The",
"callable",
"must",
"take",
"1",
"argument",
"which",
"will",
"be",
"the",
"completed",
"Task",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L245-L257 | train |
gabstopper/smc-python | smc/administration/tasks.py | TaskOperationPoller.wait | def wait(self, timeout=None):
"""
Blocking wait for task status.
"""
if self._thread is None:
return
self._thread.join(timeout=timeout) | python | def wait(self, timeout=None):
"""
Blocking wait for task status.
"""
if self._thread is None:
return
self._thread.join(timeout=timeout) | [
"def",
"wait",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"self",
".",
"_thread",
"is",
"None",
":",
"return",
"self",
".",
"_thread",
".",
"join",
"(",
"timeout",
"=",
"timeout",
")"
] | Blocking wait for task status. | [
"Blocking",
"wait",
"for",
"task",
"status",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L268-L274 | train |
gabstopper/smc-python | smc/administration/tasks.py | TaskOperationPoller.last_message | def last_message(self, timeout=5):
"""
Wait a specified amount of time and return
the last message from the task
:rtype: str
"""
if self._thread is not None:
self._thread.join(timeout=timeout)
return self._task.last_message | python | def last_message(self, timeout=5):
"""
Wait a specified amount of time and return
the last message from the task
:rtype: str
"""
if self._thread is not None:
self._thread.join(timeout=timeout)
return self._task.last_message | [
"def",
"last_message",
"(",
"self",
",",
"timeout",
"=",
"5",
")",
":",
"if",
"self",
".",
"_thread",
"is",
"not",
"None",
":",
"self",
".",
"_thread",
".",
"join",
"(",
"timeout",
"=",
"timeout",
")",
"return",
"self",
".",
"_task",
".",
"last_messa... | Wait a specified amount of time and return
the last message from the task
:rtype: str | [
"Wait",
"a",
"specified",
"amount",
"of",
"time",
"and",
"return",
"the",
"last",
"message",
"from",
"the",
"task"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L276-L285 | train |
gabstopper/smc-python | smc/administration/tasks.py | TaskOperationPoller.stop | def stop(self):
"""
Stop the running task
"""
if self._thread is not None and self._thread.isAlive():
self._done.set() | python | def stop(self):
"""
Stop the running task
"""
if self._thread is not None and self._thread.isAlive():
self._done.set() | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"_thread",
"is",
"not",
"None",
"and",
"self",
".",
"_thread",
".",
"isAlive",
"(",
")",
":",
"self",
".",
"_done",
".",
"set",
"(",
")"
] | Stop the running task | [
"Stop",
"the",
"running",
"task"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/tasks.py#L304-L309 | train |
gabstopper/smc-python | smc/base/util.py | save_to_file | def save_to_file(filename, content):
"""
Save content to file. Used by node initial contact but
can be used anywhere.
:param str filename: name of file to save to
:param str content: content to save
:return: None
:raises IOError: permissions issue saving, invalid directory, etc
"""
... | python | def save_to_file(filename, content):
"""
Save content to file. Used by node initial contact but
can be used anywhere.
:param str filename: name of file to save to
:param str content: content to save
:return: None
:raises IOError: permissions issue saving, invalid directory, etc
"""
... | [
"def",
"save_to_file",
"(",
"filename",
",",
"content",
")",
":",
"import",
"os",
".",
"path",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"filename",
")",
"with",
"open",
"(",
"path",
",",
"\"w\"",
")",
"as",
"text_file",
":",
"text_file",
... | Save content to file. Used by node initial contact but
can be used anywhere.
:param str filename: name of file to save to
:param str content: content to save
:return: None
:raises IOError: permissions issue saving, invalid directory, etc | [
"Save",
"content",
"to",
"file",
".",
"Used",
"by",
"node",
"initial",
"contact",
"but",
"can",
"be",
"used",
"anywhere",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L55-L68 | train |
gabstopper/smc-python | smc/base/util.py | merge_dicts | def merge_dicts(dict1, dict2, append_lists=False):
"""
Merge the second dict into the first
Not intended to merge list of dicts.
:param append_lists: If true, instead of clobbering a list with the
new value, append all of the new values onto the original list.
"""
for key in dict2:
... | python | def merge_dicts(dict1, dict2, append_lists=False):
"""
Merge the second dict into the first
Not intended to merge list of dicts.
:param append_lists: If true, instead of clobbering a list with the
new value, append all of the new values onto the original list.
"""
for key in dict2:
... | [
"def",
"merge_dicts",
"(",
"dict1",
",",
"dict2",
",",
"append_lists",
"=",
"False",
")",
":",
"for",
"key",
"in",
"dict2",
":",
"if",
"isinstance",
"(",
"dict2",
"[",
"key",
"]",
",",
"dict",
")",
":",
"if",
"key",
"in",
"dict1",
"and",
"key",
"in... | Merge the second dict into the first
Not intended to merge list of dicts.
:param append_lists: If true, instead of clobbering a list with the
new value, append all of the new values onto the original list. | [
"Merge",
"the",
"second",
"dict",
"into",
"the",
"first",
"Not",
"intended",
"to",
"merge",
"list",
"of",
"dicts",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L106-L131 | train |
gabstopper/smc-python | smc/base/util.py | bytes_to_unicode | def bytes_to_unicode(s, encoding='utf-8', errors='replace'):
"""
Helper to convert byte string to unicode string for user based input
:param str s: string to decode
:param str encoding: utf-8 by default
:param str errors: what to do when decoding fails
:return: unicode utf-8 string
"""
... | python | def bytes_to_unicode(s, encoding='utf-8', errors='replace'):
"""
Helper to convert byte string to unicode string for user based input
:param str s: string to decode
:param str encoding: utf-8 by default
:param str errors: what to do when decoding fails
:return: unicode utf-8 string
"""
... | [
"def",
"bytes_to_unicode",
"(",
"s",
",",
"encoding",
"=",
"'utf-8'",
",",
"errors",
"=",
"'replace'",
")",
":",
"if",
"compat",
".",
"PY3",
":",
"return",
"str",
"(",
"s",
",",
"'utf-8'",
")",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
"else",... | Helper to convert byte string to unicode string for user based input
:param str s: string to decode
:param str encoding: utf-8 by default
:param str errors: what to do when decoding fails
:return: unicode utf-8 string | [
"Helper",
"to",
"convert",
"byte",
"string",
"to",
"unicode",
"string",
"for",
"user",
"based",
"input"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/util.py#L159-L170 | train |
gabstopper/smc-python | smc/base/collection.py | CollectionManager.iterator | def iterator(self, **kwargs):
"""
Return an iterator from the collection manager. The iterator can
be re-used to chain together filters, each chaining event will be
it's own unique element collection.
:return: :class:`ElementCollection`
"""
cls_name = '{0}Collect... | python | def iterator(self, **kwargs):
"""
Return an iterator from the collection manager. The iterator can
be re-used to chain together filters, each chaining event will be
it's own unique element collection.
:return: :class:`ElementCollection`
"""
cls_name = '{0}Collect... | [
"def",
"iterator",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"cls_name",
"=",
"'{0}Collection'",
".",
"format",
"(",
"self",
".",
"_cls",
".",
"__name__",
")",
"collection_cls",
"=",
"type",
"(",
"str",
"(",
"cls_name",
")",
",",
"(",
"ElementCollectio... | Return an iterator from the collection manager. The iterator can
be re-used to chain together filters, each chaining event will be
it's own unique element collection.
:return: :class:`ElementCollection` | [
"Return",
"an",
"iterator",
"from",
"the",
"collection",
"manager",
".",
"The",
"iterator",
"can",
"be",
"re",
"-",
"used",
"to",
"chain",
"together",
"filters",
"each",
"chaining",
"event",
"will",
"be",
"it",
"s",
"own",
"unique",
"element",
"collection",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L654-L667 | train |
gabstopper/smc-python | smc/base/collection.py | Search.object_types | def object_types():
"""
Show all available 'entry points' available for searching. An entry
point defines a uri that provides unfiltered access to all elements
of the entry point type.
:return: list of entry points by name
:rtype: list(str)
"""
# Return a... | python | def object_types():
"""
Show all available 'entry points' available for searching. An entry
point defines a uri that provides unfiltered access to all elements
of the entry point type.
:return: list of entry points by name
:rtype: list(str)
"""
# Return a... | [
"def",
"object_types",
"(",
")",
":",
"types",
"=",
"[",
"element",
".",
"rel",
"for",
"element",
"in",
"entry_point",
"(",
")",
"]",
"types",
".",
"extend",
"(",
"list",
"(",
"CONTEXTS",
")",
")",
"return",
"types"
] | Show all available 'entry points' available for searching. An entry
point defines a uri that provides unfiltered access to all elements
of the entry point type.
:return: list of entry points by name
:rtype: list(str) | [
"Show",
"all",
"available",
"entry",
"points",
"available",
"for",
"searching",
".",
"An",
"entry",
"point",
"defines",
"a",
"uri",
"that",
"provides",
"unfiltered",
"access",
"to",
"all",
"elements",
"of",
"the",
"entry",
"point",
"type",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/collection.py#L819-L833 | train |
gabstopper/smc-python | smc/examples/ospf_routing.py | create_ospf_area_with_message_digest_auth | def create_ospf_area_with_message_digest_auth():
"""
If you require message-digest authentication for your OSPFArea, you must
create an OSPF key chain configuration.
"""
OSPFKeyChain.create(name='secure-keychain',
key_chain_entry=[{'key': 'fookey',
... | python | def create_ospf_area_with_message_digest_auth():
"""
If you require message-digest authentication for your OSPFArea, you must
create an OSPF key chain configuration.
"""
OSPFKeyChain.create(name='secure-keychain',
key_chain_entry=[{'key': 'fookey',
... | [
"def",
"create_ospf_area_with_message_digest_auth",
"(",
")",
":",
"OSPFKeyChain",
".",
"create",
"(",
"name",
"=",
"'secure-keychain'",
",",
"key_chain_entry",
"=",
"[",
"{",
"'key'",
":",
"'fookey'",
",",
"'key_id'",
":",
"10",
",",
"'send_key'",
":",
"True",
... | If you require message-digest authentication for your OSPFArea, you must
create an OSPF key chain configuration. | [
"If",
"you",
"require",
"message",
"-",
"digest",
"authentication",
"for",
"your",
"OSPFArea",
"you",
"must",
"create",
"an",
"OSPF",
"key",
"chain",
"configuration",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ospf_routing.py#L25-L57 | train |
gabstopper/smc-python | smc/examples/ospf_routing.py | create_ospf_profile | def create_ospf_profile():
"""
An OSPF Profile contains administrative distance and redistribution settings. An
OSPF Profile is applied at the engine level.
When creating an OSPF Profile, you must reference a OSPFDomainSetting.
An OSPFDomainSetting holds the settings of the area border router (AB... | python | def create_ospf_profile():
"""
An OSPF Profile contains administrative distance and redistribution settings. An
OSPF Profile is applied at the engine level.
When creating an OSPF Profile, you must reference a OSPFDomainSetting.
An OSPFDomainSetting holds the settings of the area border router (AB... | [
"def",
"create_ospf_profile",
"(",
")",
":",
"OSPFDomainSetting",
".",
"create",
"(",
"name",
"=",
"'custom'",
",",
"abr_type",
"=",
"'cisco'",
")",
"ospf_domain",
"=",
"OSPFDomainSetting",
"(",
"'custom'",
")",
"ospf_profile",
"=",
"OSPFProfile",
".",
"create",... | An OSPF Profile contains administrative distance and redistribution settings. An
OSPF Profile is applied at the engine level.
When creating an OSPF Profile, you must reference a OSPFDomainSetting.
An OSPFDomainSetting holds the settings of the area border router (ABR) type,
throttle timer settings, ... | [
"An",
"OSPF",
"Profile",
"contains",
"administrative",
"distance",
"and",
"redistribution",
"settings",
".",
"An",
"OSPF",
"Profile",
"is",
"applied",
"at",
"the",
"engine",
"level",
".",
"When",
"creating",
"an",
"OSPF",
"Profile",
"you",
"must",
"reference",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/examples/ospf_routing.py#L60-L77 | train |
gabstopper/smc-python | smc/core/engine_vss.py | VSSContainer.create | def create(cls, name, vss_def=None):
"""
Create a VSS Container. This maps to the Service Manager
within NSX.
vss_def is optional and has the following definition:
{"isc_ovf_appliance_model": 'virtual',
"isc_ovf_appliance_version": '',
"isc_ip_addr... | python | def create(cls, name, vss_def=None):
"""
Create a VSS Container. This maps to the Service Manager
within NSX.
vss_def is optional and has the following definition:
{"isc_ovf_appliance_model": 'virtual',
"isc_ovf_appliance_version": '',
"isc_ip_addr... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"vss_def",
"=",
"None",
")",
":",
"vss_def",
"=",
"{",
"}",
"if",
"vss_def",
"is",
"None",
"else",
"vss_def",
"json",
"=",
"{",
"'master_type'",
":",
"'dcl2fw'",
",",
"'name'",
":",
"name",
",",
"'vss_is... | Create a VSS Container. This maps to the Service Manager
within NSX.
vss_def is optional and has the following definition:
{"isc_ovf_appliance_model": 'virtual',
"isc_ovf_appliance_version": '',
"isc_ip_address": '192.168.4.84', # IP of manager, i.e. OSC
... | [
"Create",
"a",
"VSS",
"Container",
".",
"This",
"maps",
"to",
"the",
"Service",
"Manager",
"within",
"NSX",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L21-L45 | train |
gabstopper/smc-python | smc/core/engine_vss.py | VSSContainer.vss_contexts | def vss_contexts(self):
"""
Return all virtual contexts for this VSS Container.
:return list VSSContext
"""
result = self.make_request(
href=fetch_entry_point('visible_virtual_engine_mapping'),
params={'filter': self.name})
if result.get('mapping'... | python | def vss_contexts(self):
"""
Return all virtual contexts for this VSS Container.
:return list VSSContext
"""
result = self.make_request(
href=fetch_entry_point('visible_virtual_engine_mapping'),
params={'filter': self.name})
if result.get('mapping'... | [
"def",
"vss_contexts",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"href",
"=",
"fetch_entry_point",
"(",
"'visible_virtual_engine_mapping'",
")",
",",
"params",
"=",
"{",
"'filter'",
":",
"self",
".",
"name",
"}",
")",
"if",
"r... | Return all virtual contexts for this VSS Container.
:return list VSSContext | [
"Return",
"all",
"virtual",
"contexts",
"for",
"this",
"VSS",
"Container",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L86-L98 | train |
gabstopper/smc-python | smc/core/engine_vss.py | VSSContainer.remove_security_group | def remove_security_group(self, name):
"""
Remove a security group from container
"""
for group in self.security_groups:
if group.isc_name == name:
group.delete() | python | def remove_security_group(self, name):
"""
Remove a security group from container
"""
for group in self.security_groups:
if group.isc_name == name:
group.delete() | [
"def",
"remove_security_group",
"(",
"self",
",",
"name",
")",
":",
"for",
"group",
"in",
"self",
".",
"security_groups",
":",
"if",
"group",
".",
"isc_name",
"==",
"name",
":",
"group",
".",
"delete",
"(",
")"
] | Remove a security group from container | [
"Remove",
"a",
"security",
"group",
"from",
"container"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L111-L117 | train |
gabstopper/smc-python | smc/elements/netlink.py | StaticNetlink.create | def create(cls, name, gateway, network, input_speed=None,
output_speed=None, domain_server_address=None,
provider_name=None, probe_address=None,
standby_mode_period=3600, standby_mode_timeout=30,
active_mode_period=5, active_mode_timeout=1, comment=None):
... | python | def create(cls, name, gateway, network, input_speed=None,
output_speed=None, domain_server_address=None,
provider_name=None, probe_address=None,
standby_mode_period=3600, standby_mode_timeout=30,
active_mode_period=5, active_mode_timeout=1, comment=None):
... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"gateway",
",",
"network",
",",
"input_speed",
"=",
"None",
",",
"output_speed",
"=",
"None",
",",
"domain_server_address",
"=",
"None",
",",
"provider_name",
"=",
"None",
",",
"probe_address",
"=",
"None",
",... | Create a new StaticNetlink to be used as a traffic handler.
:param str name: name of netlink Element
:param gateway_ref: gateway to map this netlink to. This can be an element
or str href.
:type gateway_ref: Router,Engine
:param list ref: network/s associated with this netli... | [
"Create",
"a",
"new",
"StaticNetlink",
"to",
"be",
"used",
"as",
"a",
"traffic",
"handler",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L91-L149 | train |
gabstopper/smc-python | smc/elements/netlink.py | DynamicNetlink.create | def create(cls, name, input_speed=None, learn_dns_automatically=True,
output_speed=None, provider_name=None, probe_address=None,
standby_mode_period=3600, standby_mode_timeout=30,
active_mode_period=5, active_mode_timeout=1, comment=None):
"""
Create a Dynami... | python | def create(cls, name, input_speed=None, learn_dns_automatically=True,
output_speed=None, provider_name=None, probe_address=None,
standby_mode_period=3600, standby_mode_timeout=30,
active_mode_period=5, active_mode_timeout=1, comment=None):
"""
Create a Dynami... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"input_speed",
"=",
"None",
",",
"learn_dns_automatically",
"=",
"True",
",",
"output_speed",
"=",
"None",
",",
"provider_name",
"=",
"None",
",",
"probe_address",
"=",
"None",
",",
"standby_mode_period",
"=",
"... | Create a Dynamic Netlink.
:param str name: name of netlink Element
:param int input_speed: input speed in Kbps, used for ratio-based
load-balancing
:param int output_speed: output speed in Kbps, used for ratio-based
load-balancing
:param bool learn_dns_automatic... | [
"Create",
"a",
"Dynamic",
"Netlink",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L218-L261 | train |
gabstopper/smc-python | smc/api/common.py | fetch_meta_by_name | def fetch_meta_by_name(name, filter_context=None, exact_match=True):
"""
Find the element based on name and optional filters. By default, the
name provided uses the standard filter query. Additional filters can
be used based on supported collections in the SMC API.
:method: GET
:param str name:... | python | def fetch_meta_by_name(name, filter_context=None, exact_match=True):
"""
Find the element based on name and optional filters. By default, the
name provided uses the standard filter query. Additional filters can
be used based on supported collections in the SMC API.
:method: GET
:param str name:... | [
"def",
"fetch_meta_by_name",
"(",
"name",
",",
"filter_context",
"=",
"None",
",",
"exact_match",
"=",
"True",
")",
":",
"result",
"=",
"SMCRequest",
"(",
"params",
"=",
"{",
"'filter'",
":",
"name",
",",
"'filter_context'",
":",
"filter_context",
",",
"'exa... | Find the element based on name and optional filters. By default, the
name provided uses the standard filter query. Additional filters can
be used based on supported collections in the SMC API.
:method: GET
:param str name: element name, can use * as wildcard
:param str filter_context: further filte... | [
"Find",
"the",
"element",
"based",
"on",
"name",
"and",
"optional",
"filters",
".",
"By",
"default",
"the",
"name",
"provided",
"uses",
"the",
"standard",
"filter",
"query",
".",
"Additional",
"filters",
"can",
"be",
"used",
"based",
"on",
"supported",
"coll... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/api/common.py#L133-L155 | train |
gabstopper/smc-python | smc/administration/system.py | System.references_by_element | def references_by_element(self, element_href):
"""
Return all references to element specified.
:param str element_href: element reference
:return: list of references where element is used
:rtype: list(dict)
"""
result = self.make_request(
method='crea... | python | def references_by_element(self, element_href):
"""
Return all references to element specified.
:param str element_href: element reference
:return: list of references where element is used
:rtype: list(dict)
"""
result = self.make_request(
method='crea... | [
"def",
"references_by_element",
"(",
"self",
",",
"element_href",
")",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"method",
"=",
"'create'",
",",
"resource",
"=",
"'references_by_element'",
",",
"json",
"=",
"{",
"'value'",
":",
"element_href",
"}",... | Return all references to element specified.
:param str element_href: element reference
:return: list of references where element is used
:rtype: list(dict) | [
"Return",
"all",
"references",
"to",
"element",
"specified",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L256-L269 | train |
gabstopper/smc-python | smc/administration/system.py | System.export_elements | def export_elements(self, filename='export_elements.zip', typeof='all'):
"""
Export elements from SMC.
Valid types are:
all (All Elements)|nw (Network Elements)|ips (IPS Elements)|
sv (Services)|rb (Security Policies)|al (Alerts)|
vpn (VPN Elements)
:param type:... | python | def export_elements(self, filename='export_elements.zip', typeof='all'):
"""
Export elements from SMC.
Valid types are:
all (All Elements)|nw (Network Elements)|ips (IPS Elements)|
sv (Services)|rb (Security Policies)|al (Alerts)|
vpn (VPN Elements)
:param type:... | [
"def",
"export_elements",
"(",
"self",
",",
"filename",
"=",
"'export_elements.zip'",
",",
"typeof",
"=",
"'all'",
")",
":",
"valid_types",
"=",
"[",
"'all'",
",",
"'nw'",
",",
"'ips'",
",",
"'sv'",
",",
"'rb'",
",",
"'al'",
",",
"'vpn'",
"]",
"if",
"t... | Export elements from SMC.
Valid types are:
all (All Elements)|nw (Network Elements)|ips (IPS Elements)|
sv (Services)|rb (Security Policies)|al (Alerts)|
vpn (VPN Elements)
:param type: type of element
:param filename: Name of file for export
:raises TaskRunFail... | [
"Export",
"elements",
"from",
"SMC",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/system.py#L271-L290 | train |
gabstopper/smc-python | smc/administration/certificates/vpn.py | GatewayCertificate._create | def _create(self, common_name, public_key_algorithm='rsa',
signature_algorithm='rsa_sha_512', key_length=2048,
signing_ca=None):
"""
Internal method called as a reference from the engine.vpn
node
"""
if signing_ca is None:
signing_ca = VPNCerti... | python | def _create(self, common_name, public_key_algorithm='rsa',
signature_algorithm='rsa_sha_512', key_length=2048,
signing_ca=None):
"""
Internal method called as a reference from the engine.vpn
node
"""
if signing_ca is None:
signing_ca = VPNCerti... | [
"def",
"_create",
"(",
"self",
",",
"common_name",
",",
"public_key_algorithm",
"=",
"'rsa'",
",",
"signature_algorithm",
"=",
"'rsa_sha_512'",
",",
"key_length",
"=",
"2048",
",",
"signing_ca",
"=",
"None",
")",
":",
"if",
"signing_ca",
"is",
"None",
":",
"... | Internal method called as a reference from the engine.vpn
node | [
"Internal",
"method",
"called",
"as",
"a",
"reference",
"from",
"the",
"engine",
".",
"vpn",
"node"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/vpn.py#L59-L80 | train |
gabstopper/smc-python | smc/elements/service.py | TCPService.create | def create(cls, name, min_dst_port, max_dst_port=None, min_src_port=None,
max_src_port=None, protocol_agent=None, comment=None):
"""
Create the TCP service
:param str name: name of tcp service
:param int min_dst_port: minimum destination port value
:param int max_... | python | def create(cls, name, min_dst_port, max_dst_port=None, min_src_port=None,
max_src_port=None, protocol_agent=None, comment=None):
"""
Create the TCP service
:param str name: name of tcp service
:param int min_dst_port: minimum destination port value
:param int max_... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"min_dst_port",
",",
"max_dst_port",
"=",
"None",
",",
"min_src_port",
"=",
"None",
",",
"max_src_port",
"=",
"None",
",",
"protocol_agent",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"max_dst_port",
... | Create the TCP service
:param str name: name of tcp service
:param int min_dst_port: minimum destination port value
:param int max_dst_port: maximum destination port value
:param int min_src_port: minimum source port value
:param int max_src_port: maximum source port value
... | [
"Create",
"the",
"TCP",
"service"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/service.py#L40-L66 | train |
gabstopper/smc-python | smc/elements/service.py | IPService.create | def create(cls, name, protocol_number, protocol_agent=None, comment=None):
"""
Create the IP Service
:param str name: name of ip-service
:param int protocol_number: ip proto number for this service
:param str,ProtocolAgent protocol_agent: optional protocol agent for
... | python | def create(cls, name, protocol_number, protocol_agent=None, comment=None):
"""
Create the IP Service
:param str name: name of ip-service
:param int protocol_number: ip proto number for this service
:param str,ProtocolAgent protocol_agent: optional protocol agent for
... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"protocol_number",
",",
"protocol_agent",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'protocol_number'",
":",
"protocol_number",
",",
"'protocol_agent_ref'... | Create the IP Service
:param str name: name of ip-service
:param int protocol_number: ip proto number for this service
:param str,ProtocolAgent protocol_agent: optional protocol agent for
this service
:param str comment: optional comment
:raises CreateElementFailed: ... | [
"Create",
"the",
"IP",
"Service"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/service.py#L138-L156 | train |
gabstopper/smc-python | smc/elements/service.py | EthernetService.create | def create(cls, name, frame_type='eth2', value1=None, comment=None):
"""
Create an ethernet service
:param str name: name of service
:param str frame_type: ethernet frame type, eth2
:param str value1: hex code representing ethertype field
:param str comment: optional com... | python | def create(cls, name, frame_type='eth2', value1=None, comment=None):
"""
Create an ethernet service
:param str name: name of service
:param str frame_type: ethernet frame type, eth2
:param str value1: hex code representing ethertype field
:param str comment: optional com... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"frame_type",
"=",
"'eth2'",
",",
"value1",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'frame_type'",
":",
"frame_type",
",",
"'name'",
":",
"name",
",",
"'value1'",
":",
"int... | Create an ethernet service
:param str name: name of service
:param str frame_type: ethernet frame type, eth2
:param str value1: hex code representing ethertype field
:param str comment: optional comment
:raises CreateElementFailed: failure creating element with reason
:r... | [
"Create",
"an",
"ethernet",
"service"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/service.py#L188-L205 | train |
gabstopper/smc-python | smc/administration/certificates/tls_common.py | pem_as_string | def pem_as_string(cert):
"""
Only return False if the certificate is a file path. Otherwise it
is a file object or raw string and will need to be fed to the
file open context.
"""
if hasattr(cert, 'read'): # File object - return as is
return cert
cert = cert.encode('utf-8') if isinst... | python | def pem_as_string(cert):
"""
Only return False if the certificate is a file path. Otherwise it
is a file object or raw string and will need to be fed to the
file open context.
"""
if hasattr(cert, 'read'): # File object - return as is
return cert
cert = cert.encode('utf-8') if isinst... | [
"def",
"pem_as_string",
"(",
"cert",
")",
":",
"if",
"hasattr",
"(",
"cert",
",",
"'read'",
")",
":",
"return",
"cert",
"cert",
"=",
"cert",
".",
"encode",
"(",
"'utf-8'",
")",
"if",
"isinstance",
"(",
"cert",
",",
"unicode",
")",
"else",
"cert",
"if... | Only return False if the certificate is a file path. Otherwise it
is a file object or raw string and will need to be fed to the
file open context. | [
"Only",
"return",
"False",
"if",
"the",
"certificate",
"is",
"a",
"file",
"path",
".",
"Otherwise",
"it",
"is",
"a",
"file",
"object",
"or",
"raw",
"string",
"and",
"will",
"need",
"to",
"be",
"fed",
"to",
"the",
"file",
"open",
"context",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/certificates/tls_common.py#L20-L31 | train |
gabstopper/smc-python | smc-monitoring/smc_monitoring/wsocket.py | SMCSocketProtocol.send_message | def send_message(self, message):
"""
Send a message down the socket. The message is expected
to have a `request` attribute that holds the message to
be serialized and sent.
"""
if self.connected:
self.send(
json.dumps(message.request)) | python | def send_message(self, message):
"""
Send a message down the socket. The message is expected
to have a `request` attribute that holds the message to
be serialized and sent.
"""
if self.connected:
self.send(
json.dumps(message.request)) | [
"def",
"send_message",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"connected",
":",
"self",
".",
"send",
"(",
"json",
".",
"dumps",
"(",
"message",
".",
"request",
")",
")"
] | Send a message down the socket. The message is expected
to have a `request` attribute that holds the message to
be serialized and sent. | [
"Send",
"a",
"message",
"down",
"the",
"socket",
".",
"The",
"message",
"is",
"expected",
"to",
"have",
"a",
"request",
"attribute",
"that",
"holds",
"the",
"message",
"to",
"be",
"serialized",
"and",
"sent",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/wsocket.py#L153-L161 | train |
gabstopper/smc-python | smc-monitoring/smc_monitoring/wsocket.py | SMCSocketProtocol.receive | def receive(self):
"""
Generator yielding results from the web socket. Results
will come as they are received. Even though socket select
has a timeout, the SMC will not reply with a message more
than every two minutes.
"""
try:
itr = 0
whil... | python | def receive(self):
"""
Generator yielding results from the web socket. Results
will come as they are received. Even though socket select
has a timeout, the SMC will not reply with a message more
than every two minutes.
"""
try:
itr = 0
whil... | [
"def",
"receive",
"(",
"self",
")",
":",
"try",
":",
"itr",
"=",
"0",
"while",
"self",
".",
"connected",
":",
"r",
",",
"w",
",",
"e",
"=",
"select",
".",
"select",
"(",
"(",
"self",
".",
"sock",
",",
")",
",",
"(",
")",
",",
"(",
")",
",",... | Generator yielding results from the web socket. Results
will come as they are received. Even though socket select
has a timeout, the SMC will not reply with a message more
than every two minutes. | [
"Generator",
"yielding",
"results",
"from",
"the",
"web",
"socket",
".",
"Results",
"will",
"come",
"as",
"they",
"are",
"received",
".",
"Even",
"though",
"socket",
"select",
"has",
"a",
"timeout",
"the",
"SMC",
"will",
"not",
"reply",
"with",
"a",
"messa... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/wsocket.py#L170-L228 | train |
gabstopper/smc-python | smc/base/model.py | ElementCreator | def ElementCreator(cls, json, **kwargs):
"""
Helper method for creating elements. If the created element type is
a SubElement class type, provide href value as kwargs since that class
type does not have a direct entry point. This is a lazy load that will
provide only the meta for the element. Additi... | python | def ElementCreator(cls, json, **kwargs):
"""
Helper method for creating elements. If the created element type is
a SubElement class type, provide href value as kwargs since that class
type does not have a direct entry point. This is a lazy load that will
provide only the meta for the element. Additi... | [
"def",
"ElementCreator",
"(",
"cls",
",",
"json",
",",
"**",
"kwargs",
")",
":",
"if",
"'exception'",
"not",
"in",
"kwargs",
":",
"kwargs",
".",
"update",
"(",
"exception",
"=",
"CreateElementFailed",
")",
"href",
"=",
"kwargs",
".",
"pop",
"(",
"'href'"... | Helper method for creating elements. If the created element type is
a SubElement class type, provide href value as kwargs since that class
type does not have a direct entry point. This is a lazy load that will
provide only the meta for the element. Additional attribute access
will load the full data.
... | [
"Helper",
"method",
"for",
"creating",
"elements",
".",
"If",
"the",
"created",
"element",
"type",
"is",
"a",
"SubElement",
"class",
"type",
"provide",
"href",
"value",
"as",
"kwargs",
"since",
"that",
"class",
"type",
"does",
"not",
"have",
"a",
"direct",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L97-L127 | train |
gabstopper/smc-python | smc/base/model.py | ElementCache.etag | def etag(self, href):
"""
ETag can be None if a subset of element json is using
this container, such as the case with Routing.
"""
if self and self._etag is None:
self._etag = LoadElement(href, only_etag=True)
return self._etag | python | def etag(self, href):
"""
ETag can be None if a subset of element json is using
this container, such as the case with Routing.
"""
if self and self._etag is None:
self._etag = LoadElement(href, only_etag=True)
return self._etag | [
"def",
"etag",
"(",
"self",
",",
"href",
")",
":",
"if",
"self",
"and",
"self",
".",
"_etag",
"is",
"None",
":",
"self",
".",
"_etag",
"=",
"LoadElement",
"(",
"href",
",",
"only_etag",
"=",
"True",
")",
"return",
"self",
".",
"_etag"
] | ETag can be None if a subset of element json is using
this container, such as the case with Routing. | [
"ETag",
"can",
"be",
"None",
"if",
"a",
"subset",
"of",
"element",
"json",
"is",
"using",
"this",
"container",
"such",
"as",
"the",
"case",
"with",
"Routing",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L162-L169 | train |
gabstopper/smc-python | smc/base/model.py | ElementCache.get_link | def get_link(self, rel):
"""
Return link for specified resource
"""
if rel in self.links:
return self.links[rel]
raise ResourceNotFound('Resource requested: %r is not available '
'on this element.' % rel) | python | def get_link(self, rel):
"""
Return link for specified resource
"""
if rel in self.links:
return self.links[rel]
raise ResourceNotFound('Resource requested: %r is not available '
'on this element.' % rel) | [
"def",
"get_link",
"(",
"self",
",",
"rel",
")",
":",
"if",
"rel",
"in",
"self",
".",
"links",
":",
"return",
"self",
".",
"links",
"[",
"rel",
"]",
"raise",
"ResourceNotFound",
"(",
"'Resource requested: %r is not available '",
"'on this element.'",
"%",
"rel... | Return link for specified resource | [
"Return",
"link",
"for",
"specified",
"resource"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L181-L188 | train |
gabstopper/smc-python | smc/base/model.py | Element.add_category | def add_category(self, category):
"""
Category Tags are used to characterize an element by a type
identifier. They can then be searched and returned as a group
of elements. If the category tag specified does not exist, it
will be created. This change will take effect immediately.... | python | def add_category(self, category):
"""
Category Tags are used to characterize an element by a type
identifier. They can then be searched and returned as a group
of elements. If the category tag specified does not exist, it
will be created. This change will take effect immediately.... | [
"def",
"add_category",
"(",
"self",
",",
"category",
")",
":",
"assert",
"isinstance",
"(",
"category",
",",
"list",
")",
",",
"'Category input was expecting list.'",
"from",
"smc",
".",
"elements",
".",
"other",
"import",
"Category",
"for",
"tag",
"in",
"cate... | Category Tags are used to characterize an element by a type
identifier. They can then be searched and returned as a group
of elements. If the category tag specified does not exist, it
will be created. This change will take effect immediately.
:param list tags: list of category tag names... | [
"Category",
"Tags",
"are",
"used",
"to",
"characterize",
"an",
"element",
"by",
"a",
"type",
"identifier",
".",
"They",
"can",
"then",
"be",
"searched",
"and",
"returned",
"as",
"a",
"group",
"of",
"elements",
".",
"If",
"the",
"category",
"tag",
"specifie... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L719-L742 | train |
gabstopper/smc-python | smc/base/model.py | Element.export | def export(self, filename='element.zip'):
"""
Export this element.
Usage::
engine = Engine('myfirewall')
extask = engine.export(filename='fooexport.zip')
while not extask.done():
extask.wait(3)
print("Finished download task: %s" %... | python | def export(self, filename='element.zip'):
"""
Export this element.
Usage::
engine = Engine('myfirewall')
extask = engine.export(filename='fooexport.zip')
while not extask.done():
extask.wait(3)
print("Finished download task: %s" %... | [
"def",
"export",
"(",
"self",
",",
"filename",
"=",
"'element.zip'",
")",
":",
"from",
"smc",
".",
"administration",
".",
"tasks",
"import",
"Task",
"return",
"Task",
".",
"download",
"(",
"self",
",",
"'export'",
",",
"filename",
")"
] | Export this element.
Usage::
engine = Engine('myfirewall')
extask = engine.export(filename='fooexport.zip')
while not extask.done():
extask.wait(3)
print("Finished download task: %s" % extask.message())
print("File downloaded to: %s" ... | [
"Export",
"this",
"element",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L760-L781 | train |
gabstopper/smc-python | smc/base/model.py | Element.referenced_by | def referenced_by(self):
"""
Show all references for this element. A reference means that this
element is being used, for example, in a policy rule, as a member of
a group, etc.
:return: list referenced elements
:rtype: list(Element)
"""
href = fetch_entr... | python | def referenced_by(self):
"""
Show all references for this element. A reference means that this
element is being used, for example, in a policy rule, as a member of
a group, etc.
:return: list referenced elements
:rtype: list(Element)
"""
href = fetch_entr... | [
"def",
"referenced_by",
"(",
"self",
")",
":",
"href",
"=",
"fetch_entry_point",
"(",
"'references_by_element'",
")",
"return",
"[",
"Element",
".",
"from_meta",
"(",
"**",
"ref",
")",
"for",
"ref",
"in",
"self",
".",
"make_request",
"(",
"method",
"=",
"'... | Show all references for this element. A reference means that this
element is being used, for example, in a policy rule, as a member of
a group, etc.
:return: list referenced elements
:rtype: list(Element) | [
"Show",
"all",
"references",
"for",
"this",
"element",
".",
"A",
"reference",
"means",
"that",
"this",
"element",
"is",
"being",
"used",
"for",
"example",
"in",
"a",
"policy",
"rule",
"as",
"a",
"member",
"of",
"a",
"group",
"etc",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L784-L798 | train |
gabstopper/smc-python | smc/core/route.py | flush_parent_cache | def flush_parent_cache(node):
"""
Flush parent cache will recurse back up the tree and
wipe the cache from each parent node reference on the
given element. This allows the objects to be reused
and a clean way to force the object to update itself
if attributes or methods are referenced after upda... | python | def flush_parent_cache(node):
"""
Flush parent cache will recurse back up the tree and
wipe the cache from each parent node reference on the
given element. This allows the objects to be reused
and a clean way to force the object to update itself
if attributes or methods are referenced after upda... | [
"def",
"flush_parent_cache",
"(",
"node",
")",
":",
"if",
"node",
".",
"_parent",
"is",
"None",
":",
"node",
".",
"_del_cache",
"(",
")",
"return",
"node",
".",
"_del_cache",
"(",
")",
"flush_parent_cache",
"(",
"node",
".",
"_parent",
")"
] | Flush parent cache will recurse back up the tree and
wipe the cache from each parent node reference on the
given element. This allows the objects to be reused
and a clean way to force the object to update itself
if attributes or methods are referenced after update. | [
"Flush",
"parent",
"cache",
"will",
"recurse",
"back",
"up",
"the",
"tree",
"and",
"wipe",
"the",
"cache",
"from",
"each",
"parent",
"node",
"reference",
"on",
"the",
"given",
"element",
".",
"This",
"allows",
"the",
"objects",
"to",
"be",
"reused",
"and",... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L126-L138 | train |
gabstopper/smc-python | smc/core/route.py | route_level | def route_level(root, level):
"""
Helper method to recurse the current node and return
the specified routing node level.
"""
def recurse(nodes):
for node in nodes:
if node.level == level:
routing_node.append(node)
else:
recurse(node)
... | python | def route_level(root, level):
"""
Helper method to recurse the current node and return
the specified routing node level.
"""
def recurse(nodes):
for node in nodes:
if node.level == level:
routing_node.append(node)
else:
recurse(node)
... | [
"def",
"route_level",
"(",
"root",
",",
"level",
")",
":",
"def",
"recurse",
"(",
"nodes",
")",
":",
"for",
"node",
"in",
"nodes",
":",
"if",
"node",
".",
"level",
"==",
"level",
":",
"routing_node",
".",
"append",
"(",
"node",
")",
"else",
":",
"r... | Helper method to recurse the current node and return
the specified routing node level. | [
"Helper",
"method",
"to",
"recurse",
"the",
"current",
"node",
"and",
"return",
"the",
"specified",
"routing",
"node",
"level",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L857-L871 | train |
gabstopper/smc-python | smc/core/route.py | RoutingTree.get | def get(self, interface_id):
"""
Obtain routing configuration for a specific interface by
ID.
.. note::
If interface is a VLAN, you must use a str to specify the
interface id, such as '3.13' (interface 3, VLAN 13)
:param str,int interface_id: interface i... | python | def get(self, interface_id):
"""
Obtain routing configuration for a specific interface by
ID.
.. note::
If interface is a VLAN, you must use a str to specify the
interface id, such as '3.13' (interface 3, VLAN 13)
:param str,int interface_id: interface i... | [
"def",
"get",
"(",
"self",
",",
"interface_id",
")",
":",
"for",
"interface",
"in",
"self",
":",
"if",
"interface",
".",
"nicid",
"==",
"str",
"(",
"interface_id",
")",
"or",
"interface",
".",
"dynamic_nicid",
"==",
"str",
"(",
"interface_id",
")",
":",
... | Obtain routing configuration for a specific interface by
ID.
.. note::
If interface is a VLAN, you must use a str to specify the
interface id, such as '3.13' (interface 3, VLAN 13)
:param str,int interface_id: interface identifier
:raises InterfaceNotFound: inva... | [
"Obtain",
"routing",
"configuration",
"for",
"a",
"specific",
"interface",
"by",
"ID",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L242-L261 | train |
gabstopper/smc-python | smc/core/route.py | Routing.add_ospf_area | def add_ospf_area(self, ospf_area, ospf_interface_setting=None, network=None,
communication_mode='NOT_FORCED', unicast_ref=None):
"""
Add OSPF Area to this routing node.
Communication mode specifies how the interface will interact with the
adjacent OSPF environment... | python | def add_ospf_area(self, ospf_area, ospf_interface_setting=None, network=None,
communication_mode='NOT_FORCED', unicast_ref=None):
"""
Add OSPF Area to this routing node.
Communication mode specifies how the interface will interact with the
adjacent OSPF environment... | [
"def",
"add_ospf_area",
"(",
"self",
",",
"ospf_area",
",",
"ospf_interface_setting",
"=",
"None",
",",
"network",
"=",
"None",
",",
"communication_mode",
"=",
"'NOT_FORCED'",
",",
"unicast_ref",
"=",
"None",
")",
":",
"communication_mode",
"=",
"communication_mod... | Add OSPF Area to this routing node.
Communication mode specifies how the interface will interact with the
adjacent OSPF environment. Please see SMC API documentation for more
in depth information on each option.
If the interface has multiple networks nested below, all networks
... | [
"Add",
"OSPF",
"Area",
"to",
"this",
"routing",
"node",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L428-L473 | train |
gabstopper/smc-python | smc/elements/network.py | Host.create | def create(cls, name, address=None, ipv6_address=None,
secondary=None, comment=None):
"""
Create the host element
:param str name: Name of element
:param str address: ipv4 address of host object (optional if ipv6)
:param str ipv6_address: ipv6 address (optional if... | python | def create(cls, name, address=None, ipv6_address=None,
secondary=None, comment=None):
"""
Create the host element
:param str name: Name of element
:param str address: ipv4 address of host object (optional if ipv6)
:param str ipv6_address: ipv6 address (optional if... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"address",
"=",
"None",
",",
"ipv6_address",
"=",
"None",
",",
"secondary",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"address",
"=",
"address",
"if",
"address",
"else",
"None",
"ipv6_address",
"... | Create the host element
:param str name: Name of element
:param str address: ipv4 address of host object (optional if ipv6)
:param str ipv6_address: ipv6 address (optional if ipv4)
:param list secondary: secondary ip addresses (optional)
:param str comment: comment (optional)
... | [
"Create",
"the",
"host",
"element"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L35-L60 | train |
gabstopper/smc-python | smc/elements/network.py | AddressRange.create | def create(cls, name, ip_range, comment=None):
"""
Create an AddressRange element
:param str name: Name of element
:param str iprange: iprange of element
:param str comment: comment (optional)
:raises CreateElementFailed: element creation failed with reason
:retu... | python | def create(cls, name, ip_range, comment=None):
"""
Create an AddressRange element
:param str name: Name of element
:param str iprange: iprange of element
:param str comment: comment (optional)
:raises CreateElementFailed: element creation failed with reason
:retu... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"ip_range",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'ip_range'",
":",
"ip_range",
",",
"'comment'",
":",
"comment",
"}",
"return",
"ElementCreator",
"(",
"cls"... | Create an AddressRange element
:param str name: Name of element
:param str iprange: iprange of element
:param str comment: comment (optional)
:raises CreateElementFailed: element creation failed with reason
:return: instance with meta
:rtype: AddressRange | [
"Create",
"an",
"AddressRange",
"element"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L92-L107 | train |
gabstopper/smc-python | smc/elements/network.py | Network.create | def create(cls, name, ipv4_network=None, ipv6_network=None,
comment=None):
"""
Create the network element
:param str name: Name of element
:param str ipv4_network: network cidr (optional if ipv6)
:param str ipv6_network: network cidr (optional if ipv4)
:pa... | python | def create(cls, name, ipv4_network=None, ipv6_network=None,
comment=None):
"""
Create the network element
:param str name: Name of element
:param str ipv4_network: network cidr (optional if ipv6)
:param str ipv6_network: network cidr (optional if ipv4)
:pa... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"ipv4_network",
"=",
"None",
",",
"ipv6_network",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"ipv4_network",
"=",
"ipv4_network",
"if",
"ipv4_network",
"else",
"None",
"ipv6_network",
"=",
"ipv6_network... | Create the network element
:param str name: Name of element
:param str ipv4_network: network cidr (optional if ipv6)
:param str ipv6_network: network cidr (optional if ipv4)
:param str comment: comment (optional)
:raises CreateElementFailed: element creation failed with reason
... | [
"Create",
"the",
"network",
"element"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L186-L208 | train |
gabstopper/smc-python | smc/elements/network.py | Expression.create | def create(cls, name, ne_ref=None, operator='exclusion',
sub_expression=None, comment=None):
"""
Create the expression
:param str name: name of expression
:param list ne_ref: network element references for expression
:param str operator: 'exclusion' (negation), 'u... | python | def create(cls, name, ne_ref=None, operator='exclusion',
sub_expression=None, comment=None):
"""
Create the expression
:param str name: name of expression
:param list ne_ref: network element references for expression
:param str operator: 'exclusion' (negation), 'u... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"ne_ref",
"=",
"None",
",",
"operator",
"=",
"'exclusion'",
",",
"sub_expression",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"sub_expression",
"=",
"[",
"]",
"if",
"sub_expression",
"is",
"None",
... | Create the expression
:param str name: name of expression
:param list ne_ref: network element references for expression
:param str operator: 'exclusion' (negation), 'union', 'intersection'
(default: exclusion)
:param dict sub_expression: sub expression used
:param... | [
"Create",
"the",
"expression"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L283-L305 | train |
gabstopper/smc-python | smc/elements/network.py | IPList.download | def download(self, filename=None, as_type='zip'):
"""
Download the IPList. List format can be either zip, text or
json. For large lists, it is recommended to use zip encoding.
Filename is required for zip downloads.
:param str filename: Name of file to save to (required for zip)... | python | def download(self, filename=None, as_type='zip'):
"""
Download the IPList. List format can be either zip, text or
json. For large lists, it is recommended to use zip encoding.
Filename is required for zip downloads.
:param str filename: Name of file to save to (required for zip)... | [
"def",
"download",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"as_type",
"=",
"'zip'",
")",
":",
"headers",
"=",
"None",
"if",
"as_type",
"in",
"[",
"'zip'",
",",
"'txt'",
",",
"'json'",
"]",
":",
"if",
"as_type",
"==",
"'zip'",
":",
"if",
"fi... | Download the IPList. List format can be either zip, text or
json. For large lists, it is recommended to use zip encoding.
Filename is required for zip downloads.
:param str filename: Name of file to save to (required for zip)
:param str as_type: type of format to download in: txt,json,z... | [
"Download",
"the",
"IPList",
".",
"List",
"format",
"can",
"be",
"either",
"zip",
"text",
"or",
"json",
".",
"For",
"large",
"lists",
"it",
"is",
"recommended",
"to",
"use",
"zip",
"encoding",
".",
"Filename",
"is",
"required",
"for",
"zip",
"downloads",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L391-L421 | train |
gabstopper/smc-python | smc/elements/network.py | IPList.upload | def upload(self, filename=None, json=None, as_type='zip'):
"""
Upload an IPList to the SMC. The contents of the upload
are not incremental to what is in the existing IPList.
So if the intent is to add new entries, you should first retrieve
the existing and append to the content, ... | python | def upload(self, filename=None, json=None, as_type='zip'):
"""
Upload an IPList to the SMC. The contents of the upload
are not incremental to what is in the existing IPList.
So if the intent is to add new entries, you should first retrieve
the existing and append to the content, ... | [
"def",
"upload",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"json",
"=",
"None",
",",
"as_type",
"=",
"'zip'",
")",
":",
"headers",
"=",
"{",
"'content-type'",
":",
"'multipart/form-data'",
"}",
"params",
"=",
"None",
"files",
"=",
"None",
"if",
"... | Upload an IPList to the SMC. The contents of the upload
are not incremental to what is in the existing IPList.
So if the intent is to add new entries, you should first retrieve
the existing and append to the content, then upload.
The only upload type that can be done without loading a fi... | [
"Upload",
"an",
"IPList",
"to",
"the",
"SMC",
".",
"The",
"contents",
"of",
"the",
"upload",
"are",
"not",
"incremental",
"to",
"what",
"is",
"in",
"the",
"existing",
"IPList",
".",
"So",
"if",
"the",
"intent",
"is",
"to",
"add",
"new",
"entries",
"you... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L423-L455 | train |
gabstopper/smc-python | smc/elements/network.py | Alias.resolve | def resolve(self, engine):
"""
Resolve this Alias to a specific value. Specify the
engine by name to find it's value.
::
alias = Alias('$$ Interface ID 0.ip')
alias.resolve('smcpython-fw')
:param str engine: name of engine to resolve value
:rais... | python | def resolve(self, engine):
"""
Resolve this Alias to a specific value. Specify the
engine by name to find it's value.
::
alias = Alias('$$ Interface ID 0.ip')
alias.resolve('smcpython-fw')
:param str engine: name of engine to resolve value
:rais... | [
"def",
"resolve",
"(",
"self",
",",
"engine",
")",
":",
"if",
"not",
"self",
".",
"resolved_value",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"ElementNotFound",
",",
"href",
"=",
"self",
".",
"get_relation",
"(",
"'resolve'",
")",
",",
"param... | Resolve this Alias to a specific value. Specify the
engine by name to find it's value.
::
alias = Alias('$$ Interface ID 0.ip')
alias.resolve('smcpython-fw')
:param str engine: name of engine to resolve value
:raises ElementNotFound: if alias not found on engin... | [
"Resolve",
"this",
"Alias",
"to",
"a",
"specific",
"value",
".",
"Specify",
"the",
"engine",
"by",
"name",
"to",
"find",
"it",
"s",
"value",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L707-L729 | train |
gabstopper/smc-python | smc/policy/rule.py | Rule.name | def name(self):
"""
Name attribute of rule element
"""
return self._meta.name if self._meta.name else \
'Rule @%s' % self.tag | python | def name(self):
"""
Name attribute of rule element
"""
return self._meta.name if self._meta.name else \
'Rule @%s' % self.tag | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_meta",
".",
"name",
"if",
"self",
".",
"_meta",
".",
"name",
"else",
"'Rule @%s'",
"%",
"self",
".",
"tag"
] | Name attribute of rule element | [
"Name",
"attribute",
"of",
"rule",
"element"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L93-L98 | train |
gabstopper/smc-python | smc/policy/rule.py | IPv4Rule.create | def create(self, name, sources=None, destinations=None,
services=None, action='allow', log_options=None,
authentication_options=None, connection_tracking=None,
is_disabled=False, vpn_policy=None, mobile_vpn=False,
add_pos=None, after=None, before=None,
... | python | def create(self, name, sources=None, destinations=None,
services=None, action='allow', log_options=None,
authentication_options=None, connection_tracking=None,
is_disabled=False, vpn_policy=None, mobile_vpn=False,
add_pos=None, after=None, before=None,
... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"sources",
"=",
"None",
",",
"destinations",
"=",
"None",
",",
"services",
"=",
"None",
",",
"action",
"=",
"'allow'",
",",
"log_options",
"=",
"None",
",",
"authentication_options",
"=",
"None",
",",
"conn... | Create a layer 3 firewall rule
:param str name: name of rule
:param sources: source/s for rule
:type sources: list[str, Element]
:param destinations: destination/s for rule
:type destinations: list[str, Element]
:param services: service/s for rule
:type services:... | [
"Create",
"a",
"layer",
"3",
"firewall",
"rule"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L469-L575 | train |
gabstopper/smc-python | smc/policy/rule.py | EthernetRule.create | def create(self, name, sources=None, destinations=None,
services=None, action='allow', is_disabled=False,
logical_interfaces=None, add_pos=None,
after=None, before=None, comment=None):
"""
Create an Ethernet rule
:param str name: name of rule
... | python | def create(self, name, sources=None, destinations=None,
services=None, action='allow', is_disabled=False,
logical_interfaces=None, add_pos=None,
after=None, before=None, comment=None):
"""
Create an Ethernet rule
:param str name: name of rule
... | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"sources",
"=",
"None",
",",
"destinations",
"=",
"None",
",",
"services",
"=",
"None",
",",
"action",
"=",
"'allow'",
",",
"is_disabled",
"=",
"False",
",",
"logical_interfaces",
"=",
"None",
",",
"add_pos... | Create an Ethernet rule
:param str name: name of rule
:param sources: source/s for rule
:type sources: list[str, Element]
:param destinations: destination/s for rule
:type destinations: list[str, Element]
:param services: service/s for rule
:type services: list[s... | [
"Create",
"an",
"Ethernet",
"rule"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L677-L740 | train |
gabstopper/smc-python | smc/core/resource.py | Snapshot.download | def download(self, filename=None):
"""
Download snapshot to filename
:param str filename: fully qualified path including filename .zip
:raises EngineCommandFailed: IOError occurred downloading snapshot
:return: None
"""
if not filename:
filename = '{}... | python | def download(self, filename=None):
"""
Download snapshot to filename
:param str filename: fully qualified path including filename .zip
:raises EngineCommandFailed: IOError occurred downloading snapshot
:return: None
"""
if not filename:
filename = '{}... | [
"def",
"download",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"not",
"filename",
":",
"filename",
"=",
"'{}{}'",
".",
"format",
"(",
"self",
".",
"name",
",",
"'.zip'",
")",
"try",
":",
"self",
".",
"make_request",
"(",
"EngineCommandFa... | Download snapshot to filename
:param str filename: fully qualified path including filename .zip
:raises EngineCommandFailed: IOError occurred downloading snapshot
:return: None | [
"Download",
"snapshot",
"to",
"filename"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/resource.py#L30-L49 | train |
gabstopper/smc-python | smc/vpn/policy.py | PolicyVPN.create | def create(cls, name, nat=False, mobile_vpn_toplogy_mode=None,
vpn_profile=None):
"""
Create a new policy based VPN
:param name: name of vpn policy
:param bool nat: whether to apply NAT to the VPN (default False)
:param mobile_vpn_toplogy_mode: whether to allow re... | python | def create(cls, name, nat=False, mobile_vpn_toplogy_mode=None,
vpn_profile=None):
"""
Create a new policy based VPN
:param name: name of vpn policy
:param bool nat: whether to apply NAT to the VPN (default False)
:param mobile_vpn_toplogy_mode: whether to allow re... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"nat",
"=",
"False",
",",
"mobile_vpn_toplogy_mode",
"=",
"None",
",",
"vpn_profile",
"=",
"None",
")",
":",
"vpn_profile",
"=",
"element_resolver",
"(",
"vpn_profile",
")",
"or",
"VPNProfile",
"(",
"'VPN-A Suit... | Create a new policy based VPN
:param name: name of vpn policy
:param bool nat: whether to apply NAT to the VPN (default False)
:param mobile_vpn_toplogy_mode: whether to allow remote vpn
:param VPNProfile vpn_profile: reference to VPN profile, or uses default
:rtype: PolicyVPN | [
"Create",
"a",
"new",
"policy",
"based",
"VPN"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L32-L54 | train |
gabstopper/smc-python | smc/vpn/policy.py | PolicyVPN.enable_disable_nat | def enable_disable_nat(self):
"""
Enable or disable NAT on this policy. If NAT is disabled, it
will be enabled and vice versa.
:return: None
"""
if self.nat:
self.data['nat'] = False
else:
self.data['nat'] = True | python | def enable_disable_nat(self):
"""
Enable or disable NAT on this policy. If NAT is disabled, it
will be enabled and vice versa.
:return: None
"""
if self.nat:
self.data['nat'] = False
else:
self.data['nat'] = True | [
"def",
"enable_disable_nat",
"(",
"self",
")",
":",
"if",
"self",
".",
"nat",
":",
"self",
".",
"data",
"[",
"'nat'",
"]",
"=",
"False",
"else",
":",
"self",
".",
"data",
"[",
"'nat'",
"]",
"=",
"True"
] | Enable or disable NAT on this policy. If NAT is disabled, it
will be enabled and vice versa.
:return: None | [
"Enable",
"or",
"disable",
"NAT",
"on",
"this",
"policy",
".",
"If",
"NAT",
"is",
"disabled",
"it",
"will",
"be",
"enabled",
"and",
"vice",
"versa",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L66-L76 | train |
gabstopper/smc-python | smc/elements/group.py | GroupMixin.update_members | def update_members(self, members, append_lists=False, remove_members=False):
"""
Update group members with member list. Set append=True
to append to existing members, or append=False to overwrite.
:param list members: new members for group by href or Element
:type members: list[... | python | def update_members(self, members, append_lists=False, remove_members=False):
"""
Update group members with member list. Set append=True
to append to existing members, or append=False to overwrite.
:param list members: new members for group by href or Element
:type members: list[... | [
"def",
"update_members",
"(",
"self",
",",
"members",
",",
"append_lists",
"=",
"False",
",",
"remove_members",
"=",
"False",
")",
":",
"if",
"members",
":",
"elements",
"=",
"[",
"element_resolver",
"(",
"element",
")",
"for",
"element",
"in",
"members",
... | Update group members with member list. Set append=True
to append to existing members, or append=False to overwrite.
:param list members: new members for group by href or Element
:type members: list[str, Element]
:param bool append_lists: whether to append
:param bool remove_memb... | [
"Update",
"group",
"members",
"with",
"member",
"list",
".",
"Set",
"append",
"=",
"True",
"to",
"append",
"to",
"existing",
"members",
"or",
"append",
"=",
"False",
"to",
"overwrite",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/group.py#L53-L82 | train |
gabstopper/smc-python | smc/elements/group.py | TCPServiceGroup.create | def create(cls, name, members=None, comment=None):
"""
Create the TCP Service group
:param str name: name of tcp service group
:param list element: tcp services by element or href
:type element: list(str,Element)
:raises CreateElementFailed: element creation failed with ... | python | def create(cls, name, members=None, comment=None):
"""
Create the TCP Service group
:param str name: name of tcp service group
:param list element: tcp services by element or href
:type element: list(str,Element)
:raises CreateElementFailed: element creation failed with ... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"members",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"element",
"=",
"[",
"]",
"if",
"members",
"is",
"None",
"else",
"element_resolver",
"(",
"members",
")",
"json",
"=",
"{",
"'name'",
":",
... | Create the TCP Service group
:param str name: name of tcp service group
:param list element: tcp services by element or href
:type element: list(str,Element)
:raises CreateElementFailed: element creation failed with reason
:return: instance with meta
:rtype: TCPServiceGr... | [
"Create",
"the",
"TCP",
"Service",
"group"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/group.py#L214-L230 | train |
gabstopper/smc-python | smc/vpn/route.py | RouteVPN.create_gre_tunnel_no_encryption | def create_gre_tunnel_no_encryption(cls, name, local_endpoint, remote_endpoint,
mtu=0, pmtu_discovery=True, ttl=0,
enabled=True, comment=None):
"""
Create a GRE Tunnel with no encryption. See `create_gre_tunnel_mode` for
constructor description... | python | def create_gre_tunnel_no_encryption(cls, name, local_endpoint, remote_endpoint,
mtu=0, pmtu_discovery=True, ttl=0,
enabled=True, comment=None):
"""
Create a GRE Tunnel with no encryption. See `create_gre_tunnel_mode` for
constructor description... | [
"def",
"create_gre_tunnel_no_encryption",
"(",
"cls",
",",
"name",
",",
"local_endpoint",
",",
"remote_endpoint",
",",
"mtu",
"=",
"0",
",",
"pmtu_discovery",
"=",
"True",
",",
"ttl",
"=",
"0",
",",
"enabled",
"=",
"True",
",",
"comment",
"=",
"None",
")",... | Create a GRE Tunnel with no encryption. See `create_gre_tunnel_mode` for
constructor descriptions. | [
"Create",
"a",
"GRE",
"Tunnel",
"with",
"no",
"encryption",
".",
"See",
"create_gre_tunnel_mode",
"for",
"constructor",
"descriptions",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L252-L262 | train |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceOptions.set_auth_request | def set_auth_request(self, interface_id, address=None):
"""
Set the authentication request field for the specified
engine.
"""
self.interface.set_auth_request(interface_id, address)
self._engine.update() | python | def set_auth_request(self, interface_id, address=None):
"""
Set the authentication request field for the specified
engine.
"""
self.interface.set_auth_request(interface_id, address)
self._engine.update() | [
"def",
"set_auth_request",
"(",
"self",
",",
"interface_id",
",",
"address",
"=",
"None",
")",
":",
"self",
".",
"interface",
".",
"set_auth_request",
"(",
"interface_id",
",",
"address",
")",
"self",
".",
"_engine",
".",
"update",
"(",
")"
] | Set the authentication request field for the specified
engine. | [
"Set",
"the",
"authentication",
"request",
"field",
"for",
"the",
"specified",
"engine",
"."
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L134-L141 | train |
gabstopper/smc-python | smc/core/interfaces.py | Interface.name | def name(self):
"""
Read only name tag
"""
name = super(Interface, self).name
return name if name else self.data.get('name') | python | def name(self):
"""
Read only name tag
"""
name = super(Interface, self).name
return name if name else self.data.get('name') | [
"def",
"name",
"(",
"self",
")",
":",
"name",
"=",
"super",
"(",
"Interface",
",",
"self",
")",
".",
"name",
"return",
"name",
"if",
"name",
"else",
"self",
".",
"data",
".",
"get",
"(",
"'name'",
")"
] | Read only name tag | [
"Read",
"only",
"name",
"tag"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L845-L850 | train |
gabstopper/smc-python | smc/core/interfaces.py | TunnelInterface._add_interface | def _add_interface(self, interface_id, **kw):
"""
Create a tunnel interface. Kw argument list is as follows
"""
base_interface = ElementCache()
base_interface.update(
interface_id=str(interface_id),
interfaces=[])
if 'zone_ref' in kw:
... | python | def _add_interface(self, interface_id, **kw):
"""
Create a tunnel interface. Kw argument list is as follows
"""
base_interface = ElementCache()
base_interface.update(
interface_id=str(interface_id),
interfaces=[])
if 'zone_ref' in kw:
... | [
"def",
"_add_interface",
"(",
"self",
",",
"interface_id",
",",
"**",
"kw",
")",
":",
"base_interface",
"=",
"ElementCache",
"(",
")",
"base_interface",
".",
"update",
"(",
"interface_id",
"=",
"str",
"(",
"interface_id",
")",
",",
"interfaces",
"=",
"[",
... | Create a tunnel interface. Kw argument list is as follows | [
"Create",
"a",
"tunnel",
"interface",
".",
"Kw",
"argument",
"list",
"is",
"as",
"follows"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L941-L976 | train |
gabstopper/smc-python | smc/core/interfaces.py | ClusterPhysicalInterface._add_interface | def _add_interface(self, interface_id, mgt=None, **kw):
"""
Add the Cluster interface. If adding a cluster interface to
an existing node, retrieve the existing interface and call
this method. Use the supported format for defining an interface.
"""
_kw = copy.deepcopy(kw) ... | python | def _add_interface(self, interface_id, mgt=None, **kw):
"""
Add the Cluster interface. If adding a cluster interface to
an existing node, retrieve the existing interface and call
this method. Use the supported format for defining an interface.
"""
_kw = copy.deepcopy(kw) ... | [
"def",
"_add_interface",
"(",
"self",
",",
"interface_id",
",",
"mgt",
"=",
"None",
",",
"**",
"kw",
")",
":",
"_kw",
"=",
"copy",
".",
"deepcopy",
"(",
"kw",
")",
"mgt",
"=",
"mgt",
"if",
"mgt",
"else",
"{",
"}",
"if",
"'cvi_mode'",
"in",
"_kw",
... | Add the Cluster interface. If adding a cluster interface to
an existing node, retrieve the existing interface and call
this method. Use the supported format for defining an interface. | [
"Add",
"the",
"Cluster",
"interface",
".",
"If",
"adding",
"a",
"cluster",
"interface",
"to",
"an",
"existing",
"node",
"retrieve",
"the",
"existing",
"interface",
"and",
"call",
"this",
"method",
".",
"Use",
"the",
"supported",
"format",
"for",
"defining",
... | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L1616-L1689 | train |
gabstopper/smc-python | smc/routing/bgp.py | BGPProfile.create | def create(cls, name, port=179, external_distance=20, internal_distance=200,
local_distance=200, subnet_distance=None):
"""
Create a custom BGP Profile
:param str name: name of profile
:param int port: port for BGP process
:param int external_distance: external ad... | python | def create(cls, name, port=179, external_distance=20, internal_distance=200,
local_distance=200, subnet_distance=None):
"""
Create a custom BGP Profile
:param str name: name of profile
:param int port: port for BGP process
:param int external_distance: external ad... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"port",
"=",
"179",
",",
"external_distance",
"=",
"20",
",",
"internal_distance",
"=",
"200",
",",
"local_distance",
"=",
"200",
",",
"subnet_distance",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
... | Create a custom BGP Profile
:param str name: name of profile
:param int port: port for BGP process
:param int external_distance: external administrative distance; (1-255)
:param int internal_distance: internal administrative distance (1-255)
:param int local_distance: local admi... | [
"Create",
"a",
"custom",
"BGP",
"Profile"
] | e027b8a5dcfaf884eada32d113d41c1e56b32457 | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/routing/bgp.py#L393-L420 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.