Esempio n. 1
0
 def update_device_down(self, context, **kwargs):
     """Device no longer exists on agent"""
     # (TODO) garyk - live migration and port status
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     LOG.debug("Device %s no longer exists on %s", device, agent_id)
     port = cdb.get_port_from_device(device[self.TAP_PREFIX_LEN :])
     if port:
         entry = {"device": device, "exists": True}
         # Set port status to DOWN
         cdb.set_port_status(port["id"], api_common.PORT_STATUS_UP)
     else:
         entry = {"device": device, "exists": False}
         LOG.debug("%s can not be found in database", device)
     return entry
Esempio n. 2
0
 def get_device_details(self, context, **kwargs):
     """Agent requests device details"""
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     LOG.debug("Device %s details requested from %s", device, agent_id)
     port = cdb.get_port_from_device(device[self.TAP_PREFIX_LEN :])
     if port:
         vlan_binding = cdb.get_vlan_binding(port["network_id"])
         entry = {
             "device": device,
             "vlan_id": vlan_binding["vlan_id"],
             "network_id": port["network_id"],
             "port_id": port["id"],
             "admin_state_up": port["admin_state_up"],
         }
         # Set the port status to UP
         cdb.set_port_status(port["id"], api_common.PORT_STATUS_UP)
     else:
         entry = {"device": device}
         LOG.debug("%s can not be found in database", device)
     return entry