def unplug_interface(self, tenant_id, net_id, port_id): db.validate_port_ownership(tenant_id, net_id, port_id) db.port_set_attachment(port_id, net_id, "") db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN) #unplug in port_properties vm_id = None neuca_db.update_port_properties_iface(port_id, vm_id, None)
def update_port(self, tenant_id, net_id, port_id, **kwargs): """ Updates the state of a port on the specified Virtual Network. """ db.validate_port_ownership(tenant_id, net_id, port_id) port = db.port_get(port_id, net_id) db.port_update(port_id, net_id, **kwargs) return self._make_port_dict(port)
def update_port(self, tenant_id, net_id, port_id, **kwargs): """ Updates the state of a port on the specified Virtual Network. """ LOG.debug("update_port() called\n") port = db.port_get(port_id, net_id) db.port_update(port_id, net_id, **kwargs) return self._make_port_dict(port)
def create_port(self, tenant_id, net_id, port_state=None, **kwargs): """ Creates a port on the specified Virtual Network. """ LOG.debug("FakePlugin.create_port() called") # verify net_id self._get_network(tenant_id, net_id) port = db.port_create(net_id, port_state) # Put operational status UP db.port_update(port.uuid, net_id, op_status=OperationalStatus.UP) port_item = {'port-id': str(port.uuid)} return port_item
def unplug_interface(self, tenant_id, net_id, port_id): """ Detaches a remote interface from the specified port on the specified Virtual Network. """ LOG.debug("LinuxBridgePlugin.unplug_interface() called") db.validate_port_ownership(tenant_id, net_id, port_id) port = db.port_get(port_id, net_id) attachment_id = port[const.INTERFACEID] if attachment_id is None: return db.port_unset_attachment(port_id, net_id) db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
def unplug_interface(self, tenant_id, net_id, port_id): """ Detaches a remote interface from the specified port on the specified Virtual Network. """ LOG.debug("LinuxBridgePlugin.unplug_interface() called") network = db.network_get(net_id) port = db.port_get(port_id, net_id) attachment_id = port[const.INTERFACEID] if attachment_id == None: raise exc.InvalidDetach(port_id=port_id, net_id=net_id, att_id=remote_interface_id) db.port_unset_attachment(port_id, net_id) db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
def update_port(self, tenant_id, net_id, port_id, **kwargs): """ Updates the attributes of a specific port on the specified Virtual Network. :returns: a mapping sequence with the following signature: {'port-id': uuid representing the updated port on specified quantum network 'port-state': update port state( UP or DOWN) } :raises: exception.StateInvalid :raises: exception.PortNotFound """ LOG.debug("QuantumRestProxy: update_port() called") self.get_network(tenant_id, net_id) orig_port = self.get_port(tenant_id, net_id, port_id) # Update DB port = db.port_update(port_id, net_id, **kwargs) # update on networl ctrl try: resource = '/tenants/%s/networks/%s/ports/%s' % ( tenant_id, net_id, port_id) data = { "port": 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 create remote port: %s' % e.message) # reset port to original state orig_port = dict((k.split('-')[-1], v) for k, v in orig_port.items()) if 'id' in orig_port: orig_port.pop('id') db.port_update(net_id, tenant_id, **orig_port) raise return self.make_port_dict(port)
def update_port(self, tenant_id, net_id, port_id, **kwargs): """ Updates the attributes of a port on the specified Virtual Network. """ LOG.debug("FakePlugin.update_port() called") #validate port and network ids self._get_network(tenant_id, net_id) self._get_port(tenant_id, net_id, port_id) port = db.port_update(port_id, net_id, **kwargs) port_item = {'port-id': port_id, 'port-state': port['state']} return port_item
def update_port(self, tenant_id, net_id, port_id, **kwargs): """ Updates the attributes of a port on the specified Virtual Network. """ LOG.debug("LinuxBridgePlugin.update_port() called") network = db.network_get(net_id) self._validate_port_state(kwargs["state"]) port = db.port_update(port_id, net_id, **kwargs) new_port_dict = cutil.make_port_dict(port) return new_port_dict
def update_port(self, tenant_id, net_id, port_id, **kwargs): """ Updates the attributes of a port on the specified Virtual Network. """ LOG.debug("LinuxBridgePlugin.update_port() called") db.validate_port_ownership(tenant_id, net_id, port_id) self._validate_port_state(kwargs["state"]) port = db.port_update(port_id, net_id, **kwargs) new_port_dict = cutil.make_port_dict(port) return new_port_dict
def update_port(self, net_id, port_id, **kwargs): """Update a port.""" try: port = db.port_update(port_id, net_id, **kwargs) LOG.debug("Updated port %s", port.uuid) port_dict = {} port_dict["id"] = str(port.uuid) port_dict["net-id"] = str(port.network_id) port_dict["attachment"] = port.interface_id port_dict["state"] = port.state return port_dict except Exception as exc: LOG.error("Failed to update port state: %s", str(exc))
def update_port(self, net_id, port_id, **kwargs): """Update a port""" try: port = db.port_update(port_id, net_id, **kwargs) LOG.debug("Updated port %s", port.uuid) port_dict = {} port_dict["id"] = str(port.uuid) port_dict["net-id"] = str(port.network_id) port_dict["attachment"] = port.interface_id port_dict["state"] = port.state return port_dict except Exception, exc: LOG.error("Failed to update port state: %s", str(exc))
def unplug_interface(self, tenant_id, net_id, port_id): db.validate_port_ownership(tenant_id, net_id, port_id) db.port_set_attachment(port_id, net_id, "") db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)