sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def element_attribute_by_href(href, attr_name): """ The element href is known and you want to retrieve a specific attribute from that element. For example, if you want a specific attribute by it's name:: search.element_attribute_by_href(href_to_resource, 'name') :param str href: href of e...
The element href is known and you want to retrieve a specific attribute from that element. For example, if you want a specific attribute by it's name:: search.element_attribute_by_href(href_to_resource, 'name') :param str href: href of element :param str attr_name: name of attribute :retu...
entailment
def element_by_href_as_smcresult(href, params=None): """ Get specified element returned as an SMCResult object :param href: href direct link to object :return: :py:class:`smc.api.web.SMCResult` with etag, href and element field holding json, else None """ if href: element = fet...
Get specified element returned as an SMCResult object :param href: href direct link to object :return: :py:class:`smc.api.web.SMCResult` with etag, href and element field holding json, else None
entailment
def element_as_smcresult_use_filter(name, _filter): """ Return SMCResult object and use search filter to find object :param name: name of element to find :param _filter: filter to use, i.e. tcp_service, host, etc :return: :py:class:`smc.api.web.SMCResult` """ if name: element = fetc...
Return SMCResult object and use search filter to find object :param name: name of element to find :param _filter: filter to use, i.e. tcp_service, host, etc :return: :py:class:`smc.api.web.SMCResult`
entailment
def element_href_by_batch(list_to_find, filter=None): # @ReservedAssignment """ Find batch of entries by name. Reduces number of find calls from calling class. :param list list_to_find: list of names to find :param filter: optional filter, i.e. 'tcp_service', 'host', etc :return: list: {name: href...
Find batch of entries by name. Reduces number of find calls from calling class. :param list list_to_find: list of names to find :param filter: optional filter, i.e. 'tcp_service', 'host', etc :return: list: {name: href, name: href}, href may be None if not found
entailment
def all_elements_by_type(name): """ Get specified elements based on the entry point verb from SMC api To get the entry points available, you can get these from the session:: session.cache.entry_points Execution will get the entry point for the element type, then get all elements that match. ...
Get specified elements based on the entry point verb from SMC api To get the entry points available, you can get these from the session:: session.cache.entry_points Execution will get the entry point for the element type, then get all elements that match. For example:: search.all_ele...
entailment
def fetch_json_by_name(name): """ Fetch json based on the element name First gets the href based on a search by name, then makes a second query to obtain the element json :method: GET :param str name: element name :return: :py:class:`smc.api.web.SMCResult` """ result = fetch_meta_by...
Fetch json based on the element name First gets the href based on a search by name, then makes a second query to obtain the element json :method: GET :param str name: element name :return: :py:class:`smc.api.web.SMCResult`
entailment
def fetch_json_by_href(href, params=None): """ Fetch json for element by using href. Params should be key/value pairs. For example {'filter': 'myfilter'} :method: GET :param str href: href of the element :params dict params: optional search query parameters :return: :py:class:`smc.api.web.S...
Fetch json for element by using href. Params should be key/value pairs. For example {'filter': 'myfilter'} :method: GET :param str href: href of the element :params dict params: optional search query parameters :return: :py:class:`smc.api.web.SMCResult`
entailment
def create(cls, name, negotiation_expiration=200000, negotiation_retry_timer=500, negotiation_retry_max_number=32, negotiation_retry_timer_max=7000, certificate_cache_crl_validity=90000, mobike_after_sa_update=False, mobike_before...
Create a new gateway setting profile. :param str name: name of profile :param int negotiation_expiration: expire after (ms) :param int negotiation_retry_timer: retry time length (ms) :param int negotiation_retry_max_num: max number of retries allowed :param int negotiation_retry...
entailment
def create(cls, name, trust_all_cas=True): """ Create new External Gateway :param str name: name of test_external gateway :param bool trust_all_cas: whether to trust all internal CA's (default: True) :return: instance with meta :rtype: ExternalGateway ...
Create new External Gateway :param str name: name of test_external gateway :param bool trust_all_cas: whether to trust all internal CA's (default: True) :return: instance with meta :rtype: ExternalGateway
entailment
def update_or_create(cls, name, external_endpoint=None, vpn_site=None, trust_all_cas=True, with_status=False): """ Update or create an ExternalGateway. The ``external_endpoint`` and ``vpn_site`` parameters are expected to be a list of dicts with key/value pairs to satisfy the res...
Update or create an ExternalGateway. The ``external_endpoint`` and ``vpn_site`` parameters are expected to be a list of dicts with key/value pairs to satisfy the respective elements create constructor. VPN Sites will represent the final state of the VPN site list. ExternalEndpoint that are ...
entailment
def create(self, name, address=None, enabled=True, balancing_mode='active', ipsec_vpn=True, nat_t=False, force_nat_t=False, dynamic=False, ike_phase1_id_type=None, ike_phase1_id_value=None): """ Create an test_external endpoint. Define common settings for that speci...
Create an test_external endpoint. Define common settings for that specify the address, enabled, nat_t, name, etc. You can also omit the IP address if the endpoint is dynamic. In that case, you must also specify the ike_phase1 settings. :param str name: name of test_external endpoint ...
entailment
def update_or_create(cls, external_gateway, name, with_status=False, **kw): """ Update or create external endpoints for the specified external gateway. An ExternalEndpoint is considered unique based on the IP address for the endpoint (you cannot add two external endpoints with the same I...
Update or create external endpoints for the specified external gateway. An ExternalEndpoint is considered unique based on the IP address for the endpoint (you cannot add two external endpoints with the same IP). If the external endpoint is dynamic, then the name is the unique identifier. ...
entailment
def enable_disable(self): """ Enable or disable this endpoint. If enabled, it will be disabled and vice versa. :return: None """ if self.enabled: self.data['enabled'] = False else: self.data['enabled'] = True self.update()
Enable or disable this endpoint. If enabled, it will be disabled and vice versa. :return: None
entailment
def enable_disable_force_nat_t(self): """ Enable or disable NAT-T on this endpoint. If enabled, it will be disabled and vice versa. :return: None """ if self.force_nat_t: self.data['force_nat_t'] = False else: self.data['force_nat_t'] = Tr...
Enable or disable NAT-T on this endpoint. If enabled, it will be disabled and vice versa. :return: None
entailment
def create(self, name, site_element): """ Create a VPN site for an internal or external gateway :param str name: name of site :param list site_element: list of protected networks/hosts :type site_element: list[str,Element] :raises CreateElementFailed: create element fail...
Create a VPN site for an internal or external gateway :param str name: name of site :param list site_element: list of protected networks/hosts :type site_element: list[str,Element] :raises CreateElementFailed: create element failed with reason :return: href of new element ...
entailment
def update_or_create(cls, external_gateway, name, site_element=None, with_status=False): """ Update or create a VPN Site elements or modify an existing VPN site based on value of provided site_element list. The resultant VPN site end result will be what is provided in the sit...
Update or create a VPN Site elements or modify an existing VPN site based on value of provided site_element list. The resultant VPN site end result will be what is provided in the site_element argument (can also be an empty list to clear existing). :param ExternalGateway externa...
entailment
def add_site_element(self, element): """ Add a site element or list of elements to this VPN. :param list element: list of Elements or href's of vpn site elements :type element: list(str,Network) :raises UpdateElementFailed: fails due to reason :return: None ...
Add a site element or list of elements to this VPN. :param list element: list of Elements or href's of vpn site elements :type element: list(str,Network) :raises UpdateElementFailed: fails due to reason :return: None
entailment
def location_helper(name, search_only=False): """ Location finder by name. If location doesn't exist, create it and return the href :param str,Element name: location to resolve. If the location is by name, it will be retrieved or created, if href, returned and if Location, href returned...
Location finder by name. If location doesn't exist, create it and return the href :param str,Element name: location to resolve. If the location is by name, it will be retrieved or created, if href, returned and if Location, href returned. If None, settings an elements location to None w...
entailment
def zone_helper(zone): """ Zone finder by name. If zone doesn't exist, create it and return the href :param str zone: name of zone (if href, will be returned as is) :return str href: href of zone """ if zone is None: return None elif isinstance(zone, Zone): return zone.h...
Zone finder by name. If zone doesn't exist, create it and return the href :param str zone: name of zone (if href, will be returned as is) :return str href: href of zone
entailment
def logical_intf_helper(interface): """ Logical Interface finder by name. Create if it doesn't exist. This is useful when adding logical interfaces to for inline or capture interfaces. :param interface: logical interface name :return str href: href of logical interface """ if interface ...
Logical Interface finder by name. Create if it doesn't exist. This is useful when adding logical interfaces to for inline or capture interfaces. :param interface: logical interface name :return str href: href of logical interface
entailment
def change_password(self, password): """ Change user password. Change is committed immediately. :param str password: new password :return: None """ self.make_request( ModificationFailed, method='update', resource='change_password', ...
Change user password. Change is committed immediately. :param str password: new password :return: None
entailment
def add_permission(self, permission): """ Add a permission to this Admin User. A role defines permissions that can be enabled or disabled. Elements define the target for permission operations and can be either Access Control Lists, Engines or Policy elements. Domain specifies whe...
Add a permission to this Admin User. A role defines permissions that can be enabled or disabled. Elements define the target for permission operations and can be either Access Control Lists, Engines or Policy elements. Domain specifies where the access is granted. The Shared Domain is def...
entailment
def permissions(self): """ Return each permission role mapping for this Admin User. A permission role will have 3 fields: * Domain * Role (Viewer, Operator, etc) * Elements (Engines, Policies, or ACLs) :return: permissions as list :rtype:...
Return each permission role mapping for this Admin User. A permission role will have 3 fields: * Domain * Role (Viewer, Operator, etc) * Elements (Engines, Policies, or ACLs) :return: permissions as list :rtype: list(Permission)
entailment
def create(cls, name, local_admin=False, allow_sudo=False, superuser=False, enabled=True, engine_target=None, can_use_api=True, console_superuser=False, allowed_to_login_in_shared=True, comment=None): """ Create an admin user account. .. vers...
Create an admin user account. .. versionadded:: 0.6.2 Added can_use_api, console_superuser, and allowed_to_login_in_shared. Requires SMC >= SMC 6.4 :param str name: name of account :param bool local_admin: is a local admin only :param bool allow_sudo: al...
entailment
def change_engine_password(self, password): """ Change Engine password for engines on allowed list. :param str password: password for engine level :raises ModificationFailed: failed setting password on engine :return: None """ self.make_request( Modif...
Change Engine password for engines on allowed list. :param str password: password for engine level :raises ModificationFailed: failed setting password on engine :return: None
entailment
def create(cls, name, enabled=True, superuser=True): """ Create a new API Client. Once client is created, you can create a new password by:: >>> client = ApiClient.create('myclient') >>> print(client) ApiClient(name=myclient) >>> client.change_pas...
Create a new API Client. Once client is created, you can create a new password by:: >>> client = ApiClient.create('myclient') >>> print(client) ApiClient(name=myclient) >>> client.change_password('mynewpassword') :param str name: name of client :...
entailment
def _create(cls, name, node_type, physical_interfaces, nodes=1, loopback_ndi=None, log_server_ref=None, domain_server_address=None, enable_antivirus=False, enable_gti=False, sidewinder_proxy_enabled=False, de...
Create will return the engine configuration as a dict that is a representation of the engine. The creating class will also add engine specific requirements before constructing the request and sending to SMC (which will serialize the dict to json). :param name: name of engine :pa...
entailment
def rename(self, name): """ Rename the firewall engine, nodes, and internal gateway (VPN gw) :return: None """ for node in self.nodes: node.rename(name) self.update(name=name) self.vpn.rename(name)
Rename the firewall engine, nodes, and internal gateway (VPN gw) :return: None
entailment
def location(self): """ The location for this engine. May be None if no specific location has been assigned. :param value: location to assign engine. Can be name, str href, or Location element. If name, it will be automatically created if a Location with the same...
The location for this engine. May be None if no specific location has been assigned. :param value: location to assign engine. Can be name, str href, or Location element. If name, it will be automatically created if a Location with the same name doesn't exist. :raises Upd...
entailment
def nodes(self): """ Return a list of child nodes of this engine. This can be used to iterate to obtain access to node level operations :: >>> print(list(engine.nodes)) [Node(name=myfirewall node 1)] >>> engine.nodes.get(0) Node(na...
Return a list of child nodes of this engine. This can be used to iterate to obtain access to node level operations :: >>> print(list(engine.nodes)) [Node(name=myfirewall node 1)] >>> engine.nodes.get(0) Node(name=myfirewall node 1) ...
entailment
def permissions(self): """ Retrieve the permissions for this engine instance. :: >>> from smc.core.engine import Engine >>> engine = Engine('myfirewall') >>> for x in engine.permissions: ... print(x) ... AccessControlLis...
Retrieve the permissions for this engine instance. :: >>> from smc.core.engine import Engine >>> engine = Engine('myfirewall') >>> for x in engine.permissions: ... print(x) ... AccessControlList(name=ALL Elements) AccessCont...
entailment
def pending_changes(self): """ Pending changes provides insight into changes on an engine that are pending approval or disapproval. Feature requires SMC >= v6.2. :raises UnsupportedEngineFeature: SMC version >= 6.2 is required to support pending changes :rtype: Pendi...
Pending changes provides insight into changes on an engine that are pending approval or disapproval. Feature requires SMC >= v6.2. :raises UnsupportedEngineFeature: SMC version >= 6.2 is required to support pending changes :rtype: PendingChanges
entailment
def alias_resolving(self): """ Alias definitions with resolved values as defined on this engine. Aliases can be used in rules to simplify multiple object creation :: fw = Engine('myfirewall') for alias in fw.alias_resolving(): print(alias, alias.r...
Alias definitions with resolved values as defined on this engine. Aliases can be used in rules to simplify multiple object creation :: fw = Engine('myfirewall') for alias in fw.alias_resolving(): print(alias, alias.resolved_value) ... (Ali...
entailment
def blacklist_bulk(self, blacklist): """ Add blacklist entries to the engine node in bulk. For blacklist to work, you must also create a rule with action "Apply Blacklist". First create your blacklist entries using :class:`smc.elements.other.Blacklist` then provide the blacklist ...
Add blacklist entries to the engine node in bulk. For blacklist to work, you must also create a rule with action "Apply Blacklist". First create your blacklist entries using :class:`smc.elements.other.Blacklist` then provide the blacklist to this method. :param blacklist Blackli...
entailment
def blacklist_show(self, **kw): """ .. versionadded:: 0.5.6 Requires pip install smc-python-monitoring Blacklist show requires that you install the smc-python-monitoring package. To obtain blacklist entries from the engine you need to use this extension to pl...
.. versionadded:: 0.5.6 Requires pip install smc-python-monitoring Blacklist show requires that you install the smc-python-monitoring package. To obtain blacklist entries from the engine you need to use this extension to plumb the websocket to the session. If you nee...
entailment
def add_route(self, gateway, network): """ Add a route to engine. Specify gateway and network. If this is the default gateway, use a network address of 0.0.0.0/0. .. note: This will fail if the gateway provided does not have a corresponding interface on the netw...
Add a route to engine. Specify gateway and network. If this is the default gateway, use a network address of 0.0.0.0/0. .. note: This will fail if the gateway provided does not have a corresponding interface on the network. :param str gateway: gateway of an existing in...
entailment
def routing_monitoring(self): """ Return route table for the engine, including gateway, networks and type of route (dynamic, static). Calling this can take a few seconds to retrieve routes from the engine. Find all routes for engine resource:: >>> engine = E...
Return route table for the engine, including gateway, networks and type of route (dynamic, static). Calling this can take a few seconds to retrieve routes from the engine. Find all routes for engine resource:: >>> engine = Engine('sg_vm') >>> for route in engine...
entailment
def virtual_resource(self): """ Available on a Master Engine only. To get all virtual resources call:: engine.virtual_resource.all() :raises UnsupportedEngineFeature: master engine only :rtype: CreateCollection(VirtualResource) """ resource = create...
Available on a Master Engine only. To get all virtual resources call:: engine.virtual_resource.all() :raises UnsupportedEngineFeature: master engine only :rtype: CreateCollection(VirtualResource)
entailment
def add_interface(self, interface): """ Add interface is a lower level option to adding interfaces directly to the engine. The interface is expected to be an instance of Layer3PhysicalInterface, Layer2PhysicalInterface, TunnelInterface, or ClusterInterface. The engines instance c...
Add interface is a lower level option to adding interfaces directly to the engine. The interface is expected to be an instance of Layer3PhysicalInterface, Layer2PhysicalInterface, TunnelInterface, or ClusterInterface. The engines instance cache is flushed after this call is made to provi...
entailment
def refresh(self, timeout=3, wait_for_finish=False, **kw): """ Refresh existing policy on specified device. This is an asynchronous call that will return a 'follower' link that can be queried to determine the status of the task. :: poller = engine.refresh() ...
Refresh existing policy on specified device. This is an asynchronous call that will return a 'follower' link that can be queried to determine the status of the task. :: poller = engine.refresh() while not poller.done(): poller.wait(5) prin...
entailment
def generate_snapshot(self, filename='snapshot.zip'): """ Generate and retrieve a policy snapshot from the engine This is blocking as file is downloaded :param str filename: name of file to save file to, including directory path :raises EngineCommandFailed: snapshot ...
Generate and retrieve a policy snapshot from the engine This is blocking as file is downloaded :param str filename: name of file to save file to, including directory path :raises EngineCommandFailed: snapshot failed, possibly invalid filename specified :return: N...
entailment
def add_site(self, name, site_elements=None): """ Add a VPN site with site elements to this engine. VPN sites identify the sites with protected networks to be included in the VPN. Add a network and new VPN site:: >>> net = Network.get_or_create(name='wireless...
Add a VPN site with site elements to this engine. VPN sites identify the sites with protected networks to be included in the VPN. Add a network and new VPN site:: >>> net = Network.get_or_create(name='wireless', ipv4_network='192.168.5.0/24') >>> engine.vpn.add_s...
entailment
def generate_certificate(self, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=2048, signing_ca=None): """ Generate an internal gateway certificate used for VPN on this engine. Certificate request should be an instance of VPNCertific...
Generate an internal gateway certificate used for VPN on this engine. Certificate request should be an instance of VPNCertificate. :param: str common_name: common name for certificate :param str public_key_algorithm: public key type to use. Valid values rsa, dsa, ecdsa. :par...
entailment
def create(self, name, vfw_id, domain='Shared Domain', show_master_nic=False, connection_limit=0, comment=None): """ Create a new virtual resource. Called through engine reference:: engine.virtual_resource.create(....) :param str name: name of virtual resourc...
Create a new virtual resource. Called through engine reference:: engine.virtual_resource.create(....) :param str name: name of virtual resource :param int vfw_id: virtual fw identifier :param str domain: name of domain to install, (default Shared) :param bool show_m...
entailment
def enable(self, snmp_agent, snmp_location=None, snmp_interface=None): """ Enable SNMP on the engine. Specify a list of interfaces by ID to enable only on those interfaces. Only interfaces that have NDI's are supported. :param str,Element snmp_agent: the SNMP agent refer...
Enable SNMP on the engine. Specify a list of interfaces by ID to enable only on those interfaces. Only interfaces that have NDI's are supported. :param str,Element snmp_agent: the SNMP agent reference for this engine :param str snmp_location: the SNMP location identifier for the...
entailment
def update_configuration(self, **kwargs): """ Update the SNMP configuration using any kwargs supported in the `enable` constructor. Return whether a change was made. You must call update on the engine to commit any changes. :param dict kwargs: keyword arguments supported...
Update the SNMP configuration using any kwargs supported in the `enable` constructor. Return whether a change was made. You must call update on the engine to commit any changes. :param dict kwargs: keyword arguments supported by enable constructor :rtype: bool
entailment
def interface(self): """ Return a list of physical interfaces that the SNMP agent is bound to. :rtype: list(PhysicalInterface) """ nics = set([nic.get('nicid') for nic in \ getattr(self.engine, 'snmp_interface', [])]) return [self.engine.inter...
Return a list of physical interfaces that the SNMP agent is bound to. :rtype: list(PhysicalInterface)
entailment
def enable(self, interface_id, dns_relay_profile=None): """ Enable the DNS Relay service on this engine. :param int interface_id: interface id to enable relay :param str,DNSRelayProfile dns_relay_profile: DNSRelayProfile element or str href :raises EngineCommandFaile...
Enable the DNS Relay service on this engine. :param int interface_id: interface id to enable relay :param str,DNSRelayProfile dns_relay_profile: DNSRelayProfile element or str href :raises EngineCommandFailed: interface not found :raises ElementNotFound: profile not found ...
entailment
def disable(self): """ Disable DNS Relay on this engine :return: None """ self.engine.data.update(dns_relay_interface=[]) self.engine.data.pop('dns_relay_profile_ref', None)
Disable DNS Relay on this engine :return: None
entailment
def remove(self, values): """ Remove DNS entries from this ranked DNS list. A DNS entry can be either a raw IP Address, or an element of type :class:`smc.elements.network.Host` or :class:`smc.elements.servers.DNSServer`. :param list values: list of IP addresses, Host and...
Remove DNS entries from this ranked DNS list. A DNS entry can be either a raw IP Address, or an element of type :class:`smc.elements.network.Host` or :class:`smc.elements.servers.DNSServer`. :param list values: list of IP addresses, Host and/or DNSServer elements. :return: None
entailment
def enable(self, policy): """ Set a layer 2 interface policy. :param str,Element policy: an InterfacePolicy or str href :raises LoadPolicyFailed: Invalid policy specified :raises ElementNotFound: InterfacePolicy not found :return: None """ if hasa...
Set a layer 2 interface policy. :param str,Element policy: an InterfacePolicy or str href :raises LoadPolicyFailed: Invalid policy specified :raises ElementNotFound: InterfacePolicy not found :return: None
entailment
def create(cls, name, template='High-Security IPS Template'): """ Create an IPS Policy :param str name: Name of policy :param str template: name of template :raises CreatePolicyFailed: policy failed to create :return: IPSPolicy """ try: if cls...
Create an IPS Policy :param str name: Name of policy :param str template: name of template :raises CreatePolicyFailed: policy failed to create :return: IPSPolicy
entailment
def get(self, *args, **kwargs): """ Get an element from the iterable by an arg or kwarg. Args can be a single positional argument that is an index value to retrieve. If the specified index is out of range, None is returned. Otherwise use kwargs to provide a key/value. Th...
Get an element from the iterable by an arg or kwarg. Args can be a single positional argument that is an index value to retrieve. If the specified index is out of range, None is returned. Otherwise use kwargs to provide a key/value. The key is expected to be a valid attribute of the ite...
entailment
def upload_as_zip(name, filename): """ Upload an IPList as a zip file. Useful when IPList is very large. This is the default upload format for IPLists. :param str name: name of IPList :param str filename: name of zip file to upload, full path :return: None """ location = list(IPList.obj...
Upload an IPList as a zip file. Useful when IPList is very large. This is the default upload format for IPLists. :param str name: name of IPList :param str filename: name of zip file to upload, full path :return: None
entailment
def upload_as_text(name, filename): """ Upload the IPList as text from a file. :param str name: name of IPList :param str filename: name of text file to upload :return: None """ location = list(IPList.objects.filter(name)) if location: iplist = location[0] return iplist...
Upload the IPList as text from a file. :param str name: name of IPList :param str filename: name of text file to upload :return: None
entailment
def upload_as_json(name, mylist): """ Upload the IPList as json payload. :param str name: name of IPList :param list: list of IPList entries :return: None """ location = list(IPList.objects.filter(name)) if location: iplist = location[0] return iplist.upload(json=mylist...
Upload the IPList as json payload. :param str name: name of IPList :param list: list of IPList entries :return: None
entailment
def download_as_zip(name, filename): """ Download IPList with zip compression. Recommended for IPLists of larger sizes. This is the default format for downloading IPLists. :param str name: name of IPList :param str filename: name of filename for IPList """ location = list(IPList.objects...
Download IPList with zip compression. Recommended for IPLists of larger sizes. This is the default format for downloading IPLists. :param str name: name of IPList :param str filename: name of filename for IPList
entailment
def download_as_text(name, filename): """ Download IPList as text to specified filename. :param str name: name of IPList :param str filename: name of file for IPList download """ location = list(IPList.objects.filter(name)) if location: iplist = location[0] return iplist.dow...
Download IPList as text to specified filename. :param str name: name of IPList :param str filename: name of file for IPList download
entailment
def download_as_json(name): """ Download IPList as json. This would allow for easily manipulation of the IPList, but generally recommended only for smaller lists :param str name: name of IPList :return: None """ location = list(IPList.objects.filter(name)) if location: ipli...
Download IPList as json. This would allow for easily manipulation of the IPList, but generally recommended only for smaller lists :param str name: name of IPList :return: None
entailment
def create_iplist_with_data(name, iplist): """ Create an IPList with initial list contents. :param str name: name of IPList :param list iplist: list of IPList IP's, networks, etc :return: href of list location """ iplist = IPList.create(name=name, iplist=iplist) return iplist
Create an IPList with initial list contents. :param str name: name of IPList :param list iplist: list of IPList IP's, networks, etc :return: href of list location
entailment
def enable(self, ospf_profile=None, router_id=None): """ Enable OSPF on this engine. For master engines, enable OSPF on the virtual firewall. Once enabled on the engine, add an OSPF area to an interface:: engine.dynamic_routing.ospf.enable() interface = engine.r...
Enable OSPF on this engine. For master engines, enable OSPF on the virtual firewall. Once enabled on the engine, add an OSPF area to an interface:: engine.dynamic_routing.ospf.enable() interface = engine.routing.get(0) interface.add_ospf_area(OSPFArea('myarea')) ...
entailment
def update_configuration(self, **kwargs): """ Update the OSPF configuration using kwargs that match the `enable` constructor. :param dict kwargs: keyword arguments matching enable constructor. :return: whether change was made :rtype: bool """ upda...
Update the OSPF configuration using kwargs that match the `enable` constructor. :param dict kwargs: keyword arguments matching enable constructor. :return: whether change was made :rtype: bool
entailment
def create(cls, name, interface_settings_ref=None, area_id=1, area_type='normal', outbound_filters=None, inbound_filters=None, shortcut_capable_area=False, ospfv2_virtual_links_endpoints_container=None, ospf_abr_substitute_container=None, comment=None, **kwarg...
Create a new OSPF Area :param str name: name of OSPFArea configuration :param str,OSPFInterfaceSetting interface_settings_ref: an OSPFInterfaceSetting element or href. If None, uses the default system profile :param str name: area id :param str area_type: \|normal\|stub\|not...
entailment
def create(cls, name, dead_interval=40, hello_interval=10, hello_interval_type='normal', dead_multiplier=1, mtu_mismatch_detection=True, retransmit_interval=5, router_priority=1, transmit_delay=1, authentication_type=None, password=None, key_cha...
Create custom OSPF interface settings profile :param str name: name of interface settings :param int dead_interval: in seconds :param str hello_interval: in seconds :param str hello_interval_type: \|normal\|fast_hello :param int dead_multipler: fast hello packet multipler ...
entailment
def create(cls, name, key_chain_entry): """ Create a key chain with list of keys Key_chain_entry format is:: [{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}] :param str name: Name of key chain :param list key_chain_entry: list of key chain entries ...
Create a key chain with list of keys Key_chain_entry format is:: [{'key': 'xxxx', 'key_id': 1-255, 'send_key': True|False}] :param str name: Name of key chain :param list key_chain_entry: list of key chain entries :raises CreateElementFailed: create failed with reason ...
entailment
def create(cls, name, domain_settings_ref=None, external_distance=110, inter_distance=110, intra_distance=110, redistribution_entry=None, default_metric=None, comment=None): """ Create an OSPF Profile. If providing a list of redistribution entries, provide ...
Create an OSPF Profile. If providing a list of redistribution entries, provide in the following dict format: {'enabled': boolean, 'metric_type': 'external_1' or 'external_2', 'metric': 2, 'type': 'kernel'} Valid types for redistribution entries are: k...
entailment
def create(cls, name, abr_type='cisco', auto_cost_bandwidth=100, deprecated_algorithm=False, initial_delay=200, initial_hold_time=1000, max_hold_time=10000, shutdown_max_metric_lsa=0, startup_max_metric_lsa=0): """ Create custom Domain Settings Domai...
Create custom Domain Settings Domain settings are referenced by an OSPFProfile :param str name: name of custom domain settings :param str abr_type: cisco|shortcut|standard :param int auto_cost_bandwidth: Mbits/s :param bool deprecated_algorithm: RFC 1518 compatibility :...
entailment
def create_hook(function): """ Provide a pre-filter to the create function that provides the ability to modify the element json before submitting to the SMC. To register a create hook, set on the class or top level Element class to enable this on any descendent of Element:: Element._cre...
Provide a pre-filter to the create function that provides the ability to modify the element json before submitting to the SMC. To register a create hook, set on the class or top level Element class to enable this on any descendent of Element:: Element._create_hook = classmethod(myhook) ...
entailment
def exception(function): """ If exception was specified for prepared_request, inject this into SMCRequest so it can be used for return if needed. """ @functools.wraps(function) def wrapper(*exception, **kwargs): result = function(**kwargs) if exception: result.exc...
If exception was specified for prepared_request, inject this into SMCRequest so it can be used for return if needed.
entailment
def add_snmp(data, interfaces): """ Format data for adding SNMP to an engine. :param list data: list of interfaces as provided by kw :param list interfaces: interfaces to enable SNMP by id """ snmp_interface = [] if interfaces: # Not providing interfaces will enable SNMP on all NDIs ...
Format data for adding SNMP to an engine. :param list data: list of interfaces as provided by kw :param list interfaces: interfaces to enable SNMP by id
entailment
def create_bulk(cls, name, interfaces=None, primary_mgt=None, backup_mgt=None, log_server_ref=None, domain_server_address=None, location_ref=None, default_nat=False, enable_antivirus=False, enable_gti=False, ...
Create a Layer 3 Firewall providing all of the interface configuration. This method provides a way to fully create the engine and all interfaces at once versus using :py:meth:`~create` and creating each individual interface after the engine exists. Example interfaces format:: ...
entailment
def create(cls, name, mgmt_ip, mgmt_network, mgmt_interface=0, log_server_ref=None, default_nat=False, reverse_connection=False, domain_server_address=None, zone_ref=None, enable_antivirus=False, enable_gti=False, l...
Create a single layer 3 firewall with management interface and DNS. Provide the `interfaces` keyword argument if adding multiple additional interfaces. Interfaces can be one of any valid interface for a layer 3 firewall. Unless the interface type is specified, physical_interface is assumed. ...
entailment
def create_dynamic(cls, name, interface_id, dynamic_index=1, reverse_connection=True, automatic_default_route=True, domain_server_address=None, loopback_ndi='127.0.0.1', location_ref...
Create a single layer 3 firewall with only a single DHCP interface. Useful when creating virtualized FW's such as in Microsoft Azure. :param str name: name of engine :param str,int interface_id: interface ID used for dynamic interface and management :param bool reverse_connectio...
entailment
def create(cls, name, mgmt_ip, mgmt_network, mgmt_interface=0, inline_interface='1-2', logical_interface='default_eth', log_server_ref=None, domain_server_address=None, zone_ref=None, enable_antivirus=False, enable_gti=False, comm...
Create a single layer 2 firewall with management interface and inline pair :param str name: name of firewall engine :param str mgmt_ip: ip address of management interface :param str mgmt_network: management network in cidr format :param int mgmt_interface: (optional) interface for manag...
entailment
def create(cls, name, master_engine, virtual_resource, interfaces, default_nat=False, outgoing_intf=0, domain_server_address=None, enable_ospf=False, ospf_profile=None, comment=None, **kw): """ Create a Layer3Virtual engine for a Master Engine. Provide interf...
Create a Layer3Virtual engine for a Master Engine. Provide interfaces as a list of dict items specifying the interface details in format:: {'interface_id': 1, 'address': '1.1.1.1', 'network_value': '1.1.1.0/24', 'zone_ref': zone_by_name,href, 'comment': 'my interface comment'} ...
entailment
def create_bulk(cls, name, interfaces=None, nodes=2, cluster_mode='balancing', primary_mgt=None, backup_mgt=None, primary_heartbeat=None, log_server_ref=None, domain_server_address=None, location_ref=None, default_nat=False, enable_antivirus=False, enable_gti=False, comment=None, ...
:param dict snmp: SNMP dict should have keys `snmp_agent` str defining name of SNMPAgent, `snmp_interface` which is a list of interface IDs, and optionally `snmp_location` which is a string with the SNMP location name.
entailment
def create(cls, name, cluster_virtual, network_value, macaddress, interface_id, nodes, vlan_id=None, cluster_mode='balancing', backup_mgt=None, primary_heartbeat=None, log_server_ref=None, domain_server_address=None, location_ref=None, zone_ref=None, default_n...
Create a layer 3 firewall cluster with management interface and any number of nodes. If providing keyword arguments to create additional interfaces, use the same constructor arguments and pass an `interfaces` keyword argument. The constructor defined interface will be assigned as the primary ...
entailment
def create(cls, name, master_type, mgmt_ip, mgmt_network, mgmt_interface=0, log_server_ref=None, zone_ref=None, domain_server_address=None, enable_gti=False, enable_antivirus=False, comment=None): """ Create a Master Engine with management inte...
Create a Master Engine with management interface :param str name: name of master engine engine :param str master_type: firewall| :param str mgmt_ip: ip address for management interface :param str mgmt_network: full netmask for management :param str mgmt_interface: interface to u...
entailment
def create(cls, name, master_type, macaddress, nodes, mgmt_interface=0, log_server_ref=None, domain_server_address=None, enable_gti=False, enable_antivirus=False, comment=None, **kw): """ Create Master Engine Cluster :param str name: name of master engine engine :param s...
Create Master Engine Cluster :param str name: name of master engine engine :param str master_type: firewall| :param str mgmt_ip: ip address for management interface :param str mgmt_netmask: full netmask for management :param str mgmt_interface: interface to use for mgmt (default...
entailment
def set_stream_logger(log_level=logging.DEBUG, format_string=None, logger_name='smc'): """ Stream logger convenience function to log to console :param int log_level: A log level as specified in the `logging` module :param str format_string: Optional format string as specified in the `log...
Stream logger convenience function to log to console :param int log_level: A log level as specified in the `logging` module :param str format_string: Optional format string as specified in the `logging` module
entailment
def set_file_logger(path, log_level=logging.DEBUG, format_string=None, logger_name='smc'): """ Convenience function to quickly configure any level of logging to a file. :param int log_level: A log level as specified in the `logging` module :param str format_string: Optional format string as specifi...
Convenience function to quickly configure any level of logging to a file. :param int log_level: A log level as specified in the `logging` module :param str format_string: Optional format string as specified in the `logging` module :param str path: Path to the log file. The file will be create...
entailment
def create(cls, name, ldap_server, isdefault=False, auth_method=None, comment=None): """ Create an External LDAP user domain. These are used as containers for retrieving user and groups from the configured LDAP server/s. If you have multiple authentication methods supported for your LDAP...
Create an External LDAP user domain. These are used as containers for retrieving user and groups from the configured LDAP server/s. If you have multiple authentication methods supported for your LDAP server, or have none configured, you can set the `auth_method` to a supported Authentica...
entailment
def create(cls, name, user_group=None, activation_date=None, expiration_date=None, comment=None): """ Create an internal user. Add a user example:: InternalUser.create(name='goog', comment='my comment') :param str name: name of user that is disp...
Create an internal user. Add a user example:: InternalUser.create(name='goog', comment='my comment') :param str name: name of user that is displayed in SMC :param list(str,InternalUserGroup) user_group: internal user groups which to add this use...
entailment
def create(cls, name, member=None, comment=None): """ Create an internal group. An internal group will always be attached to the default (and only) InternalUserDomain within the SMC. Example of creating an internal user group:: InternalUserGroup.create(name=...
Create an internal group. An internal group will always be attached to the default (and only) InternalUserDomain within the SMC. Example of creating an internal user group:: InternalUserGroup.create(name='foogroup2', comment='mycomment') :param str name: Name o...
entailment
def get_all_loopbacks(engine): """ Get all loopback interfaces for a given engine """ data = [] if 'fw_cluster' in engine.type: for cvi in engine.data.get('loopback_cluster_virtual_interface', []): data.append( LoopbackClusterInterface(cvi, engine)) for node ...
Get all loopback interfaces for a given engine
entailment
def get(self, address): """ Get a loopback address by it's address. Find all loopback addresses by iterating at either the node level or the engine:: loopback = engine.loopback_interface.get('127.0.0.10') :param str address: ip address of loopback :r...
Get a loopback address by it's address. Find all loopback addresses by iterating at either the node level or the engine:: loopback = engine.loopback_interface.get('127.0.0.10') :param str address: ip address of loopback :raises InterfaceNotFound: invalid interface s...
entailment
def update_or_create(self, interface): """ Collections class update or create method that can be used as a shortcut to updating or creating an interface. The interface must first be defined and provided as the argument. The interface method must have an `update_interface` method ...
Collections class update or create method that can be used as a shortcut to updating or creating an interface. The interface must first be defined and provided as the argument. The interface method must have an `update_interface` method which resolves differences and adds as necessary. ...
entailment
def add_cluster_virtual_interface(self, interface_id, cluster_virtual=None, network_value=None, nodes=None, zone_ref=None, comment=None): """ Add a tunnel interface on a clustered engine. For tunnel interfaces on a cluster, you can specify a CVI only, NDI interfaces, or both....
Add a tunnel interface on a clustered engine. For tunnel interfaces on a cluster, you can specify a CVI only, NDI interfaces, or both. This interface type is only supported on layer 3 firewall engines. :: Add a tunnel CVI and NDI: engine.tunnel_interface.add_cluster_vir...
entailment
def add(self, interface_id, virtual_mapping=None, virtual_resource_name=None, zone_ref=None, comment=None): """ Add single physical interface with interface_id. Use other methods to fully add an interface configuration based on engine type. Virtual mapping and resource are on...
Add single physical interface with interface_id. Use other methods to fully add an interface configuration based on engine type. Virtual mapping and resource are only used in Virtual Engines. :param str,int interface_id: interface identifier :param int virtual_mapping: virtual firewall ...
entailment
def add_capture_interface(self, interface_id, logical_interface_ref, inspect_unspecified_vlans=True, zone_ref=None, comment=None): """ Add a capture interface. Capture interfaces are supported on Layer 2 FW and IPS engines. ..note:: Capture interface are ...
Add a capture interface. Capture interfaces are supported on Layer 2 FW and IPS engines. ..note:: Capture interface are supported on Layer 3 FW/clusters for NGFW engines version >= 6.3 and SMC >= 6.3. :param str,int interface_id: interface identifier ...
entailment
def add_layer3_interface(self, interface_id, address, network_value, zone_ref=None, comment=None, **kw): """ Add a layer 3 interface on a non-clustered engine. For Layer 2 FW and IPS engines, this interface type represents a layer 3 routed (node dedicated) in...
Add a layer 3 interface on a non-clustered engine. For Layer 2 FW and IPS engines, this interface type represents a layer 3 routed (node dedicated) interface. For clusters, use the cluster related methods such as :func:`add_cluster_virtual_interface` :param str,int interface_id: interfa...
entailment
def add_layer3_vlan_interface(self, interface_id, vlan_id, address=None, network_value=None, virtual_mapping=None, virtual_resource_name=None, zone_ref=None, comment=None, **kw): """ Add a Layer 3 VLAN interface. Optionally specify an address and network if assigning an IP to the...
Add a Layer 3 VLAN interface. Optionally specify an address and network if assigning an IP to the VLAN. This method will also assign an IP address to an existing VLAN, or add an additional address to an existing VLAN. This method may commonly be used on a Master Engine to create VLANs for virtua...
entailment
def add_layer3_cluster_interface(self, interface_id, cluster_virtual=None, network_value=None, macaddress=None, nodes=None, cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw): """ Add cluster virtual interface. A "CVI" interface is used as a VIP address for clu...
Add cluster virtual interface. A "CVI" interface is used as a VIP address for clustered engines. Providing 'nodes' will create the node specific interfaces. You can also add a cluster address with only a CVI, or only NDI's. Add CVI only:: engine.physic...
entailment
def add_layer3_vlan_cluster_interface(self, interface_id, vlan_id, nodes=None, cluster_virtual=None, network_value=None, macaddress=None, cvi_mode='packetdispatch', zone_ref=None, comment=None, **kw): """ Add IP addresses to VLANs on a firewall cluster. The minimum params ...
Add IP addresses to VLANs on a firewall cluster. The minimum params required are ``interface_id`` and ``vlan_id``. To create a VLAN interface with a CVI, specify ``cluster_virtual``, ``cluster_mask`` and ``macaddress``. To create a VLAN with only NDI, specify ``nodes`` parameter. ...
entailment
def add_inline_interface(self, interface_id, second_interface_id, logical_interface_ref=None, vlan_id=None, second_vlan_id=None, zone_ref=None, second_zone_ref=None, failure_mode='normal', comment=None, **kw): """ Add an inline interface pair. This method is only for IPS or L2FW engine ...
Add an inline interface pair. This method is only for IPS or L2FW engine types. :param str interface_id: interface id of first interface :param str second_interface_id: second interface pair id :param str, href logical_interface_ref: logical interface by href or name :pa...
entailment
def add_inline_ips_interface(self, interface_id, second_interface_id, logical_interface_ref=None, vlan_id=None, failure_mode='normal', zone_ref=None, second_zone_ref=None, comment=None): """ .. versionadded:: 0.5.6 Using an inline interface on a layer 3 FW requires SMC and en...
.. versionadded:: 0.5.6 Using an inline interface on a layer 3 FW requires SMC and engine version >= 6.3. An inline IPS interface is a new interface type for Layer 3 NGFW engines version >=6.3. Traffic passing an Inline IPS interface will have a access rule d...
entailment
def add_inline_l2fw_interface(self, interface_id, second_interface_id, logical_interface_ref=None, vlan_id=None, zone_ref=None, second_zone_ref=None, comment=None): """ .. versionadded:: 0.5.6 Requires NGFW engine >=6.3 and layer 3 FW or cluster An in...
.. versionadded:: 0.5.6 Requires NGFW engine >=6.3 and layer 3 FW or cluster An inline L2 FW interface is a new interface type for Layer 3 NGFW engines version >=6.3. Traffic passing an Inline Layer 2 Firewall interface will have a default action in access rules of Discard. ...
entailment
def add_dhcp_interface(self, interface_id, dynamic_index, zone_ref=None, vlan_id=None, comment=None): """ Add a DHCP interface on a single FW :param int interface_id: interface id :param int dynamic_index: index number for dhcp interface :param bool primary_mgt: whet...
Add a DHCP interface on a single FW :param int interface_id: interface id :param int dynamic_index: index number for dhcp interface :param bool primary_mgt: whether to make this primary mgt :param str zone_ref: zone reference, can be name, href or Zone :raises EngineCommandFaile...
entailment
def add_cluster_interface_on_master_engine(self, interface_id, macaddress, nodes, zone_ref=None, vlan_id=None, comment=None): """ Add a cluster address specific to a master engine. Master engine clusters will not use "CVI" interfaces like normal layer 3 FW clusters, instead e...
Add a cluster address specific to a master engine. Master engine clusters will not use "CVI" interfaces like normal layer 3 FW clusters, instead each node has a unique address and share a common macaddress. Adding multiple addresses to an interface is not supported with this method. ...
entailment
def add_tunnel_interface(self, interface_id, address, network_value, zone_ref=None, comment=None): """ Creates a tunnel interface for a virtual engine. :param str,int interface_id: the tunnel id for the interface, used as nicid also :param str address: ip ad...
Creates a tunnel interface for a virtual engine. :param str,int interface_id: the tunnel id for the interface, used as nicid also :param str address: ip address of interface :param str network_value: network cidr for interface; format: 1.1.1.0/24 :param str zone_ref: zone reference for ...
entailment