Comment 6 for bug 1701097

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

# inet6 address types properly rendered on both xenial and zesty

cat > net-config.yaml <<"EOF"
> version: 1
> config:
> - type: physical
> name: eth0
> mac_address: "c0:d6:9f:2c:e8:80"
> subnets:
> - type: static
> address: "2001:1::2/64"
> routes:
> - gateway: "2001:4800:78ff:1b::1"
> netmask: "::"
> network: "::"
> EOF

 for release in xenial zesty; do
> echo "$release START --------------";
> lxc exec test-$release -- grep CODENAME /etc/lsb-release;
> lxc exec test-$release -- dpkg-query --show cloud-init;
> lxc file push net-convert.py test-$release/net-convert.py;
> lxc file push net-config.yaml test-$release/net-config.yaml;
> lxc exec test-$release -- python3 /net-convert.py \
> --network-data=/net-config.yaml --kind=yaml --output-kind=eni \
> --mac=eth0,c0:d6:9f:2c:e8:80 --directory=out.d;
> lxc exec test-$release -- cat out.d/etc/network/interfaces;
> echo "$release FINISH --------------";
> done
xenial START --------------
DISTRIB_CODENAME=xenial
cloud-init 0.7.9-233-ge586fe35-0ubuntu1~16.04.1
Input YAML
config:
- mac_address: c0:d6:9f:2c:e8:80
    name: eth0
    subnets:
    - address: 2001:1::2/64
        routes:
        - gateway: 2001:4800:78ff:1b::1
            netmask: '::'
            network: '::'
        type: static
    type: physical
version: 1

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers: []
        search: []
    interfaces:
        eth0:
            address: null
            gateway: null
            inet: inet
            mac_address: c0:d6:9f:2c:e8:80
            mode: manual
            mtu: null
            name: eth0
            subnets:
            - address: 2001:1::2
                prefix: 64
                routes:
                - gateway: 2001:4800:78ff:1b::1
                    netmask: '::'
                    network: '::'
                    prefix: 0
                type: static
            type: physical
    routes: []
    use_ipv6: true
_version: 1
use_ipv6: true

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet6 static
    address 2001:1::2/64
    post-up route add -A inet6 default gw 2001:4800:78ff:1b::1 || true
    pre-down route del -A inet6 default gw 2001:4800:78ff:1b::1 || true
xenial FINISH --------------
zesty START --------------
DISTRIB_CODENAME=zesty
cloud-init 0.7.9-233-ge586fe35-0ubuntu1~17.04.1
Input YAML
config:
- mac_address: c0:d6:9f:2c:e8:80
    name: eth0
    subnets:
    - address: 2001:1::2/64
        routes:
        - gateway: 2001:4800:78ff:1b::1
            netmask: '::'
            network: '::'
        type: static
    type: physical
version: 1

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
    dns:
        nameservers: []
        search: []
    interfaces:
        eth0:
            address: null
            gateway: null
            inet: inet
            mac_address: c0:d6:9f:2c:e8:80
            mode: manual
            mtu: null
            name: eth0
            subnets:
            - address: 2001:1::2
                prefix: 64
                routes:
                - gateway: 2001:4800:78ff:1b::1
                    netmask: '::'
                    network: '::'
                    prefix: 0
                type: static
            type: physical
    routes: []
    use_ipv6: true
_version: 1
use_ipv6: true

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet6 static
    address 2001:1::2/64
    post-up route add -A inet6 default gw 2001:4800:78ff:1b::1 || true
    pre-down route del -A inet6 default gw 2001:4800:78ff:1b::1 || true
zesty FINISH --------------