From bc4adcf9a4b7dee5e0a56c39b707e40f6d64f482 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 5 Feb 2025 23:12:45 +0100 Subject: vyos.ifconfig: T7135: only restart DHCPv6 client if needed Previously the DHCPv6 client was restarted on any change to the interface, including changes only to the interface description. Re-use pattern from IPv4 DHCP to only restart the DHCP client if necessary. --- smoketest/scripts/cli/base_interfaces_test.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index 85888a448..78c807d59 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -366,6 +366,26 @@ class BasicInterfaceTest: vrf_pids = cmd(f'ip vrf pids {vrf_name}') self.assertIn(str(tmp), vrf_pids) + # T7135: remove interface from VRF instance and move DHCP client + # back to default VRF. This must restart the DHCP client process + for interface in self._interfaces: + self.cli_delete(self._base_path + [interface, 'vrf']) + + self.cli_commit() + + # Validate interface state + for interface in self._interfaces: + tmp = get_interface_vrf(interface) + self.assertEqual(tmp, 'default') + + # Check if dhclient process runs + tmp = process_named_running(dhcp6c_process_name, cmdline=interface, timeout=10) + self.assertTrue(tmp) + # .. inside the appropriate VRF instance + vrf_pids = cmd(f'ip vrf pids {vrf_name}') + self.assertNotIn(str(tmp), vrf_pids) + + self.cli_delete(['vrf', 'name', vrf_name]) def test_move_interface_between_vrf_instances(self): -- cgit v1.2.3