summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-10 22:27:29 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-10 22:35:50 +0200
commit6fca4854aa2e950795ff0411abe4601f86bdeac0 (patch)
tree0b2d88df6a2935effcdefc66a8162d88a49eaadd
parent9e2fa823901104ff7e3ef7440b3cf164652d49bb (diff)
downloadvyos-1x-6fca4854aa2e950795ff0411abe4601f86bdeac0.tar.gz
vyos-1x-6fca4854aa2e950795ff0411abe4601f86bdeac0.zip
smoketest: bond: add testcase for source-interface re-use
A bond member is not allowed to also be used as a source interface for e.g. PPPoE or MACsec.
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bonding.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py
index 237abb487..29a055124 100755
--- a/smoketest/scripts/cli/test_interfaces_bonding.py
+++ b/smoketest/scripts/cli/test_interfaces_bonding.py
@@ -49,7 +49,7 @@ class BondingInterfaceTest(BasicInterfaceTest.TestCase):
if not '.' in tmp:
cls._members.append(tmp)
- cls._options['bond0'] = []
+ cls._options = {'bond0' : []}
for member in cls._members:
cls._options['bond0'].append(f'member interface {member}')
cls._interfaces = list(cls._options)
@@ -165,6 +165,26 @@ class BondingInterfaceTest(BasicInterfaceTest.TestCase):
self.cli_commit()
+ def test_bonding_source_interface(self):
+ # Re-use member interface that is already a source-interface
+ bond = 'bond99'
+ pppoe = 'pppoe98756'
+ member = next(iter(self._members))
+
+ self.cli_set(self._base_path + [bond, 'member', 'interface', member])
+ self.cli_set(['interfaces', 'pppoe', pppoe, 'source-interface', member])
+
+ # check validate() - can not add interface to bond, it is the source-interface of ...
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+
+ self.cli_delete(['interfaces', 'pppoe', pppoe])
+ self.cli_commit()
+
+ # verify config
+ slaves = read_file(f'/sys/class/net/{bond}/bonding/slaves').split()
+ self.assertIn(member, slaves)
+
def test_bonding_uniq_member_description(self):
ethernet_path = ['interfaces', 'ethernet']
for interface in self._interfaces: