Skip to content

Instantly share code, notes, and snippets.

@joshgachnang
Last active August 29, 2015 14:02
Show Gist options
  • Save joshgachnang/c16b443723bbf1f2e361 to your computer and use it in GitHub Desktop.
Save joshgachnang/c16b443723bbf1f2e361 to your computer and use it in GitHub Desktop.
{
"networks": [ // a network is attached to one link and contains a set of L3 configs, such as IP/netmask or whether to dhcp
{
"id": "servicenet", //required
"type": "ipv4-static", //required
"link": "servicenet_vlan", //required, single link
"ip": "10.0.0.5",
"gateway_ip": "10.0.0.1",
"netmask": "255.255.0.0"
"dns_nameservers": ["10.0.3.2"],
"routes": [ ], // Should we explicitly list default route? I think gateway_ip covers it.
},
{
"id": "pubnet", //required
"type": "ipv6-static", //required
"link": "bond0.101", //required, single link
"ip": "52.0.0.5",
"gateway_ip": "52.0.0.1",
"netmask": "255.255.0.0"
"routes": [
{
"destination": "172.16.0.0/0",
"gateway_ip": "52.0.0.2",
},
],
},
{
"id": "dhcpnet", //required
"type": "ipv4-dhcp", //required
"link": "eth2", //required, single link
"dhcp_hostname": "foo.bar.example.com"
},
],
"links": [ // links are L1/L2 devices, such as NICs, bonds, VLANs.
{
"id": "servicenet_vlan", //required
"type": "vlan", //required
"vlan_link": "bond0",
"vlan_id": 401,
"neutron_port_id": "11111111-1111-1111-1111-111111111111"
"vlan_link": "bond0" //single link for VLAN
},
{
"id": "bond0", //required
"type": "bond", //required
"bond_links": [
"eth0",
"eth1"
], //required, a list of link ids
"bond_type": "802.1ad" // required
},
{
"id": "eth0", //required
"type": "ethernet", //required
"ethernet_mac_address": "aa:bb:cc:dd:ee:ff" //could be "ethernet_pci_path" instead
},
{
"id": "eth1", //required
"type": "ethernet", //required
"ethernet_mac_address": "aa:bb:cc:dd:ee:fe"
},
{
"id": "eth2", //required
"type": "ethernet", //required
"ethernet_mac_address": "aa:bb:cc:dd:ee:fd"
},
]
}
@joshgachnang
Copy link
Author

Russell: Whoops that's what I meant to do.

I agree on the routes, and gateway_ip > nexthop. Those were from the nova-spec, so I'm going to -1 that to try to get a better structure.

So, I pulled VLAN out into its own top level key. My thought is that a port represents a network on a device, possibly with a VLAN. That device can be a combination of interfaces (bond, bridge, etc). Ports can share interfaces. You'd have a new port for each new VLAN. So you could have a port for pubnet and one for servicenet, both using "device": "bond0". Is that sensible?

My other thought was that a VLAN could have a device key. So ports have VLANs, VLANs are on devices, devices have interfaces. But if you don't have a VLAN this gets a bit weird. So I'm leaning towards the first way.

I am aiming to have something that could feasibly be the standard for Nova so we don't have some divergence down the road.

@morgabra
Copy link

So the top level vlan key sort of makes sense other than is kind of sucks when you have to iterate over all the objects to find the one you are looking for (so maybe have the name be the key?)

It's also worth maybe abstracting 'vlan' out a bit. There's a few things that could feasibly go there (vlan, vxlan, whatever) and it might not make sense to call everything a vlan. Neutron abstracts this out into {'segmentation_id', 'network_type', and 'physcial_network'}, maybe you should make that match?

@joshgachnang
Copy link
Author

@morgabra Alright, fixed both. I left physical_network off for providers because it is specified in ports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment