def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id): """ Provides connectivity to a remote interface to the specified Virtual Network. """ LOG.debug("plug_interface() called\n") network = db.network_get(net_id) port = db.port_get(net_id, port_id) attachment_id = port[const.INTERFACEID] if attachment_id == None: raise cexc.InvalidAttach(port_id=port_id, net_id=net_id, att_id=remote_interface_id) attachment_id = attachment_id[:const.UUID_LENGTH] remote_interface_id = remote_interface_id[:const.UUID_LENGTH] if remote_interface_id != attachment_id: LOG.debug("Existing attachment_id:%s, remote_interface_id:%s" % \ (attachment_id, remote_interface_id)) raise exc.PortInUse(port_id=port_id, net_id=net_id, att_id=attachment_id) self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id, attachment_id]) db.port_unset_attachment(net_id, port_id) db.port_set_attachment(net_id, port_id, attachment_id)
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id): """ Provides connectivity to a remote interface to the specified Virtual Network. """ LOG.debug("plug_interface() called\n") network = db.network_get(net_id) port = db.port_get(net_id, port_id) attachment_id = port[const.INTERFACEID] if attachment_id is None: raise cexc.InvalidAttach(port_id=port_id, net_id=net_id, att_id=remote_interface_id) attachment_id = attachment_id[:const.UUID_LENGTH] remote_interface_id = remote_interface_id[:const.UUID_LENGTH] if remote_interface_id != attachment_id: LOG.debug("Existing attachment_id:%s, remote_interface_id:%s" % \ (attachment_id, remote_interface_id)) raise exc.PortInUse(port_id=port_id, net_id=net_id, att_id=attachment_id) self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id, attachment_id]) db.port_unset_attachment(net_id, port_id) db.port_set_attachment(net_id, port_id, attachment_id)
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("unplug_interface() called\n") network = db.network_get(net_id) self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id]) db.port_unset_attachment(net_id, port_id)
def unplug_interface(self, tenant_id, net_id, port_id): """ Removes connectivity of a remote interface to the specified Virtual Network. """ LOG.debug("unplug_interface() called\n") network = db.network_get(net_id) port = db.port_get(net_id, port_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) self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id]) attachment_id = attachment_id[: const.UUID_LENGTH] attachment_id = attachment_id + const.UNPLUGGED db.port_unset_attachment(net_id, port_id) db.port_set_attachment(net_id, port_id, attachment_id)
def unplug_interface(self, tenant_id, net_id, port_id): """ Removes connectivity of a remote interface to the specified Virtual Network. """ LOG.debug("unplug_interface() called\n") network = db.network_get(net_id) port = db.port_get(net_id, port_id) attachment_id = port[const.INTERFACEID] if attachment_id is None: raise exc.InvalidDetach(port_id=port_id, net_id=net_id, att_id=remote_interface_id) self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id]) attachment_id = attachment_id[:const.UUID_LENGTH] attachment_id = attachment_id + const.UNPLUGGED db.port_unset_attachment(net_id, port_id) db.port_set_attachment(net_id, port_id, attachment_id)
def unplug_interface(self, net_id, port_id): """Unplug interface to a port""" try: port = db.port_unset_attachment(net_id, port_id) LOG.debug("Detached interface from port %s" % port.uuid) port_dict = {} port_dict["port-id"] = str(port.uuid) port_dict["net-id"] = str(port.network_id) port_dict["int-id"] = port.interface_id port_dict["state"] = port.state return port_dict except Exception, exc: raise Exception("Failed to unplug interface: %s" % str(exc))
def unplug_interface(self, net_id, port_id): """Unplug interface to a port.""" try: port = db.port_unset_attachment(net_id, port_id) LOG.debug("Detached interface from port %s" % port.uuid) port_dict = {} port_dict["port-id"] = str(port.uuid) port_dict["net-id"] = str(port.network_id) port_dict["int-id"] = port.interface_id port_dict["state"] = port.state return port_dict except Exception as exc: raise Exception("Failed to unplug interface: %s" % str(exc))