def ifc2asa(self, no_asa_cfg_stack, asa_cfg_list, interfaces = None): '''Generate ASA configuration from IFC configuration delta. @see DMObject.ifc2asa for parameter details ''' if not self.has_ifc_delta_cfg(): return action = self.get_action() if action == State.NOCHANGE: return if action == State.DESTROY and self.is_removable: self.generate_cli(no_asa_cfg_stack, 'no ' + self.get_cli()) else: self.generate_cli(asa_cfg_list, self.get_cli()) # apply the pool to the management interface value = normalize_param_dict(self.delta_ifc_cfg_value['value']) intf = self.get_top().get_mgmt_interface() if not intf: # default management interface: m0/0 intf = 'm0/0' attr = self.get_mgmt_intf_attributes(intf) if attr == None: return clii = CLIInteraction(mode_command='interface ' + util.normalize_interface_name(intf), command='ip address ' + attr['ip'] + ' ' + attr['mask'] + ' cluster-pool ' + value['pool_name'], response_parser=cluster_response_parser) asa_cfg_list.append(clii) SimpleType.ifc2asa(self, no_asa_cfg_stack, asa_cfg_list)
def get_cli(self): """ Normalize the interface name before filling the template. """ assert self.has_ifc_delta_cfg() value = util.normalize_param_dict(self.delta_ifc_cfg_value["value"]) value["interface"] = util.normalize_interface_name(self.get_top().get_failover_link_interface()) return " ".join((self.asa_gen_template % value).split())
def get_cli(self): ''' Normalize the interface name before filling the template. ''' assert self.has_ifc_delta_cfg() value = util.normalize_param_dict(self.delta_ifc_cfg_value['value']) value['interface'] = util.normalize_interface_name( self.get_top().get_failover_link_interface()) return ' '.join((self.asa_gen_template % value).split())
def get_cli(self): '''Return the CLI for the self.delta_ifc_cfg_value, used by ifc2asa. @precondition: self.has_iifc_detal_cfg() is True @note: it always returns the +ve CLI, i.e. no "no" prefix in the return value. ''' if not self.has_ifc_delta_cfg(): return '' value = normalize_param_dict(self.delta_ifc_cfg_value['value']) value['interface'] = util.normalize_interface_name(self.get_top().get_ClusterControLink_interface()) '''The following join, split, and strip, and split are used to rid of extra space characters that may result from empty optional parameters. ''' return ' '.join((self.asa_gen_template % value).split())
def ifc2asa(self, no_asa_cfg_stack, asa_cfg_list): '''Generate ASA configuration from IFC configuration delta. @see DMObject.ifc2asa for parameter details ''' if not self.has_ifc_delta_cfg(): return action = self.get_action() if action == State.NOCHANGE: return if action in (State.CREATE, State.MODIFY): self.generate_cli(asa_cfg_list, self.get_cli()) # 'no shutdown' the cluster control link interface intf = util.normalize_interface_name(self.get_top().get_ClusterControLink_interface()) if intf: clii = CLIInteraction(mode_command='interface ' + intf, command='no shutdown') asa_cfg_list.append(clii)
def get_interface_cli(self): 'Return the cli of the interface command' return 'interface ' + normalize_interface_name(self.delta_ifc_cfg_value['value'])
def get_interface_cli(self): 'Return the cli of the interface command' return 'interface ' + normalize_interface_name( self.delta_ifc_cfg_value['value'])