def request_vms_info(self, payload):

        # This request is received from an agent when it runs for the first
        # time and uplink is detected.
        agent = payload.get('agent')
        LOG.debug('request_vms_info: Getting VMs info for %s', agent)
        req = dict(host=payload.get('agent'))
        instances = self.get_vms_for_this_req(**req)
        for vm in instances:
            if vm.ip.endswith(constants.IP_DHCP_WAIT):
                ipaddr = vm.ip.replace(constants.IP_DHCP_WAIT, '')
            else:
                ipaddr = vm.ip
            vm_info = dict(status=vm.status,
                           vm_mac=vm.mac,
                           segmentation_id=vm.segmentation_id,
                           host=vm.host,
                           port_uuid=vm.port_id,
                           net_uuid=vm.network_id,
                           oui=dict(ip_addr=ipaddr,
                                    vm_name=vm.name,
                                    vm_uuid=vm.instance_id,
                                    gw_mac=vm.gw_mac,
                                    fwd_mod=vm.fwd_mod,
                                    oui_id='cisco'))
            try:
                self.neutron_event.send_vm_info(vm.host,
                                                str(vm_info))
            except (rpc.MessagingTimeout, rpc.RPCException, rpc.RemoteError):
                LOG.error(_LE('Failed to send VM info to agent.'))
Get the VMs from the database and send the info to the agent.
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/apps/saf/server/dfa_server.py/DfaServer.request_vms_info