def ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): '''Override the default implementation for modify action: Need to issue no command to delete old one and then issue command to set the new one. ''' if self.get_action() == State.MODIFY: old_cli = self.get_old_cli() if old_cli: self.generate_cli(no_asa_cfg_stack, 'no ' + old_cli) SimpleType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list)
def ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): '''Override the default implementation to take care of the special 'sub-command' class-map, which is actually a global-command. ''' if not self.has_ifc_delta_cfg(): return if self.get_action() == State.DESTROY: 'To generate the no form of the command' for child in self.children.values(): #taking care of removing class-map global command child.ifc2asa(no_asa_cfg_stack, asa_cfg_list) SimpleType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list) return _CompositeType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list)
def ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): '''Override the default implementation to take care of the class-map command which is global rather than sub-command. ''' if not self.has_ifc_delta_cfg(): return class_map = self.children.values()[0] sub_commands = self.children.values()[1] if self.get_action() == State.DESTROY: 'To generate the no form of the command, rid of class-map global command, no need to issue "no class" sub-command' class_map.ifc2asa(no_asa_cfg_stack, asa_cfg_list) 'Only issue "no class" command if we modify the policy-map rather than destroy the policy-map' if self.parent.get_action() != State.DESTROY: SimpleType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list) return 'Generate CLIs from the children, class_map is a global command.' class_map.ifc2asa(no_asa_cfg_stack, asa_cfg_list); sub_commands.mode_command = self.get_child_mode_command() sub_commands.ifc2asa(no_asa_cfg_stack, asa_cfg_list);
def ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): 'Override default implementation to deal with different CLI for no commands.' tmp_no_asa_cfg_stack = [] result = SimpleType.ifc2asa(self, tmp_no_asa_cfg_stack, asa_cfg_list) if tmp_no_asa_cfg_stack: action = self.get_action() if action == State.DESTROY and self.is_removable: if self.get_asa_key() == 'ip audit info': self.generate_cli(no_asa_cfg_stack, 'no ip audit info') else: self.generate_cli(no_asa_cfg_stack, 'no ip audit attack') return result
def gen_ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): '''Generate ASA configuration from IFC configuration delta. @see SimpleType.ifc2asa for parameter details ''' SimpleType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list)
def gen_ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): '''Generate ASA configuration from IFC configuration delta. @see SimpleType.ifc2asa for parameter details ''' SimpleType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list)