def delete_network(self, tenant_id, net_id): """ Deletes the network with the specified network identifier belonging to the specified tenant. """ LOG.debug("LinuxBridgePlugin.delete_network() called") net = db.network_get(net_id) if net: ports_on_net = db.port_list(net_id) if len(ports_on_net) > 0: for port in ports_on_net: if port[const.INTERFACEID]: raise exc.NetworkInUse(net_id=net_id) for port in ports_on_net: self.delete_port(tenant_id, net_id, port[const.UUID]) net_dict = cutil.make_net_dict(net[const.UUID], net[const.NETWORKNAME], [], net[const.OPSTATUS]) try: self._release_vlan_for_tenant(tenant_id, net_id) cdb.remove_vlan_binding(net_id) except Exception as excp: LOG.warning("Exception: %s" % excp) db.network_update(net_id, tenant_id, {const.OPSTATUS: OperationalStatus.DOWN}) db.network_destroy(net_id) return net_dict # Network not found raise exc.NetworkNotFound(net_id=net_id)
def delete_network(self, tenant_id, net_id): """ Deletes the network with the specified network identifier belonging to the specified tenant. """ LOG.debug("LinuxBridgePlugin.delete_network() called") db.validate_network_ownership(tenant_id, net_id) net = db.network_get(net_id) if net: ports_on_net = db.port_list(net_id) if len(ports_on_net) > 0: for port in ports_on_net: if port[const.INTERFACEID]: raise exc.NetworkInUse(net_id=net_id) for port in ports_on_net: self.delete_port(tenant_id, net_id, port[const.UUID]) net_dict = cutil.make_net_dict(net[const.UUID], net[const.NETWORKNAME], [], net[const.OPSTATUS]) try: self._release_vlan_for_tenant(tenant_id, net_id) cdb.remove_vlan_binding(net_id) except Exception as excp: LOG.warning("Exception: %s" % excp) db.network_update(net_id, tenant_id, {const.OPSTATUS: OperationalStatus.DOWN}) db.network_destroy(net_id) return net_dict # Network not found raise exc.NetworkNotFound(net_id=net_id)
def delete_vlan_binding(self, network_id): """Delete a vlan binding""" try: res = l2network_db.remove_vlan_binding(network_id) LOG.debug("Deleted vlan binding for vlan: %s" % res.vlan_id) vlan_dict = {} vlan_dict["vlan-id"] = str(res.vlan_id) return vlan_dict except Exception, exc: raise Exception("Failed to delete vlan binding: %s" % str(exc))
def delete_vlan_binding(self, network_id): """Delete a vlan binding""" try: res = l2network_db.remove_vlan_binding(network_id) LOG.debug("Deleted vlan binding for vlan: %s" % res.vlan_id) vlan_dict = {} vlan_dict["vlan-id"] = str(res.vlan_id) return vlan_dict except Exception, exc: raise Exception("Failed to delete vlan binding: %s" % str(exc))
def delete_network(self, context, id): vlan_binding = cdb.get_vlan_binding(id) cdb.release_vlanid(vlan_binding['vlan_id']) cdb.remove_vlan_binding(id) return super(LinuxBridgePluginV2, self).delete_network(context, id)