def cleanup(self, **kwargs):
        """cleanup ASA context for an edge tenant pair. """
        params = kwargs.get('params')
        LOG.info("asa_cleanup: tenant %(tenant)s %(in_vlan)d %(out_vlan)d"
                 " %(in_ip)s %(in_mask)s %(out_ip)s %(out_mask)s",
                 {'tenant': params.get('tenant_name'),
                  'in_vlan': params.get('in_vlan'),
                  'out_vlan': params.get('out_vlan'),
                  'in_ip': params.get('in_ip'),
                  'in_mask': params.get('in_mask'),
                  'out_ip': params.get('out_ip'),
                  'out_mask': params.get('out_mask')})
        inside_vlan = str(params.get('in_vlan'))
        outside_vlan = str(params.get('out_vlan'))
        context = params.get('tenant_name')
        cmds = ["conf t", "changeto system"]
        cmds.append("no context " + context + " noconfirm")
        inside_int = params.get('intf_in') + '.' + inside_vlan
        outside_int = params.get('intf_out') + '.' + outside_vlan
        cmds.append("no interface " + inside_int)
        cmds.append("no interface " + outside_int)
        cmds.append("write memory")
        cmds.append("del /noconfirm disk0:/" + context + ".cfg")

        if context in self.tenant_rule:
            for rule in self.tenant_rule[context].get('rule_lst'):
                del self.rule_tbl[rule]
            del self.tenant_rule[context]
        data = {"commands": cmds}
        return self.rest_send_cli(data)
def cleanup ( self , ** kwargs ) : params = kwargs . get ( 'params' ) LOG . info ( "asa_cleanup: tenant %(tenant)s %(in_vlan)d %(out_vlan)d" " %(in_ip)s %(in_mask)s %(out_ip)s %(out_mask)s" , { 'tenant' : params . get ( 'tenant_name' ) , 'in_vlan' : params . get ( 'in_vlan' ) , 'out_vlan' : params . get ( 'out_vlan' ) , 'in_ip' : params . get ( 'in_ip' ) , 'in_mask' : params . get ( 'in_mask' ) , 'out_ip' : params . get ( 'out_ip' ) , 'out_mask' : params . get ( 'out_mask' ) } ) inside_vlan = str ( params . get ( 'in_vlan' ) ) outside_vlan = str ( params . get ( 'out_vlan' ) ) context = params . get ( 'tenant_name' ) cmds = [ "conf t" , "changeto system" ] cmds . append ( "no context " + context + " noconfirm" ) inside_int = params . get ( 'intf_in' ) + '.' + inside_vlan outside_int = params . get ( 'intf_out' ) + '.' + outside_vlan cmds . append ( "no interface " + inside_int ) cmds . append ( "no interface " + outside_int ) cmds . append ( "write memory" ) cmds . append ( "del /noconfirm disk0:/" + context + ".cfg" ) if context in self . tenant_rule : for rule in self . tenant_rule [ context ] . get ( 'rule_lst' ) : del self . rule_tbl [ rule ] del self . tenant_rule [ context ] data = { "commands" : cmds } return self . rest_send_cli ( data )
cleanup ASA context for an edge tenant pair.