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

tests: ethernets: Add ipv6-address-generation integration tests #509

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions tests/integration/ethernets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import sys
import subprocess
import unittest
import ipaddress

from base import IntegrationTestsBase, nm_uses_dnsmasq, resolved_in_use, test_backends

Expand Down Expand Up @@ -221,6 +222,48 @@ def test_ip6_token(self):
self.generate_and_settle([self.state(self.dev_e_client, '::42')])
self.assert_iface_up(self.dev_e_client, ['inet6 2600::42/64'])

def test_ip6_stable_privacy(self):
self.setup_eth('ra-only')
with open(self.config, 'w') as f:
f.write('''network:
version: 2
renderer: %(r)s
ethernets:
%(ec)s:
dhcp6: yes
accept-ra: yes
ipv6-address-generation: stable-privacy''' % {'r': self.backend, 'ec': self.dev_e_client})
self.generate_and_settle([self.state_dhcp6(self.dev_e_client)])
mac_addr = [int(h, base=16) for h in self.dev_e_client_mac.split(':')]
mac_addr[0] ^= 2
mac_addr[3:3] = [0xff, 0xfe]
eui_addr_int = 0x26000000000000000000000000000000
for i, h in enumerate(reversed(mac_addr)):
eui_addr_int |= h << 8 * i
slyon marked this conversation as resolved.
Show resolved Hide resolved
eui_addr = ipaddress.IPv6Address(eui_addr_int)
self.assert_iface_up(self.dev_e_client, ['inet6 2600::'], [f'inet6 {eui_addr.compressed}/64'])

def test_ip6_eui64(self):
self.setup_eth('ra-only')
with open(self.config, 'w') as f:
f.write('''network:
version: 2
renderer: %(r)s
ethernets:
%(ec)s:
dhcp6: yes
accept-ra: yes
ipv6-address-generation: eui64''' % {'r': self.backend, 'ec': self.dev_e_client})
self.generate_and_settle([self.state_dhcp6(self.dev_e_client)])
mac_addr = [int(h, base=16) for h in self.dev_e_client_mac.split(':')]
mac_addr[0] ^= 2
mac_addr[3:3] = [0xff, 0xfe]
eui_addr_int = 0x26000000000000000000000000000000
for i, h in enumerate(reversed(mac_addr)):
eui_addr_int |= h << 8 * i
slyon marked this conversation as resolved.
Show resolved Hide resolved
eui_addr = ipaddress.IPv6Address(eui_addr_int)
self.assert_iface_up(self.dev_e_client, [f'inet6 {eui_addr.compressed}/64'])

def test_link_local_all(self):
self.setup_eth(None)
with open(self.config, 'w') as f:
Expand Down
Loading