From 4c4223edfd46841062340fe449cd97a93dccc498 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Wed, 15 Jul 2020 08:44:54 -0700 Subject: bonding lacp: replace slave string with member - Replace textual string slave with member except APIs. - For APIs, mark the existing APIs as deprecated and introduce new APIs - While introducing sw_bond_interface_dump, add the optional filter by sw_if_index and enhance the testcases to make use of it. Type: improvement Signed-off-by: Steven Luong Change-Id: Ib6626c514e45350308aeeda0decb70f3aba2f63e --- test/test_bond.py | 63 ++++++++++++++++++++++++---------------------- test/vpp_bond_interface.py | 18 ++++++------- 2 files changed, 42 insertions(+), 39 deletions(-) (limited to 'test') diff --git a/test/test_bond.py b/test/test_bond.py index dd4a6453977..911b1fb4deb 100644 --- a/test/test_bond.py +++ b/test/test_bond.py @@ -51,11 +51,11 @@ class TestBondInterface(VppTestCase): # # RX-> TX-> # - # pg2 ------+ +------pg0 (slave) + # pg2 ------+ +------pg0 (member) # | | # BondEthernet0 (10.10.10.1) # | | - # pg3 ------+ +------pg1 (slave) + # pg3 ------+ +------pg1 (memberx) # # create interface (BondEthernet0) @@ -83,14 +83,14 @@ class TestBondInterface(VppTestCase): self.logger.info(self.vapi.cli("show interface address")) self.logger.info(self.vapi.cli("show ip neighbors")) - # enslave pg0 and pg1 to BondEthernet0 - self.logger.info("bond enslave interface pg0 to BondEthernet0") - bond0.enslave_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index) - self.logger.info("bond enslave interface pg1 to BondEthernet0") - bond0.enslave_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index) + # add member pg0 and pg1 to BondEthernet0 + self.logger.info("bond add member interface pg0 to BondEthernet0") + bond0.add_member_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index) + self.logger.info("bond add_member interface pg1 to BondEthernet0") + bond0.add_member_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index) - # verify both slaves in BondEthernet0 - if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index) + # verify both members in BondEthernet0 + if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index) self.assertTrue(self.pg0.is_interface_config_in_dump(if_dump)) self.assertTrue(self.pg1.is_interface_config_in_dump(if_dump)) @@ -163,8 +163,8 @@ class TestBondInterface(VppTestCase): bond0.remove_vpp_config() - def test_bond_enslave(self): - """ Bond enslave/detach slave test """ + def test_bond_add_member(self): + """ Bond add_member/detach member test """ # create interface (BondEthernet0) and set bond mode to LACP self.logger.info("create bond") @@ -172,25 +172,27 @@ class TestBondInterface(VppTestCase): bond0.add_vpp_config() bond0.admin_up() - # verify that interfaces can be enslaved and detached two times + # verify that interfaces can be added as_member and detached two times for i in range(2): # verify pg0 and pg1 not in BondEthernet0 - if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index) + if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index) self.assertFalse(self.pg0.is_interface_config_in_dump(if_dump)) self.assertFalse(self.pg1.is_interface_config_in_dump(if_dump)) - # enslave pg0 and pg1 to BondEthernet0 - self.logger.info("bond enslave interface pg0 to BondEthernet0") - bond0.enslave_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index, - is_passive=0, - is_long_timeout=0) - - self.logger.info("bond enslave interface pg1 to BondEthernet0") - bond0.enslave_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index, - is_passive=0, - is_long_timeout=0) - # verify both slaves in BondEthernet0 - if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index) + # add_member pg0 and pg1 to BondEthernet0 + self.logger.info("bond add_member interface pg0 to BondEthernet0") + bond0.add_member_vpp_bond_interface( + sw_if_index=self.pg0.sw_if_index, + is_passive=0, + is_long_timeout=0) + + self.logger.info("bond add_member interface pg1 to BondEthernet0") + bond0.add_member_vpp_bond_interface( + sw_if_index=self.pg1.sw_if_index, + is_passive=0, + is_long_timeout=0) + # verify both members in BondEthernet0 + if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index) self.assertTrue(self.pg0.is_interface_config_in_dump(if_dump)) self.assertTrue(self.pg1.is_interface_config_in_dump(if_dump)) @@ -199,7 +201,7 @@ class TestBondInterface(VppTestCase): bond0.detach_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index) # verify pg0 is not in BondEthernet0, but pg1 is - if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index) + if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index) self.assertFalse(self.pg0.is_interface_config_in_dump(if_dump)) self.assertTrue(self.pg1.is_interface_config_in_dump(if_dump)) @@ -208,7 +210,7 @@ class TestBondInterface(VppTestCase): bond0.detach_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index) # verify pg0 and pg1 not in BondEthernet0 - if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index) + if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index) self.assertFalse(self.pg0.is_interface_config_in_dump(if_dump)) self.assertFalse(self.pg1.is_interface_config_in_dump(if_dump)) @@ -234,7 +236,7 @@ class TestBondInterface(VppTestCase): self.assertIn('BondEthernet1', ifs) # verify they are in the dump also - if_dump = self.vapi.sw_interface_bond_dump() + if_dump = self.vapi.sw_bond_interface_dump(sw_if_index=0xFFFFFFFF) self.assertTrue(bond0.is_interface_config_in_dump(if_dump)) self.assertTrue(bond1.is_interface_config_in_dump(if_dump)) @@ -252,7 +254,7 @@ class TestBondInterface(VppTestCase): self.assertNotIn('BondEthernet1', ifs) # verify BondEthernet1 is not in the dump - if_dump = self.vapi.sw_interface_bond_dump() + if_dump = self.vapi.sw_bond_interface_dump(sw_if_index=0xFFFFFFFF) self.assertFalse(bond1.is_interface_config_in_dump(if_dump)) # verify BondEthernet0 is still in the dump @@ -269,7 +271,8 @@ class TestBondInterface(VppTestCase): self.assertNotIn('BondEthernet0', ifs) # verify BondEthernet0 is not in the dump - if_dump = self.vapi.sw_interface_bond_dump() + if_dump = self.vapi.sw_bond_interface_dump( + sw_if_index=bond0.sw_if_index) self.assertFalse(bond0.is_interface_config_in_dump(if_dump)) diff --git a/test/vpp_bond_interface.py b/test/vpp_bond_interface.py index 0db04e135b1..8ad7bceac70 100644 --- a/test/vpp_bond_interface.py +++ b/test/vpp_bond_interface.py @@ -27,18 +27,18 @@ class VppBondInterface(VppInterface): def remove_vpp_config(self): self.test.vapi.bond_delete(self.sw_if_index) - def enslave_vpp_bond_interface(self, - sw_if_index, - is_passive=0, - is_long_timeout=0): - self.test.vapi.bond_enslave(sw_if_index, - self.sw_if_index, - is_passive, - is_long_timeout) + def add_member_vpp_bond_interface(self, + sw_if_index, + is_passive=0, + is_long_timeout=0): + self.test.vapi.bond_add_member(sw_if_index, + self.sw_if_index, + is_passive, + is_long_timeout) def detach_vpp_bond_interface(self, sw_if_index): - self.test.vapi.bond_detach_slave(sw_if_index) + self.test.vapi.bond_detach_member(sw_if_index) def is_interface_config_in_dump(self, dump): for i in dump: -- cgit 1.2.3-korg