diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py index 38026c69a47..fe9da48d31b 100644 --- a/cloudinit/sources/DataSourceSmartOS.py +++ b/cloudinit/sources/DataSourceSmartOS.py @@ -927,6 +927,8 @@ def is_valid_ipv6(addr): for ip in nic.get("ips", []): if ip == "dhcp": subnet = {"type": "dhcp4"} + elif ip == "addrconf": + subnet = {"type": "dhcp6"} else: routeents = [] subnet = dict( diff --git a/tests/unittests/sources/test_smartos.py b/tests/unittests/sources/test_smartos.py index b4d7dbb1945..fbb7ee625a6 100644 --- a/tests/unittests/sources/test_smartos.py +++ b/tests/unittests/sources/test_smartos.py @@ -327,6 +327,30 @@ """ ) +SDC_NICS_ADDRCONF = json.loads( + """ +[ + { + "gateway": "10.64.1.129", + "gateways": [ + "10.64.1.129" + ], + "interface": "net0", + "ip": "10.64.1.130", + "ips": [ + "10.64.1.130/26", + "addrconf" + ], + "mac": "e2:7f:c1:50:eb:99", + "model": "virtio", + "netmask": "255.255.255.192", + "nic_tag": "external", + "primary": true, + "vlan_id": 20 + } +] +""" +) MOCK_RETURNS = { "hostname": "test-host", @@ -1344,6 +1368,29 @@ def test_routes_on_all_nics(self): self.maxDiff = None self.assertEqual(expected, found) + def test_ipv6_addrconf(self): + expected = { + "config": [ + { + "mac_address": "e2:7f:c1:50:eb:99", + "name": "net0", + "subnets": [ + { + "address": "10.64.1.130/26", + "gateway": "10.64.1.129", + "type": "static", + }, + {"type": "dhcp6"}, + ], + "type": "physical", + } + ], + "version": 1, + } + found = convert_net(SDC_NICS_ADDRCONF) + self.maxDiff = None + self.assertEqual(expected, found) + @unittest.skipUnless( get_smartos_environ() == SMARTOS_ENV_KVM, diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers index f2b19e6f979..49790ea2fbd 100644 --- a/tools/.github-cla-signers +++ b/tools/.github-cla-signers @@ -27,6 +27,7 @@ berolinux bin456789 bipinbachhao BirknerAlex +blackhelicoptersdotnet bmhughes brianphaley BrinKe-dev