def create_cli(self, config, state): ''' Create the CLI using the config and the state ''' if state == State.NOCHANGE: return '' if not config: return '' result = AdvancedThreatDetection.THREAT_DETECTION_STATISTICS if state == State.DESTROY: if self.parent.is_audit(): if self.parent.statistics_exists('statistics'): return None return 'no ' + AdvancedThreatDetection.THREAT_DETECTION_STATISTICS + ' ' + self.stat_type status = 'enable' try: if isinstance(config, dict): status = config.get('status') else: return '' except KeyError: return SimpleType.get_cli(self) if status and status.startswith('disable'): return 'no ' + AdvancedThreatDetection.THREAT_DETECTION_STATISTICS + ' ' + self.stat_type result += ' ' + self.stat_type rate = config.get('number_of_rate') if rate: result += ' number-of-rate ' + str(rate) return result
def get_cli(self): ''' Generate the CLI for this single CLI with optional parameter 'reset' ''' assert self.has_ifc_delta_cfg() config = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) reset_option = (config.get('idle_reset') == 'enable') if config is not None else False # default value for reset: disable reset_option = ' ' + TIMEOUT_RESET_CLI if reset_option else '' return SimpleType.get_cli(self) + reset_option
def get_cli(self): """Generate the CLI for this single failover ip config. """ assert self.has_ifc_delta_cfg() config = util.normalize_param_dict(self.delta_ifc_cfg_value["value"]) netmask = config.get("netmask") if ":" not in config.get("active_ip") else "" standby_ip = config.get("standby_ip") result = SimpleType.get_cli(self) result += " " + netmask + " standby " + standby_ip return " ".join(result.split())
def get_cli(self): '''Generate the CLI for this single cluster ip config. ''' assert self.has_ifc_delta_cfg() config = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) mask = config.get('mask') result = SimpleType.get_cli(self) if mask: result += ' mask ' + mask return ' '.join(result.split())
def get_cli(self): '''Generate the CLI for this single failover ip config. ''' assert self.has_ifc_delta_cfg() config = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) netmask = config.get('netmask') if ':' not in config.get( 'active_ip') else '' standby_ip = config.get('standby_ip') result = SimpleType.get_cli(self) result += ' ' + netmask + ' standby ' + standby_ip return ' '.join(result.split())
def get_cli(self): '''Generate the CLI for this CLACP system-mac configuration. ''' if not self.has_ifc_delta_cfg(): return '' config = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) priority = config.get('priority') result = SimpleType.get_cli(self) if priority: result += ' system-priority ' + priority return ' '.join(result.split())
def get_cli(self): ''' Generate the CLI for this single CLI with optional parameter 'reset' ''' assert self.has_ifc_delta_cfg() config = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) reset_option = ( config.get('idle_reset') == 'enable' ) if config is not None else False # default value for reset: disable reset_option = ' ' + TIMEOUT_RESET_CLI if reset_option else '' return SimpleType.get_cli(self) + reset_option
def get_cli(self): '''Generate the CLI for this single logging trap config. ''' cli = SimpleType.get_cli(self).lower() trap_level_list = [('0', 'emergencies'), ('1', 'alerts'), ('2', 'critical'), ('3', 'errors'), ('4', 'warnings'), ('5', 'notifications'), ('6', 'informational'), ('7', 'debugging')] for item in trap_level_list: (num_level, desc_level) = item cli = cli.replace(num_level, desc_level) return cli
def get_cli(self): '''Generate the CLI for this single logging host config. ''' assert self.has_ifc_delta_cfg() config = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) protocol_port = config.get('protocol_port', '') secure = config.get('secure') secure = " secure" if secure == 'enable' else '' emblem = config.get('emblem') emblem = " format emblem" if emblem == 'enable' else '' result = SimpleType.get_cli(self) result += ' ' + protocol_port + secure + emblem result = result.lower() # This is how ASA saves them result = result.replace('tcp/', '6/') result = result.replace('udp/', '17/') return ' '.join(result.split())