Comment 4 for bug 1687485

Revision history for this message
Chad Smith (chad.smith) wrote :

No problems with networking experienced when starting up xenial yakkety or zesty cloud-init proposed containers.

Also validated the expected raised ValueError due to duplicate macs with the following script:

cat >duplicate_gw_data.json <<EOF
{
 "links": [
  {"ethernet_mac_address": "aa:ab:ac:ad:ae:00",
   "id": "tap1a", "type": "phy", "vif_id": "1a81968a"}
 ],
 "networks": [
   {"id": "network0", "ip_address": "172.19.1.34", "link": "tap1a",
    "netmask": "255.255.255.0", "network_id": "dacd568d", "type": "ipv4",
    "routes": [
     {"gateway": "172.19.3.254", "netmask": "0.0.0.0",
      "network": "0.0.0.0"},
     {"gateway": "172.19.3.200", "netmask": "0.0.0.0",
      "network": "0.0.0.0"}]}
 ],
 "services": [{"address": "172.19.0.12", "type": "dns"}]
}
EOF

for release in xenial yakkety zesty; do echo $release ----------------;
  lxc file push duplicate_gw_data.json test-$release/root/duplicate_gw_data.json;
  lxc file push net-convert.py test-$release/root/net-convert.py;
  lxc exec test-$release -- ./net-convert.py --network-data=duplicate_gw_data.json --kind=network_data.json --output-kind=sysconfig -m eth1,aa:ab:ac:ad:ae:00 --directory=./out.d;
  lxc exec test-$release -- dpkg-query --show cloud-init;
done;

--------OUTPUT with expected ValueErrors------
xenial ----------------

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers:
        - 172.19.0.12
        search: []
    interfaces:
        eth1:
            address: null
            gateway: null
            inet: inet
            mac_address: aa:ab:ac:ad:ae:00
            mode: manual
            mtu: null
            name: eth1
            subnets:
            - address: 172.19.1.34
                ipv4: true
                netmask: 255.255.255.0
                routes:
                - gateway: 172.19.3.254
                    netmask: 0.0.0.0
                    network: 0.0.0.0
                - gateway: 172.19.3.200
                    netmask: 0.0.0.0
                    network: 0.0.0.0
                type: static
            type: physical
    routes: []
    use_ipv6: false
_version: 1
use_ipv6: false

Traceback (most recent call last):
  File "./net-convert.py", line 82, in <module>
    main()
  File "./net-convert.py", line 78, in main
    r.render_network_state(network_state=ns, target=args.directory)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 501, in render_network_state
    network_state).items():
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 479, in _render_sysconfig
    cls._render_physical_interfaces(network_state, iface_contents)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 407, in _render_physical_interfaces
    cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 352, in _render_subnet_routes
    % (iface_cfg.name))
ValueError: Duplicate declaration of default route found for interface 'eth1'
cloud-init 0.7.9-153-g16a7302f-0ubuntu1~16.04.1
yakkety ----------------

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers:
        - 172.19.0.12
        search: []
    interfaces:
        eth1:
            address: null
            gateway: null
            inet: inet
            mac_address: aa:ab:ac:ad:ae:00
            mode: manual
            mtu: null
            name: eth1
            subnets:
            - address: 172.19.1.34
                ipv4: true
                netmask: 255.255.255.0
                routes:
                - gateway: 172.19.3.254
                    netmask: 0.0.0.0
                    network: 0.0.0.0
                - gateway: 172.19.3.200
                    netmask: 0.0.0.0
                    network: 0.0.0.0
                type: static
            type: physical
    routes: []
    use_ipv6: false
_version: 1
use_ipv6: false

Traceback (most recent call last):
  File "./net-convert.py", line 82, in <module>
    main()
  File "./net-convert.py", line 78, in main
    r.render_network_state(network_state=ns, target=args.directory)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 501, in render_network_state
    network_state).items():
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 479, in _render_sysconfig
    cls._render_physical_interfaces(network_state, iface_contents)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 407, in _render_physical_interfaces
    cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 352, in _render_subnet_routes
    % (iface_cfg.name))
ValueError: Duplicate declaration of default route found for interface 'eth1'
cloud-init 0.7.9-153-g16a7302f-0ubuntu1~16.10.1
zesty ----------------

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers:
        - 172.19.0.12
        search: []
    interfaces:
        eth1:
            address: null
            gateway: null
            inet: inet
            mac_address: aa:ab:ac:ad:ae:00
            mode: manual
            mtu: null
            name: eth1
            subnets:
            - address: 172.19.1.34
                ipv4: true
                netmask: 255.255.255.0
                routes:
                - gateway: 172.19.3.254
                    netmask: 0.0.0.0
                    network: 0.0.0.0
                - gateway: 172.19.3.200
                    netmask: 0.0.0.0
                    network: 0.0.0.0
                type: static
            type: physical
    routes: []
    use_ipv6: false
_version: 1
use_ipv6: false

Traceback (most recent call last):
  File "./net-convert.py", line 82, in <module>
    main()
  File "./net-convert.py", line 78, in main
    r.render_network_state(network_state=ns, target=args.directory)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 501, in render_network_state
    network_state).items():
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 479, in _render_sysconfig
    cls._render_physical_interfaces(network_state, iface_contents)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 407, in _render_physical_interfaces
    cls._render_subnet_routes(iface_cfg, route_cfg, iface_subnets)
  File "/usr/lib/python3/dist-packages/cloudinit/net/sysconfig.py", line 352, in _render_subnet_routes
    % (iface_cfg.name))
ValueError: Duplicate declaration of default route found for interface 'eth1'
cloud-init 0.7.9-153-g16a7302f-0ubuntu1~17.04.1

for release in xenial yakkety zesty; do
 echo $release ----------------;
 lxc file push duplicate_gw_data.json test-xenial/root/duplicate_gw_data.json;
 lxc exec test-$release -- ./net-convert.py --network-data=duplicate_gw_data.json --kind=network_data.json --output-kind=sysconfig -m eth1,aa:ab:ac:ad:ae:00 --directory=./out.d;
 lxc file exec test-$release -- dpkg-query --show cloud-init;
done;