summaryrefslogtreecommitdiff
path: root/tests/unittests/test_net.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2019-05-29 04:59:43 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-05-29 04:59:43 +0000
commitded1ec81e3c6c37c5241b12fcc3c41182e675dff (patch)
treec78c95e9f82d6bb60336531d0beca6887932606c /tests/unittests/test_net.py
parentc951963ffa94145be1bd5f1cef7dba6007f75bd2 (diff)
downloadvyos-cloud-init-ded1ec81e3c6c37c5241b12fcc3c41182e675dff.tar.gz
vyos-cloud-init-ded1ec81e3c6c37c5241b12fcc3c41182e675dff.zip
netplan: update netplan key mappings for gratuitous-arp
Previous versions of netplan included a misspelling for the bond parameter around gratuitous-arp. This has been fixed and released and cloud-init needs to accept both values. This branch fixes the key that will be rendered and transforms the previous misspelling when capturing network_state. LP: #1827238
Diffstat (limited to 'tests/unittests/test_net.py')
-rw-r--r--tests/unittests/test_net.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index e85e9640..b936bc9c 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -407,6 +407,37 @@ network:
- maas
"""
+NETPLAN_BOND_GRAT_ARP = """
+network:
+ bonds:
+ bond0:
+ interfaces:
+ - ens3
+ macaddress: 68:05:ca:64:d3:6c
+ mtu: 9000
+ parameters:
+ gratuitious-arp: 1
+ bond1:
+ interfaces:
+ - ens4
+ macaddress: 68:05:ca:64:d3:6d
+ mtu: 9000
+ parameters:
+ gratuitous-arp: 2
+ ethernets:
+ ens3:
+ dhcp4: false
+ dhcp6: false
+ match:
+ macaddress: 52:54:00:ab:cd:ef
+ ens4:
+ dhcp4: false
+ dhcp6: false
+ match:
+ macaddress: 52:54:00:11:22:ff
+ version: 2
+"""
+
NETPLAN_DHCP_FALSE = """
version: 2
ethernets:
@@ -3589,6 +3620,21 @@ class TestNetplanRoundTrip(CiTestCase):
entry['expected_netplan'].splitlines(),
files['/etc/netplan/50-cloud-init.yaml'].splitlines())
+ def test_render_output_supports_both_grat_arp_spelling(self):
+ entry = {
+ 'yaml': NETPLAN_BOND_GRAT_ARP,
+ 'expected_netplan': NETPLAN_BOND_GRAT_ARP.replace('gratuitous',
+ 'gratuitious'),
+ }
+ network_config = yaml.load(entry['yaml']).get('network')
+ files = self._render_and_read(network_config=network_config)
+ print(entry['expected_netplan'])
+ print('-- expected ^ | v rendered --')
+ print(files['/etc/netplan/50-cloud-init.yaml'])
+ self.assertEqual(
+ entry['expected_netplan'].splitlines(),
+ files['/etc/netplan/50-cloud-init.yaml'].splitlines())
+
class TestEniRoundTrip(CiTestCase):