'Agent requests device details.'

def get_device_details(self, rpc_context, **kwargs):

    agent_id = kwargs.get('agent_id')
    device = kwargs.get('device')
    host = kwargs.get('host')
    cached_networks = kwargs.get('cached_networks')
    LOG.debug('Device    %(device)s    details    requested    by    agent    %(agent_id)s    with    host    %(host)s', {'device': device, 'agent_id': agent_id, 'host': host})
    plugin = directory.get_plugin()
    port_id = plugin._device_to_port_id(rpc_context, device)
    port_context = plugin.get_bound_port_context(rpc_context, port_id, host, cached_networks)
    if (not port_context):
        LOG.debug('Device    %(device)s    requested    by    agent    %(agent_id)s    not    found    in    database', {'device': device, 'agent_id': agent_id})
        return {'device': device}
    port = port_context.current
    if (cached_networks is not None):
        if (port['network_id'] not in cached_networks):
            cached_networks[port['network_id']] = port_context.network.current
    result = self._get_device_details(rpc_context, agent_id=agent_id, host=host, device=device, port_context=port_context)
    if ('network_id' in result):
        new_status = self._get_new_status(host, port_context)
        if new_status:
            plugin.update_port_status(rpc_context, port_id, new_status, host, port_context.network.current)
    return result
