From a92a3d59497e792fa3be643fffb2efb479b83467 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Mon, 19 Aug 2024 20:58:59 +0300 Subject: [PATCH] tests: ethernets: Add ipv6-address-generation integration tests These tests validate the Stable Privacy and Modified EUI-64 IPv6 address generation methods under both NetworkManager and systemd-networkd. --- tests/integration/ethernets.py | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/integration/ethernets.py b/tests/integration/ethernets.py index 09b7f6ee9..c7cab98d4 100644 --- a/tests/integration/ethernets.py +++ b/tests/integration/ethernets.py @@ -221,6 +221,42 @@ 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 = self.dev_e_client_mac.split(':') + mac_addr[0] = format(int(mac_addr[0], base=16) ^ 2, 'x') + mac_addr[3:3] = ['ff', 'fe'] + eui_pairs = [''.join(o) for o in zip(*[iter(mac_addr)] * 2)] + self.assert_iface_up(self.dev_e_client, ['inet6 2600::'], [f'inet6 2600::{":".join(eui_pairs)}/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 = self.dev_e_client_mac.split(':') + mac_addr[0] = format(int(mac_addr[0], base=16) ^ 2, 'x') + mac_addr[3:3] = ['ff', 'fe'] + eui_pairs = [''.join(o) for o in zip(*[iter(mac_addr)] * 2)] + self.assert_iface_up(self.dev_e_client, [f'inet6 2600::{":".join(eui_pairs)}/64']) + def test_link_local_all(self): self.setup_eth(None) with open(self.config, 'w') as f: