Example #1
0
 def update_port(self, tenant_id, net_id, port_id, port_state):
     """
     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_set_state(port_id, net_id, port_state)
     return self._make_port_dict(str(port.uuid), port.state,
                                     port.network_id, port.interface_id)
Example #2
0
 def update_port(self, tenant_id, net_id, port_id, new_state):
     """
     Updates the state 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)
     self._validate_port_state(new_state)
     db.port_set_state(port_id, net_id, new_state)
     port_item = {"port-id": port_id, "port-state": new_state}
     return port_item
 def update_port(self, net_id, port_id, port_state):
     """Update a port"""
     try:
         port = db.port_set_state(net_id, port_id, port_state)
         LOG.debug("Updated 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 update port state: %s" % str(exc))
 def update_port(self, net_id, port_id, **kwargs):
     """Update a port"""
     try:
         port = db.port_set_state(net_id, port_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))
Example #5
0
 def update_port(self, net_id, port_id, **kwargs):
     """Update a port"""
     try:
         port = db.port_set_state(net_id, port_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 update_port(self, tenant_id, network_id, port_id, new_state):
     """
     Updates the state of a port on the specified Virtual Network.
     """
     LOG.debug("update_port() called")
     port = self._get_port(tenant_id, network_id, port_id)
     self._validate_port_state(new_state)
     new_state_up = new_state.upper()
     old_state_up = port.state.upper()
     if old_state_up == new_state_up:
         LOG.debug("update_port(): port state was not changed.")
         return {'port-id': port.uuid, 'port-state': port.state}
     if new_state_up in "DOWN":
         if self._port_attachable(port):
             self._detach(tenant_id, network_id, port_id)
     port = db.port_set_state(port_id, network_id, new_state_up)
     if new_state_up in "ACTIVE":
         if self._port_attachable(port):
             self._attach(tenant_id, network_id, port_id, port.interface_id)
     return {'port-id': port.uuid, 'port-state': port.state}