diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-09-10 17:26:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 17:26:11 +0200 |
| commit | 148dd2b2f5ac5f0cd3671650aa11100fc293b588 (patch) | |
| tree | cbcfc483d4699314b411ebb99448363051aab0c0 /smoketest/scripts/cli | |
| parent | b656e77a1c9a206edf35c361f4fcb1940cd5be91 (diff) | |
| parent | aa3f1c548198a1110d67385f19ccc910c5c48be8 (diff) | |
| download | vyos-1x-148dd2b2f5ac5f0cd3671650aa11100fc293b588.tar.gz vyos-1x-148dd2b2f5ac5f0cd3671650aa11100fc293b588.zip | |
Merge pull request #5454 from c-po/bond-fix-add-member
bond: T9269: keep the bond MAC when appending a member interface
Diffstat (limited to 'smoketest/scripts/cli')
| -rwxr-xr-x | smoketest/scripts/cli/test_interfaces_bonding.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py index ed4e5d911..3a3b1e5cf 100755 --- a/smoketest/scripts/cli/test_interfaces_bonding.py +++ b/smoketest/scripts/cli/test_interfaces_bonding.py @@ -134,6 +134,42 @@ class BondingInterfaceTest(BasicInterfaceTest.TestCase): state = Interface(remove_member).get_admin_state() self.assertEqual('up', state) + def test_bonding_append_member(self): + # T9269: appending a member to a bond that already has one must not + # disturb the existing member. leaf_node_changed() used to report the + # already configured member as removed, because a multi node holding a + # single value renders as a plain string and only becomes a list once + # it holds several values - so the bond released it again right after + # adding the new one. The bond MAC must not move to the new member + # either, that only happens while the bond has no member at all. + if len(self._members) < 2: + self.skipTest('not enough member interfaces available') + + first, second = self._members[0], self._members[1] + + for interface in self._interfaces: + self.cli_set(self._base_path + [interface, 'member', 'interface', first]) + self.cli_commit() + + bond_macs = {} + for interface in self._interfaces: + slaves = read_file(f'/sys/class/net/{interface}/bonding/slaves').split() + self.assertEqual(slaves, [first]) + bond_macs[interface] = Interface(interface).get_mac() + + for interface in self._interfaces: + self.cli_set(self._base_path + [interface, 'member', 'interface', second]) + self.cli_commit() + + for interface in self._interfaces: + slaves = read_file(f'/sys/class/net/{interface}/bonding/slaves').split() + # the pre-existing member must still be enslaved and up + self.assertIn(first, slaves) + self.assertIn(second, slaves) + self.assertEqual(Interface(first).get_admin_state(), 'up') + # appending a member must not change the bond's own MAC address + self.assertEqual(Interface(interface).get_mac(), bond_macs[interface]) + def test_bonding_min_links(self): # configure member interfaces min_links = len(self._interfaces) |
