def get_network_details(uid, context):
    """
    Extracts the VMs network adapter information.

    uid -- Id of the VM.
    context -- The os context.
    """
    vm_instance = vm.get_vm(uid, context)

    result = {'public': [], 'admin': []}
    try:
        net_info = NETWORK_API.get_instance_nw_info(context, vm_instance)[0]
    except __HOLE__:
        LOG.warn('Unable to retrieve network information - this is because '
                 'of OpenStack!!')
        return result
    gw = net_info['network']['subnets'][0]['gateway']['address']
    mac = net_info['address']

    if len(net_info['network']['subnets'][0]['ips']) == 0:
        tmp = {'floating_ips': [], 'address': '0.0.0.0'}
    else:
        tmp = net_info['network']['subnets'][0]['ips'][0]
    for item in tmp['floating_ips']:
        result['public'].append({'interface': 'eth0',
                                 'mac': 'aa:bb:cc:dd:ee:ff',
                                 'state': 'active',
                                 'address': item['address'],
                                 'gateway': '0.0.0.0',
                                 'allocation': 'static'})
    result['admin'].append({'interface': 'eth0',
                            'mac': mac,
                            'state': 'active',
                            'address': tmp['address'],
                            'gateway': gw,
                            'allocation': 'static'})

    return result
dataset/ETHPy150Open tmetsch/occi-os/occi_os_api/nova_glue/net.py/get_network_details