repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L181-L188 |
gabstopper/smc-python | smc/base/model.py | Element.get | def get(cls, name, raise_exc=True):
"""
Get the element by name. Does an exact match by element type.
:param str name: name of element
:param bool raise_exc: optionally disable exception.
:raises ElementNotFound: if element does not exist
:rtype: Element
... | python | def get(cls, name, raise_exc=True):
"""
Get the element by name. Does an exact match by element type.
:param str name: name of element
:param bool raise_exc: optionally disable exception.
:raises ElementNotFound: if element does not exist
:rtype: Element
... | [
"def",
"get",
"(",
"cls",
",",
"name",
",",
"raise_exc",
"=",
"True",
")",
":",
"element",
"=",
"cls",
".",
"objects",
".",
"filter",
"(",
"name",
",",
"exact_match",
"=",
"True",
")",
".",
"first",
"(",
")",
"if",
"name",
"is",
"not",
"None",
"e... | Get the element by name. Does an exact match by element type.
:param str name: name of element
:param bool raise_exc: optionally disable exception.
:raises ElementNotFound: if element does not exist
:rtype: Element | [
"Get",
"the",
"element",
"by",
"name",
".",
"Does",
"an",
"exact",
"match",
"by",
"element",
"type",
".",
":",
"param",
"str",
"name",
":",
"name",
"of",
"element",
":",
"param",
"bool",
"raise_exc",
":",
"optionally",
"disable",
"exception",
".",
":",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L506-L520 |
gabstopper/smc-python | smc/base/model.py | Element.get_or_create | def get_or_create(cls, filter_key=None, with_status=False, **kwargs):
"""
Convenience method to retrieve an Element or create if it does not
exist. If an element does not have a `create` classmethod, then it
is considered read-only and the request will be redirected to :meth:`~get`.
... | python | def get_or_create(cls, filter_key=None, with_status=False, **kwargs):
"""
Convenience method to retrieve an Element or create if it does not
exist. If an element does not have a `create` classmethod, then it
is considered read-only and the request will be redirected to :meth:`~get`.
... | [
"def",
"get_or_create",
"(",
"cls",
",",
"filter_key",
"=",
"None",
",",
"with_status",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"was_created",
"=",
"False",
"if",
"'name'",
"not",
"in",
"kwargs",
":",
"raise",
"ElementNotFound",
"(",
"'Name field ... | Convenience method to retrieve an Element or create if it does not
exist. If an element does not have a `create` classmethod, then it
is considered read-only and the request will be redirected to :meth:`~get`.
Any keyword arguments passed except the optional filter_key
will be used in a ... | [
"Convenience",
"method",
"to",
"retrieve",
"an",
"Element",
"or",
"create",
"if",
"it",
"does",
"not",
"exist",
".",
"If",
"an",
"element",
"does",
"not",
"have",
"a",
"create",
"classmethod",
"then",
"it",
"is",
"considered",
"read",
"-",
"only",
"and",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L523-L590 |
gabstopper/smc-python | smc/base/model.py | Element.update_or_create | def update_or_create(cls, filter_key=None, with_status=False, **kwargs):
"""
Update or create the element. If the element exists, update it using the
kwargs provided if the provided kwargs after resolving differences from
existing values. When comparing values, strings and ints are compa... | python | def update_or_create(cls, filter_key=None, with_status=False, **kwargs):
"""
Update or create the element. If the element exists, update it using the
kwargs provided if the provided kwargs after resolving differences from
existing values. When comparing values, strings and ints are compa... | [
"def",
"update_or_create",
"(",
"cls",
",",
"filter_key",
"=",
"None",
",",
"with_status",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"updated",
"=",
"False",
"# Providing this flag will return before updating and require the calling",
"# class to call update if cha... | Update or create the element. If the element exists, update it using the
kwargs provided if the provided kwargs after resolving differences from
existing values. When comparing values, strings and ints are compared
directly. If a list is provided and is a list of strings, it will be
com... | [
"Update",
"or",
"create",
"the",
"element",
".",
"If",
"the",
"element",
"exists",
"update",
"it",
"using",
"the",
"kwargs",
"provided",
"if",
"the",
"provided",
"kwargs",
"after",
"resolving",
"differences",
"from",
"existing",
"values",
".",
"When",
"compari... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L593-L689 |
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... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L719-L742 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L760-L781 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L784-L798 |
gabstopper/smc-python | smc/base/model.py | Element.history | def history(self):
"""
.. versionadded:: 0.5.7
Requires SMC version >= 6.3.2
Obtain the history of this element. This will not chronicle every
modification made over time, but instead a current snapshot with
historical information such as when the element was... | python | def history(self):
"""
.. versionadded:: 0.5.7
Requires SMC version >= 6.3.2
Obtain the history of this element. This will not chronicle every
modification made over time, but instead a current snapshot with
historical information such as when the element was... | [
"def",
"history",
"(",
"self",
")",
":",
"from",
"smc",
".",
"core",
".",
"resource",
"import",
"History",
"return",
"History",
"(",
"*",
"*",
"self",
".",
"make_request",
"(",
"resource",
"=",
"'history'",
")",
")"
] | .. versionadded:: 0.5.7
Requires SMC version >= 6.3.2
Obtain the history of this element. This will not chronicle every
modification made over time, but instead a current snapshot with
historical information such as when the element was created, by
whom, when it was ... | [
"..",
"versionadded",
"::",
"0",
".",
"5",
".",
"7",
"Requires",
"SMC",
"version",
">",
"=",
"6",
".",
"3",
".",
"2",
"Obtain",
"the",
"history",
"of",
"this",
"element",
".",
"This",
"will",
"not",
"chronicle",
"every",
"modification",
"made",
"over",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L801-L815 |
gabstopper/smc-python | smc/base/model.py | Element.duplicate | def duplicate(self, name):
"""
.. versionadded:: 0.5.8
Requires SMC version >= 6.3.2
Duplicate this element. This is a shortcut method that will make
a direct copy of the element under the new name and type.
:param str name: name for the duplicated e... | python | def duplicate(self, name):
"""
.. versionadded:: 0.5.8
Requires SMC version >= 6.3.2
Duplicate this element. This is a shortcut method that will make
a direct copy of the element under the new name and type.
:param str name: name for the duplicated e... | [
"def",
"duplicate",
"(",
"self",
",",
"name",
")",
":",
"dup",
"=",
"self",
".",
"make_request",
"(",
"method",
"=",
"'update'",
",",
"raw_result",
"=",
"True",
",",
"resource",
"=",
"'duplicate'",
",",
"params",
"=",
"{",
"'name'",
":",
"name",
"}",
... | .. versionadded:: 0.5.8
Requires SMC version >= 6.3.2
Duplicate this element. This is a shortcut method that will make
a direct copy of the element under the new name and type.
:param str name: name for the duplicated element
:raises ActionCommandFailed: fai... | [
"..",
"versionadded",
"::",
"0",
".",
"5",
".",
"8",
"Requires",
"SMC",
"version",
">",
"=",
"6",
".",
"3",
".",
"2",
"Duplicate",
"this",
"element",
".",
"This",
"is",
"a",
"shortcut",
"method",
"that",
"will",
"make",
"a",
"direct",
"copy",
"of",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/base/model.py#L817-L835 |
gabstopper/smc-python | smc/elements/servers.py | MultiContactAddress.get | def get(self, location_name):
"""
Get a contact address by location name
:param str location_name: name of location
:return: return contact address element or None
:rtype: ContactAddress
"""
location_ref = location_helper(location_name, search_only=True)
... | python | def get(self, location_name):
"""
Get a contact address by location name
:param str location_name: name of location
:return: return contact address element or None
:rtype: ContactAddress
"""
location_ref = location_helper(location_name, search_only=True)
... | [
"def",
"get",
"(",
"self",
",",
"location_name",
")",
":",
"location_ref",
"=",
"location_helper",
"(",
"location_name",
",",
"search_only",
"=",
"True",
")",
"if",
"location_ref",
":",
"for",
"location",
"in",
"self",
":",
"if",
"location",
".",
"location_r... | Get a contact address by location name
:param str location_name: name of location
:return: return contact address element or None
:rtype: ContactAddress | [
"Get",
"a",
"contact",
"address",
"by",
"location",
"name",
":",
"param",
"str",
"location_name",
":",
"name",
"of",
"location",
":",
"return",
":",
"return",
"contact",
"address",
"element",
"or",
"None",
":",
"rtype",
":",
"ContactAddress"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/servers.py#L44-L56 |
gabstopper/smc-python | smc/elements/servers.py | MultiContactAddress.update_or_create | def update_or_create(self, location, contact_addresses, with_status=False,
overwrite_existing=False, **kw):
"""
Update or create a contact address and location pair. If the
location does not exist it will be automatically created. If the
server already has a location assigned... | python | def update_or_create(self, location, contact_addresses, with_status=False,
overwrite_existing=False, **kw):
"""
Update or create a contact address and location pair. If the
location does not exist it will be automatically created. If the
server already has a location assigned... | [
"def",
"update_or_create",
"(",
"self",
",",
"location",
",",
"contact_addresses",
",",
"with_status",
"=",
"False",
",",
"overwrite_existing",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"updated",
",",
"created",
"=",
"False",
",",
"False",
"location_ref"... | Update or create a contact address and location pair. If the
location does not exist it will be automatically created. If the
server already has a location assigned with the same name, the
contact address specified will be added if it doesn't already
exist (Management and Log Server can ... | [
"Update",
"or",
"create",
"a",
"contact",
"address",
"and",
"location",
"pair",
".",
"If",
"the",
"location",
"does",
"not",
"exist",
"it",
"will",
"be",
"automatically",
"created",
".",
"If",
"the",
"server",
"already",
"has",
"a",
"location",
"assigned",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/servers.py#L77-L121 |
gabstopper/smc-python | smc/elements/servers.py | ContactAddressMixin.contact_addresses | def contact_addresses(self):
"""
Provides a reference to contact addresses used by this server.
Obtain a reference to manipulate or iterate existing contact
addresses::
>>> from smc.elements.servers import ManagementServer
>>> mgt_server = Manage... | python | def contact_addresses(self):
"""
Provides a reference to contact addresses used by this server.
Obtain a reference to manipulate or iterate existing contact
addresses::
>>> from smc.elements.servers import ManagementServer
>>> mgt_server = Manage... | [
"def",
"contact_addresses",
"(",
"self",
")",
":",
"return",
"MultiContactAddress",
"(",
"href",
"=",
"self",
".",
"get_relation",
"(",
"'contact_addresses'",
")",
",",
"type",
"=",
"self",
".",
"typeof",
",",
"name",
"=",
"self",
".",
"name",
")"
] | Provides a reference to contact addresses used by this server.
Obtain a reference to manipulate or iterate existing contact
addresses::
>>> from smc.elements.servers import ManagementServer
>>> mgt_server = ManagementServer.objects.first()
>>> for co... | [
"Provides",
"a",
"reference",
"to",
"contact",
"addresses",
"used",
"by",
"this",
"server",
".",
"Obtain",
"a",
"reference",
"to",
"manipulate",
"or",
"iterate",
"existing",
"contact",
"addresses",
"::",
">>>",
"from",
"smc",
".",
"elements",
".",
"servers",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/servers.py#L132-L152 |
gabstopper/smc-python | smc/elements/servers.py | HttpProxy.create | def create(cls, name, address, proxy_port=8080, username=None,
password=None, secondary=None, comment=None):
"""
Create a new HTTP Proxy service. Proxy must define at least
one primary address but can optionally also define a list
of secondary addresses.
:... | python | def create(cls, name, address, proxy_port=8080, username=None,
password=None, secondary=None, comment=None):
"""
Create a new HTTP Proxy service. Proxy must define at least
one primary address but can optionally also define a list
of secondary addresses.
:... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"address",
",",
"proxy_port",
"=",
"8080",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"secondary",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
... | Create a new HTTP Proxy service. Proxy must define at least
one primary address but can optionally also define a list
of secondary addresses.
:param str name: Name of the proxy element
:param str address: Primary address for proxy
:param int proxy_port: proxy port (defau... | [
"Create",
"a",
"new",
"HTTP",
"Proxy",
"service",
".",
"Proxy",
"must",
"define",
"at",
"least",
"one",
"primary",
"address",
"but",
"can",
"optionally",
"also",
"define",
"a",
"list",
"of",
"secondary",
"addresses",
".",
":",
"param",
"str",
"name",
":",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/servers.py#L225-L251 |
gabstopper/smc-python | smc/elements/servers.py | DNSServer.create | def create(cls, name, address, time_to_live=20, update_interval=10,
secondary=None, comment=None):
"""
Create a DNS Server element.
:param str name: Name of DNS Server
:param str address: IP address for DNS Server element
:param int time_to_live: Defines h... | python | def create(cls, name, address, time_to_live=20, update_interval=10,
secondary=None, comment=None):
"""
Create a DNS Server element.
:param str name: Name of DNS Server
:param str address: IP address for DNS Server element
:param int time_to_live: Defines h... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"address",
",",
"time_to_live",
"=",
"20",
",",
"update_interval",
"=",
"10",
",",
"secondary",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'address... | Create a DNS Server element.
:param str name: Name of DNS Server
:param str address: IP address for DNS Server element
:param int time_to_live: Defines how long a DNS entry can be cached
before querying the DNS server again (default: 20)
:param int update_interval: D... | [
"Create",
"a",
"DNS",
"Server",
"element",
".",
":",
"param",
"str",
"name",
":",
"Name",
"of",
"DNS",
"Server",
":",
"param",
"str",
"address",
":",
"IP",
"address",
"for",
"DNS",
"Server",
"element",
":",
"param",
"int",
"time_to_live",
":",
"Defines",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/servers.py#L273-L297 |
gabstopper/smc-python | smc/elements/servers.py | ProxyServer.create | def create(cls, name, address, inspected_service, secondary=None,
balancing_mode='ha', proxy_service='generic', location=None,
comment=None, add_x_forwarded_for=False, trust_host_header=False,
**kw):
"""
Create a Proxy Server element
:param s... | python | def create(cls, name, address, inspected_service, secondary=None,
balancing_mode='ha', proxy_service='generic', location=None,
comment=None, add_x_forwarded_for=False, trust_host_header=False,
**kw):
"""
Create a Proxy Server element
:param s... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"address",
",",
"inspected_service",
",",
"secondary",
"=",
"None",
",",
"balancing_mode",
"=",
"'ha'",
",",
"proxy_service",
"=",
"'generic'",
",",
"location",
"=",
"None",
",",
"comment",
"=",
"None",
",",
... | Create a Proxy Server element
:param str name: name of proxy server element
:param str address: address of element. Can be a single FQDN or comma separated
list of IP addresses
:param list secondary: list of secondary IP addresses
:param str balancing_mode: how to ba... | [
"Create",
"a",
"Proxy",
"Server",
"element",
":",
"param",
"str",
"name",
":",
"name",
"of",
"proxy",
"server",
"element",
":",
"param",
"str",
"address",
":",
"address",
"of",
"element",
".",
"Can",
"be",
"a",
"single",
"FQDN",
"or",
"comma",
"separated... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/servers.py#L327-L377 |
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",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L126-L138 |
gabstopper/smc-python | smc/core/route.py | from_meta | def from_meta(node):
"""
Helper method that reolves a routing node to element. Rather than doing
a lookup and fetch, the routing node provides the information to
build the element from meta alone.
:rtype: Element
"""
# Version SMC < 6.4
if 'related_element_type' not in node.data:
... | python | def from_meta(node):
"""
Helper method that reolves a routing node to element. Rather than doing
a lookup and fetch, the routing node provides the information to
build the element from meta alone.
:rtype: Element
"""
# Version SMC < 6.4
if 'related_element_type' not in node.data:
... | [
"def",
"from_meta",
"(",
"node",
")",
":",
"# Version SMC < 6.4",
"if",
"'related_element_type'",
"not",
"in",
"node",
".",
"data",
":",
"return",
"Element",
".",
"from_href",
"(",
"node",
".",
"data",
".",
"get",
"(",
"'href'",
")",
")",
"# SMC Version >= 6... | Helper method that reolves a routing node to element. Rather than doing
a lookup and fetch, the routing node provides the information to
build the element from meta alone.
:rtype: Element | [
"Helper",
"method",
"that",
"reolves",
"a",
"routing",
"node",
"to",
"element",
".",
"Rather",
"than",
"doing",
"a",
"lookup",
"and",
"fetch",
"the",
"routing",
"node",
"provides",
"the",
"information",
"to",
"build",
"the",
"element",
"from",
"meta",
"alone... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L836-L854 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L857-L871 |
gabstopper/smc-python | smc/core/route.py | gateway_by_type | def gateway_by_type(self, type=None, on_network=None): # @ReservedAssignment
"""
Return gateways for the specified node. You can also
specify type to find only gateways of a specific type.
Valid types are: bgp_peering, netlink, ospfv2_area.
:param RoutingNode self: the routing node to check
... | python | def gateway_by_type(self, type=None, on_network=None): # @ReservedAssignment
"""
Return gateways for the specified node. You can also
specify type to find only gateways of a specific type.
Valid types are: bgp_peering, netlink, ospfv2_area.
:param RoutingNode self: the routing node to check
... | [
"def",
"gateway_by_type",
"(",
"self",
",",
"type",
"=",
"None",
",",
"on_network",
"=",
"None",
")",
":",
"# @ReservedAssignment",
"gateways",
"=",
"route_level",
"(",
"self",
",",
"'gateway'",
")",
"if",
"not",
"type",
":",
"for",
"gw",
"in",
"gateways",... | Return gateways for the specified node. You can also
specify type to find only gateways of a specific type.
Valid types are: bgp_peering, netlink, ospfv2_area.
:param RoutingNode self: the routing node to check
:param str type: bgp_peering, netlink, ospfv2_area
:param str on_network: if network... | [
"Return",
"gateways",
"for",
"the",
"specified",
"node",
".",
"You",
"can",
"also",
"specify",
"type",
"to",
"find",
"only",
"gateways",
"of",
"a",
"specific",
"type",
".",
"Valid",
"types",
"are",
":",
"bgp_peering",
"netlink",
"ospfv2_area",
".",
":",
"p... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L874-L911 |
gabstopper/smc-python | smc/core/route.py | _which_ip_protocol | def _which_ip_protocol(element):
"""
Validate the protocol addresses for the element. Most elements can
have an IPv4 or IPv6 address assigned on the same element. This
allows elements to be validated and placed on the right network.
:return: boolean tuple
:rtype: tuple(ipv4, ipv6)
"""
... | python | def _which_ip_protocol(element):
"""
Validate the protocol addresses for the element. Most elements can
have an IPv4 or IPv6 address assigned on the same element. This
allows elements to be validated and placed on the right network.
:return: boolean tuple
:rtype: tuple(ipv4, ipv6)
"""
... | [
"def",
"_which_ip_protocol",
"(",
"element",
")",
":",
"try",
":",
"if",
"element",
".",
"typeof",
"in",
"(",
"'host'",
",",
"'router'",
")",
":",
"return",
"getattr",
"(",
"element",
",",
"'address'",
",",
"False",
")",
",",
"getattr",
"(",
"element",
... | Validate the protocol addresses for the element. Most elements can
have an IPv4 or IPv6 address assigned on the same element. This
allows elements to be validated and placed on the right network.
:return: boolean tuple
:rtype: tuple(ipv4, ipv6) | [
"Validate",
"the",
"protocol",
"addresses",
"for",
"the",
"element",
".",
"Most",
"elements",
"can",
"have",
"an",
"IPv4",
"or",
"IPv6",
"address",
"assigned",
"on",
"the",
"same",
"element",
".",
"This",
"allows",
"elements",
"to",
"be",
"validated",
"and",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L914-L938 |
gabstopper/smc-python | smc/core/route.py | del_invalid_routes | def del_invalid_routes(engine, nicids):
"""
Helper method to run through and delete any routes that are tagged
as invalid or to_delete by a list of nicids. Since we could have a
list of routes, iterate from top level engine routing node to avoid
fetch exceptions. Route list should be a list of nicid... | python | def del_invalid_routes(engine, nicids):
"""
Helper method to run through and delete any routes that are tagged
as invalid or to_delete by a list of nicids. Since we could have a
list of routes, iterate from top level engine routing node to avoid
fetch exceptions. Route list should be a list of nicid... | [
"def",
"del_invalid_routes",
"(",
"engine",
",",
"nicids",
")",
":",
"nicids",
"=",
"map",
"(",
"str",
",",
"nicids",
")",
"for",
"interface",
"in",
"engine",
".",
"routing",
":",
"if",
"interface",
".",
"nicid",
"in",
"nicids",
":",
"if",
"getattr",
"... | Helper method to run through and delete any routes that are tagged
as invalid or to_delete by a list of nicids. Since we could have a
list of routes, iterate from top level engine routing node to avoid
fetch exceptions. Route list should be a list of nicids as str.
:param list nicids: list of nicid... | [
"Helper",
"method",
"to",
"run",
"through",
"and",
"delete",
"any",
"routes",
"that",
"are",
"tagged",
"as",
"invalid",
"or",
"to_delete",
"by",
"a",
"list",
"of",
"nicids",
".",
"Since",
"we",
"could",
"have",
"a",
"list",
"of",
"routes",
"iterate",
"fr... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L941-L960 |
gabstopper/smc-python | smc/core/route.py | RoutingTree.related_element_type | def related_element_type(self):
"""
.. versionadded:: 0.6.0
Requires SMC version >= 6.4
Related element type defines the 'type' of element at this
routing or antispoofing node level.
:rtype: str
"""
if 'related_element_type' in se... | python | def related_element_type(self):
"""
.. versionadded:: 0.6.0
Requires SMC version >= 6.4
Related element type defines the 'type' of element at this
routing or antispoofing node level.
:rtype: str
"""
if 'related_element_type' in se... | [
"def",
"related_element_type",
"(",
"self",
")",
":",
"if",
"'related_element_type'",
"in",
"self",
".",
"data",
":",
"return",
"self",
".",
"data",
".",
"get",
"(",
"'related_element_type'",
")",
"return",
"None",
"if",
"self",
".",
"dynamic_nicid",
"or",
"... | .. versionadded:: 0.6.0
Requires SMC version >= 6.4
Related element type defines the 'type' of element at this
routing or antispoofing node level.
:rtype: str | [
"..",
"versionadded",
"::",
"0",
".",
"6",
".",
"0",
"Requires",
"SMC",
"version",
">",
"=",
"6",
".",
"4",
"Related",
"element",
"type",
"defines",
"the",
"type",
"of",
"element",
"at",
"this",
"routing",
"or",
"antispoofing",
"node",
"level",
".",
":... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L215-L228 |
gabstopper/smc-python | smc/core/route.py | RoutingTree.as_tree | def as_tree(self, level=0):
"""
Display the routing tree representation in string
format
:rtype: str
"""
ret = '--' * level + repr(self) + '\n'
for routing_node in self:
ret += routing_node.as_tree(level+1)
return ret | python | def as_tree(self, level=0):
"""
Display the routing tree representation in string
format
:rtype: str
"""
ret = '--' * level + repr(self) + '\n'
for routing_node in self:
ret += routing_node.as_tree(level+1)
return ret | [
"def",
"as_tree",
"(",
"self",
",",
"level",
"=",
"0",
")",
":",
"ret",
"=",
"'--'",
"*",
"level",
"+",
"repr",
"(",
"self",
")",
"+",
"'\\n'",
"for",
"routing_node",
"in",
"self",
":",
"ret",
"+=",
"routing_node",
".",
"as_tree",
"(",
"level",
"+"... | Display the routing tree representation in string
format
:rtype: str | [
"Display",
"the",
"routing",
"tree",
"representation",
"in",
"string",
"format",
":",
"rtype",
":",
"str"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L230-L240 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L242-L261 |
gabstopper/smc-python | smc/core/route.py | Routing.add_traffic_handler | def add_traffic_handler(self, netlink, netlink_gw=None, network=None):
"""
Add a traffic handler to a routing node. A traffic handler can be
either a static netlink or a multilink traffic handler. If ``network``
is not specified and the interface has multiple IP addresses, the
t... | python | def add_traffic_handler(self, netlink, netlink_gw=None, network=None):
"""
Add a traffic handler to a routing node. A traffic handler can be
either a static netlink or a multilink traffic handler. If ``network``
is not specified and the interface has multiple IP addresses, the
t... | [
"def",
"add_traffic_handler",
"(",
"self",
",",
"netlink",
",",
"netlink_gw",
"=",
"None",
",",
"network",
"=",
"None",
")",
":",
"routing_node_gateway",
"=",
"RoutingNodeGateway",
"(",
"netlink",
",",
"destinations",
"=",
"[",
"]",
"if",
"not",
"netlink_gw",
... | Add a traffic handler to a routing node. A traffic handler can be
either a static netlink or a multilink traffic handler. If ``network``
is not specified and the interface has multiple IP addresses, the
traffic handler will be added to all ipv4 addresses.
Add a pre-defined netl... | [
"Add",
"a",
"traffic",
"handler",
"to",
"a",
"routing",
"node",
".",
"A",
"traffic",
"handler",
"can",
"be",
"either",
"a",
"static",
"netlink",
"or",
"a",
"multilink",
"traffic",
"handler",
".",
"If",
"network",
"is",
"not",
"specified",
"and",
"the",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L391-L426 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L428-L473 |
gabstopper/smc-python | smc/core/route.py | Routing.add_bgp_peering | def add_bgp_peering(self, bgp_peering, external_bgp_peer=None,
network=None):
"""
Add a BGP configuration to this routing interface.
If the interface has multiple ip addresses, all networks will receive
the BGP peering by default unless the ``network`` parameter ... | python | def add_bgp_peering(self, bgp_peering, external_bgp_peer=None,
network=None):
"""
Add a BGP configuration to this routing interface.
If the interface has multiple ip addresses, all networks will receive
the BGP peering by default unless the ``network`` parameter ... | [
"def",
"add_bgp_peering",
"(",
"self",
",",
"bgp_peering",
",",
"external_bgp_peer",
"=",
"None",
",",
"network",
"=",
"None",
")",
":",
"destination",
"=",
"[",
"external_bgp_peer",
"]",
"if",
"external_bgp_peer",
"else",
"[",
"]",
"routing_node_gateway",
"=",
... | Add a BGP configuration to this routing interface.
If the interface has multiple ip addresses, all networks will receive
the BGP peering by default unless the ``network`` parameter is
specified.
Example of adding BGP to an interface by ID::
interface = engine.routi... | [
"Add",
"a",
"BGP",
"configuration",
"to",
"this",
"routing",
"interface",
".",
"If",
"the",
"interface",
"has",
"multiple",
"ip",
"addresses",
"all",
"networks",
"will",
"receive",
"the",
"BGP",
"peering",
"by",
"default",
"unless",
"the",
"network",
"paramete... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L475-L502 |
gabstopper/smc-python | smc/core/route.py | Routing.add_static_route | def add_static_route(self, gateway, destination, network=None):
"""
Add a static route to this route table. Destination can be any element
type supported in the routing table such as a Group of network members.
Since a static route gateway needs to be on the same network as the
i... | python | def add_static_route(self, gateway, destination, network=None):
"""
Add a static route to this route table. Destination can be any element
type supported in the routing table such as a Group of network members.
Since a static route gateway needs to be on the same network as the
i... | [
"def",
"add_static_route",
"(",
"self",
",",
"gateway",
",",
"destination",
",",
"network",
"=",
"None",
")",
":",
"routing_node_gateway",
"=",
"RoutingNodeGateway",
"(",
"gateway",
",",
"destinations",
"=",
"destination",
")",
"return",
"self",
".",
"_add_gatew... | Add a static route to this route table. Destination can be any element
type supported in the routing table such as a Group of network members.
Since a static route gateway needs to be on the same network as the
interface, provide a value for `network` if an interface has multiple
address... | [
"Add",
"a",
"static",
"route",
"to",
"this",
"route",
"table",
".",
"Destination",
"can",
"be",
"any",
"element",
"type",
"supported",
"in",
"the",
"routing",
"table",
"such",
"as",
"a",
"Group",
"of",
"network",
"members",
".",
"Since",
"a",
"static",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L504-L529 |
gabstopper/smc-python | smc/core/route.py | Routing.add_dynamic_gateway | def add_dynamic_gateway(self, networks):
"""
A dynamic gateway object creates a router object that is
attached to a DHCP interface. You can associate networks with
this gateway address to identify networks for routing on this
interface.
::
route = en... | python | def add_dynamic_gateway(self, networks):
"""
A dynamic gateway object creates a router object that is
attached to a DHCP interface. You can associate networks with
this gateway address to identify networks for routing on this
interface.
::
route = en... | [
"def",
"add_dynamic_gateway",
"(",
"self",
",",
"networks",
")",
":",
"routing_node_gateway",
"=",
"RoutingNodeGateway",
"(",
"dynamic_classid",
"=",
"'gateway'",
",",
"destinations",
"=",
"networks",
"or",
"[",
"]",
")",
"return",
"self",
".",
"_add_gateway_node"... | A dynamic gateway object creates a router object that is
attached to a DHCP interface. You can associate networks with
this gateway address to identify networks for routing on this
interface.
::
route = engine.routing.get(0)
route.add_dynamic_gateway([Ne... | [
"A",
"dynamic",
"gateway",
"object",
"creates",
"a",
"router",
"object",
"that",
"is",
"attached",
"to",
"a",
"DHCP",
"interface",
".",
"You",
"can",
"associate",
"networks",
"with",
"this",
"gateway",
"address",
"to",
"identify",
"networks",
"for",
"routing",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L531-L551 |
gabstopper/smc-python | smc/core/route.py | Routing._add_gateway_node_on_tunnel | def _add_gateway_node_on_tunnel(self, routing_node_gateway):
"""
Add a gateway node on a tunnel interface. Tunnel interface elements
are attached to the interface level and not directly nested under
the networks node.
:param RouteNodeGateway routing_node_gateway: routing... | python | def _add_gateway_node_on_tunnel(self, routing_node_gateway):
"""
Add a gateway node on a tunnel interface. Tunnel interface elements
are attached to the interface level and not directly nested under
the networks node.
:param RouteNodeGateway routing_node_gateway: routing... | [
"def",
"_add_gateway_node_on_tunnel",
"(",
"self",
",",
"routing_node_gateway",
")",
":",
"modified",
"=",
"False",
"peering",
"=",
"[",
"next_hop",
"for",
"next_hop",
"in",
"self",
"if",
"next_hop",
".",
"routing_node_element",
"==",
"routing_node_gateway",
".",
... | Add a gateway node on a tunnel interface. Tunnel interface elements
are attached to the interface level and not directly nested under
the networks node.
:param RouteNodeGateway routing_node_gateway: routing node gateway instance
:return: Whether a change was made or not
... | [
"Add",
"a",
"gateway",
"node",
"on",
"a",
"tunnel",
"interface",
".",
"Tunnel",
"interface",
"elements",
"are",
"attached",
"to",
"the",
"interface",
"level",
"and",
"not",
"directly",
"nested",
"under",
"the",
"networks",
"node",
".",
":",
"param",
"RouteNo... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L553-L582 |
gabstopper/smc-python | smc/core/route.py | Routing._add_gateway_node | def _add_gateway_node(self, gw_type, routing_node_gateway, network=None):
"""
Add a gateway node to existing routing tree. Gateways are only added if
they do not already exist. If they do exist, check the destinations of
the existing gateway and add destinations that are not already ther... | python | def _add_gateway_node(self, gw_type, routing_node_gateway, network=None):
"""
Add a gateway node to existing routing tree. Gateways are only added if
they do not already exist. If they do exist, check the destinations of
the existing gateway and add destinations that are not already ther... | [
"def",
"_add_gateway_node",
"(",
"self",
",",
"gw_type",
",",
"routing_node_gateway",
",",
"network",
"=",
"None",
")",
":",
"if",
"self",
".",
"level",
"!=",
"'interface'",
":",
"raise",
"ModificationAborted",
"(",
"'You must make this change from the '",
"'interfa... | Add a gateway node to existing routing tree. Gateways are only added if
they do not already exist. If they do exist, check the destinations of
the existing gateway and add destinations that are not already there.
A current limitation is that if a gateway doesn't exist and the
destination... | [
"Add",
"a",
"gateway",
"node",
"to",
"existing",
"routing",
"tree",
".",
"Gateways",
"are",
"only",
"added",
"if",
"they",
"do",
"not",
"already",
"exist",
".",
"If",
"they",
"do",
"exist",
"check",
"the",
"destinations",
"of",
"the",
"existing",
"gateway"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L584-L669 |
gabstopper/smc-python | smc/core/route.py | Routing.remove_route_gateway | def remove_route_gateway(self, element, network=None):
"""
Remove a route element by href or Element. Use this if you want to
remove a netlink or a routing element such as BGP or OSPF. Removing
is done from within the routing interface context.
::
interface0 ... | python | def remove_route_gateway(self, element, network=None):
"""
Remove a route element by href or Element. Use this if you want to
remove a netlink or a routing element such as BGP or OSPF. Removing
is done from within the routing interface context.
::
interface0 ... | [
"def",
"remove_route_gateway",
"(",
"self",
",",
"element",
",",
"network",
"=",
"None",
")",
":",
"if",
"self",
".",
"level",
"not",
"in",
"(",
"'interface'",
",",
")",
":",
"raise",
"ModificationAborted",
"(",
"'You must make this change from the '",
"'interfa... | Remove a route element by href or Element. Use this if you want to
remove a netlink or a routing element such as BGP or OSPF. Removing
is done from within the routing interface context.
::
interface0 = engine.routing.get(0)
interface0.remove_route_gateway(StaticN... | [
"Remove",
"a",
"route",
"element",
"by",
"href",
"or",
"Element",
".",
"Use",
"this",
"if",
"you",
"want",
"to",
"remove",
"a",
"netlink",
"or",
"a",
"routing",
"element",
"such",
"as",
"BGP",
"or",
"OSPF",
".",
"Removing",
"is",
"done",
"from",
"withi... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L671-L711 |
gabstopper/smc-python | smc/core/route.py | Antispoofing.add | def add(self, element):
"""
Add an entry to this antispoofing node level.
Entry can be either href or network elements specified
in :py:class:`smc.elements.network`
::
if0 = engine.antispoofing.get(0)
if0.add(Network('foonet'))
:param Element ele... | python | def add(self, element):
"""
Add an entry to this antispoofing node level.
Entry can be either href or network elements specified
in :py:class:`smc.elements.network`
::
if0 = engine.antispoofing.get(0)
if0.add(Network('foonet'))
:param Element ele... | [
"def",
"add",
"(",
"self",
",",
"element",
")",
":",
"if",
"self",
".",
"level",
"==",
"'interface'",
":",
"for",
"network",
"in",
"self",
":",
"if",
"from_meta",
"(",
"network",
")",
"==",
"element",
":",
"return",
"False",
"self",
".",
"data",
"[",... | Add an entry to this antispoofing node level.
Entry can be either href or network elements specified
in :py:class:`smc.elements.network`
::
if0 = engine.antispoofing.get(0)
if0.add(Network('foonet'))
:param Element element: entry to add, i.e. Network('mynetwork'... | [
"Add",
"an",
"entry",
"to",
"this",
"antispoofing",
"node",
"level",
".",
"Entry",
"can",
"be",
"either",
"href",
"or",
"network",
"elements",
"specified",
"in",
":",
"py",
":",
"class",
":",
"smc",
".",
"elements",
".",
"network",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L775-L806 |
gabstopper/smc-python | smc/core/route.py | Antispoofing.remove | def remove(self, element):
"""
Remove a specific user added element from the antispoofing tables of
a given interface. This will not remove autogenerated or system level
entries.
:param Element element: element to remove
:return: remove element if it exists and r... | python | def remove(self, element):
"""
Remove a specific user added element from the antispoofing tables of
a given interface. This will not remove autogenerated or system level
entries.
:param Element element: element to remove
:return: remove element if it exists and r... | [
"def",
"remove",
"(",
"self",
",",
"element",
")",
":",
"if",
"self",
".",
"level",
"==",
"'interface'",
":",
"len_before_change",
"=",
"len",
"(",
"self",
")",
"_nodes",
"=",
"[",
"]",
"for",
"network",
"in",
"self",
":",
"if",
"from_meta",
"(",
"ne... | Remove a specific user added element from the antispoofing tables of
a given interface. This will not remove autogenerated or system level
entries.
:param Element element: element to remove
:return: remove element if it exists and return bool
:rtype: bool | [
"Remove",
"a",
"specific",
"user",
"added",
"element",
"from",
"the",
"antispoofing",
"tables",
"of",
"a",
"given",
"interface",
".",
"This",
"will",
"not",
"remove",
"autogenerated",
"or",
"system",
"level",
"entries",
".",
":",
"param",
"Element",
"element",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L811-L834 |
gabstopper/smc-python | smc/core/route.py | PolicyRoute.create | def create(self, source, destination, gateway_ip, comment=None):
"""
Add a new policy route to the engine.
:param str source: network address with /cidr
:param str destination: network address with /cidr
:param str gateway: IP address, must be on source network
:... | python | def create(self, source, destination, gateway_ip, comment=None):
"""
Add a new policy route to the engine.
:param str source: network address with /cidr
:param str destination: network address with /cidr
:param str gateway: IP address, must be on source network
:... | [
"def",
"create",
"(",
"self",
",",
"source",
",",
"destination",
",",
"gateway_ip",
",",
"comment",
"=",
"None",
")",
":",
"self",
".",
"items",
".",
"append",
"(",
"dict",
"(",
"source",
"=",
"source",
",",
"destination",
"=",
"destination",
",",
"gat... | Add a new policy route to the engine.
:param str source: network address with /cidr
:param str destination: network address with /cidr
:param str gateway: IP address, must be on source network
:param str comment: optional comment | [
"Add",
"a",
"new",
"policy",
"route",
"to",
"the",
"engine",
".",
":",
"param",
"str",
"source",
":",
"network",
"address",
"with",
"/",
"cidr",
":",
"param",
"str",
"destination",
":",
"network",
"address",
"with",
"/",
"cidr",
":",
"param",
"str",
"g... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L1035-L1046 |
gabstopper/smc-python | smc/core/route.py | PolicyRoute.delete | def delete(self, **kw):
"""
Delete a policy route from the engine. You can delete using a
single field or multiple fields for a more exact match.
Use a keyword argument to delete a route by any valid attribute.
:param kw: use valid Route keyword values to delete by exact... | python | def delete(self, **kw):
"""
Delete a policy route from the engine. You can delete using a
single field or multiple fields for a more exact match.
Use a keyword argument to delete a route by any valid attribute.
:param kw: use valid Route keyword values to delete by exact... | [
"def",
"delete",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"delete_by",
"=",
"[",
"]",
"for",
"field",
",",
"val",
"in",
"kw",
".",
"items",
"(",
")",
":",
"if",
"val",
"is",
"not",
"None",
":",
"delete_by",
".",
"append",
"(",
"field",
")",
... | Delete a policy route from the engine. You can delete using a
single field or multiple fields for a more exact match.
Use a keyword argument to delete a route by any valid attribute.
:param kw: use valid Route keyword values to delete by exact match | [
"Delete",
"a",
"policy",
"route",
"from",
"the",
"engine",
".",
"You",
"can",
"delete",
"using",
"a",
"single",
"field",
"or",
"multiple",
"fields",
"for",
"a",
"more",
"exact",
"match",
".",
"Use",
"a",
"keyword",
"argument",
"to",
"delete",
"a",
"route... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/route.py#L1048-L1063 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L35-L60 |
gabstopper/smc-python | smc/elements/network.py | Host.add_secondary | def add_secondary(self, address, append_lists=False):
"""
Add secondary IP addresses to this host element. If append_list
is True, then add to existing list. Otherwise overwrite.
:param list address: ip addresses to add in IPv4 or IPv6 format
:param bool append_list: add... | python | def add_secondary(self, address, append_lists=False):
"""
Add secondary IP addresses to this host element. If append_list
is True, then add to existing list. Otherwise overwrite.
:param list address: ip addresses to add in IPv4 or IPv6 format
:param bool append_list: add... | [
"def",
"add_secondary",
"(",
"self",
",",
"address",
",",
"append_lists",
"=",
"False",
")",
":",
"self",
".",
"update",
"(",
"secondary",
"=",
"address",
",",
"append_lists",
"=",
"append_lists",
")"
] | Add secondary IP addresses to this host element. If append_list
is True, then add to existing list. Otherwise overwrite.
:param list address: ip addresses to add in IPv4 or IPv6 format
:param bool append_list: add to existing or overwrite (default: append)
:return: None | [
"Add",
"secondary",
"IP",
"addresses",
"to",
"this",
"host",
"element",
".",
"If",
"append_list",
"is",
"True",
"then",
"add",
"to",
"existing",
"list",
".",
"Otherwise",
"overwrite",
".",
":",
"param",
"list",
"address",
":",
"ip",
"addresses",
"to",
"add... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L62-L73 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L92-L107 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L186-L208 |
gabstopper/smc-python | smc/elements/network.py | Expression.build_sub_expression | def build_sub_expression(name, ne_ref=None, operator='union'):
"""
Static method to build and return the proper json for a sub-expression.
A sub-expression would be the grouping of network elements used as a
target match. For example, (network A or network B) would be considered
... | python | def build_sub_expression(name, ne_ref=None, operator='union'):
"""
Static method to build and return the proper json for a sub-expression.
A sub-expression would be the grouping of network elements used as a
target match. For example, (network A or network B) would be considered
... | [
"def",
"build_sub_expression",
"(",
"name",
",",
"ne_ref",
"=",
"None",
",",
"operator",
"=",
"'union'",
")",
":",
"ne_ref",
"=",
"[",
"]",
"if",
"ne_ref",
"is",
"None",
"else",
"ne_ref",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'ne_ref'",
":",
... | Static method to build and return the proper json for a sub-expression.
A sub-expression would be the grouping of network elements used as a
target match. For example, (network A or network B) would be considered
a sub-expression. This can be used to compound sub-expressions before
calli... | [
"Static",
"method",
"to",
"build",
"and",
"return",
"the",
"proper",
"json",
"for",
"a",
"sub",
"-",
"expression",
".",
"A",
"sub",
"-",
"expression",
"would",
"be",
"the",
"grouping",
"of",
"network",
"elements",
"used",
"as",
"a",
"target",
"match",
".... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L263-L280 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L283-L305 |
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",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L391-L421 |
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... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L423-L455 |
gabstopper/smc-python | smc/elements/network.py | IPList.update_or_create | def update_or_create(cls, append_lists=True, with_status=False, **kwargs):
"""
Update or create an IPList.
:param bool append_lists: append to existing IP List
:param dict kwargs: provide at minimum the name attribute
and optionally match the create constructor value... | python | def update_or_create(cls, append_lists=True, with_status=False, **kwargs):
"""
Update or create an IPList.
:param bool append_lists: append to existing IP List
:param dict kwargs: provide at minimum the name attribute
and optionally match the create constructor value... | [
"def",
"update_or_create",
"(",
"cls",
",",
"append_lists",
"=",
"True",
",",
"with_status",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"was_created",
",",
"was_modified",
"=",
"False",
",",
"False",
"element",
"=",
"None",
"try",
":",
"element",
"... | Update or create an IPList.
:param bool append_lists: append to existing IP List
:param dict kwargs: provide at minimum the name attribute
and optionally match the create constructor values
:raises FetchElementFailed: Reason for retrieval failure | [
"Update",
"or",
"create",
"an",
"IPList",
".",
":",
"param",
"bool",
"append_lists",
":",
"append",
"to",
"existing",
"IP",
"List",
":",
"param",
"dict",
"kwargs",
":",
"provide",
"at",
"minimum",
"the",
"name",
"attribute",
"and",
"optionally",
"match",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L458-L493 |
gabstopper/smc-python | smc/elements/network.py | IPList.create | def create(cls, name, iplist=None, comment=None):
"""
Create an IP List. It is also possible to add entries by supplying
a list of IPs/networks, although this is optional. You can also
use upload/download to add to the iplist.
:param str name: name of ip list
:param list... | python | def create(cls, name, iplist=None, comment=None):
"""
Create an IP List. It is also possible to add entries by supplying
a list of IPs/networks, although this is optional. You can also
use upload/download to add to the iplist.
:param str name: name of ip list
:param list... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"iplist",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"json",
"=",
"{",
"'name'",
":",
"name",
",",
"'comment'",
":",
"comment",
"}",
"result",
"=",
"ElementCreator",
"(",
"cls",
",",
"json",
"... | Create an IP List. It is also possible to add entries by supplying
a list of IPs/networks, although this is optional. You can also
use upload/download to add to the iplist.
:param str name: name of ip list
:param list iplist: list of ipaddress
:param str comment: optional commen... | [
"Create",
"an",
"IP",
"List",
".",
"It",
"is",
"also",
"possible",
"to",
"add",
"entries",
"by",
"supplying",
"a",
"list",
"of",
"IPs",
"/",
"networks",
"although",
"this",
"is",
"optional",
".",
"You",
"can",
"also",
"use",
"upload",
"/",
"download",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L508-L532 |
gabstopper/smc-python | smc/elements/network.py | Alias.update_or_create | def update_or_create(cls, name, engine, translation_values=None, with_status=False):
"""
Update or create an Alias and it's mappings.
:param str name: name of alias
:param Engine engine: engine to modify alias translation values
:param list(str,Element) translation_value... | python | def update_or_create(cls, name, engine, translation_values=None, with_status=False):
"""
Update or create an Alias and it's mappings.
:param str name: name of alias
:param Engine engine: engine to modify alias translation values
:param list(str,Element) translation_value... | [
"def",
"update_or_create",
"(",
"cls",
",",
"name",
",",
"engine",
",",
"translation_values",
"=",
"None",
",",
"with_status",
"=",
"False",
")",
":",
"updated",
",",
"created",
"=",
"False",
",",
"False",
"alias",
"=",
"cls",
".",
"get",
"(",
"name",
... | Update or create an Alias and it's mappings.
:param str name: name of alias
:param Engine engine: engine to modify alias translation values
:param list(str,Element) translation_values: translation values
as elements. Can be None if you want to unset any existing values
... | [
"Update",
"or",
"create",
"an",
"Alias",
"and",
"it",
"s",
"mappings",
".",
":",
"param",
"str",
"name",
":",
"name",
"of",
"alias",
":",
"param",
"Engine",
"engine",
":",
"engine",
"to",
"modify",
"alias",
"translation",
"values",
":",
"param",
"list",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L633-L686 |
gabstopper/smc-python | smc/elements/network.py | Alias._from_engine | def _from_engine(cls, data, alias_list):
"""
Return an alias for the engine. The data is dict provided
when calling engine.alias_resolving(). The alias list is
the list of aliases pre-fetched from Alias.objects.all().
This will return an Alias element by taking the alias_ref
... | python | def _from_engine(cls, data, alias_list):
"""
Return an alias for the engine. The data is dict provided
when calling engine.alias_resolving(). The alias list is
the list of aliases pre-fetched from Alias.objects.all().
This will return an Alias element by taking the alias_ref
... | [
"def",
"_from_engine",
"(",
"cls",
",",
"data",
",",
"alias_list",
")",
":",
"for",
"alias",
"in",
"alias_list",
":",
"href",
"=",
"data",
".",
"get",
"(",
"'alias_ref'",
")",
"if",
"alias",
".",
"href",
"==",
"href",
":",
"_alias",
"=",
"Alias",
"("... | Return an alias for the engine. The data is dict provided
when calling engine.alias_resolving(). The alias list is
the list of aliases pre-fetched from Alias.objects.all().
This will return an Alias element by taking the alias_ref
and finding the name in the alias list.
... | [
"Return",
"an",
"alias",
"for",
"the",
"engine",
".",
"The",
"data",
"is",
"dict",
"provided",
"when",
"calling",
"engine",
".",
"alias_resolving",
"()",
".",
"The",
"alias",
"list",
"is",
"the",
"list",
"of",
"aliases",
"pre",
"-",
"fetched",
"from",
"A... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L689-L705 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L707-L729 |
gabstopper/smc-python | smc-monitoring/smc_monitoring/monitors/blacklist.py | BlacklistQuery.fetch_as_element | def fetch_as_element(self, **kw):
"""
Fetch the blacklist and return as an instance of Element.
:return: generator returning element instances
:rtype: BlacklistEntry
"""
clone = self.copy()
# Replace all filters with a combined filter
bldata = Tex... | python | def fetch_as_element(self, **kw):
"""
Fetch the blacklist and return as an instance of Element.
:return: generator returning element instances
:rtype: BlacklistEntry
"""
clone = self.copy()
# Replace all filters with a combined filter
bldata = Tex... | [
"def",
"fetch_as_element",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"clone",
"=",
"self",
".",
"copy",
"(",
")",
"# Replace all filters with a combined filter",
"bldata",
"=",
"TextFormat",
"(",
"field_format",
"=",
"'name'",
")",
"# Preserve resolving fields f... | Fetch the blacklist and return as an instance of Element.
:return: generator returning element instances
:rtype: BlacklistEntry | [
"Fetch",
"the",
"blacklist",
"and",
"return",
"as",
"an",
"instance",
"of",
"Element",
".",
":",
"return",
":",
"generator",
"returning",
"element",
"instances",
":",
"rtype",
":",
"BlacklistEntry"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/blacklist.py#L83-L108 |
gabstopper/smc-python | smc-monitoring/smc_monitoring/monitors/blacklist.py | BlacklistEntry.source_ports | def source_ports(self):
"""
Source ports for this blacklist entry. If no ports are specified (i.e. ALL
ports), 'ANY' is returned.
:rtype: str
"""
start_port = self.blacklist.get('BlacklistEntrySourcePort')
if start_port is not None:
return '{}... | python | def source_ports(self):
"""
Source ports for this blacklist entry. If no ports are specified (i.e. ALL
ports), 'ANY' is returned.
:rtype: str
"""
start_port = self.blacklist.get('BlacklistEntrySourcePort')
if start_port is not None:
return '{}... | [
"def",
"source_ports",
"(",
"self",
")",
":",
"start_port",
"=",
"self",
".",
"blacklist",
".",
"get",
"(",
"'BlacklistEntrySourcePort'",
")",
"if",
"start_port",
"is",
"not",
"None",
":",
"return",
"'{}-{}'",
".",
"format",
"(",
"start_port",
",",
"self",
... | Source ports for this blacklist entry. If no ports are specified (i.e. ALL
ports), 'ANY' is returned.
:rtype: str | [
"Source",
"ports",
"for",
"this",
"blacklist",
"entry",
".",
"If",
"no",
"ports",
"are",
"specified",
"(",
"i",
".",
"e",
".",
"ALL",
"ports",
")",
"ANY",
"is",
"returned",
".",
":",
"rtype",
":",
"str"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/blacklist.py#L200-L211 |
gabstopper/smc-python | smc-monitoring/smc_monitoring/monitors/blacklist.py | BlacklistEntry.dest_ports | def dest_ports(self):
"""
Destination ports for this blacklist entry. If no ports are specified,
'ANY' is returned.
:rtype: str
"""
start_port = self.blacklist.get('BlacklistEntryDestinationPort')
if start_port is not None:
return '{}-{}'.form... | python | def dest_ports(self):
"""
Destination ports for this blacklist entry. If no ports are specified,
'ANY' is returned.
:rtype: str
"""
start_port = self.blacklist.get('BlacklistEntryDestinationPort')
if start_port is not None:
return '{}-{}'.form... | [
"def",
"dest_ports",
"(",
"self",
")",
":",
"start_port",
"=",
"self",
".",
"blacklist",
".",
"get",
"(",
"'BlacklistEntryDestinationPort'",
")",
"if",
"start_port",
"is",
"not",
"None",
":",
"return",
"'{}-{}'",
".",
"format",
"(",
"start_port",
",",
"self"... | Destination ports for this blacklist entry. If no ports are specified,
'ANY' is returned.
:rtype: str | [
"Destination",
"ports",
"for",
"this",
"blacklist",
"entry",
".",
"If",
"no",
"ports",
"are",
"specified",
"ANY",
"is",
"returned",
".",
":",
"rtype",
":",
"str"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/monitors/blacklist.py#L214-L225 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L93-L98 |
gabstopper/smc-python | smc/policy/rule.py | Rule.move_rule_after | def move_rule_after(self, other_rule):
"""
Add this rule after another. This process will make a copy of
the existing rule and add after the specified rule. If this
raises an exception, processing is stopped. Otherwise the original
rule is then deleted.
You must re-retrie... | python | def move_rule_after(self, other_rule):
"""
Add this rule after another. This process will make a copy of
the existing rule and add after the specified rule. If this
raises an exception, processing is stopped. Otherwise the original
rule is then deleted.
You must re-retrie... | [
"def",
"move_rule_after",
"(",
"self",
",",
"other_rule",
")",
":",
"self",
".",
"make_request",
"(",
"CreateRuleFailed",
",",
"href",
"=",
"other_rule",
".",
"get_relation",
"(",
"'add_after'",
")",
",",
"method",
"=",
"'create'",
",",
"json",
"=",
"self",
... | Add this rule after another. This process will make a copy of
the existing rule and add after the specified rule. If this
raises an exception, processing is stopped. Otherwise the original
rule is then deleted.
You must re-retrieve the new element after running this operation
as ... | [
"Add",
"this",
"rule",
"after",
"another",
".",
"This",
"process",
"will",
"make",
"a",
"copy",
"of",
"the",
"existing",
"rule",
"and",
"add",
"after",
"the",
"specified",
"rule",
".",
"If",
"this",
"raises",
"an",
"exception",
"processing",
"is",
"stopped... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L100-L118 |
gabstopper/smc-python | smc/policy/rule.py | RuleCommon.create_rule_section | def create_rule_section(self, name, add_pos=None, after=None, before=None):
"""
Create a rule section in a Firewall Policy. To specify a specific numbering
position for the rule section, use the `add_pos` field. If no position or
before/after is specified, the rule section will be placed... | python | def create_rule_section(self, name, add_pos=None, after=None, before=None):
"""
Create a rule section in a Firewall Policy. To specify a specific numbering
position for the rule section, use the `add_pos` field. If no position or
before/after is specified, the rule section will be placed... | [
"def",
"create_rule_section",
"(",
"self",
",",
"name",
",",
"add_pos",
"=",
"None",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
")",
":",
"href",
"=",
"self",
".",
"href",
"params",
"=",
"None",
"if",
"add_pos",
"is",
"not",
"None",
":",
... | Create a rule section in a Firewall Policy. To specify a specific numbering
position for the rule section, use the `add_pos` field. If no position or
before/after is specified, the rule section will be placed at the top which
will encapsulate all rules below.
Create a rule section for th... | [
"Create",
"a",
"rule",
"section",
"in",
"a",
"Firewall",
"Policy",
".",
"To",
"specify",
"a",
"specific",
"numbering",
"position",
"for",
"the",
"rule",
"section",
"use",
"the",
"add_pos",
"field",
".",
"If",
"no",
"position",
"or",
"before",
"/",
"after",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L292-L332 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L469-L575 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L677-L740 |
gabstopper/smc-python | smc/elements/situations.py | _severity_by_name | def _severity_by_name(name):
"""
Return the severity integer value by it's name. If not found,
return 'information'.
:rtype: int
"""
for intvalue, sevname in SEVERITY.items():
if name.lower() == sevname:
return intvalue
return 1 | python | def _severity_by_name(name):
"""
Return the severity integer value by it's name. If not found,
return 'information'.
:rtype: int
"""
for intvalue, sevname in SEVERITY.items():
if name.lower() == sevname:
return intvalue
return 1 | [
"def",
"_severity_by_name",
"(",
"name",
")",
":",
"for",
"intvalue",
",",
"sevname",
"in",
"SEVERITY",
".",
"items",
"(",
")",
":",
"if",
"name",
".",
"lower",
"(",
")",
"==",
"sevname",
":",
"return",
"intvalue",
"return",
"1"
] | Return the severity integer value by it's name. If not found,
return 'information'.
:rtype: int | [
"Return",
"the",
"severity",
"integer",
"value",
"by",
"it",
"s",
"name",
".",
"If",
"not",
"found",
"return",
"information",
".",
":",
"rtype",
":",
"int"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/situations.py#L102-L112 |
gabstopper/smc-python | smc/elements/situations.py | SituationContext.situation_parameters | def situation_parameters(self):
"""
Situation parameters defining detection logic for the context.
This will return a list of SituationParameter indicating how
the detection is made, i.e. regular expression, integer value,
etc.
:rtype: list(SituationParameter)
... | python | def situation_parameters(self):
"""
Situation parameters defining detection logic for the context.
This will return a list of SituationParameter indicating how
the detection is made, i.e. regular expression, integer value,
etc.
:rtype: list(SituationParameter)
... | [
"def",
"situation_parameters",
"(",
"self",
")",
":",
"for",
"param",
"in",
"self",
".",
"data",
".",
"get",
"(",
"'situation_parameters'",
",",
"[",
"]",
")",
":",
"cache",
"=",
"ElementCache",
"(",
"data",
"=",
"self",
".",
"make_request",
"(",
"href",... | Situation parameters defining detection logic for the context.
This will return a list of SituationParameter indicating how
the detection is made, i.e. regular expression, integer value,
etc.
:rtype: list(SituationParameter) | [
"Situation",
"parameters",
"defining",
"detection",
"logic",
"for",
"the",
"context",
".",
"This",
"will",
"return",
"a",
"list",
"of",
"SituationParameter",
"indicating",
"how",
"the",
"detection",
"is",
"made",
"i",
".",
"e",
".",
"regular",
"expression",
"i... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/situations.py#L205-L217 |
gabstopper/smc-python | smc/elements/situations.py | Situation.parameter_values | def parameter_values(self):
"""
Parameter values for this inspection situation. This correlate to
the the situation_context.
:rtype: list(SituationParameterValue)
"""
for param in self.data.get('parameter_values', []):
cache = ElementCache(data=self.m... | python | def parameter_values(self):
"""
Parameter values for this inspection situation. This correlate to
the the situation_context.
:rtype: list(SituationParameterValue)
"""
for param in self.data.get('parameter_values', []):
cache = ElementCache(data=self.m... | [
"def",
"parameter_values",
"(",
"self",
")",
":",
"for",
"param",
"in",
"self",
".",
"data",
".",
"get",
"(",
"'parameter_values'",
",",
"[",
"]",
")",
":",
"cache",
"=",
"ElementCache",
"(",
"data",
"=",
"self",
".",
"make_request",
"(",
"href",
"=",
... | Parameter values for this inspection situation. This correlate to
the the situation_context.
:rtype: list(SituationParameterValue) | [
"Parameter",
"values",
"for",
"this",
"inspection",
"situation",
".",
"This",
"correlate",
"to",
"the",
"the",
"situation_context",
".",
":",
"rtype",
":",
"list",
"(",
"SituationParameterValue",
")"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/situations.py#L291-L302 |
gabstopper/smc-python | smc/elements/situations.py | InspectionSituation.create | def create(cls, name, situation_context, attacker=None, target=None,
severity='information', situation_type=None, description=None,
comment=None):
"""
Create an inspection situation.
:param str name: name of the situation
:param InspectionSituationC... | python | def create(cls, name, situation_context, attacker=None, target=None,
severity='information', situation_type=None, description=None,
comment=None):
"""
Create an inspection situation.
:param str name: name of the situation
:param InspectionSituationC... | [
"def",
"create",
"(",
"cls",
",",
"name",
",",
"situation_context",
",",
"attacker",
"=",
"None",
",",
"target",
"=",
"None",
",",
"severity",
"=",
"'information'",
",",
"situation_type",
"=",
"None",
",",
"description",
"=",
"None",
",",
"comment",
"=",
... | Create an inspection situation.
:param str name: name of the situation
:param InspectionSituationContext situation_context: The situation
context type used to define this situation. Identifies the proper
parameter that identifies how the situation is defined (i.e. regex,... | [
"Create",
"an",
"inspection",
"situation",
".",
":",
"param",
"str",
"name",
":",
"name",
"of",
"the",
"situation",
":",
"param",
"InspectionSituationContext",
"situation_context",
":",
"The",
"situation",
"context",
"type",
"used",
"to",
"define",
"this",
"situ... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/situations.py#L315-L353 |
gabstopper/smc-python | smc/elements/situations.py | InspectionSituation.create_regular_expression | def create_regular_expression(self, regexp):
"""
Create a regular expression for this inspection situation
context. The inspection situation must be using an inspection
context that supports regex.
:param str regexp: regular expression string
:raises CreateElemen... | python | def create_regular_expression(self, regexp):
"""
Create a regular expression for this inspection situation
context. The inspection situation must be using an inspection
context that supports regex.
:param str regexp: regular expression string
:raises CreateElemen... | [
"def",
"create_regular_expression",
"(",
"self",
",",
"regexp",
")",
":",
"for",
"parameter",
"in",
"self",
".",
"situation_context",
".",
"situation_parameters",
":",
"if",
"parameter",
".",
"type",
"==",
"'regexp'",
":",
"return",
"self",
".",
"add_parameter_v... | Create a regular expression for this inspection situation
context. The inspection situation must be using an inspection
context that supports regex.
:param str regexp: regular expression string
:raises CreateElementFailed: failed to modify the situation | [
"Create",
"a",
"regular",
"expression",
"for",
"this",
"inspection",
"situation",
"context",
".",
"The",
"inspection",
"situation",
"must",
"be",
"using",
"an",
"inspection",
"context",
"that",
"supports",
"regex",
".",
":",
"param",
"str",
"regexp",
":",
"reg... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/situations.py#L355-L372 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/resource.py#L30-L49 |
gabstopper/smc-python | smc/policy/policy.py | Policy.upload | def upload(self, engine, timeout=5, wait_for_finish=False, **kw):
"""
Upload policy to specific device. Using wait for finish
returns a poller thread for monitoring progress::
policy = FirewallPolicy('_NSX_Master_Default')
poller = policy.upload('myfirewall', wait_for_fi... | python | def upload(self, engine, timeout=5, wait_for_finish=False, **kw):
"""
Upload policy to specific device. Using wait for finish
returns a poller thread for monitoring progress::
policy = FirewallPolicy('_NSX_Master_Default')
poller = policy.upload('myfirewall', wait_for_fi... | [
"def",
"upload",
"(",
"self",
",",
"engine",
",",
"timeout",
"=",
"5",
",",
"wait_for_finish",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"return",
"Task",
".",
"execute",
"(",
"self",
",",
"'upload'",
",",
"params",
"=",
"{",
"'filter'",
":",
"e... | Upload policy to specific device. Using wait for finish
returns a poller thread for monitoring progress::
policy = FirewallPolicy('_NSX_Master_Default')
poller = policy.upload('myfirewall', wait_for_finish=True)
while not poller.done():
poller.wait(3)
... | [
"Upload",
"policy",
"to",
"specific",
"device",
".",
"Using",
"wait",
"for",
"finish",
"returns",
"a",
"poller",
"thread",
"for",
"monitoring",
"progress",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/policy.py#L48-L65 |
gabstopper/smc-python | smc/policy/policy.py | Policy.search_rule | def search_rule(self, search):
"""
Search a rule for a rule tag or name value
Result will be the meta data for rule (name, href, type)
Searching for a rule in specific policy::
f = FirewallPolicy(policy)
search = f.search_rule(searchable)
:param str sea... | python | def search_rule(self, search):
"""
Search a rule for a rule tag or name value
Result will be the meta data for rule (name, href, type)
Searching for a rule in specific policy::
f = FirewallPolicy(policy)
search = f.search_rule(searchable)
:param str sea... | [
"def",
"search_rule",
"(",
"self",
",",
"search",
")",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"resource",
"=",
"'search_rule'",
",",
"params",
"=",
"{",
"'filter'",
":",
"search",
"}",
")",
"if",
"result",
":",
"results",
"=",
"[",
"]",
... | Search a rule for a rule tag or name value
Result will be the meta data for rule (name, href, type)
Searching for a rule in specific policy::
f = FirewallPolicy(policy)
search = f.search_rule(searchable)
:param str search: search string
:return: rule elements m... | [
"Search",
"a",
"rule",
"for",
"a",
"rule",
"tag",
"or",
"name",
"value",
"Result",
"will",
"be",
"the",
"meta",
"data",
"for",
"rule",
"(",
"name",
"href",
"type",
")"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/policy.py#L78-L109 |
gabstopper/smc-python | smc/policy/policy.py | Policy.rule_counters | def rule_counters(self, engine, duration_type='one_week',
duration=0, start_time=0):
"""
.. versionadded:: 0.5.6
Obtain rule counters for this policy. Requires SMC >= 6.2
Rule counters can be obtained for a given policy and duration for
those counters can... | python | def rule_counters(self, engine, duration_type='one_week',
duration=0, start_time=0):
"""
.. versionadded:: 0.5.6
Obtain rule counters for this policy. Requires SMC >= 6.2
Rule counters can be obtained for a given policy and duration for
those counters can... | [
"def",
"rule_counters",
"(",
"self",
",",
"engine",
",",
"duration_type",
"=",
"'one_week'",
",",
"duration",
"=",
"0",
",",
"start_time",
"=",
"0",
")",
":",
"json",
"=",
"{",
"'target_ref'",
":",
"engine",
".",
"href",
",",
"'duration_type'",
":",
"dur... | .. versionadded:: 0.5.6
Obtain rule counters for this policy. Requires SMC >= 6.2
Rule counters can be obtained for a given policy and duration for
those counters can be provided in duration_type. A custom start
range can also be provided.
:param Engine engine: the ... | [
"..",
"versionadded",
"::",
"0",
".",
"5",
".",
"6",
"Obtain",
"rule",
"counters",
"for",
"this",
"policy",
".",
"Requires",
"SMC",
">",
"=",
"6",
".",
"2",
"Rule",
"counters",
"can",
"be",
"obtained",
"for",
"a",
"given",
"policy",
"and",
"duration",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/policy.py#L111-L137 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L32-L54 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L66-L76 |
gabstopper/smc-python | smc/vpn/policy.py | PolicyVPN.add_mobile_gateway | def add_mobile_gateway(self, gateway):
"""
Add a mobile VPN gateway to this policy VPN.
Example of adding or removing a mobile VPN gateway::
policy_vpn = PolicyVPN('myvpn')
policy_vpn.open()
policy_vpn.add_mobile_vpn_gateway(ExternalGateway('extgw3')... | python | def add_mobile_gateway(self, gateway):
"""
Add a mobile VPN gateway to this policy VPN.
Example of adding or removing a mobile VPN gateway::
policy_vpn = PolicyVPN('myvpn')
policy_vpn.open()
policy_vpn.add_mobile_vpn_gateway(ExternalGateway('extgw3')... | [
"def",
"add_mobile_gateway",
"(",
"self",
",",
"gateway",
")",
":",
"try",
":",
"gateway",
"=",
"gateway",
".",
"vpn",
".",
"internal_gateway",
".",
"href",
"# Engine",
"except",
"AttributeError",
":",
"gateway",
"=",
"element_resolver",
"(",
"gateway",
")",
... | Add a mobile VPN gateway to this policy VPN.
Example of adding or removing a mobile VPN gateway::
policy_vpn = PolicyVPN('myvpn')
policy_vpn.open()
policy_vpn.add_mobile_vpn_gateway(ExternalGateway('extgw3'))
for mobile_gateway in policy_vpn... | [
"Add",
"a",
"mobile",
"VPN",
"gateway",
"to",
"this",
"policy",
"VPN",
".",
"Example",
"of",
"adding",
"or",
"removing",
"a",
"mobile",
"VPN",
"gateway",
"::",
"policy_vpn",
"=",
"PolicyVPN",
"(",
"myvpn",
")",
"policy_vpn",
".",
"open",
"()",
"policy_vpn"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L210-L239 |
gabstopper/smc-python | smc/vpn/policy.py | PolicyVPN.add_internal_gateway_to_vpn | def add_internal_gateway_to_vpn(internal_gateway_href, vpn_policy,
vpn_role='central'):
"""
Add an internal gateway (managed engine node) to a VPN policy
based on the internal gateway href.
:param str internal_gateway_href: href for engine internal gw... | python | def add_internal_gateway_to_vpn(internal_gateway_href, vpn_policy,
vpn_role='central'):
"""
Add an internal gateway (managed engine node) to a VPN policy
based on the internal gateway href.
:param str internal_gateway_href: href for engine internal gw... | [
"def",
"add_internal_gateway_to_vpn",
"(",
"internal_gateway_href",
",",
"vpn_policy",
",",
"vpn_role",
"=",
"'central'",
")",
":",
"try",
":",
"vpn",
"=",
"PolicyVPN",
"(",
"vpn_policy",
")",
"vpn",
".",
"open",
"(",
")",
"if",
"vpn_role",
"==",
"'central'",
... | Add an internal gateway (managed engine node) to a VPN policy
based on the internal gateway href.
:param str internal_gateway_href: href for engine internal gw
:param str vpn_policy: name of vpn policy
:param str vpn_role: central|satellite
:return: True for success
:rty... | [
"Add",
"an",
"internal",
"gateway",
"(",
"managed",
"engine",
"node",
")",
"to",
"a",
"VPN",
"policy",
"based",
"on",
"the",
"internal",
"gateway",
"href",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L285-L308 |
gabstopper/smc-python | smc/vpn/policy.py | GatewayTunnel.enable_disable | def enable_disable(self):
"""
Enable or disable the tunnel link between endpoints.
:raises UpdateElementFailed: failed with reason
:return: None
"""
if self.enabled:
self.update(enabled=False)
else:
self.update(enabled=True) | python | def enable_disable(self):
"""
Enable or disable the tunnel link between endpoints.
:raises UpdateElementFailed: failed with reason
:return: None
"""
if self.enabled:
self.update(enabled=False)
else:
self.update(enabled=True) | [
"def",
"enable_disable",
"(",
"self",
")",
":",
"if",
"self",
".",
"enabled",
":",
"self",
".",
"update",
"(",
"enabled",
"=",
"False",
")",
"else",
":",
"self",
".",
"update",
"(",
"enabled",
"=",
"True",
")"
] | Enable or disable the tunnel link between endpoints.
:raises UpdateElementFailed: failed with reason
:return: None | [
"Enable",
"or",
"disable",
"the",
"tunnel",
"link",
"between",
"endpoints",
".",
":",
"raises",
"UpdateElementFailed",
":",
"failed",
"with",
"reason",
":",
"return",
":",
"None"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/policy.py#L435-L445 |
gabstopper/smc-python | smc/elements/other.py | prepare_blacklist | def prepare_blacklist(src, dst, duration=3600, src_port1=None,
src_port2=None, src_proto='predefined_tcp',
dst_port1=None, dst_port2=None,
dst_proto='predefined_tcp'):
"""
Create a blacklist entry.
A blacklist can be added directly from... | python | def prepare_blacklist(src, dst, duration=3600, src_port1=None,
src_port2=None, src_proto='predefined_tcp',
dst_port1=None, dst_port2=None,
dst_proto='predefined_tcp'):
"""
Create a blacklist entry.
A blacklist can be added directly from... | [
"def",
"prepare_blacklist",
"(",
"src",
",",
"dst",
",",
"duration",
"=",
"3600",
",",
"src_port1",
"=",
"None",
",",
"src_port2",
"=",
"None",
",",
"src_proto",
"=",
"'predefined_tcp'",
",",
"dst_port1",
"=",
"None",
",",
"dst_port2",
"=",
"None",
",",
... | Create a blacklist entry.
A blacklist can be added directly from the engine node, or from
the system context. If submitting from the system context, it becomes
a global blacklist. This will return the properly formatted json
to submit.
:param src: source address, with cidr, i.e. 10.10.10.1... | [
"Create",
"a",
"blacklist",
"entry",
".",
"A",
"blacklist",
"can",
"be",
"added",
"directly",
"from",
"the",
"engine",
"node",
"or",
"from",
"the",
"system",
"context",
".",
"If",
"submitting",
"from",
"the",
"system",
"context",
"it",
"becomes",
"a",
"glo... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/other.py#L409-L474 |
gabstopper/smc-python | smc/elements/other.py | Category.add_element | def add_element(self, element):
"""
Element can be href or type :py:class:`smc.base.model.Element`
::
>>> from smc.elements.other import Category
>>> category = Category('foo')
>>> category.add_element(Host('kali'))
:param str,Element element: elemen... | python | def add_element(self, element):
"""
Element can be href or type :py:class:`smc.base.model.Element`
::
>>> from smc.elements.other import Category
>>> category = Category('foo')
>>> category.add_element(Host('kali'))
:param str,Element element: elemen... | [
"def",
"add_element",
"(",
"self",
",",
"element",
")",
":",
"element",
"=",
"element_resolver",
"(",
"element",
")",
"self",
".",
"make_request",
"(",
"ModificationFailed",
",",
"method",
"=",
"'create'",
",",
"resource",
"=",
"'category_add_element'",
",",
"... | Element can be href or type :py:class:`smc.base.model.Element`
::
>>> from smc.elements.other import Category
>>> category = Category('foo')
>>> category.add_element(Host('kali'))
:param str,Element element: element to add to tag
:raises: ModificationFailed:... | [
"Element",
"can",
"be",
"href",
"or",
"type",
":",
"py",
":",
"class",
":",
"smc",
".",
"base",
".",
"model",
".",
"Element",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/other.py#L64-L83 |
gabstopper/smc-python | smc/elements/other.py | Category.add_category_tag | def add_category_tag(self, tags, append_lists=True):
"""
Add this category to a category tag (group). This provides drop down
filters in the SMC UI by category tag.
:param list tags: category tag by name
:param bool append_lists: append to existing tags or overwrite
... | python | def add_category_tag(self, tags, append_lists=True):
"""
Add this category to a category tag (group). This provides drop down
filters in the SMC UI by category tag.
:param list tags: category tag by name
:param bool append_lists: append to existing tags or overwrite
... | [
"def",
"add_category_tag",
"(",
"self",
",",
"tags",
",",
"append_lists",
"=",
"True",
")",
":",
"tags",
"=",
"element_resolver",
"(",
"tags",
")",
"self",
".",
"update",
"(",
"category_parent_ref",
"=",
"tags",
",",
"append_lists",
"=",
"append_lists",
")"
... | Add this category to a category tag (group). This provides drop down
filters in the SMC UI by category tag.
:param list tags: category tag by name
:param bool append_lists: append to existing tags or overwrite
default: append)
:type tags: list(str)
:return: N... | [
"Add",
"this",
"category",
"to",
"a",
"category",
"tag",
"(",
"group",
")",
".",
"This",
"provides",
"drop",
"down",
"filters",
"in",
"the",
"SMC",
"UI",
"by",
"category",
"tag",
".",
":",
"param",
"list",
"tags",
":",
"category",
"tag",
"by",
"name",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/other.py#L108-L122 |
gabstopper/smc-python | smc/elements/other.py | CategoryTag.remove_category | def remove_category(self, categories):
"""
Remove a category from this Category Tag (group).
:param list categories: categories to remove
:type categories: list(str,Element)
:return: None
"""
categories = element_resolver(categories)
diff = [categ... | python | def remove_category(self, categories):
"""
Remove a category from this Category Tag (group).
:param list categories: categories to remove
:type categories: list(str,Element)
:return: None
"""
categories = element_resolver(categories)
diff = [categ... | [
"def",
"remove_category",
"(",
"self",
",",
"categories",
")",
":",
"categories",
"=",
"element_resolver",
"(",
"categories",
")",
"diff",
"=",
"[",
"category",
"for",
"category",
"in",
"self",
".",
"data",
"[",
"'category_child_ref'",
"]",
"if",
"category",
... | Remove a category from this Category Tag (group).
:param list categories: categories to remove
:type categories: list(str,Element)
:return: None | [
"Remove",
"a",
"category",
"from",
"this",
"Category",
"Tag",
"(",
"group",
")",
".",
":",
"param",
"list",
"categories",
":",
"categories",
"to",
"remove",
":",
"type",
"categories",
":",
"list",
"(",
"str",
"Element",
")",
":",
"return",
":",
"None"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/other.py#L159-L170 |
gabstopper/smc-python | smc/elements/other.py | Blacklist.add_entry | def add_entry(self, src, dst, duration=3600, src_port1=None,
src_port2=None, src_proto='predefined_tcp',
dst_port1=None, dst_port2=None,
dst_proto='predefined_tcp'):
"""
Create a blacklist entry.
A blacklist can be added directly fr... | python | def add_entry(self, src, dst, duration=3600, src_port1=None,
src_port2=None, src_proto='predefined_tcp',
dst_port1=None, dst_port2=None,
dst_proto='predefined_tcp'):
"""
Create a blacklist entry.
A blacklist can be added directly fr... | [
"def",
"add_entry",
"(",
"self",
",",
"src",
",",
"dst",
",",
"duration",
"=",
"3600",
",",
"src_port1",
"=",
"None",
",",
"src_port2",
"=",
"None",
",",
"src_proto",
"=",
"'predefined_tcp'",
",",
"dst_port1",
"=",
"None",
",",
"dst_port2",
"=",
"None",
... | Create a blacklist entry.
A blacklist can be added directly from the engine node, or from
the system context. If submitting from the system context, it becomes
a global blacklist. This will return the properly formatted json
to submit.
:param src: source address... | [
"Create",
"a",
"blacklist",
"entry",
".",
"A",
"blacklist",
"can",
"be",
"added",
"directly",
"from",
"the",
"engine",
"node",
"or",
"from",
"the",
"system",
"context",
".",
"If",
"submitting",
"from",
"the",
"system",
"context",
"it",
"becomes",
"a",
"glo... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/other.py#L347-L392 |
gabstopper/smc-python | smc/elements/group.py | GroupMixin.update_or_create | def update_or_create(cls, append_lists=True, with_status=False,
remove_members=False, **kwargs):
"""
Update or create group entries. If the group exists, the members
will be updated. Set append_lists=True to add new members to
the list, or False to reset the list... | python | def update_or_create(cls, append_lists=True, with_status=False,
remove_members=False, **kwargs):
"""
Update or create group entries. If the group exists, the members
will be updated. Set append_lists=True to add new members to
the list, or False to reset the list... | [
"def",
"update_or_create",
"(",
"cls",
",",
"append_lists",
"=",
"True",
",",
"with_status",
"=",
"False",
",",
"remove_members",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"was_created",
",",
"was_modified",
"=",
"False",
",",
"False",
"element",
"=... | Update or create group entries. If the group exists, the members
will be updated. Set append_lists=True to add new members to
the list, or False to reset the list to the provided members. If
setting remove_members, this will override append_lists if set.
:param bool append_lists... | [
"Update",
"or",
"create",
"group",
"entries",
".",
"If",
"the",
"group",
"exists",
"the",
"members",
"will",
"be",
"updated",
".",
"Set",
"append_lists",
"=",
"True",
"to",
"add",
"new",
"members",
"to",
"the",
"list",
"or",
"False",
"to",
"reset",
"the"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/group.py#L18-L51 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/group.py#L53-L82 |
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"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/group.py#L214-L230 |
gabstopper/smc-python | smc/administration/reports.py | ReportDesign.generate | def generate(self, start_time=0, end_time=0,
senders=None, wait_for_finish=False, timeout=5, **kw): # @ReservedAssignment
"""
Generate the report and optionally wait for results.
You can optionally add filters to the report by providing the senders
argument as a list of typ... | python | def generate(self, start_time=0, end_time=0,
senders=None, wait_for_finish=False, timeout=5, **kw): # @ReservedAssignment
"""
Generate the report and optionally wait for results.
You can optionally add filters to the report by providing the senders
argument as a list of typ... | [
"def",
"generate",
"(",
"self",
",",
"start_time",
"=",
"0",
",",
"end_time",
"=",
"0",
",",
"senders",
"=",
"None",
",",
"wait_for_finish",
"=",
"False",
",",
"timeout",
"=",
"5",
",",
"*",
"*",
"kw",
")",
":",
"# @ReservedAssignment",
"if",
"start_ti... | Generate the report and optionally wait for results.
You can optionally add filters to the report by providing the senders
argument as a list of type Element::
report = ReportDesign('Firewall Weekly Summary')
begin = datetime_to_ms(datetime.strptime("2018-02-03T00:00:00"... | [
"Generate",
"the",
"report",
"and",
"optionally",
"wait",
"for",
"results",
".",
"You",
"can",
"optionally",
"add",
"filters",
"to",
"the",
"report",
"by",
"providing",
"the",
"senders",
"argument",
"as",
"a",
"list",
"of",
"type",
"Element",
"::",
"report",... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/reports.py#L78-L106 |
gabstopper/smc-python | smc/administration/reports.py | ReportTemplate.create_design | def create_design(self, name):
"""
Create a report design based on an existing template.
:param str name: Name of new report design
:raises CreateElementFailed: failed to create template
:rtype: ReportDesign
"""
result = self.make_request(
Cre... | python | def create_design(self, name):
"""
Create a report design based on an existing template.
:param str name: Name of new report design
:raises CreateElementFailed: failed to create template
:rtype: ReportDesign
"""
result = self.make_request(
Cre... | [
"def",
"create_design",
"(",
"self",
",",
"name",
")",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"CreateElementFailed",
",",
"resource",
"=",
"'create_design'",
",",
"raw_result",
"=",
"True",
",",
"method",
"=",
"'create'",
",",
"params",
"=",
... | Create a report design based on an existing template.
:param str name: Name of new report design
:raises CreateElementFailed: failed to create template
:rtype: ReportDesign | [
"Create",
"a",
"report",
"design",
"based",
"on",
"an",
"existing",
"template",
".",
":",
"param",
"str",
"name",
":",
"Name",
"of",
"new",
"report",
"design",
":",
"raises",
"CreateElementFailed",
":",
"failed",
"to",
"create",
"template",
":",
"rtype",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/reports.py#L139-L155 |
gabstopper/smc-python | smc/administration/reports.py | Report.export_pdf | def export_pdf(self, filename):
"""
Export the report in PDF format. Specify a path for which
to save the file, including the trailing filename.
:param str filename: path including filename
:return: None
"""
self.make_request(
raw_result=True,... | python | def export_pdf(self, filename):
"""
Export the report in PDF format. Specify a path for which
to save the file, including the trailing filename.
:param str filename: path including filename
:return: None
"""
self.make_request(
raw_result=True,... | [
"def",
"export_pdf",
"(",
"self",
",",
"filename",
")",
":",
"self",
".",
"make_request",
"(",
"raw_result",
"=",
"True",
",",
"resource",
"=",
"'export'",
",",
"filename",
"=",
"filename",
",",
"headers",
"=",
"{",
"'accept'",
":",
"'application/pdf'",
"}... | Export the report in PDF format. Specify a path for which
to save the file, including the trailing filename.
:param str filename: path including filename
:return: None | [
"Export",
"the",
"report",
"in",
"PDF",
"format",
".",
"Specify",
"a",
"path",
"for",
"which",
"to",
"save",
"the",
"file",
"including",
"the",
"trailing",
"filename",
".",
":",
"param",
"str",
"filename",
":",
"path",
"including",
"filename",
":",
"return... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/reports.py#L193-L205 |
gabstopper/smc-python | smc/administration/reports.py | Report.export_text | def export_text(self, filename=None):
"""
Export in text format. Optionally provide a filename to
save to.
:param str filename: path including filename (optional)
:return: None
"""
result = self.make_request(
resource='export',
par... | python | def export_text(self, filename=None):
"""
Export in text format. Optionally provide a filename to
save to.
:param str filename: path including filename (optional)
:return: None
"""
result = self.make_request(
resource='export',
par... | [
"def",
"export_text",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"make_request",
"(",
"resource",
"=",
"'export'",
",",
"params",
"=",
"{",
"'format'",
":",
"'txt'",
"}",
",",
"filename",
"=",
"filename",
",",
"raw... | Export in text format. Optionally provide a filename to
save to.
:param str filename: path including filename (optional)
:return: None | [
"Export",
"in",
"text",
"format",
".",
"Optionally",
"provide",
"a",
"filename",
"to",
"save",
"to",
".",
":",
"param",
"str",
"filename",
":",
"path",
"including",
"filename",
"(",
"optional",
")",
":",
"return",
":",
"None"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/administration/reports.py#L207-L223 |
gabstopper/smc-python | smc/vpn/route.py | RouteVPN.create_ipsec_tunnel | def create_ipsec_tunnel(cls, name, local_endpoint, remote_endpoint,
preshared_key=None, monitoring_group=None,
vpn_profile=None, mtu=0, pmtu_discovery=True,
ttl=0, enabled=True, comment=None):
"""
The VPN tunnel type neg... | python | def create_ipsec_tunnel(cls, name, local_endpoint, remote_endpoint,
preshared_key=None, monitoring_group=None,
vpn_profile=None, mtu=0, pmtu_discovery=True,
ttl=0, enabled=True, comment=None):
"""
The VPN tunnel type neg... | [
"def",
"create_ipsec_tunnel",
"(",
"cls",
",",
"name",
",",
"local_endpoint",
",",
"remote_endpoint",
",",
"preshared_key",
"=",
"None",
",",
"monitoring_group",
"=",
"None",
",",
"vpn_profile",
"=",
"None",
",",
"mtu",
"=",
"0",
",",
"pmtu_discovery",
"=",
... | The VPN tunnel type negotiates IPsec tunnels in the same way
as policy-based VPNs, but traffic is selected to be sent into
the tunnel based on routing.
:param str name: name of VPN
:param TunnelEndpoint local_endpoint: the local side endpoint for
this VPN.
:p... | [
"The",
"VPN",
"tunnel",
"type",
"negotiates",
"IPsec",
"tunnels",
"in",
"the",
"same",
"way",
"as",
"policy",
"-",
"based",
"VPNs",
"but",
"traffic",
"is",
"selected",
"to",
"be",
"sent",
"into",
"the",
"tunnel",
"based",
"on",
"routing",
".",
":",
"para... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L154-L202 |
gabstopper/smc-python | smc/vpn/route.py | RouteVPN.create_gre_tunnel_mode | def create_gre_tunnel_mode(cls, name, local_endpoint, remote_endpoint,
policy_vpn, mtu=0, pmtu_discovery=True, ttl=0,
enabled=True, comment=None):
"""
Create a GRE based tunnel mode route VPN. Tunnel mode GRE wraps the
GRE tunnel in an IPSEC tu... | python | def create_gre_tunnel_mode(cls, name, local_endpoint, remote_endpoint,
policy_vpn, mtu=0, pmtu_discovery=True, ttl=0,
enabled=True, comment=None):
"""
Create a GRE based tunnel mode route VPN. Tunnel mode GRE wraps the
GRE tunnel in an IPSEC tu... | [
"def",
"create_gre_tunnel_mode",
"(",
"cls",
",",
"name",
",",
"local_endpoint",
",",
"remote_endpoint",
",",
"policy_vpn",
",",
"mtu",
"=",
"0",
",",
"pmtu_discovery",
"=",
"True",
",",
"ttl",
"=",
"0",
",",
"enabled",
"=",
"True",
",",
"comment",
"=",
... | Create a GRE based tunnel mode route VPN. Tunnel mode GRE wraps the
GRE tunnel in an IPSEC tunnel to provide encrypted end-to-end
security. Therefore a policy based VPN is required to 'wrap' the
GRE into IPSEC.
:param str name: name of VPN
:param TunnelEndpoint local_en... | [
"Create",
"a",
"GRE",
"based",
"tunnel",
"mode",
"route",
"VPN",
".",
"Tunnel",
"mode",
"GRE",
"wraps",
"the",
"GRE",
"tunnel",
"in",
"an",
"IPSEC",
"tunnel",
"to",
"provide",
"encrypted",
"end",
"-",
"to",
"-",
"end",
"security",
".",
"Therefore",
"a",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L205-L249 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L252-L262 |
gabstopper/smc-python | smc/vpn/route.py | RouteVPN.set_preshared_key | def set_preshared_key(self, new_key):
"""
Set the preshared key for this VPN. A pre-shared key is only
present when the tunnel type is 'VPN' or the encryption mode
is 'transport'.
:return: None
"""
if self.data.get('preshared_key'):
self.updat... | python | def set_preshared_key(self, new_key):
"""
Set the preshared key for this VPN. A pre-shared key is only
present when the tunnel type is 'VPN' or the encryption mode
is 'transport'.
:return: None
"""
if self.data.get('preshared_key'):
self.updat... | [
"def",
"set_preshared_key",
"(",
"self",
",",
"new_key",
")",
":",
"if",
"self",
".",
"data",
".",
"get",
"(",
"'preshared_key'",
")",
":",
"self",
".",
"update",
"(",
"preshared_key",
"=",
"new_key",
")"
] | Set the preshared key for this VPN. A pre-shared key is only
present when the tunnel type is 'VPN' or the encryption mode
is 'transport'.
:return: None | [
"Set",
"the",
"preshared",
"key",
"for",
"this",
"VPN",
".",
"A",
"pre",
"-",
"shared",
"key",
"is",
"only",
"present",
"when",
"the",
"tunnel",
"type",
"is",
"VPN",
"or",
"the",
"encryption",
"mode",
"is",
"transport",
".",
":",
"return",
":",
"None"
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L332-L341 |
gabstopper/smc-python | smc/vpn/route.py | TunnelEndpoint.endpoint | def endpoint(self):
"""
Endpoint is used to specify which interface is enabled for
VPN. This is the InternalEndpoint property of the
InternalGateway.
:return: internal endpoint where VPN is enabled
:rtype: InternalEndpoint,ExternalGateway
"""
if s... | python | def endpoint(self):
"""
Endpoint is used to specify which interface is enabled for
VPN. This is the InternalEndpoint property of the
InternalGateway.
:return: internal endpoint where VPN is enabled
:rtype: InternalEndpoint,ExternalGateway
"""
if s... | [
"def",
"endpoint",
"(",
"self",
")",
":",
"if",
"self",
".",
"endpoint_ref",
"and",
"self",
".",
"tunnel_interface_ref",
":",
"return",
"InternalEndpoint",
"(",
"href",
"=",
"self",
".",
"endpoint_ref",
")",
"return",
"Element",
".",
"from_href",
"(",
"self"... | Endpoint is used to specify which interface is enabled for
VPN. This is the InternalEndpoint property of the
InternalGateway.
:return: internal endpoint where VPN is enabled
:rtype: InternalEndpoint,ExternalGateway | [
"Endpoint",
"is",
"used",
"to",
"specify",
"which",
"interface",
"is",
"enabled",
"for",
"VPN",
".",
"This",
"is",
"the",
"InternalEndpoint",
"property",
"of",
"the",
"InternalGateway",
".",
":",
"return",
":",
"internal",
"endpoint",
"where",
"VPN",
"is",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L401-L412 |
gabstopper/smc-python | smc/vpn/route.py | TunnelEndpoint.create_gre_tunnel_endpoint | def create_gre_tunnel_endpoint(cls, endpoint=None, tunnel_interface=None,
remote_address=None):
"""
Create the GRE tunnel mode or no encryption mode endpoint.
If the GRE tunnel mode endpoint is an SMC managed device,
both an endpoint and a tunnel interf... | python | def create_gre_tunnel_endpoint(cls, endpoint=None, tunnel_interface=None,
remote_address=None):
"""
Create the GRE tunnel mode or no encryption mode endpoint.
If the GRE tunnel mode endpoint is an SMC managed device,
both an endpoint and a tunnel interf... | [
"def",
"create_gre_tunnel_endpoint",
"(",
"cls",
",",
"endpoint",
"=",
"None",
",",
"tunnel_interface",
"=",
"None",
",",
"remote_address",
"=",
"None",
")",
":",
"tunnel_interface",
"=",
"tunnel_interface",
".",
"href",
"if",
"tunnel_interface",
"else",
"None",
... | Create the GRE tunnel mode or no encryption mode endpoint.
If the GRE tunnel mode endpoint is an SMC managed device,
both an endpoint and a tunnel interface is required. If the
endpoint is externally managed, only an IP address is required.
:param InternalEndpoint,ExternalEndpoi... | [
"Create",
"the",
"GRE",
"tunnel",
"mode",
"or",
"no",
"encryption",
"mode",
"endpoint",
".",
"If",
"the",
"GRE",
"tunnel",
"mode",
"endpoint",
"is",
"an",
"SMC",
"managed",
"device",
"both",
"an",
"endpoint",
"and",
"a",
"tunnel",
"interface",
"is",
"requi... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L426-L447 |
gabstopper/smc-python | smc/vpn/route.py | TunnelEndpoint.create_gre_transport_endpoint | def create_gre_transport_endpoint(cls, endpoint, tunnel_interface=None):
"""
Create the GRE transport mode endpoint. If the GRE transport mode
endpoint is an SMC managed device, both an endpoint and a tunnel
interface is required. If the GRE endpoint is an externally managed
devi... | python | def create_gre_transport_endpoint(cls, endpoint, tunnel_interface=None):
"""
Create the GRE transport mode endpoint. If the GRE transport mode
endpoint is an SMC managed device, both an endpoint and a tunnel
interface is required. If the GRE endpoint is an externally managed
devi... | [
"def",
"create_gre_transport_endpoint",
"(",
"cls",
",",
"endpoint",
",",
"tunnel_interface",
"=",
"None",
")",
":",
"tunnel_interface",
"=",
"tunnel_interface",
".",
"href",
"if",
"tunnel_interface",
"else",
"None",
"return",
"TunnelEndpoint",
"(",
"endpoint_ref",
... | Create the GRE transport mode endpoint. If the GRE transport mode
endpoint is an SMC managed device, both an endpoint and a tunnel
interface is required. If the GRE endpoint is an externally managed
device, only an endpoint is required.
:param InternalEndpoint,ExternalEndpoint e... | [
"Create",
"the",
"GRE",
"transport",
"mode",
"endpoint",
".",
"If",
"the",
"GRE",
"transport",
"mode",
"endpoint",
"is",
"an",
"SMC",
"managed",
"device",
"both",
"an",
"endpoint",
"and",
"a",
"tunnel",
"interface",
"is",
"required",
".",
"If",
"the",
"GRE... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L450-L466 |
gabstopper/smc-python | smc/vpn/route.py | TunnelEndpoint.create_ipsec_endpoint | def create_ipsec_endpoint(cls, gateway, tunnel_interface=None):
"""
Create the VPN tunnel endpoint. If the VPN tunnel endpoint
is an SMC managed device, both a gateway and a tunnel interface
is required. If the VPN endpoint is an externally managed
device, only a gateway is r... | python | def create_ipsec_endpoint(cls, gateway, tunnel_interface=None):
"""
Create the VPN tunnel endpoint. If the VPN tunnel endpoint
is an SMC managed device, both a gateway and a tunnel interface
is required. If the VPN endpoint is an externally managed
device, only a gateway is r... | [
"def",
"create_ipsec_endpoint",
"(",
"cls",
",",
"gateway",
",",
"tunnel_interface",
"=",
"None",
")",
":",
"tunnel_interface",
"=",
"tunnel_interface",
".",
"href",
"if",
"tunnel_interface",
"else",
"None",
"return",
"TunnelEndpoint",
"(",
"gateway_ref",
"=",
"ga... | Create the VPN tunnel endpoint. If the VPN tunnel endpoint
is an SMC managed device, both a gateway and a tunnel interface
is required. If the VPN endpoint is an externally managed
device, only a gateway is required.
:param InternalGateway,ExternalGateway gateway: the gateway
... | [
"Create",
"the",
"VPN",
"tunnel",
"endpoint",
".",
"If",
"the",
"VPN",
"tunnel",
"endpoint",
"is",
"an",
"SMC",
"managed",
"device",
"both",
"a",
"gateway",
"and",
"a",
"tunnel",
"interface",
"is",
"required",
".",
"If",
"the",
"VPN",
"endpoint",
"is",
"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/vpn/route.py#L469-L486 |
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",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L134-L141 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceOptions.set_primary_heartbeat | def set_primary_heartbeat(self, interface_id):
"""
Set this interface as the primary heartbeat for this engine.
This will 'unset' the current primary heartbeat and move to
specified interface_id.
Clusters and Master NGFW Engines only.
:param str,int interface_id... | python | def set_primary_heartbeat(self, interface_id):
"""
Set this interface as the primary heartbeat for this engine.
This will 'unset' the current primary heartbeat and move to
specified interface_id.
Clusters and Master NGFW Engines only.
:param str,int interface_id... | [
"def",
"set_primary_heartbeat",
"(",
"self",
",",
"interface_id",
")",
":",
"self",
".",
"interface",
".",
"set_unset",
"(",
"interface_id",
",",
"'primary_heartbeat'",
")",
"self",
".",
"_engine",
".",
"update",
"(",
")"
] | Set this interface as the primary heartbeat for this engine.
This will 'unset' the current primary heartbeat and move to
specified interface_id.
Clusters and Master NGFW Engines only.
:param str,int interface_id: interface specified for primary mgmt
:raises InterfaceNot... | [
"Set",
"this",
"interface",
"as",
"the",
"primary",
"heartbeat",
"for",
"this",
"engine",
".",
"This",
"will",
"unset",
"the",
"current",
"primary",
"heartbeat",
"and",
"move",
"to",
"specified",
"interface_id",
".",
"Clusters",
"and",
"Master",
"NGFW",
"Engin... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L143-L156 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceOptions.set_backup_heartbeat | def set_backup_heartbeat(self, interface_id):
"""
Set this interface as the backup heartbeat interface.
Clusters and Master NGFW Engines only.
:param str,int interface_id: interface as backup
:raises InterfaceNotFound: specified interface is not found
:raises Upd... | python | def set_backup_heartbeat(self, interface_id):
"""
Set this interface as the backup heartbeat interface.
Clusters and Master NGFW Engines only.
:param str,int interface_id: interface as backup
:raises InterfaceNotFound: specified interface is not found
:raises Upd... | [
"def",
"set_backup_heartbeat",
"(",
"self",
",",
"interface_id",
")",
":",
"self",
".",
"interface",
".",
"set_unset",
"(",
"interface_id",
",",
"'backup_heartbeat'",
")",
"self",
".",
"_engine",
".",
"update",
"(",
")"
] | Set this interface as the backup heartbeat interface.
Clusters and Master NGFW Engines only.
:param str,int interface_id: interface as backup
:raises InterfaceNotFound: specified interface is not found
:raises UpdateElementFailed: failure to update interface
:return: Non... | [
"Set",
"this",
"interface",
"as",
"the",
"backup",
"heartbeat",
"interface",
".",
"Clusters",
"and",
"Master",
"NGFW",
"Engines",
"only",
".",
":",
"param",
"str",
"int",
"interface_id",
":",
"interface",
"as",
"backup",
":",
"raises",
"InterfaceNotFound",
":"... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L158-L169 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceOptions.set_primary_mgt | def set_primary_mgt(self, interface_id, auth_request=None,
address=None):
"""
Specifies the Primary Control IP address for Management Server
contact. For single FW and cluster FW's, this will enable 'Outgoing',
'Auth Request' and the 'Primary Control' interface. F... | python | def set_primary_mgt(self, interface_id, auth_request=None,
address=None):
"""
Specifies the Primary Control IP address for Management Server
contact. For single FW and cluster FW's, this will enable 'Outgoing',
'Auth Request' and the 'Primary Control' interface. F... | [
"def",
"set_primary_mgt",
"(",
"self",
",",
"interface_id",
",",
"auth_request",
"=",
"None",
",",
"address",
"=",
"None",
")",
":",
"intfattr",
"=",
"[",
"'primary_mgt'",
",",
"'outgoing'",
"]",
"if",
"self",
".",
"interface",
".",
"engine",
".",
"type",
... | Specifies the Primary Control IP address for Management Server
contact. For single FW and cluster FW's, this will enable 'Outgoing',
'Auth Request' and the 'Primary Control' interface. For clusters, the
primary heartbeat will NOT follow this change and should be set
separately using :met... | [
"Specifies",
"the",
"Primary",
"Control",
"IP",
"address",
"for",
"Management",
"Server",
"contact",
".",
"For",
"single",
"FW",
"and",
"cluster",
"FW",
"s",
"this",
"will",
"enable",
"Outgoing",
"Auth",
"Request",
"and",
"the",
"Primary",
"Control",
"interfac... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L171-L227 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceOptions.set_backup_mgt | def set_backup_mgt(self, interface_id):
"""
Set this interface as a backup management interface.
Backup management interfaces cannot be placed on an interface with
only a CVI (requires node interface/s). To 'unset' the specified
interface address, set interface id to Non... | python | def set_backup_mgt(self, interface_id):
"""
Set this interface as a backup management interface.
Backup management interfaces cannot be placed on an interface with
only a CVI (requires node interface/s). To 'unset' the specified
interface address, set interface id to Non... | [
"def",
"set_backup_mgt",
"(",
"self",
",",
"interface_id",
")",
":",
"self",
".",
"interface",
".",
"set_unset",
"(",
"interface_id",
",",
"'backup_mgt'",
")",
"self",
".",
"_engine",
".",
"update",
"(",
")"
] | Set this interface as a backup management interface.
Backup management interfaces cannot be placed on an interface with
only a CVI (requires node interface/s). To 'unset' the specified
interface address, set interface id to None
::
engine.interface_options.s... | [
"Set",
"this",
"interface",
"as",
"a",
"backup",
"management",
"interface",
".",
"Backup",
"management",
"interfaces",
"cannot",
"be",
"placed",
"on",
"an",
"interface",
"with",
"only",
"a",
"CVI",
"(",
"requires",
"node",
"interface",
"/",
"s",
")",
".",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L229-L255 |
gabstopper/smc-python | smc/core/interfaces.py | InterfaceOptions.set_outgoing | def set_outgoing(self, interface_id):
"""
Specifies the IP address that the engine uses to initiate connections
(such as for system communications and ping) through an interface
that has no Node Dedicated IP Address. In clusters, you must select
an interface that has an IP addres... | python | def set_outgoing(self, interface_id):
"""
Specifies the IP address that the engine uses to initiate connections
(such as for system communications and ping) through an interface
that has no Node Dedicated IP Address. In clusters, you must select
an interface that has an IP addres... | [
"def",
"set_outgoing",
"(",
"self",
",",
"interface_id",
")",
":",
"self",
".",
"interface",
".",
"set_unset",
"(",
"interface_id",
",",
"'outgoing'",
")",
"self",
".",
"_engine",
".",
"update",
"(",
")"
] | Specifies the IP address that the engine uses to initiate connections
(such as for system communications and ping) through an interface
that has no Node Dedicated IP Address. In clusters, you must select
an interface that has an IP address defined for all nodes.
Setting primary_mgt also ... | [
"Specifies",
"the",
"IP",
"address",
"that",
"the",
"engine",
"uses",
"to",
"initiate",
"connections",
"(",
"such",
"as",
"for",
"system",
"communications",
"and",
"ping",
")",
"through",
"an",
"interface",
"that",
"has",
"no",
"Node",
"Dedicated",
"IP",
"Ad... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L257-L272 |
gabstopper/smc-python | smc/core/interfaces.py | QoS.dscp_marking_and_throttling | def dscp_marking_and_throttling(self, qos_policy):
"""
Enable DSCP marking and throttling on the interface. This requires that
you provide a QoS policy to which identifies DSCP tags and how to prioritize
that traffic.
:param QoSPolicy qos_policy: the qos policy to apply ... | python | def dscp_marking_and_throttling(self, qos_policy):
"""
Enable DSCP marking and throttling on the interface. This requires that
you provide a QoS policy to which identifies DSCP tags and how to prioritize
that traffic.
:param QoSPolicy qos_policy: the qos policy to apply ... | [
"def",
"dscp_marking_and_throttling",
"(",
"self",
",",
"qos_policy",
")",
":",
"self",
".",
"_interface",
".",
"data",
".",
"update",
"(",
"qos_limit",
"=",
"-",
"1",
",",
"qos_mode",
"=",
"'dscp'",
",",
"qos_policy_ref",
"=",
"qos_policy",
".",
"href",
"... | Enable DSCP marking and throttling on the interface. This requires that
you provide a QoS policy to which identifies DSCP tags and how to prioritize
that traffic.
:param QoSPolicy qos_policy: the qos policy to apply to the interface | [
"Enable",
"DSCP",
"marking",
"and",
"throttling",
"on",
"the",
"interface",
".",
"This",
"requires",
"that",
"you",
"provide",
"a",
"QoS",
"policy",
"to",
"which",
"identifies",
"DSCP",
"tags",
"and",
"how",
"to",
"prioritize",
"that",
"traffic",
".",
":",
... | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L369-L379 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.delete | def delete(self):
"""
Override delete in parent class, this will also delete
the routing configuration referencing this interface.
::
engine = Engine('vm')
interface = engine.interface.get(2)
interface.delete()
"""
super(Interface, sel... | python | def delete(self):
"""
Override delete in parent class, this will also delete
the routing configuration referencing this interface.
::
engine = Engine('vm')
interface = engine.interface.get(2)
interface.delete()
"""
super(Interface, sel... | [
"def",
"delete",
"(",
"self",
")",
":",
"super",
"(",
"Interface",
",",
"self",
")",
".",
"delete",
"(",
")",
"for",
"route",
"in",
"self",
".",
"_engine",
".",
"routing",
":",
"if",
"route",
".",
"to_delete",
":",
"route",
".",
"delete",
"(",
")",... | Override delete in parent class, this will also delete
the routing configuration referencing this interface.
::
engine = Engine('vm')
interface = engine.interface.get(2)
interface.delete() | [
"Override",
"delete",
"in",
"parent",
"class",
"this",
"will",
"also",
"delete",
"the",
"routing",
"configuration",
"referencing",
"this",
"interface",
".",
"::"
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L392-L406 |
gabstopper/smc-python | smc/core/interfaces.py | Interface.update | def update(self, *args, **kw):
"""
Update/save this interface information back to SMC. When interface
changes are made, especially to sub interfaces, call `update` on
the top level interface.
Example of changing the IP address of an interface::
>>> engine = Engine('... | python | def update(self, *args, **kw):
"""
Update/save this interface information back to SMC. When interface
changes are made, especially to sub interfaces, call `update` on
the top level interface.
Example of changing the IP address of an interface::
>>> engine = Engine('... | [
"def",
"update",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"super",
"(",
"Interface",
",",
"self",
")",
".",
"update",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
"self",
".",
"_engine",
".",
"_del_cache",
"(",
")",
"return"... | Update/save this interface information back to SMC. When interface
changes are made, especially to sub interfaces, call `update` on
the top level interface.
Example of changing the IP address of an interface::
>>> engine = Engine('sg_vm')
>>> interface = engine.physical... | [
"Update",
"/",
"save",
"this",
"interface",
"information",
"back",
"to",
"SMC",
".",
"When",
"interface",
"changes",
"are",
"made",
"especially",
"to",
"sub",
"interfaces",
"call",
"update",
"on",
"the",
"top",
"level",
"interface",
"."
] | train | https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/interfaces.py#L408-L426 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.