Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(smartos): Add addrconf IPv6 support #5831

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cloudinit/sources/DataSourceSmartOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
47 changes: 47 additions & 0 deletions tests/unittests/sources/test_smartos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ berolinux
bin456789
bipinbachhao
BirknerAlex
blackhelicoptersdotnet
bmhughes
brianphaley
BrinKe-dev
Expand Down