def get_port_from_device(cls, device):
     """
        To maintain compatibility with Linux Bridge L2 Agent for DHCP/L3 services 
        get device  either by linux bridge plugin device name convention or by mac address
     """
     port = db.get_port_from_device(device[cls.TAP_PREFIX_LEN :])
     if port:
         port["device"] = device
     else:
         port = db.get_port_from_device_mac(device)
     return port
예제 #2
0
    def get_port_from_device(cls, device):
        """Get port according to device.

        To maintain compatibility with Linux Bridge L2 Agent for DHCP/L3
        services get device either by linux bridge plugin
        device name convention or by mac address
        """
        port = db.get_port_from_device(device[cls.TAP_PREFIX_LEN:])
        if port:
            port['device'] = device
        else:
            port = db.get_port_from_device_mac(device)
        return port
 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent"""
     agent_id = kwargs.get("agent_id")
     device = kwargs.get("device")
     LOG.debug("Device %s no longer exists on %s", device, agent_id)
     port = db.get_port_from_device(device)
     if port:
         entry = {"device": device, "exists": True}
         # Set port status to DOWN
         db.set_port_status(port["id"], q_const.PORT_STATUS_DOWN)
     else:
         entry = {"device": device, "exists": False}
         LOG.debug("%s can not be found in database", device)
     return entry
예제 #4
0
 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = db.get_port_from_device(device)
     if port:
         entry = {'device': device,
                  'exists': True}
         # Set port status to DOWN
         db.set_port_status(port['id'], q_const.PORT_STATUS_DOWN)
     else:
         entry = {'device': device,
                  'exists': False}
         LOG.debug(_("%s can not be found in database"), device)
     return entry