API: Proxy neutron configuration to guest instance (partial)

Registered by John Garbutt

Currently the metadata service only contains minimal network information. Like user_data and vendor_data, we should also provide network_data

Really we should provide all the information we can (from neutron) in both config drive and metadata service.

Main use case:
* cloud has no DHCP
* image has no "nova-agent" or similar
* but image is still able to setup network info
* image can have custom startup scripts to get networking config from Config Drive

Other usecase:
consider a VM with the first interface configured by DHCP, and all other interfaces on private networks where the interfaces are statically configured, but you are not using config drive, just the metadata service, and not cheating by doing file injection, presenting the data in a guest agnostic format.

More discussion from Icehouse summit is here:
https://etherpad.openstack.org/IcehouseNovaMetadataService

Notes:
* only in v3 API
* information will only be populated if neutron is enabled
* information comes from current network_info for instance
* API should be fairly similar to the neutron get port details API
* but we only really need concrete info: mac address, fixed IP address, subnet, gateway, host routes, etc
* but probably best to include at least: neutron port-id, neutron network-id, neutron subnet-id
* it should all be grouped by mac address, so guest can link it to the VIFs correctly

Sample API for getting network information from metadata service

GET: http://169.254.169.254/openstack/latest/metadata/network_data

JSON Response

{
   "ports":[
      {
         "name":"foo",
         "network_id":"ebda9658-093b-41ba-80ce-0cf8cb8365d4",
         "mac_address":"fa:16:3e:b9:ef:05",
         "fixed_ips":[
            {
                "subnet-id":"91e47a57-7508-46fe-afc9-fc454e8580e1",
               "ip_address":"172.24.4.227",
               "cidr":"10.0.3.0/24",
               "dns_nameservers":["10.0.3.2"],
               "enable_dhcp":true,
               "gateway_ip":"10.0.3.1",
               "host_routes":[{"destination":"10.0.3.0/24", "nexthop":"172.24.4.228"}],
               "ip_version":4,
            }
         ],
         "id":"664ebd1a-facd-4c20-948c-07a784475ab0",
      },
      {
         "name":"",
         "network_id":...
         ...
      }
   ]
}

Blueprint information

Status:
Complete
Approver:
John Garbutt
Priority:
Low
Drafter:
John Garbutt
Direction:
Approved
Assignee:
Josh Gachnang
Definition:
Approved
Series goal:
Accepted for liberty
Implementation:
Implemented
Milestone target:
milestone icon 12.0.0
Started by
Claxton Correya
Completed by
John Garbutt

Related branches

Sprints

Whiteboard

Addressed by: https://review.openstack.org/167385
    API: Proxy neutron configuration to guest instance

Apologies, this missed the deadline for Feature Freeze. Please rebase patches as soon as Juno opens, and we will try to get this in during that period. --johnthetubaguy (5th March 2014)

Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)

Sorry, we have now hit the non-priority feature freeze for kilo. Please resubmit your spec for the L release. --johnthetubaguy 5th Feb 2015

Approved for liberty now. --johnthetubaguy 20th April 2015

Gerrit topic: https://review.openstack.org/#q,topic:metadata-service-network-info,n,z

Addressed by:
https://review.openstack.org/102649
https://review.openstack.org/#/c/153097
https://review.openstack.org/#/c/152703

Gerrit topic: https://review.openstack.org/#q,topic:bp/metadata-service-network-info,n,z

Addressed by: https://review.openstack.org/153097
    Expose Neutron network data in metadata service

Addressed by: https://review.openstack.org/152703
    Add support for provider networks in network_data.json

Given this merged: https://review.openstack.org/153097 I am marking this as partially complete. The provider networks bit should probably be tracked separately anyway, but feels like its blocked on Neutron API changes, for a complete solution. --johnthetubaguy 3rd July 2015

Addressed by: https://review.openstack.org/337819
    Update metadata-service-network-info according to implementation

(?)

Work Items

Work items:
Get basic networking info from neutron into Metadata Service (list of: mac, IP, subnet, gateway, neutron-port-id, host-routes): DONE
Add above information into ConfigDrive as "network_data": DONE

This blueprint contains Public information 
Everyone can see this information.