1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
summary: Ensure that netplan config integration works
details: |
Check the netplan configuration is correct in Ubuntu Core 20+. Verify
that is is possible to add a br54 interface via netplan, including the
configuration for dhcp4 and dhcp6. Verify that `snap unset` works for the whole
br54 subtree
# TODO: enable for all ubuntu core versions once netplan.io got SRUed
# into the older versions of ubuntu
systems:
- ubuntu-core-2*
restore: |
ip link del br54 || true
execute: |
echo "Getting version works"
snap get system system.network.netplan.network.version | MATCH "^2$"
echo "Getting the full document works and it is valid json"
snap get -d system system.network.netplan | gojq .
echo "Check that setting adding a br54 interface via netplan works"
# set dhcp4=false avoids that networkd waits for a valid dhcp record
# here (which will never come), see LP:1967084 for details
snap set system system.network.netplan.network.bridges.br54.dhcp4=false
echo "Check that the interface is really there"
netplan get | MATCH br54
ip link | MATCH br54
echo "Check that the setting is written to the expected yaml file"
res=$(gojq --yaml-input -r '.network.bridges.br54.dhcp4' - < /etc/netplan/90-snapd-config.yaml)
# yp returns "false" as expected for this setting (note that if
# the key was missing it would return "null")
[ "$res" = "false" ]
echo "Now add dhcp6"
snap set system system.network.netplan.network.bridges.br54.dhcp6=false
res=$(gojq --yaml-input -r '.network.bridges.br54.dhcp6' - < /etc/netplan/90-snapd-config.yaml)
[ "$res" = "false" ]
echo "And the dhcp4 setting is preserved and it is still set to false"
res=$(gojq --yaml-input -r '.network.bridges.br54.dhcp4' - < /etc/netplan/90-snapd-config.yaml)
[ "$res" = "false" ]
echo "Check that unset works"
snap unset system system.network.netplan.network.bridges.br54.dhcp6
res=$(gojq --yaml-input -r '.network.bridges.br54.dhcp6' - < /etc/netplan/90-snapd-config.yaml)
if [ "$res" != "null" ]; then
echo "getting the .network.bridges.br54.dhcp6 should fail"
cat /etc/netplan/90-snapd-config.yaml
exit 1
fi
echo "Unset the whole subtree works"
snap unset system system.network.netplan.network.bridges.br54
snap get -d system system.network.netplan | NOMATCH br54
ip link | NOMATCH br54
|