summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorLaMont Jones <lamont.jones@canonical.com>2016-09-21 10:31:40 -0400
committerScott Moser <smoser@brickies.net>2016-09-21 11:53:12 -0400
commit970dbd13f5ae40b0f95ea390b72d2b3426e8e4d9 (patch)
treef8c3fe1280421ce77d34f59a4ef71cd512731cb0 /tests/unittests
parent80f5ec4be0f781b26eca51d90d51abfab396b3f6 (diff)
downloadvyos-cloud-init-970dbd13f5ae40b0f95ea390b72d2b3426e8e4d9.tar.gz
vyos-cloud-init-970dbd13f5ae40b0f95ea390b72d2b3426e8e4d9.zip
net: support reading ipv6 dhcp config from initramfs
This adds support for understanding 'dhcp6' as a protocol that can be written into /run/net-IFACE.cfg files by the initramfs. The end result is supporting ipv6 dhcp from initramfs boot all the way into iscsi root. LP: #1621615, #1621507
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_net.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 41b9a6d0..78c080ca 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -53,6 +53,45 @@ DHCP_EXPECTED_1 = {
'dns_nameservers': ['192.168.122.1']}],
}
+DHCP6_CONTENT_1 = """
+DEVICE=eno1
+HOSTNAME=
+DNSDOMAIN=
+reason='PREINIT'
+interface='eno1'
+DEVICE=eno1
+HOSTNAME=
+DNSDOMAIN=
+reason='FAIL'
+interface='eno1'
+DEVICE=eno1
+HOSTNAME=
+DNSDOMAIN=
+reason='PREINIT6'
+interface='eno1'
+DEVICE=eno1
+IPV6PROTO=dhcp6
+IPV6ADDR=2001:67c:1562:8010:0:1::
+IPV6NETMASK=64
+IPV6DNS0=2001:67c:1562:8010::2:1
+IPV6DOMAINSEARCH=
+HOSTNAME=
+DNSDOMAIN=
+reason='BOUND6'
+interface='eno1'
+new_ip6_address='2001:67c:1562:8010:0:1::'
+new_ip6_prefixlen='64'
+new_dhcp6_name_servers='2001:67c:1562:8010::2:1'
+"""
+
+DHCP6_EXPECTED_1 = {
+ 'name': 'eno1',
+ 'type': 'physical',
+ 'subnets': [{'control': 'manual',
+ 'dns_nameservers': ['2001:67c:1562:8010::2:1'],
+ 'netmask': '64',
+ 'type': 'dhcp6'}]}
+
STATIC_CONTENT_1 = """
DEVICE='eth1'
@@ -590,6 +629,10 @@ class TestCmdlineConfigParsing(TestCase):
found = cmdline._klibc_to_config_entry(DHCP_CONTENT_1)
self.assertEqual(found, ('eth0', DHCP_EXPECTED_1))
+ def test_cmdline_convert_dhcp6(self):
+ found = cmdline._klibc_to_config_entry(DHCP6_CONTENT_1)
+ self.assertEqual(found, ('eno1', DHCP6_EXPECTED_1))
+
def test_cmdline_convert_static(self):
found = cmdline._klibc_to_config_entry(STATIC_CONTENT_1)
self.assertEqual(found, ('eth1', STATIC_EXPECTED_1))