sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def update_or_create(cls, with_status=False, overwrite_existing=False, **kw): """ Update or create the Access List. This method will not attempt to evaluate whether the access list has differences, instead it will update with the contents of the payload entirely. If the intent is ...
Update or create the Access List. This method will not attempt to evaluate whether the access list has differences, instead it will update with the contents of the payload entirely. If the intent is to only add or remove a single entry, use `~add_entry` and `~remove_entry` methods. ...
entailment
def update_status(self): """ Gets the current status of this task and returns a new task object. :raises TaskRunFailed: fail to update task status """ task = self.make_request( TaskRunFailed, href=self.href) return Task(task)
Gets the current status of this task and returns a new task object. :raises TaskRunFailed: fail to update task status
entailment
def execute(self, resource, **kw): """ Execute the task and return a TaskOperationPoller. :rtype: TaskOperationPoller """ params = kw.pop('params', {}) json = kw.pop('json', None) task = self.make_request( TaskRunFailed, method='cr...
Execute the task and return a TaskOperationPoller. :rtype: TaskOperationPoller
entailment
def download(self, resource, filename, **kw): """ Start and return a Download Task :rtype: DownloadTask(TaskOperationPoller) """ params = kw.pop('params', {}) task = self.make_request( TaskRunFailed, method='create', resource=r...
Start and return a Download Task :rtype: DownloadTask(TaskOperationPoller)
entailment
def add_done_callback(self, callback): """ Add a callback to run after the task completes. The callable must take 1 argument which will be the completed Task. :param callback: a callable that takes a single argument which will be the completed Task. """ ...
Add a callback to run after the task completes. The callable must take 1 argument which will be the completed Task. :param callback: a callable that takes a single argument which will be the completed Task.
entailment
def wait(self, timeout=None): """ Blocking wait for task status. """ if self._thread is None: return self._thread.join(timeout=timeout)
Blocking wait for task status.
entailment
def last_message(self, timeout=5): """ Wait a specified amount of time and return the last message from the task :rtype: str """ if self._thread is not None: self._thread.join(timeout=timeout) return self._task.last_message
Wait a specified amount of time and return the last message from the task :rtype: str
entailment
def stop(self): """ Stop the running task """ if self._thread is not None and self._thread.isAlive(): self._done.set()
Stop the running task
entailment
def create(cls, name, granted_element=None): """ Create a new ACL :param str name: Name of ACL :param list granted_elements: Elements to grant access to. Can be engines, policies or other acl's. :type granted_elements: list(str,Element) :raises Create...
Create a new ACL :param str name: Name of ACL :param list granted_elements: Elements to grant access to. Can be engines, policies or other acl's. :type granted_elements: list(str,Element) :raises CreateElementFailed: failed creating ACL :return: instance with...
entailment
def add_permission(self, elements): """ Add permission/s to this ACL. By default this change is committed after the method is called. :param list elements: Elements to grant access to. Can be engines, policies, or other ACLs :type elements: list(str,Element) ...
Add permission/s to this ACL. By default this change is committed after the method is called. :param list elements: Elements to grant access to. Can be engines, policies, or other ACLs :type elements: list(str,Element) :raises UpdateElementFailed: Failed updating per...
entailment
def remove_permission(self, elements): """ Remove permission/s to this ACL. Change is committed at end of method call. :param list elements: list of element/s to remove :type elements: list(str,Element) :raises UpdateElementFailed: Failed modifying permission...
Remove permission/s to this ACL. Change is committed at end of method call. :param list elements: list of element/s to remove :type elements: list(str,Element) :raises UpdateElementFailed: Failed modifying permissions :return: None
entailment
def create(cls, elements, role, domain=None): """ Create a permission. :param list granted_elements: Elements for this permission. Can be engines, policies or ACLs :type granted_elements: list(str,Element) :param str,Role role: role for this permission ...
Create a permission. :param list granted_elements: Elements for this permission. Can be engines, policies or ACLs :type granted_elements: list(str,Element) :param str,Role role: role for this permission :param str,Element domain: domain to apply (default: Shared Doma...
entailment
def save_to_file(filename, content): """ Save content to file. Used by node initial contact but can be used anywhere. :param str filename: name of file to save to :param str content: content to save :return: None :raises IOError: permissions issue saving, invalid directory, etc """ ...
Save content to file. Used by node initial contact but can be used anywhere. :param str filename: name of file to save to :param str content: content to save :return: None :raises IOError: permissions issue saving, invalid directory, etc
entailment
def element_resolver(elements, do_raise=True): """ Element resolver takes either a single class instance or a list of elements to resolve the href. It does not assume a specific interface, instead if it's a class, it just needs an 'href' attribute that should hold the http url for the resource. ...
Element resolver takes either a single class instance or a list of elements to resolve the href. It does not assume a specific interface, instead if it's a class, it just needs an 'href' attribute that should hold the http url for the resource. If a list is provided, a list is returned. If you want ...
entailment
def merge_dicts(dict1, dict2, append_lists=False): """ Merge the second dict into the first Not intended to merge list of dicts. :param append_lists: If true, instead of clobbering a list with the new value, append all of the new values onto the original list. """ for key in dict2: ...
Merge the second dict into the first Not intended to merge list of dicts. :param append_lists: If true, instead of clobbering a list with the new value, append all of the new values onto the original list.
entailment
def unicode_to_bytes(s, encoding='utf-8', errors='replace'): """ Helper to convert unicode strings to bytes for data that needs to be written to on output stream (i.e. terminal) For Python 3 this should be called str_to_bytes :param str s: string to encode :param str encoding: utf-8 by default ...
Helper to convert unicode strings to bytes for data that needs to be written to on output stream (i.e. terminal) For Python 3 this should be called str_to_bytes :param str s: string to encode :param str encoding: utf-8 by default :param str errors: what to do when encoding fails :return: byte s...
entailment
def b64encode(source): """ Base64 encoding for python 2 and 3 :rtype: base64 content """ if compat.PY3: source = source.encode('utf-8') return base64.b64encode(source).decode('utf-8')
Base64 encoding for python 2 and 3 :rtype: base64 content
entailment
def bytes_to_unicode(s, encoding='utf-8', errors='replace'): """ Helper to convert byte string to unicode string for user based input :param str s: string to decode :param str encoding: utf-8 by default :param str errors: what to do when decoding fails :return: unicode utf-8 string """ ...
Helper to convert byte string to unicode string for user based input :param str s: string to decode :param str encoding: utf-8 by default :param str errors: what to do when decoding fails :return: unicode utf-8 string
entailment
def create_collection(href, cls): """ This collection type inserts a ``create`` method into the collection. This will proxy to the sub elements create method while restricting access to other attributes that wouldn't be initialized yet. .. py:method:: create(...) Create method is inser...
This collection type inserts a ``create`` method into the collection. This will proxy to the sub elements create method while restricting access to other attributes that wouldn't be initialized yet. .. py:method:: create(...) Create method is inserted dynamically for the collection class type....
entailment
def rule_collection(href, cls): """ Rule collections insert a ``create`` and ``create_rule_section`` method into the collection. This collection type is returned when accessing rules through a reference, as:: policy = FirewallPolicy('mypolicy') policy.fw_ipv4_access_rules.create(....) ...
Rule collections insert a ``create`` and ``create_rule_section`` method into the collection. This collection type is returned when accessing rules through a reference, as:: policy = FirewallPolicy('mypolicy') policy.fw_ipv4_access_rules.create(....) policy.fw_ipv4_access_rules.create_ru...
entailment
def _strip_metachars(val): """ When a filter uses a / or - in the search, only the elements name and comment field is searched. This can cause issues if searching a network element, i.e. 1.1.1.0/24 where the /24 portion is not present in the name and only the elements ipv4_network attribute. If ...
When a filter uses a / or - in the search, only the elements name and comment field is searched. This can cause issues if searching a network element, i.e. 1.1.1.0/24 where the /24 portion is not present in the name and only the elements ipv4_network attribute. If exact_match is not specified, strip off...
entailment
def get(self, index): """ Get the element by index. If index is out of bounds for the internal list, None is returned. Indexes cannot be negative. :param int index: retrieve element by positive index in list :rtype: SubElement or None """ if self ...
Get the element by index. If index is out of bounds for the internal list, None is returned. Indexes cannot be negative. :param int index: retrieve element by positive index in list :rtype: SubElement or None
entailment
def get_contains(self, value, case_sensitive=True): """ A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Sub elements created by SMC will generally have a descriptive name that helps to identify their purpose. Returns only the first...
A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Sub elements created by SMC will generally have a descriptive name that helps to identify their purpose. Returns only the first entry matched even if there are multiple. .. s...
entailment
def get_all_contains(self, value, case_sensitive=True): """ A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Returns all elements that match the specified value. .. seealso:: :meth:`get_contains` for returning only a single...
A partial match on the name field. Does an `in` comparsion to elements by the meta `name` field. Returns all elements that match the specified value. .. seealso:: :meth:`get_contains` for returning only a single item. :param str value: searchable string for contains mat...
entailment
def _clone(self, **kwargs): """ Create a clone of this collection. The only param in the initial collection is the filter context. Each chainable filter is added to the clone and returned to preserve previous iterators and their returned elements. :return: :class...
Create a clone of this collection. The only param in the initial collection is the filter context. Each chainable filter is added to the clone and returned to preserve previous iterators and their returned elements. :return: :class:`.ElementCollection`
entailment
def filter(self, *filter, **kw): # @ReservedAssignment """ Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC...
Filter results for specific element type. keyword arguments can be used to specify a match against the elements attribute directly. It's important to note that if the search filter contains a / or -, the SMC will only search the name and comment fields. Otherwise other key f...
entailment
def batch(self, num): """ Iterator returning results in batches. When making more general queries that might have larger results, specify a batch result that should be returned with each iteration. :param int num: number of results per iteration :return: iterator...
Iterator returning results in batches. When making more general queries that might have larger results, specify a batch result that should be returned with each iteration. :param int num: number of results per iteration :return: iterator holding list of results
entailment
def first(self): """ Returns the first object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.count()) ...
Returns the first object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.count()) >>> print(c.first()) 7...
entailment
def last(self): """ Returns the last object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.last()) Hos...
Returns the last object matched or None if there is no matching object. :: >>> iterator = Host.objects.iterator() >>> c = iterator.filter('kali') >>> if c.exists(): >>> print(c.last()) Host(name=kali-foo) :r...
entailment
def iterator(self, **kwargs): """ Return an iterator from the collection manager. The iterator can be re-used to chain together filters, each chaining event will be it's own unique element collection. :return: :class:`ElementCollection` """ cls_name = '{0}Collect...
Return an iterator from the collection manager. The iterator can be re-used to chain together filters, each chaining event will be it's own unique element collection. :return: :class:`ElementCollection`
entailment
def entry_point(self, entry_point): """ Provide an entry point for element types to search. :param str entry_point: valid entry point. Use `~object_types()` to find all available entry points. """ if len(entry_point.split(',')) == 1: self._params....
Provide an entry point for element types to search. :param str entry_point: valid entry point. Use `~object_types()` to find all available entry points.
entailment
def context_filter(self, context): """ Provide a context filter to search. :param str context: Context filter by name """ if context in CONTEXTS: self._params.update(filter_context=context) return self raise InvalidSearchFilter( ...
Provide a context filter to search. :param str context: Context filter by name
entailment
def unused(self): """ Return unused user-created elements. :rtype: list(Element) """ self._params.update( href=self._resource.get('search_unused')) return self
Return unused user-created elements. :rtype: list(Element)
entailment
def duplicates(self): """ Return duplicate user-created elements. :rtype: list(Element) """ self._params.update( href=self._resource.get('search_duplicate')) return self
Return duplicate user-created elements. :rtype: list(Element)
entailment
def object_types(): """ Show all available 'entry points' available for searching. An entry point defines a uri that provides unfiltered access to all elements of the entry point type. :return: list of entry points by name :rtype: list(str) """ # Return a...
Show all available 'entry points' available for searching. An entry point defines a uri that provides unfiltered access to all elements of the entry point type. :return: list of entry points by name :rtype: list(str)
entailment
def fetch_as_element(self, **kw): """ Fetch the results and return as a Connection element. The original query is not modified. :return: generator of elements :rtype: :class:`.Connection` """ clone = self.copy() clone.format.field_format('id') ...
Fetch the results and return as a Connection element. The original query is not modified. :return: generator of elements :rtype: :class:`.Connection`
entailment
def create_ospf_area_with_message_digest_auth(): """ If you require message-digest authentication for your OSPFArea, you must create an OSPF key chain configuration. """ OSPFKeyChain.create(name='secure-keychain', key_chain_entry=[{'key': 'fookey', ...
If you require message-digest authentication for your OSPFArea, you must create an OSPF key chain configuration.
entailment
def create_ospf_profile(): """ An OSPF Profile contains administrative distance and redistribution settings. An OSPF Profile is applied at the engine level. When creating an OSPF Profile, you must reference a OSPFDomainSetting. An OSPFDomainSetting holds the settings of the area border router (AB...
An OSPF Profile contains administrative distance and redistribution settings. An OSPF Profile is applied at the engine level. When creating an OSPF Profile, you must reference a OSPFDomainSetting. An OSPFDomainSetting holds the settings of the area border router (ABR) type, throttle timer settings, ...
entailment
def timezone(self, tz): """ Set timezone on the audit records. Timezone can be in formats: 'US/Eastern', 'PST', 'Europe/Helsinki' See SMC Log Viewer settings for more examples. :param str tz: timezone, i.e. CST """ self.data['resolving'].update( ...
Set timezone on the audit records. Timezone can be in formats: 'US/Eastern', 'PST', 'Europe/Helsinki' See SMC Log Viewer settings for more examples. :param str tz: timezone, i.e. CST
entailment
def set_resolving(self, **kw): """ Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. ...
Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. :param bool time_show_millis: show timezone in...
entailment
def fetch_raw(self): """ Execute the query and return by batches. Optional keyword arguments are passed to Query.execute(). Whether this is real-time or stored logs is dependent on the value of ``fetch_type``. :return: generator of dict results """ ...
Execute the query and return by batches. Optional keyword arguments are passed to Query.execute(). Whether this is real-time or stored logs is dependent on the value of ``fetch_type``. :return: generator of dict results
entailment
def fetch_batch(self, formatter=TableFormat): """ Fetch a batch of logs and return using the specified formatter. Formatter is class type defined in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch (this method forces ``fetch_type='stored'`...
Fetch a batch of logs and return using the specified formatter. Formatter is class type defined in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch (this method forces ``fetch_type='stored'``). If ``fetch_size`` is not already set on the query, the...
entailment
def fetch_live(self, formatter=TableFormat): """ View logs in real-time. If previous filters were already set on this query, they will be preserved on the original instance (this method forces ``fetch_type='current'``). :param formatter: Formatter type for data represent...
View logs in real-time. If previous filters were already set on this query, they will be preserved on the original instance (this method forces ``fetch_type='current'``). :param formatter: Formatter type for data representation. Any type in :py:mod:`smc_monitoring.models.for...
entailment
def create(cls, name, vss_def=None): """ Create a VSS Container. This maps to the Service Manager within NSX. vss_def is optional and has the following definition: {"isc_ovf_appliance_model": 'virtual', "isc_ovf_appliance_version": '', "isc_ip_addr...
Create a VSS Container. This maps to the Service Manager within NSX. vss_def is optional and has the following definition: {"isc_ovf_appliance_model": 'virtual', "isc_ovf_appliance_version": '', "isc_ip_address": '192.168.4.84', # IP of manager, i.e. OSC ...
entailment
def nodes(self): """ Return the nodes for this VSS Container :rtype: SubElementCollection(VSSContainerNode) """ resource = sub_collection( self.get_relation('vss_container_node'), VSSContainerNode) resource._load_from_engine(self, 'nodes...
Return the nodes for this VSS Container :rtype: SubElementCollection(VSSContainerNode)
entailment
def vss_contexts(self): """ Return all virtual contexts for this VSS Container. :return list VSSContext """ result = self.make_request( href=fetch_entry_point('visible_virtual_engine_mapping'), params={'filter': self.name}) if result.get('mapping'...
Return all virtual contexts for this VSS Container. :return list VSSContext
entailment
def remove_security_group(self, name): """ Remove a security group from container """ for group in self.security_groups: if group.isc_name == name: group.delete()
Remove a security group from container
entailment
def add_security_group(self, name, isc_id, comment=None): """ Create a new security group. :param str name: NSX security group name :param str isc_id: NSX Security Group objectId i.e. (securitygroup-14) :raises CreateElementFailed: failed to create :rtype: Se...
Create a new security group. :param str name: NSX security group name :param str isc_id: NSX Security Group objectId i.e. (securitygroup-14) :raises CreateElementFailed: failed to create :rtype: SecurityGroup
entailment
def add_context(self, isc_name, isc_policy_id, isc_traffic_tag): """ Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX group...
Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX groupId (serviceprofile-145) :raises CreateElementFailed: failed to create ...
entailment
def create(cls, name, vss_container, vss_node_def, comment=None): """ Create VSS node. This is the engines dvFilter management interface within the NSX agent. .. seealso:: `~.isc_settings` for documentation on the vss_node_def dict :param str ...
Create VSS node. This is the engines dvFilter management interface within the NSX agent. .. seealso:: `~.isc_settings` for documentation on the vss_node_def dict :param str name: name of node :param VSSContainer vss_container: container to nest this node :pa...
entailment
def create(cls, isc_name, isc_policy_id, isc_traffic_tag, vss_container): """ Create the VSS Context within the VSSContainer :param str name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX ...
Create the VSS Context within the VSSContainer :param str name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX groupId (serviceprofile-145) :param VSSContainer vss_container: VSS Container to get c...
entailment
def remove_from_master_node(self, wait_for_finish=False, timeout=20, **kw): """ Remove this VSS Context from it's parent VSS Container. This is required before calling VSSContext.delete(). It preps the engine for removal. :param bool wait_for_finish: wait for the task to...
Remove this VSS Context from it's parent VSS Container. This is required before calling VSSContext.delete(). It preps the engine for removal. :param bool wait_for_finish: wait for the task to finish :param int timeout: how long to wait if delay :type: TaskOperationPoller
entailment
def create(cls, name, isc_id, vss_container, comment=None): """ Create a new security group. Find a security group:: SecurityGroup.objects.filter(name) .. note:: The isc_id (securitygroup-10, etc) represents the internal NSX reference fo...
Create a new security group. Find a security group:: SecurityGroup.objects.filter(name) .. note:: The isc_id (securitygroup-10, etc) represents the internal NSX reference for the Security Composer group. This is placed in the comment field w...
entailment
def create(cls, name, gateway, network, input_speed=None, output_speed=None, domain_server_address=None, provider_name=None, probe_address=None, standby_mode_period=3600, standby_mode_timeout=30, active_mode_period=5, active_mode_timeout=1, comment=None): ...
Create a new StaticNetlink to be used as a traffic handler. :param str name: name of netlink Element :param gateway_ref: gateway to map this netlink to. This can be an element or str href. :type gateway_ref: Router,Engine :param list ref: network/s associated with this netli...
entailment
def update_or_create(cls, with_status=False, **kwargs): """ Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_se...
Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_server_address` method to add or remove. :raises Crea...
entailment
def create(cls, name, input_speed=None, learn_dns_automatically=True, output_speed=None, provider_name=None, probe_address=None, standby_mode_period=3600, standby_mode_timeout=30, active_mode_period=5, active_mode_timeout=1, comment=None): """ Create a Dynami...
Create a Dynamic Netlink. :param str name: name of netlink Element :param int input_speed: input speed in Kbps, used for ratio-based load-balancing :param int output_speed: output speed in Kbps, used for ratio-based load-balancing :param bool learn_dns_automatic...
entailment
def create(cls, name, multilink_members, multilink_method='rtt', retries=2, timeout=3600, comment=None): """ Create a new multilink configuration. Multilink requires at least one netlink for operation, although 2 or more are recommeneded. :param str name: name of ...
Create a new multilink configuration. Multilink requires at least one netlink for operation, although 2 or more are recommeneded. :param str name: name of multilink :param list multilink_members: the output of calling :func:`.multilink_member` to retrieve the proper formatti...
entailment
def create_with_netlinks(cls, name, netlinks, **kwargs): """ Create a multilink with a list of StaticNetlinks. To properly create the multilink using this method, pass a list of netlinks with the following dict structure:: netlinks = [{'netlink': StaticNetlink, ...
Create a multilink with a list of StaticNetlinks. To properly create the multilink using this method, pass a list of netlinks with the following dict structure:: netlinks = [{'netlink': StaticNetlink, 'ip_range': 1.1.1.1-1.1.1.2, 'ne...
entailment
def create(cls, netlink, ip_range=None, netlink_role='active'): """ Create a multilink member. Multilink members are added to an Outbound Multilink configuration and define the ip range, static netlink to use, and the role. This element can be passed to the Multilink constructor ...
Create a multilink member. Multilink members are added to an Outbound Multilink configuration and define the ip range, static netlink to use, and the role. This element can be passed to the Multilink constructor to simplify creation of the outbound multilink. :param StaticNetlin...
entailment
def create(cls, name, tls_version, use_only_subject_alt_name=False, accept_wildcard=False, check_revocation=True, tls_cryptography_suites=None, crl_delay=0, ocsp_delay=0, ignore_network_issues=False, tls_trusted_ca_ref=None, comment=None): """ Create a TLS Profile. By default the...
Create a TLS Profile. By default the SMC will have a default NIST TLS Profile but it is also possible to create a custom profile to provide special TLS handling. :param str name: name of TLS Profile :param str tls_verison: supported tls verison, valid options are TLS...
entailment
def ciphers(from_suite=None): """ This is a helper method that will return all of the cipher strings used in a specified TLSCryptographySuite or returns the system default NIST profile list of ciphers. This can be used as a helper to identify the ciphers to specify/add wh...
This is a helper method that will return all of the cipher strings used in a specified TLSCryptographySuite or returns the system default NIST profile list of ciphers. This can be used as a helper to identify the ciphers to specify/add when creating a new TLSCryptographySuite. ...
entailment
def create(cls, name, certificate): """ Create a TLS CA. The certificate must be compatible with OpenSSL and be in PEM format. The certificate can be either a file with the Root CA, or a raw string starting with BEGIN CERTIFICATE, etc. When creating a TLS CA, you must also import...
Create a TLS CA. The certificate must be compatible with OpenSSL and be in PEM format. The certificate can be either a file with the Root CA, or a raw string starting with BEGIN CERTIFICATE, etc. When creating a TLS CA, you must also import the CA certificate. Once the CA is created, it ...
entailment
def create_csr(cls, name, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=4096): """ Create a certificate signing request. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. ...
Create a certificate signing request. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. An example would be: "CN=CommonName,O=Organization,OU=Unit,C=FR,ST=PACA,L=Nice". At minimum, a "CN" is required. :param str...
entailment
def create_self_signed(cls, name, common_name, public_key_algorithm='rsa', signature_algorithm='rsa_sha_512', key_length=4096): """ Create a self signed certificate. This is a convenience method that first calls :meth:`~create_csr`, then calls :meth:`~self_sign` on the return...
Create a self signed certificate. This is a convenience method that first calls :meth:`~create_csr`, then calls :meth:`~self_sign` on the returned TLSServerCredential object. :param str name: name of TLS Server Credential :param str rcommon_name: common name for certificate. An ...
entailment
def import_signed(cls, name, certificate, private_key, intermediate=None): """ Import a signed certificate and private key to SMC, and optionally an intermediate certificate. The certificate and the associated private key must be compatible with OpenSSL and be in PEM format. The ...
Import a signed certificate and private key to SMC, and optionally an intermediate certificate. The certificate and the associated private key must be compatible with OpenSSL and be in PEM format. The certificate and private key can be imported as a raw string, file path or file object. ...
entailment
def import_from_chain(cls, name, certificate_file, private_key=None): """ Import the server certificate, intermediate and optionally private key from a certificate chain file. The expected format of the chain file follows RFC 4346. In short, the server certificate should come fir...
Import the server certificate, intermediate and optionally private key from a certificate chain file. The expected format of the chain file follows RFC 4346. In short, the server certificate should come first, followed by any intermediate certificates, optionally followed by the ...
entailment
def import_signed(cls, name, certificate, private_key): """ Import a signed certificate and private key as a client protection CA. This is a shortcut method to the 3 step process: * Create CA with name * Import certificate * Import private ke...
Import a signed certificate and private key as a client protection CA. This is a shortcut method to the 3 step process: * Create CA with name * Import certificate * Import private key Create the CA:: ClientProtectionCA.i...
entailment
def create_self_signed(cls, name, prefix, password, public_key_algorithm='rsa', life_time=365, key_length=2048): """ Create a self signed client protection CA. To prevent browser warnings during decryption, you must trust the signing certificate in the client browsers. ...
Create a self signed client protection CA. To prevent browser warnings during decryption, you must trust the signing certificate in the client browsers. :param str name: Name of this ex: "SG Root CA" Used as Key. Real common name will be derivated at creation time with a uniqueId. ...
entailment
def update_format(self, format): """ Update the format for this query. :param format: new format to use for this query :type format: :py:mod:`smc_monitoring.models.formats` """ self.format = format self.request.update(format=self.format.data)
Update the format for this query. :param format: new format to use for this query :type format: :py:mod:`smc_monitoring.models.formats`
entailment
def add_in_filter(self, *values): """ Add a filter using "IN" logic. This is typically the primary filter that will be used to find a match and generally combines other filters to get more granular. An example of usage would be searching for an IP address (or addresses) in a spec...
Add a filter using "IN" logic. This is typically the primary filter that will be used to find a match and generally combines other filters to get more granular. An example of usage would be searching for an IP address (or addresses) in a specific log field. Or looking for an IP address i...
entailment
def add_and_filter(self, *values): """ Add a filter using "AND" logic. This filter is useful when requiring multiple matches to evaluate to true. For example, searching for a specific IP address in the src field and another in the dst field. .. seealso:: :class:`smc_...
Add a filter using "AND" logic. This filter is useful when requiring multiple matches to evaluate to true. For example, searching for a specific IP address in the src field and another in the dst field. .. seealso:: :class:`smc_monitoring.models.filters.AndFilter` for examples. ...
entailment
def add_or_filter(self, *values): """ Add a filter using "OR" logic. This filter is useful when matching on one or more criteria. For example, searching for IP 1.1.1.1 and service TCP/443, or IP 1.1.1.10 and TCP/80. Either pair would produce a positive match. .. ...
Add a filter using "OR" logic. This filter is useful when matching on one or more criteria. For example, searching for IP 1.1.1.1 and service TCP/443, or IP 1.1.1.10 and TCP/80. Either pair would produce a positive match. .. seealso:: :class:`smc_monitoring.models.filters.OrFilt...
entailment
def add_not_filter(self, *value): """ Add a filter using "NOT" logic. Typically this filter is used in conjunction with and AND or OR filters, but can be used by itself as well. This might be more useful as a standalone filter when displaying logs in real time and filtering out ...
Add a filter using "NOT" logic. Typically this filter is used in conjunction with and AND or OR filters, but can be used by itself as well. This might be more useful as a standalone filter when displaying logs in real time and filtering out unwanted entry types. .. seealso:: :c...
entailment
def add_defined_filter(self, *value): """ Add a DefinedFilter expression to the query. This filter will be considered true if the :class:`smc.monitoring.values.Value` instance has a value. .. seealso:: :class:`smc_monitoring.models.filters.DefinedFilter` for examples. ...
Add a DefinedFilter expression to the query. This filter will be considered true if the :class:`smc.monitoring.values.Value` instance has a value. .. seealso:: :class:`smc_monitoring.models.filters.DefinedFilter` for examples. :param Value value: single value for the fi...
entailment
def resolve_field_ids(ids, **kw): """ Retrieve the log field details based on the LogField constant IDs. This provides a helper to view the fields representation when using different field_formats. Each query class has a default set of field IDs that can easily be looked up to e...
Retrieve the log field details based on the LogField constant IDs. This provides a helper to view the fields representation when using different field_formats. Each query class has a default set of field IDs that can easily be looked up to examine their fields and different label option...
entailment
def _get_field_schema(self): """ Get a list of all of the default fields for this query type. If data is available in the monitor type, a list of field definitions will be returned ahead of the actual data, providing insight into the available fields. If no data is available in a...
Get a list of all of the default fields for this query type. If data is available in the monitor type, a list of field definitions will be returned ahead of the actual data, providing insight into the available fields. If no data is available in a monitor, this will block on recv(). ...
entailment
def execute(self): """ Execute the query with optional timeout. The response to the execute query is the raw payload received from the websocket and will contain multiple dict keys and values. It is more common to call query.fetch_XXX which will filter the return result based on ...
Execute the query with optional timeout. The response to the execute query is the raw payload received from the websocket and will contain multiple dict keys and values. It is more common to call query.fetch_XXX which will filter the return result based on the method. Each result set wil...
entailment
def fetch_raw(self, **kw): """ Fetch the records for this query. This fetch type will return the results in raw dict format. It is possible to limit the number of receives on the socket that return results before exiting by providing max_recv. This fetch should b...
Fetch the records for this query. This fetch type will return the results in raw dict format. It is possible to limit the number of receives on the socket that return results before exiting by providing max_recv. This fetch should be used if you want to return only the result re...
entailment
def fetch_batch(self, formatter=TableFormat, **kw): """ Fetch and return in the specified format. Output format is a formatter class in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch unless providing max_recv keyword with a value greater t...
Fetch and return in the specified format. Output format is a formatter class in :py:mod:`smc_monitoring.models.formatters`. This fetch type will be a single shot fetch unless providing max_recv keyword with a value greater than the default of 1. Keyword arguments available are kw in :met...
entailment
def fetch_live(self, formatter=TableFormat): """ Fetch a live stream query. This is the equivalent of selecting the "Play" option for monitoring fields within the SMC UI. Data will be streamed back in real time. :param formatter: Formatter type for data representation. A...
Fetch a live stream query. This is the equivalent of selecting the "Play" option for monitoring fields within the SMC UI. Data will be streamed back in real time. :param formatter: Formatter type for data representation. Any type in :py:mod:`smc_monitoring.models.formatters`...
entailment
def fetch_meta_by_name(name, filter_context=None, exact_match=True): """ Find the element based on name and optional filters. By default, the name provided uses the standard filter query. Additional filters can be used based on supported collections in the SMC API. :method: GET :param str name:...
Find the element based on name and optional filters. By default, the name provided uses the standard filter query. Additional filters can be used based on supported collections in the SMC API. :method: GET :param str name: element name, can use * as wildcard :param str filter_context: further filte...
entailment
def blacklist(self, src, dst, duration=3600, **kw): """ Add blacklist to all defined engines. Use the cidr netmask at the end of src and dst, such as: 1.1.1.1/32, etc. :param src: source of the entry :param dst: destination of blacklist entry :raises ActionComman...
Add blacklist to all defined engines. Use the cidr netmask at the end of src and dst, such as: 1.1.1.1/32, etc. :param src: source of the entry :param dst: destination of blacklist entry :raises ActionCommandFailed: blacklist apply failed with reason :return: None ...
entailment
def license_install(self, license_file): """ Install a new license. :param str license_file: fully qualified path to the license jar file. :raises: ActionCommandFailed :return: None """ self.make_request( method='update', ...
Install a new license. :param str license_file: fully qualified path to the license jar file. :raises: ActionCommandFailed :return: None
entailment
def visible_security_group_mapping(self, filter=None): # @ReservedAssignment """ Return all security groups assigned to VSS container types. This is only available on SMC >= 6.5. :param str filter: filter for searching by name :raises ActionCommandFailed: element not fo...
Return all security groups assigned to VSS container types. This is only available on SMC >= 6.5. :param str filter: filter for searching by name :raises ActionCommandFailed: element not found on this version of SMC :raises ResourceNotFound: unsupported method on SMC < 6.5 ...
entailment
def references_by_element(self, element_href): """ Return all references to element specified. :param str element_href: element reference :return: list of references where element is used :rtype: list(dict) """ result = self.make_request( method='crea...
Return all references to element specified. :param str element_href: element reference :return: list of references where element is used :rtype: list(dict)
entailment
def export_elements(self, filename='export_elements.zip', typeof='all'): """ Export elements from SMC. Valid types are: all (All Elements)|nw (Network Elements)|ips (IPS Elements)| sv (Services)|rb (Security Policies)|al (Alerts)| vpn (VPN Elements) :param type:...
Export elements from SMC. Valid types are: all (All Elements)|nw (Network Elements)|ips (IPS Elements)| sv (Services)|rb (Security Policies)|al (Alerts)| vpn (VPN Elements) :param type: type of element :param filename: Name of file for export :raises TaskRunFail...
entailment
def import_elements(self, import_file): """ Import elements into SMC. Specify the fully qualified path to the import file. :param str import_file: system level path to file :raises: ActionCommandFailed :return: None """ self.make_request( ...
Import elements into SMC. Specify the fully qualified path to the import file. :param str import_file: system level path to file :raises: ActionCommandFailed :return: None
entailment
def update_protocol_agent(self, protocol_agent): """ Update this service to use the specified protocol agent. After adding the protocol agent to the service you must call `update` on the element to commit. :param str,ProtocolAgent protocol_agent: protocol agent element o...
Update this service to use the specified protocol agent. After adding the protocol agent to the service you must call `update` on the element to commit. :param str,ProtocolAgent protocol_agent: protocol agent element or href :return: None
entailment
def _get_param_values(self, name): """ Return the parameter by name as stored on the protocol agent payload. This loads the data from the local cache versus having to query the SMC for each parameter. :param str name: name of param :rtype: dict """ ...
Return the parameter by name as stored on the protocol agent payload. This loads the data from the local cache versus having to query the SMC for each parameter. :param str name: name of param :rtype: dict
entailment
def parameters(self): """ Protocol agent parameters are settings specific to the protocol agent type. Each protocol agent will have parameter settings that are configurable when a service uses a given protocol agent. Parameters on the protocol agent are templates that define sett...
Protocol agent parameters are settings specific to the protocol agent type. Each protocol agent will have parameter settings that are configurable when a service uses a given protocol agent. Parameters on the protocol agent are templates that define settings exposed in the service. These...
entailment
def protocol_parameter(self): """ The protocol parameter defined from the base protocol agent. This is a read-only element that provides some additional context to the parameter setting. :rtype: ProtocolParameter """ for parameter in self.protocol_agent.p...
The protocol parameter defined from the base protocol agent. This is a read-only element that provides some additional context to the parameter setting. :rtype: ProtocolParameter
entailment
def _update(self, **kwargs): """ Update the mutable field `value`. :rtype: bool """ if 'value' in kwargs and self.protocol_agent_values.get('value') != \ kwargs.get('value'): self.protocol_agent_values.update(value=kwargs['value']) ret...
Update the mutable field `value`. :rtype: bool
entailment
def proxy_server(self): """ The ProxyServer element referenced in this protocol parameter, if any. :return: The proxy server element or None if one is not assigned :rtype: ProxyServer """ # TODO: Workaround for SMC 6.4.3 which only provides the inspected service ...
The ProxyServer element referenced in this protocol parameter, if any. :return: The proxy server element or None if one is not assigned :rtype: ProxyServer
entailment
def _update(self, **kwargs): """ Internal method to update the parameter dict stored in attribute protocol_agent_values. Allows masking of real attribute names to something more sane. :rtype: bool """ updated = False if 'proxy_server' in kwargs: ...
Internal method to update the parameter dict stored in attribute protocol_agent_values. Allows masking of real attribute names to something more sane. :rtype: bool
entailment
def update(self, name, **kwargs): """ Update protocol agent parameters based on the parameter name. Provide the relevant keyword pairs based on the parameter type. When update is called, a boolean is returned indicating whether the field was successfully updated or not. You shoul...
Update protocol agent parameters based on the parameter name. Provide the relevant keyword pairs based on the parameter type. When update is called, a boolean is returned indicating whether the field was successfully updated or not. You should check the return value and call `update` on ...
entailment
def add_access_list(self, accesslist, rank=None): """ Add an access list to the match condition. Valid access list types are IPAccessList (v4 and v6), IPPrefixList (v4 and v6), AS Path, CommunityAccessList, ExtendedCommunityAccessList. """ self.conditions.append( ...
Add an access list to the match condition. Valid access list types are IPAccessList (v4 and v6), IPPrefixList (v4 and v6), AS Path, CommunityAccessList, ExtendedCommunityAccessList.
entailment
def add_metric(self, value, rank=None): """ Add a metric to this match condition :param int value: metric value """ self.conditions.append( dict(metric=value, type='metric', rank=rank))
Add a metric to this match condition :param int value: metric value
entailment
def add_next_hop(self, access_or_prefix_list, rank=None): """ Add a next hop condition. Next hop elements must be of type IPAccessList or IPPrefixList. :raises ElementNotFound: If element specified does not exist """ self.conditions.append(dict( next_...
Add a next hop condition. Next hop elements must be of type IPAccessList or IPPrefixList. :raises ElementNotFound: If element specified does not exist
entailment
def add_peer_address(self, ext_bgp_peer_or_fw, rank=None): """ Add a peer address. Peer address types are ExternalBGPPeer or Engine. :raises ElementNotFound: If element specified does not exist """ if ext_bgp_peer_or_fw.typeof == 'external_bgp_peer': ...
Add a peer address. Peer address types are ExternalBGPPeer or Engine. :raises ElementNotFound: If element specified does not exist
entailment
def remove_condition(self, rank): """ Remove a condition element using it's rank. You can find the rank and element for a match condition by iterating the match condition:: >>> rule1 = rm.route_map_rules.get(0) >>> for condition in rule1.match_condition: ...
Remove a condition element using it's rank. You can find the rank and element for a match condition by iterating the match condition:: >>> rule1 = rm.route_map_rules.get(0) >>> for condition in rule1.match_condition: ... condition ... ...
entailment