def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id): """Plug an interface. Attaches a remote interface to the specified port on the specified Virtual Network. """ port = self._get_port(tenant_id, net_id, port_id) # Validate attachment self._validate_attachment(tenant_id, net_id, port_id, remote_interface_id) if port['interface_id']: raise exc.PortInUse(net_id=net_id, port_id=port_id, att_id=port['interface_id']) db.port_set_attachment(port_id, net_id, remote_interface_id)
def plug_interface(self, net_id, port_id, int_id): """Plug interface to a port.""" try: port = db.port_set_attachment(port_id, net_id, int_id) LOG.debug("Attached interface to 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 plug interface: %s", str(exc))