def delete_network(self, tenant_id, net_id, **kwargs): """ Deletes a VLAN in the switch, and removes the VLAN configuration from the relevant interfaces """ LOG.debug("NexusPlugin:delete_network() called\n") vlan_id = self._get_vlan_id_for_network(tenant_id, net_id) ports_id = nxos_db.get_nexusport_binding(vlan_id) LOG.debug("NexusPlugin: Interfaces to be disassociated: %s" % ports_id) nxos_db.remove_nexusport_binding(vlan_id) net = self._get_network(tenant_id, net_id) if net: self._client.delete_vlan(str(vlan_id), self._nexus_ip, self._nexus_username, self._nexus_password, self._nexus_first_port, self._nexus_second_port, self._nexus_ssh_port) return net # Network not found raise exc.NetworkNotFound(net_id=net_id)
def delete_network(self, tenant_id, net_id, **kwargs): """ Deletes a VLAN in the switch, and removes the VLAN configuration from the relevant interfaces """ LOG.debug("NexusPlugin:delete_network() called\n") vlan_id = self._get_vlan_id_for_network(tenant_id, net_id) ports_id = nxos_db.get_nexusport_binding(vlan_id) LOG.debug("NexusPlugin: Interfaces to be disassociated: %s" % ports_id) nxos_db.remove_nexusport_binding(vlan_id) net = self._get_network(tenant_id, net_id) if net: self._client.delete_vlan( str(vlan_id), self._nexus_ip, self._nexus_username, self._nexus_password, self._nexus_first_port, self._nexus_second_port, self._nexus_ssh_port) return net # Network not found raise exc.NetworkNotFound(net_id=net_id)
def delete_nexusportbinding(self, vlan_id): """delete nexus port binding""" bindings = [] try: bind = nexus_db.remove_nexusport_binding(vlan_id) for res in bind: LOG.debug("Deleted nexus port binding: %s" % res.vlan_id) bind_dict = {} bind_dict["port-id"] = res.port_id bindings.append(bind_dict) return bindings except Exception, exc: raise Exception("Failed to delete nexus port binding: %s" % str(exc))