sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def load_from_environ(): """ Load the SMC URL, API KEY and optional SSL certificate from the environment. Fields are:: SMC_ADDRESS=http://1.1.1.1:8082 SMC_API_KEY=123abc SMC_CLIENT_CERT=path/to/cert SMC_TIMEOUT = 30 (seconds) SMC_API_VERSION = 6.1 (optio...
Load the SMC URL, API KEY and optional SSL certificate from the environment. Fields are:: SMC_ADDRESS=http://1.1.1.1:8082 SMC_API_KEY=123abc SMC_CLIENT_CERT=path/to/cert SMC_TIMEOUT = 30 (seconds) SMC_API_VERSION = 6.1 (optional - uses latest by default) ...
entailment
def load_from_file(alt_filepath=None): """ Attempt to read the SMC configuration from a dot(.) file in the users home directory. The order in which credentials are parsed is: - Passing credentials as parameters to the session login - Shared credential file (~/.smcrc) - Environment variables ...
Attempt to read the SMC configuration from a dot(.) file in the users home directory. The order in which credentials are parsed is: - Passing credentials as parameters to the session login - Shared credential file (~/.smcrc) - Environment variables :param alt_filepath: Specify a different file...
entailment
def transform_login(config): """ Parse login data as dict. Called from load_from_file and also can be used when collecting information from other sources as well. :param dict data: data representing the valid key/value pairs from smcrc :return: dict dict of settings that can be sent ...
Parse login data as dict. Called from load_from_file and also can be used when collecting information from other sources as well. :param dict data: data representing the valid key/value pairs from smcrc :return: dict dict of settings that can be sent into session.login
entailment
def within_ipv4_network(self, field, values): """ This filter adds specified networks to a filter to check for inclusion. :param str field: name of field to filter on. Taken from 'Show Filter Expression' within SMC. :param list values: network definitions, in...
This filter adds specified networks to a filter to check for inclusion. :param str field: name of field to filter on. Taken from 'Show Filter Expression' within SMC. :param list values: network definitions, in cidr format, i.e: 1.1.1.0/24.
entailment
def within_ipv4_range(self, field, values): """ Add an IP range network filter for relevant address fields. Range (between) filters allow only one range be provided. :param str field: name of field to filter on. Taken from 'Show Filter Expression' within SMC. ...
Add an IP range network filter for relevant address fields. Range (between) filters allow only one range be provided. :param str field: name of field to filter on. Taken from 'Show Filter Expression' within SMC. :param list values: IP range values. Values would be a list of ...
entailment
def exact_ipv4_match(self, field, values): """ An exact IPv4 address match on relevant address fields. :param str field: name of field to filter on. Taken from 'Show Filter Expression' within SMC. :param list values: value/s to add. If more than a single value is ...
An exact IPv4 address match on relevant address fields. :param str field: name of field to filter on. Taken from 'Show Filter Expression' within SMC. :param list values: value/s to add. If more than a single value is provided, the query is modified to use UNION vs. == ...
entailment
def download(self, timeout=5, wait_for_finish=False): """ Download Package or Engine Update :param int timeout: timeout between queries :raises TaskRunFailed: failure during task status :rtype: TaskOperationPoller """ return Task.execute(self, 'download', timeout...
Download Package or Engine Update :param int timeout: timeout between queries :raises TaskRunFailed: failure during task status :rtype: TaskOperationPoller
entailment
def activate(self, resource=None, timeout=3, wait_for_finish=False): """ Activate this package on the SMC :param list resource: node href's to activate on. Resource is only required for software upgrades :param int timeout: timeout between queries :raises TaskRunF...
Activate this package on the SMC :param list resource: node href's to activate on. Resource is only required for software upgrades :param int timeout: timeout between queries :raises TaskRunFailed: failure during activation (downloading, etc) :rtype: TaskOperationPoller
entailment
def all(self): """ Return all entries :rtype: list(dict) """ attribute = self._attr[0] return self.profile.data.get(attribute, [])
Return all entries :rtype: list(dict)
entailment
def create(cls, name, sandbox_data_center, portal_username=None, comment=None): """ Create a Sandbox Service element """ json = { 'name': name, 'sandbox_data_center': element_resolver(sandbox_data_center), 'portal_username': portal_username if portal_u...
Create a Sandbox Service element
entailment
def available_api_versions(base_url, timeout=10, verify=True): """ Get all available API versions for this SMC :return version numbers :rtype: list """ try: r = requests.get('%s/api' % base_url, timeout=timeout, verify=verify) # no session required ...
Get all available API versions for this SMC :return version numbers :rtype: list
entailment
def get_api_version(base_url, api_version=None, timeout=10, verify=True): """ Get the API version specified or resolve the latest version :return api version :rtype: float """ versions = available_api_versions(base_url, timeout, verify) newest_version = max([float(i) for i in versions]...
Get the API version specified or resolve the latest version :return api version :rtype: float
entailment
def create(cls, sessions=None): """ A session manager will be mounted to the SMCRequest class through this classmethod. If there is already an existing SessionManager, that is returned instead. :param list sessions: a list of Session objects :rtype: SessionManage...
A session manager will be mounted to the SMCRequest class through this classmethod. If there is already an existing SessionManager, that is returned instead. :param list sessions: a list of Session objects :rtype: SessionManager
entailment
def get_default_session(self): """ The default session is nothing more than the first session added into the session handler pool. This will likely change in the future but for now each session identifies the domain and also manages domain switching within a single session. ...
The default session is nothing more than the first session added into the session handler pool. This will likely change in the future but for now each session identifies the domain and also manages domain switching within a single session. :rtype: Session
entailment
def _register(self, session): """ Register a session """ if session.session_id: self._sessions[session.name] = session
Register a session
entailment
def _deregister(self, session): """ Deregister a session. """ if session in self: self._sessions.pop(self._get_session_key(session), None)
Deregister a session.
entailment
def manager(self): """ Return the session manager for this session :rtype: SessionManager """ manager = SMCRequest._session_manager if not self._manager \ else self._manager if not manager: raise SessionManagerNotFound('A session manager w...
Return the session manager for this session :rtype: SessionManager
entailment
def session_id(self): """ The session ID in header type format. Can be inserted into a connection if necessary using:: {'Cookie': session.session_id} :rtype: str """ return None if not self.session or 'JSESSIONID' not in \ self.se...
The session ID in header type format. Can be inserted into a connection if necessary using:: {'Cookie': session.session_id} :rtype: str
entailment
def name(self): """ Return the administrator name for this session. Can be None if the session has not yet been established. .. note:: The administrator name was introduced in SMC version 6.4. Previous versions will show the unique session identifier for ...
Return the administrator name for this session. Can be None if the session has not yet been established. .. note:: The administrator name was introduced in SMC version 6.4. Previous versions will show the unique session identifier for this session. :rtyp...
entailment
def current_user(self): """ .. versionadded:: 0.6.0 Requires SMC version >= 6.4 Return the currently logged on API Client user element. :raises UnsupportedEntryPoint: Current user is only supported with SMC version >= 6.4 :rtype: Element ...
.. versionadded:: 0.6.0 Requires SMC version >= 6.4 Return the currently logged on API Client user element. :raises UnsupportedEntryPoint: Current user is only supported with SMC version >= 6.4 :rtype: Element
entailment
def login(self, url=None, api_key=None, login=None, pwd=None, api_version=None, timeout=None, verify=True, alt_filepath=None, domain=None, **kwargs): """ Login to SMC API and retrieve a valid session. Sessions use a pool connection manager to provide dynamic scalability ...
Login to SMC API and retrieve a valid session. Sessions use a pool connection manager to provide dynamic scalability during times of increased load. Each session is managed by a global session manager making it possible to have more than one session per interpreter. An example l...
entailment
def _build_auth_request(self, verify=False, **kwargs): """ Build the authentication request to SMC """ json = { 'domain': self.domain } credential = self.credential params = {} if credential.provider_name.startswith('lms'): ...
Build the authentication request to SMC
entailment
def _get_session(self, request): """ Authenticate the request dict :param dict request: request dict built from user input :raises SMCConnectionError: failure to connect :return: python requests session :rtype: requests.Session """ _session = requ...
Authenticate the request dict :param dict request: request dict built from user input :raises SMCConnectionError: failure to connect :return: python requests session :rtype: requests.Session
entailment
def logout(self): """ Logout session from SMC :return: None """ if not self.session: self.manager._deregister(self) return try: r = self.session.put(self.entry_points.get('logout')) if r.status_code == 204: ...
Logout session from SMC :return: None
entailment
def refresh(self): """ Refresh session on 401. This is called automatically if your existing session times out and resends the operation/s which returned the error. :raises SMCConnectionError: Problem re-authenticating using existing api credentials """ ...
Refresh session on 401. This is called automatically if your existing session times out and resends the operation/s which returned the error. :raises SMCConnectionError: Problem re-authenticating using existing api credentials
entailment
def switch_domain(self, domain): """ Switch from one domain to another. You can call session.login() with a domain key value to log directly into the domain of choice or alternatively switch from domain to domain. The user must have permissions to the domain or unauthorized will ...
Switch from one domain to another. You can call session.login() with a domain key value to log directly into the domain of choice or alternatively switch from domain to domain. The user must have permissions to the domain or unauthorized will be returned. In addition, when switching domains, you...
entailment
def set_retry_on_busy(self, total=5, backoff_factor=0.1, status_forcelist=None, **kwargs): """ Mount a custom retry object on the current session that allows service level retries when the SMC might reply with a Service Unavailable (503) message. This can be possible in larger environmen...
Mount a custom retry object on the current session that allows service level retries when the SMC might reply with a Service Unavailable (503) message. This can be possible in larger environments with higher database activity. You can all this on the existing session, or provide as a dict to the...
entailment
def _get_log_schema(self): """ Get the log schema for this SMC version. :return: dict """ if self.session and self.session_id: schema = '{}/{}/monitoring/log/schemas'.format(self.url, self.api_version) response = self.session.get( ...
Get the log schema for this SMC version. :return: dict
entailment
def has_credentials(self): """ Does this session have valid credentials :rtype: bool """ return all([ getattr(self, '_%s' % field, None) is not None for field in self.CredentialMap.get(self.provider_name)])
Does this session have valid credentials :rtype: bool
entailment
def add(self, data): """ Add a single entry to field. Entries can be added to a rule using the href of the element or by loading the element directly. Element should be of type :py:mod:`smc.elements.network`. After modifying rule, call :py:meth:`~.save`. Example...
Add a single entry to field. Entries can be added to a rule using the href of the element or by loading the element directly. Element should be of type :py:mod:`smc.elements.network`. After modifying rule, call :py:meth:`~.save`. Example of adding entry by element:: ...
entailment
def add_many(self, data): """ Add multiple entries to field. Entries should be list format. Entries can be of types relavant to the field type. For example, for source and destination fields, elements may be of type :py:mod:`smc.elements.network` or be the elements direct href, ...
Add multiple entries to field. Entries should be list format. Entries can be of types relavant to the field type. For example, for source and destination fields, elements may be of type :py:mod:`smc.elements.network` or be the elements direct href, or a combination of both. Add...
entailment
def update_field(self, elements): """ Update the field with a list of provided values but only if the values are different. Return a boolean indicating whether a change was made indicating whether `save` should be called. If the field is currently set to any or none, then no comp...
Update the field with a list of provided values but only if the values are different. Return a boolean indicating whether a change was made indicating whether `save` should be called. If the field is currently set to any or none, then no comparison is made and field is updated. ...
entailment
def all_as_href(self): """ Return all elements without resolving to :class:`smc.elements.network` or :class:`smc.elements.service`. Just raw representation as href. :return: elements in href form :rtype: list """ if not self.is_any and not self.is_none: ...
Return all elements without resolving to :class:`smc.elements.network` or :class:`smc.elements.service`. Just raw representation as href. :return: elements in href form :rtype: list
entailment
def all(self): """ Return all destinations for this rule. Elements returned are of the object type for the given element for further introspection. Search the fields in rule:: for sources in rule.sources.all(): print('My source: %s' % sources) ...
Return all destinations for this rule. Elements returned are of the object type for the given element for further introspection. Search the fields in rule:: for sources in rule.sources.all(): print('My source: %s' % sources) :return: elements by resolved ob...
entailment
def create(cls, name, user=None, network_element=None, domain_name=None, zone=None, executable=None): """ Create a match expression :param str name: name of match expression :param str user: name of user or user group :param Element network_element: valid network ...
Create a match expression :param str name: name of match expression :param str user: name of user or user group :param Element network_element: valid network element type, i.e. host, network, etc :param DomainName domain_name: domain name network element :param Zone zone: zone t...
entailment
def http_proxy(self, proxy, proxy_port, user=None, password=None): """ .. versionadded:: 0.5.7 Requires SMC and engine version >= 6.4 Set http proxy settings for Antivirus updates. :param str proxy: proxy IP address :param str,int proxy_port: proxy p...
.. versionadded:: 0.5.7 Requires SMC and engine version >= 6.4 Set http proxy settings for Antivirus updates. :param str proxy: proxy IP address :param str,int proxy_port: proxy port :param str user: optional user for authentication
entailment
def enable(self): """ Enable antivirus on the engine """ self.update(antivirus_enabled=True, virus_mirror='update.nai.com/Products/CommonUpdater' if \ not self.get('virus_mirror') else self.virus_mirror, antivirus_update_tim...
Enable antivirus on the engine
entailment
def enable(self, http_proxy=None): """ Enable URL Filtering on the engine. If proxy servers are needed, provide a list of HTTPProxy elements. :param http_proxy: list of proxies for GTI connections :type http_proxy: list(str,HttpProxy) """ self.update(ts_e...
Enable URL Filtering on the engine. If proxy servers are needed, provide a list of HTTPProxy elements. :param http_proxy: list of proxies for GTI connections :type http_proxy: list(str,HttpProxy)
entailment
def status(self): """ Status of sandbox on this engine :rtype: bool """ if 'sandbox_type' in self.engine.data: if self.engine.sandbox_type == 'none': return False return True return False
Status of sandbox on this engine :rtype: bool
entailment
def disable(self): """ Disable the sandbox on this engine. """ self.engine.data.update(sandbox_type='none') self.pop('cloud_sandbox_settings', None) #pre-6.3 self.pop('sandbox_settings', None)
Disable the sandbox on this engine.
entailment
def enable(self, license_key, license_token, sandbox_type='cloud_sandbox', service='Automatic', http_proxy=None, sandbox_data_center='Automatic'): """ Enable sandbox on this engine. Provide a valid license key and license token obtained from your engine licensing. ...
Enable sandbox on this engine. Provide a valid license key and license token obtained from your engine licensing. Requires SMC version >= 6.3. .. note:: Cloud sandbox is a feature that requires an engine license. :param str license_key: license key for specific engine :...
entailment
def add_tls_credential(self, credentials): """ Add a list of TLSServerCredential to this engine. TLSServerCredentials can be in element form or can also be the href for the element. :param credentials: list of pre-created TLSServerCredentials :type creden...
Add a list of TLSServerCredential to this engine. TLSServerCredentials can be in element form or can also be the href for the element. :param credentials: list of pre-created TLSServerCredentials :type credentials: list(str,TLSServerCredential) :return: None
entailment
def remove_tls_credential(self, credentials): """ Remove a list of TLSServerCredentials on this engine. :param credentials: list of credentials to remove from the engine :type credentials: list(str,TLSServerCredential) :return: None """ fo...
Remove a list of TLSServerCredentials on this engine. :param credentials: list of credentials to remove from the engine :type credentials: list(str,TLSServerCredential) :return: None
entailment
def policy_validation_settings(**kwargs): """ Set policy validation settings. This is used when policy based tasks are created and `validate_policy` is set to True. The following kwargs can be overridden in the create constructor. :param bool configuration_validation_for_alert_chain: default Fa...
Set policy validation settings. This is used when policy based tasks are created and `validate_policy` is set to True. The following kwargs can be overridden in the create constructor. :param bool configuration_validation_for_alert_chain: default False :param bool duplicate_rule_check_settings: def...
entailment
def log_target_types(all_logs=False, **kwargs): """ Log targets for log tasks. A log target defines the log types that will be affected by the operation. For example, when creating a DeleteLogTask, you can specify which log types are deleted. :param bool for_alert_event_log: alert events traces...
Log targets for log tasks. A log target defines the log types that will be affected by the operation. For example, when creating a DeleteLogTask, you can specify which log types are deleted. :param bool for_alert_event_log: alert events traces (default: False) :param bool for_alert_log: alerts (def...
entailment
def activate(self): """ If a task is suspended, this will re-activate the task. Usually it's best to check for activated before running this:: task = RefreshPolicyTask('mytask') for scheduler in task.task_schedule: if scheduler.activated: ...
If a task is suspended, this will re-activate the task. Usually it's best to check for activated before running this:: task = RefreshPolicyTask('mytask') for scheduler in task.task_schedule: if scheduler.activated: scheduler.suspend() ...
entailment
def add_schedule(self, name, activation_date, day_period='one_time', final_action='ALERT_FAILURE', activated=True, minute_period='one_time', day_mask=None, repeat_until_date=None, comment=None): """ Add a schedule to an existing task. ...
Add a schedule to an existing task. :param str name: name for this schedule :param int activation_date: when to start this task. Activation date should be a UTC time represented in milliseconds. :param str day_period: when this task should be run. Valid options: ...
entailment
def create(cls, name, engines, comment=None, validate_policy=True, **kwargs): """ Create a refresh policy task associated with specific engines. A policy refresh task does not require a policy be specified. The policy used in the refresh will be the policy already ...
Create a refresh policy task associated with specific engines. A policy refresh task does not require a policy be specified. The policy used in the refresh will be the policy already assigned to the engine. :param str name: name of this task :param engines: list of Engin...
entailment
def create(cls, name, engines, policy=None, comment=None, **kwargs): """ Create a new validate policy task. If a policy is not specified, the engines existing policy will be validated. Override default validation settings as kwargs. :param str name: name of task ...
Create a new validate policy task. If a policy is not specified, the engines existing policy will be validated. Override default validation settings as kwargs. :param str name: name of task :param engines: list of engines to validate :type engines: list(Engine) :...
entailment
def create(cls, name, master_engines, comment=None): """ Create a refresh task for master engines. :param str name: name of task :param master_engines: list of master engines for this task :type master_engines: list(MasterEngine) :param str comment: optional com...
Create a refresh task for master engines. :param str name: name of task :param master_engines: list of master engines for this task :type master_engines: list(MasterEngine) :param str comment: optional comment :raises CreateElementFailed: failed to create the task ...
entailment
def create(cls, name, servers=None, time_range='yesterday', all_logs=False, filter_for_delete=None, comment=None, **kwargs): """ Create a new delete log task. Provide True to all_logs to delete all log types. Otherwise provide kwargs to specify each log by type of interest...
Create a new delete log task. Provide True to all_logs to delete all log types. Otherwise provide kwargs to specify each log by type of interest. :param str name: name for this task :param servers: servers to back up. Servers must be instances of management servers o...
entailment
def create(cls, name, servers, backup_log_data=False, encrypt_password=None, comment=None): """ Create a new server backup task. This task provides the ability to backup individual or all management and log servers under SMC management. :param str name: na...
Create a new server backup task. This task provides the ability to backup individual or all management and log servers under SMC management. :param str name: name of task :param servers: servers to back up. Servers must be instances of management servers or log serve...
entailment
def create(cls, name, engines, include_core_files=False, include_slapcat_output=False, comment=None): """ Create an sginfo task. :param str name: name of task :param engines: list of engines to apply the sginfo task :type engines: list(Engine) :pa...
Create an sginfo task. :param str name: name of task :param engines: list of engines to apply the sginfo task :type engines: list(Engine) :param bool include_core_files: include core files in the sginfo backup (default: False) :param bool include_slapcat_out...
entailment
def send_request(user_session, method, request): """ Send request to SMC :param Session user_session: session object :param str method: method for request :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult """ if user_ses...
Send request to SMC :param Session user_session: session object :param str method: method for request :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult
entailment
def file_download(user_session, request): """ Called when GET request specifies a filename to retrieve. :param Session user_session: session object :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult """ logger.debug('Download...
Called when GET request specifies a filename to retrieve. :param Session user_session: session object :param SMCRequest request: request object :raises SMCOperationFailure: failure with reason :rtype: SMCResult
entailment
def file_upload(user_session, method, request): """ Perform a file upload PUT/POST to SMC. Request should have the files attribute set which will be an open handle to the file that will be binary transfer. :param Session user_session: session object :param str method: method to use, could b...
Perform a file upload PUT/POST to SMC. Request should have the files attribute set which will be an open handle to the file that will be binary transfer. :param Session user_session: session object :param str method: method to use, could be put or post :param SMCRequest request: request object ...
entailment
def rename(self, name): """ Rename this node :param str name: new name for node """ self.update(name='{} node {}'.format(name, self.nodeid))
Rename this node :param str name: new name for node
entailment
def _create(cls, name, node_type, nodeid=1, loopback_ndi=None): """ Create the node/s for the engine. This isn't called directly, instead it is used when engine.create() is called :param str name: name of node :param str node_type: based on engine type specified ...
Create the node/s for the engine. This isn't called directly, instead it is used when engine.create() is called :param str name: name of node :param str node_type: based on engine type specified :param int nodeid: used to identify which node :param list LoopbackInterface loopbac...
entailment
def loopback_interface(self): """ Loopback interfaces for this node. This will return empty if the engine is not a layer 3 firewall type:: >>> engine = Engine('dingo') >>> for node in engine.nodes: ... for loopback in node.loopback_interface: ...
Loopback interfaces for this node. This will return empty if the engine is not a layer 3 firewall type:: >>> engine = Engine('dingo') >>> for node in engine.nodes: ... for loopback in node.loopback_interface: ... loopback ... ...
entailment
def bind_license(self, license_item_id=None): """ Auto bind license, uses dynamic if POS is not found :param str license_item_id: license id :raises LicenseError: binding license failed, possibly no licenses :return: None """ params = {'license_item_id': license_...
Auto bind license, uses dynamic if POS is not found :param str license_item_id: license id :raises LicenseError: binding license failed, possibly no licenses :return: None
entailment
def initial_contact(self, enable_ssh=True, time_zone=None, keyboard=None, install_on_server=None, filename=None, as_base64=False): """ Allows to save the initial contact for for the specified node :p...
Allows to save the initial contact for for the specified node :param bool enable_ssh: flag to know if we allow the ssh daemon on the specified node :param str time_zone: optional time zone to set on the specified node :param str keyboard: optional keyboard to set on the specified...
entailment
def interface_status(self): """ Obtain the interface status for this node. This will return an iterable that provides information about the existing interfaces. Retrieve a single interface status:: >>> node = engine.nodes[0] >>> node Node(name...
Obtain the interface status for this node. This will return an iterable that provides information about the existing interfaces. Retrieve a single interface status:: >>> node = engine.nodes[0] >>> node Node(name=ngf-1065) >>> node.interface_status...
entailment
def hardware_status(self): """ Obtain hardware statistics for various areas of this node. See :class:`~HardwareStatus` for usage. :raises NodeCommandFailed: failure to retrieve current status :rtype: HardwareStatus """ result = self.make_request(...
Obtain hardware statistics for various areas of this node. See :class:`~HardwareStatus` for usage. :raises NodeCommandFailed: failure to retrieve current status :rtype: HardwareStatus
entailment
def go_online(self, comment=None): """ Executes a Go-Online operation on the specified node typically done when the node has already been forced offline via :func:`go_offline` :param str comment: (optional) comment to audit :raises NodeCommandFailed: online not available...
Executes a Go-Online operation on the specified node typically done when the node has already been forced offline via :func:`go_offline` :param str comment: (optional) comment to audit :raises NodeCommandFailed: online not available :return: None
entailment
def go_offline(self, comment=None): """ Executes a Go-Offline operation on the specified node :param str comment: optional comment to audit :raises NodeCommandFailed: offline not available :return: None """ self.make_request( NodeCommandFailed, ...
Executes a Go-Offline operation on the specified node :param str comment: optional comment to audit :raises NodeCommandFailed: offline not available :return: None
entailment
def go_standby(self, comment=None): """ Executes a Go-Standby operation on the specified node. To get the status of the current node/s, run :func:`status` :param str comment: optional comment to audit :raises NodeCommandFailed: engine cannot go standby :return: None ...
Executes a Go-Standby operation on the specified node. To get the status of the current node/s, run :func:`status` :param str comment: optional comment to audit :raises NodeCommandFailed: engine cannot go standby :return: None
entailment
def lock_online(self, comment=None): """ Executes a Lock-Online operation on the specified node :param str comment: comment for audit :raises NodeCommandFailed: cannot lock online :return: None """ self.make_request( NodeCommandFailed, met...
Executes a Lock-Online operation on the specified node :param str comment: comment for audit :raises NodeCommandFailed: cannot lock online :return: None
entailment
def lock_offline(self, comment=None): """ Executes a Lock-Offline operation on the specified node Bring back online by running :func:`go_online`. :param str comment: comment for audit :raises NodeCommandFailed: lock offline failed :return: None """ self.m...
Executes a Lock-Offline operation on the specified node Bring back online by running :func:`go_online`. :param str comment: comment for audit :raises NodeCommandFailed: lock offline failed :return: None
entailment
def reset_user_db(self, comment=None): """ Executes a Send Reset LDAP User DB Request operation on this node. :param str comment: comment to audit :raises NodeCommandFailed: failure resetting db :return: None """ self.make_request( NodeCommand...
Executes a Send Reset LDAP User DB Request operation on this node. :param str comment: comment to audit :raises NodeCommandFailed: failure resetting db :return: None
entailment
def debug(self, filter_enabled=False): """ View all debug settings for this node. This will return a debug object. View the debug object repr to identify settings to enable or disable and submit the object to :meth:`set_debug` to enable settings. Add filter_enabl...
View all debug settings for this node. This will return a debug object. View the debug object repr to identify settings to enable or disable and submit the object to :meth:`set_debug` to enable settings. Add filter_enabled=True argument to see only enabled settings :par...
entailment
def set_debug(self, debug): """ Set the debug settings for this node. This should be a modified :class:`~Debug` instance. This will take effect immediately on the specified node. :param Debug debug: debug object with specified settings :raises NodeCommandFailed: ...
Set the debug settings for this node. This should be a modified :class:`~Debug` instance. This will take effect immediately on the specified node. :param Debug debug: debug object with specified settings :raises NodeCommandFailed: fail to communicate with node :return: N...
entailment
def reboot(self, comment=None): """ Send reboot command to this node. :param str comment: comment to audit :raises NodeCommandFailed: reboot failed with reason :return: None """ self.make_request( NodeCommandFailed, method='update', ...
Send reboot command to this node. :param str comment: comment to audit :raises NodeCommandFailed: reboot failed with reason :return: None
entailment
def sginfo(self, include_core_files=False, include_slapcat_output=False, filename='sginfo.gz'): """ Get the SG Info of the specified node. Optionally provide a filename, otherwise default to 'sginfo.gz'. Once you run gzip -d <filename>, the inner contents wi...
Get the SG Info of the specified node. Optionally provide a filename, otherwise default to 'sginfo.gz'. Once you run gzip -d <filename>, the inner contents will be in .tar format. :param include_core_files: flag to include or not core files :param include_slapcat_output: flag to include...
entailment
def ssh(self, enable=True, comment=None): """ Enable or disable SSH :param bool enable: enable or disable SSH daemon :param str comment: optional comment for audit :raises NodeCommandFailed: cannot enable SSH daemon :return: None """ self.make_request( ...
Enable or disable SSH :param bool enable: enable or disable SSH daemon :param str comment: optional comment for audit :raises NodeCommandFailed: cannot enable SSH daemon :return: None
entailment
def change_ssh_pwd(self, pwd=None, comment=None): """ Executes a change SSH password operation on the specified node :param str pwd: changed password value :param str comment: optional comment for audit log :raises NodeCommandFailed: cannot change ssh password :return: N...
Executes a change SSH password operation on the specified node :param str pwd: changed password value :param str comment: optional comment for audit log :raises NodeCommandFailed: cannot change ssh password :return: None
entailment
def logging_subsystem(self): """ A collection of logging subsystem statuses :rtype: Status """ for item in self: if item.name.startswith('Logging'): for s in item_status(item): yield s
A collection of logging subsystem statuses :rtype: Status
entailment
def filesystem(self): """ A collection of filesystem related statuses :rtype: Status """ for item in self: if item.name.startswith('File System'): for s in item_status(item): yield s
A collection of filesystem related statuses :rtype: Status
entailment
def delete(self, location_name): """ Remove a given location by location name. This operation is performed only if the given location is valid, and if so, `update` is called automatically. :param str location: location name or location ref :raises UpdateElementFa...
Remove a given location by location name. This operation is performed only if the given location is valid, and if so, `update` is called automatically. :param str location: location name or location ref :raises UpdateElementFailed: failed to update element with reason :r...
entailment
def update_or_create(self, location, contact_address, with_status=False, **kw): """ Update an existing contact address or create if the location does not exist. :param str location: name of the location, the location will be added if it doesn't exist :param s...
Update an existing contact address or create if the location does not exist. :param str location: name of the location, the location will be added if it doesn't exist :param str contact_address: contact address IP. Can be the string 'dynamic' if this should be a ...
entailment
def get(self, interface_id, interface_ip=None): """ Get will return a list of interface references based on the specified interface id. Multiple references can be returned if a single interface has multiple IP addresses assigned. :return: If interface_ip is provided, a s...
Get will return a list of interface references based on the specified interface id. Multiple references can be returned if a single interface has multiple IP addresses assigned. :return: If interface_ip is provided, a single ContactAddressNode element is returned if found. O...
entailment
def change_interface_id(self, interface_id): """ Generic change interface ID for VLAN interfaces that are not Inline Interfaces (non-VLAN sub interfaces do not have an interface_id field). :param str, int interface_id: interface ID value """ _, second = s...
Generic change interface ID for VLAN interfaces that are not Inline Interfaces (non-VLAN sub interfaces do not have an interface_id field). :param str, int interface_id: interface ID value
entailment
def change_vlan_id(self, vlan_id): """ Change a VLAN id :param str vlan_id: new vlan """ first, _ = self.nicid.split('.') self.update(nicid='{}.{}'.format(first, str(vlan_id)))
Change a VLAN id :param str vlan_id: new vlan
entailment
def vlan_id(self): """ VLAN ID for this interface, if any :return: VLAN identifier :rtype: str """ nicid = self.nicid if nicid: v = nicid.split('.') if len(v) > 1: return nicid.split('.')[1]
VLAN ID for this interface, if any :return: VLAN identifier :rtype: str
entailment
def create(cls, interface_id, logical_interface_ref, second_interface_id=None, zone_ref=None, **kwargs): """ :param str interface_id: two interfaces, i.e. '1-2', '4-5', '7-10', etc :param str logical_ref: logical interface reference :param str zone_ref: reference to zone, set...
:param str interface_id: two interfaces, i.e. '1-2', '4-5', '7-10', etc :param str logical_ref: logical interface reference :param str zone_ref: reference to zone, set on second inline pair :rtype: dict
entailment
def change_vlan_id(self, vlan_id): """ Change a VLAN id for an inline interface. :param str vlan_id: New VLAN id. Can be in format '1-2' or a single numerical value. If in '1-2' format, this specifies the vlan ID for the first inline interface and the rightmost ...
Change a VLAN id for an inline interface. :param str vlan_id: New VLAN id. Can be in format '1-2' or a single numerical value. If in '1-2' format, this specifies the vlan ID for the first inline interface and the rightmost for the second. :return: None
entailment
def change_interface_id(self, newid): """ Change the inline interface ID. The current format is nicid='1-2', where '1' is the top level interface ID (first), and '2' is the second interface in the pair. Consider the existing nicid in case this is a VLAN. :param s...
Change the inline interface ID. The current format is nicid='1-2', where '1' is the top level interface ID (first), and '2' is the second interface in the pair. Consider the existing nicid in case this is a VLAN. :param str newid: string defining new pair, i.e. '3-4' :re...
entailment
def vlan_id(self): """ VLAN ID for this interface, if any :return: VLAN identifier :rtype: str """ nicids = self.nicid.split('-') if nicids: u = [] for vlan in nicids: if vlan.split('.')[-1] not in u: ...
VLAN ID for this interface, if any :return: VLAN identifier :rtype: str
entailment
def create(cls, interface_id, logical_interface_ref, **kw): """ :param int interface_id: the interface id :param str logical_ref: logical interface reference, must be unique from inline intfs :rtype: dict """ data = {'inspect_unspecified_vlans': True, ...
:param int interface_id: the interface id :param str logical_ref: logical interface reference, must be unique from inline intfs :rtype: dict
entailment
def create(cls, interface_id, address, network_value, nodeid=1, **kwargs): """ :param int interface_id: interface id :param str address: ip address of the interface :param str network_value: network/netmask, i.e. x.x.x.x/24 :param int nodeid: for clusters, used to ...
:param int interface_id: interface id :param str address: ip address of the interface :param str network_value: network/netmask, i.e. x.x.x.x/24 :param int nodeid: for clusters, used to identify the node number :rtype: dict
entailment
def create(cls, interface_id, address=None, network_value=None, nodeid=1, **kw): """ :param int interface_id: interface id :param str address: address of this interface :param str network_value: network of this interface in cidr x.x.x.x/24 :param int nodeid: if a c...
:param int interface_id: interface id :param str address: address of this interface :param str network_value: network of this interface in cidr x.x.x.x/24 :param int nodeid: if a cluster, identifies which node this is for :rtype: dict
entailment
def create(cls, address, ospf_area=None, **kwargs): """ Create a loopback interface. Uses parent constructor :rtype: LoopbackClusterInterface """ return super(LoopbackClusterInterface, cls).create( address=address, network_value='{}/32'.format(add...
Create a loopback interface. Uses parent constructor :rtype: LoopbackClusterInterface
entailment
def delete(self): """ Delete a loopback cluster virtual interface from this engine. Changes to the engine configuration are done immediately. You can find cluster virtual loopbacks by iterating at the engine level:: for loopbacks in engine.loopback_...
Delete a loopback cluster virtual interface from this engine. Changes to the engine configuration are done immediately. You can find cluster virtual loopbacks by iterating at the engine level:: for loopbacks in engine.loopback_interface: ... ...
entailment
def add_cvi_loopback(self, address, ospf_area=None, **kw): """ Add a loopback interface as a cluster virtual loopback. This enables the loopback to 'float' between cluster members. Changes are committed immediately. :param str address: ip address for loopback :pa...
Add a loopback interface as a cluster virtual loopback. This enables the loopback to 'float' between cluster members. Changes are committed immediately. :param str address: ip address for loopback :param int rank: rank of this entry :param str,Element ospf_area: optional...
entailment
def add_single(self, address, rank=1, nodeid=1, ospf_area=None, **kwargs): """ Add a single loopback interface to this engine. This is used for single or virtual FW engines. :param str address: ip address for loopback :param int nodeid: nodeid to apply. Default to 1 for ...
Add a single loopback interface to this engine. This is used for single or virtual FW engines. :param str address: ip address for loopback :param int nodeid: nodeid to apply. Default to 1 for single FW :param str, Element ospf_area: ospf area href or element :raises Upda...
entailment
def delete(self): """ Delete a loopback interface from this engine. Changes to the engine configuration are done immediately. A simple way to obtain an existing loopback is to iterate the loopbacks or to get by address:: lb = engine.loopback_interfac...
Delete a loopback interface from this engine. Changes to the engine configuration are done immediately. A simple way to obtain an existing loopback is to iterate the loopbacks or to get by address:: lb = engine.loopback_interface.get('127.0.0.10') lb.del...
entailment
def create(cls, name, address, base_dn, bind_user_id=None, bind_password=None, port=389, protocol='ldap', tls_profile=None, tls_identity=None, domain_controller=None, supported_method=None, timeout=10, max_search_result=0, page_size=0, internet_auth_service_enabled=False, **kwargs): """ ...
Create an AD server element using basic settings. You can also provide additional kwargs documented in the class description:: ActiveDirectoryServer.create(name='somedirectory', address='10.10.10.10', base_dn='dc=domain,dc=net', bind_user_id='...
entailment
def update_or_create(cls, with_status=False, **kwargs): """ Update or create active directory configuration. :param dict kwargs: kwargs to satisfy the `create` constructor arguments if the element doesn't exist or attributes to change :raises CreateElementFailed: fai...
Update or create active directory configuration. :param dict kwargs: kwargs to satisfy the `create` constructor arguments if the element doesn't exist or attributes to change :raises CreateElementFailed: failed creating element :return: element instance by type or 3-tuple if...
entailment
def create(cls, name, entries=None, comment=None, **kw): """ Create an Access List Entry. Depending on the access list type you are creating (IPAccessList, IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList, ExtendedCommunityAccessList), entries will define a dict...
Create an Access List Entry. Depending on the access list type you are creating (IPAccessList, IPv6AccessList, IPPrefixList, IPv6PrefixList, CommunityAccessList, ExtendedCommunityAccessList), entries will define a dict of the valid attributes for that ACL type. Each class has a defined ...
entailment
def add_entry(self, **kw): """ Add an entry to an AccessList. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failure to modify with reason :return: None """ self.data.setdefault('entries', []).append( ...
Add an entry to an AccessList. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failure to modify with reason :return: None
entailment
def remove_entry(self, **field_value): """ Remove an AccessList entry by field specified. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failed to modify with reason :return: None """ field, value = next(i...
Remove an AccessList entry by field specified. Use the supported arguments for the inheriting class for keyword arguments. :raises UpdateElementFailed: failed to modify with reason :return: None
entailment