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 create_network(self, tenant_id, net_name, **kwargs): """ Creates a new Virtual Network, and assigns it a symbolic name. """ LOG.debug("FakePlugin.create_network() called") new_net = db.network_create(tenant_id, net_name) # Put operational status UP db.network_update(new_net.uuid, net_name, op_status=OperationalStatus.UP) # Return uuid for newly created network as net-id. return {'net-id': new_net.uuid}
def create_network(self, tenant_id, net_name, **kwargs): """ Creates a new Virtual Network, and assigns it a symbolic name. """ LOG.debug("FakePlugin.create_network() called") new_net = db.network_create(tenant_id, net_name) # Put operational status UP db.network_update(new_net.uuid, net_name, op_status=OperationalStatus.UP) # Return uuid for newly created network as net-id. return {'net-id': new_net.uuid}
def update_network(self, tenant_id, net_id, **kwargs): """ Updates the attributes of a particular Virtual Network. """ LOG.debug("FakePlugin.update_network() called") net = db.network_update(net_id, tenant_id, **kwargs) return net
def update_network(self, tenant_id, net_id, **kwargs): """ Updates the attributes of a particular Virtual Network. """ LOG.debug("FakePlugin.update_network() called") net = db.network_update(net_id, tenant_id, **kwargs) return net
def create_network(self, tenant_id, net_name, **kwargs): """ Creates a new Virtual Network, and assigns it a symbolic name. :returns: a sequence of mappings with the following signature: {'net-id': uuid that uniquely identifies the particular quantum network, 'net-name': a human-readable name associated with network referenced by net-id } :raises: """ LOG.debug("QuantumRestProxy: create_network() called") # create in DB new_net = db.network_create(tenant_id, net_name) db.network_update(new_net.uuid, net_name, op_status=OperationalStatus.UP) net_id = str(new_net.uuid) # create on networl ctrl try: resource = '/tenants/%s/networks' % tenant_id data = { "network": { "id": net_id, "name": net_name, "gateway": self.nova.get_gateway(net_id), } } ret = self.servers.post(resource, data) if not self.servers.action_success(ret): raise RemoteRestError(ret[2]) except RemoteRestError as e: LOG.error( 'QuantumRestProxy: Unable to create remote network: %s' % e.message) db.network_destroy(net_id) raise # return created network return { 'net-id': net_id, 'net-name': net_name, }
def update_network(self, tenant_id, net_id, **kwargs): db.validate_network_ownership(tenant_id, net_id) net = db.network_update(net_id, tenant_id, **kwargs) #LOG.debug("PRUTH: update_network: %s %s" % (net, kwargs['name'])) update_network_properties(net.network_id, net.network_type, net.switch_name, net.vlan_tag, net.max_ingress_rate, net.max_ingress_burst) return self._make_net_dict(str(net.uuid), net.name, None, net.op_status)
def update_network(self, tenant_id, net_id, **kwargs): """ Updates the attributes of a particular Virtual Network. """ LOG.debug("LinuxBridgePlugin.update_network() called") network = db.network_update(net_id, tenant_id, **kwargs) net_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [], network[const.OPSTATUS]) return net_dict
def update_network(self, tenant_id, net_id, **kwargs): """ Updates the attributes of a particular Virtual Network. :returns: a sequence of mappings representing the new network attributes, with the following signature: {'net-id': uuid that uniquely identifies the particular quantum network 'net-name': the new human-readable name associated with network referenced by net-id } :raises: exception.NetworkNotFound """ LOG.debug("QuantumRestProxy.update_network() called") orig_net = self.get_network(tenant_id, net_id) # update DB net = db.network_update(net_id, tenant_id, **kwargs) # update network on network controller try: if kwargs: resource = '/tenants/%s/networks/%s' % (tenant_id, net_id) data = { "network": kwargs, } ret = self.servers.put(resource, data) if not self.servers.action_success(ret): raise RemoteRestError(ret[2]) except RemoteRestError as e: LOG.error( 'QuantumRestProxy: Unable to update remote network: %s' % e.message) # reset network to original state orig_net = dict((k.split('-')[-1], v) for k, v in orig_net.items()) if 'id' in orig_net: orig_net.pop('id') db.network_update(net_id, tenant_id, **orig_net) raise # return updated network return net
def update_network(self, tenant_id, net_id, **kwargs): """Update a network""" try: net = db.network_update(net_id, tenant_id, **kwargs) LOG.debug("Updated network: %s" % net.uuid) net_dict = {} net_dict["net-id"] = str(net.uuid) net_dict["net-name"] = net.name return net_dict except Exception, exc: raise Exception("Failed to update network: %s" % str(exc))
def update_network(self, tenant_id, net_id, **kwargs): """ Updates the attributes of a particular Virtual Network. """ LOG.debug("LinuxBridgePlugin.update_network() called") db.validate_network_ownership(tenant_id, net_id) network = db.network_update(net_id, tenant_id, **kwargs) net_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [], network[const.OPSTATUS]) return net_dict
def update_network(self, tenant_id, net_id, param_data): """Rename a network""" try: print param_data net = db.network_update(net_id, tenant_id, **param_data) LOG.debug("Updated network: %s", net.uuid) net_dict = {} net_dict["id"] = str(net.uuid) net_dict["name"] = net.name return net_dict except Exception, exc: LOG.error("Failed to update network: %s", str(exc))
def update_network(self, tenant_id, net_id, param_data): """Rename a network.""" try: print param_data net = db.network_update(net_id, tenant_id, **param_data) LOG.debug("Updated network: %s", net.uuid) net_dict = {} net_dict["id"] = str(net.uuid) net_dict["name"] = net.name return net_dict except Exception as exc: LOG.error("Failed to update network: %s", str(exc))
def update_network(self, tenant_id, net_id, **kwargs): db.validate_network_ownership(tenant_id, net_id) net = db.network_update(net_id, tenant_id, **kwargs) return self._make_net_dict(str(net.uuid), net.name, None, net.op_status)
def update_network(self, tenant_id, net_id, **kwargs): net = db.network_update(net_id, tenant_id, **kwargs) return self._make_net_dict(str(net.uuid), net.name, None)
def update_network(self, tenant_id, net_id, **kwargs): db.validate_network_ownership(tenant_id, net_id) net = db.network_update(net_id, tenant_id, **kwargs) return self._make_net_dict(str(net.uuid), net.name, None, net.op_status)