def get_nexusportbinding(self, vlan_id): """get nexus port binding""" binding = [] try: for bind in nexus_db.get_nexusport_binding(vlan_id): LOG.debug("Getting nexus port binding : %s" % bind.port_id) bind_dict = {} bind_dict["port-id"] = str(bind.port_id) bind_dict["vlan-id"] = str(bind.vlan_id) binding.append(bind_dict) except Exception, exc: LOG.error("Failed to get all bindings: %s" % str(exc))
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)