# 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
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 --------------
# inet6 address types properly rendered on both xenial and zesty
cat > net-config.yaml <<"EOF" 78ff:1b: :1"
> 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:
> netmask: "::"
> network: "::"
> EOF
for release in xenial zesty; do net-convert. py; net-config. yaml; data=/net- config. yaml --kind=yaml --output-kind=eni \ c0:d6:9f: 2c:e8:80 --directory=out.d; network/ interfaces; CODENAME= xenial ge586fe35- 0ubuntu1~ 16.04.1 78ff:1b: :1
netmask: '::'
network: '::'
> 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/
> lxc file push net-config.yaml test-$release/
> lxc exec test-$release -- python3 /net-convert.py \
> --network-
> --mac=eth0,
> lxc exec test-$release -- cat out.d/etc/
> echo "$release FINISH --------------";
> done
xenial START --------------
DISTRIB_
cloud-init 0.7.9-233-
Input YAML
config:
- mac_address: c0:d6:9f:2c:e8:80
name: eth0
subnets:
- address: 2001:1::2/64
routes:
- gateway: 2001:4800:
type: static
type: physical
version: 1
Internal State object: cloudinit. net.network_ state.NetworkSt ate
nameservers: []
address: null
gateway: null
mac_ address: c0:d6:9f:2c:e8:80
subnets:
prefix: 64
routes: 78ff:1b: :1
netmask: '::'
network: '::'
prefix: 0
type: static
!!python/
_network_state:
dns:
search: []
interfaces:
eth0:
inet: inet
mode: manual
mtu: null
name: eth0
- address: 2001:1::2
- gateway: 2001:4800:
type: physical
routes: []
use_ipv6: true
_version: 1
use_ipv6: true
auto lo
iface lo inet loopback
auto eth0 78ff:1b: :1 || true 78ff:1b: :1 || true CODENAME= zesty ge586fe35- 0ubuntu1~ 17.04.1 78ff:1b: :1
netmask: '::'
network: '::'
iface eth0 inet6 static
address 2001:1::2/64
post-up route add -A inet6 default gw 2001:4800:
pre-down route del -A inet6 default gw 2001:4800:
xenial FINISH --------------
zesty START --------------
DISTRIB_
cloud-init 0.7.9-233-
Input YAML
config:
- mac_address: c0:d6:9f:2c:e8:80
name: eth0
subnets:
- address: 2001:1::2/64
routes:
- gateway: 2001:4800:
type: static
type: physical
version: 1
Internal State object: cloudinit. net.network_ state.NetworkSt ate
nameservers: []
address: null
gateway: null
mac_ address: c0:d6:9f:2c:e8:80
subnets:
prefix: 64
routes: 78ff:1b: :1
netmask: '::'
network: '::'
prefix: 0
type: static
!!python/
_network_state:
dns:
search: []
interfaces:
eth0:
inet: inet
mode: manual
mtu: null
name: eth0
- address: 2001:1::2
- gateway: 2001:4800:
type: physical
routes: []
use_ipv6: true
_version: 1
use_ipv6: true
auto lo
iface lo inet loopback
auto eth0 78ff:1b: :1 || true 78ff:1b: :1 || true
iface eth0 inet6 static
address 2001:1::2/64
post-up route add -A inet6 default gw 2001:4800:
pre-down route del -A inet6 default gw 2001:4800:
zesty FINISH --------------