diff options
author | Laszlo Kiraly <laszlo.kiraly@est.tech> | 2022-09-16 13:20:07 +0200 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2022-10-11 23:21:03 +0000 |
commit | 0f8f4351b03f9350a406ad1d63f97d1f4b59fec2 (patch) | |
tree | f1167a00efd992a453eacd8278bc4b1760015427 /test | |
parent | 7498aadd23eb4d5be2891041c9153cc5dff1a6cc (diff) |
l2: Add bridge_domain_add_del_v2 to l2 api
https://jira.fd.io/browse/VPP-2034
Type: fix
Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
Change-Id: Ieb6919f958f437fc603d5e1f48cab01de780951d
Diffstat (limited to 'test')
-rw-r--r-- | test/test_acl_plugin.py | 4 | ||||
-rw-r--r-- | test/test_classify_l2_acl.py | 4 | ||||
-rw-r--r-- | test/test_flowprobe.py | 4 | ||||
-rw-r--r-- | test/test_l2_fib.py | 4 | ||||
-rw-r--r-- | test/test_l2_flood.py | 18 | ||||
-rw-r--r-- | test/test_l2bd_arp_term.py | 6 | ||||
-rw-r--r-- | test/test_l2bd_learnlimit.py | 12 | ||||
-rw-r--r-- | test/test_l2bd_learnlimit_bdenabled.py | 18 | ||||
-rw-r--r-- | test/test_l2bd_learnlimit_enabled.py | 12 | ||||
-rw-r--r-- | test/test_l2bd_multi_instance.py | 45 | ||||
-rw-r--r-- | test/vpp_l2.py | 4 | ||||
-rw-r--r-- | test/vpp_papi_provider.py | 7 |
12 files changed, 90 insertions, 48 deletions
diff --git a/test/test_acl_plugin.py b/test/test_acl_plugin.py index 32ecedba2a6..036a5dbc0c2 100644 --- a/test/test_acl_plugin.py +++ b/test/test_acl_plugin.py @@ -105,7 +105,9 @@ class TestACLplugin(VppTestCase): # Create BD with MAC learning and unknown unicast flooding disabled # and put interfaces to this BD - cls.vapi.bridge_domain_add_del(bd_id=cls.bd_id, uu_flood=1, learn=1) + cls.vapi.bridge_domain_add_del_v2( + bd_id=cls.bd_id, uu_flood=1, learn=1, flood=1, forward=1, is_add=1 + ) for pg_if in cls.pg_interfaces: cls.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=pg_if.sw_if_index, bd_id=cls.bd_id diff --git a/test/test_classify_l2_acl.py b/test/test_classify_l2_acl.py index d94af3f718e..52f139132dc 100644 --- a/test/test_classify_l2_acl.py +++ b/test/test_classify_l2_acl.py @@ -104,7 +104,9 @@ class TestClassifyAcl(TestClassifier): # Create BD with MAC learning and unknown unicast flooding disabled # and put interfaces to this BD - cls.vapi.bridge_domain_add_del(bd_id=cls.bd_id, uu_flood=1, learn=1) + cls.vapi.bridge_domain_add_del_v2( + bd_id=cls.bd_id, uu_flood=1, learn=1, flood=1, forward=1, is_add=1 + ) for pg_if in cls.pg_interfaces: cls.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=pg_if.sw_if_index, bd_id=cls.bd_id diff --git a/test/test_flowprobe.py b/test/test_flowprobe.py index e3ff2245ad1..1d565dcf0a4 100644 --- a/test/test_flowprobe.py +++ b/test/test_flowprobe.py @@ -165,7 +165,9 @@ class MethodHolder(VppTestCase): # Create BD with MAC learning and unknown unicast flooding disabled # and put interfaces to this BD - cls.vapi.bridge_domain_add_del(bd_id=1, uu_flood=1, learn=1) + cls.vapi.bridge_domain_add_del_v2( + bd_id=1, uu_flood=1, learn=1, flood=1, forward=1, is_add=1 + ) cls.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=cls.pg1._sw_if_index, bd_id=1 ) diff --git a/test/test_l2_fib.py b/test/test_l2_fib.py index fe1ea458182..41b934dab42 100644 --- a/test/test_l2_fib.py +++ b/test/test_l2_fib.py @@ -112,7 +112,9 @@ class TestL2fib(VppTestCase): for bd_id in n_brs: # Create BD with MAC learning and unknown unicast flooding # disabled and put interfaces to this BD - cls.vapi.bridge_domain_add_del(bd_id=bd_id, uu_flood=0, learn=0) + cls.vapi.bridge_domain_add_del_v2( + bd_id=bd_id, is_add=1, uu_flood=0, learn=0, flood=1, forward=1 + ) ifs = [cls.pg_interfaces[i] for i in cls.bd_ifs(bd_id)] for pg_if in ifs: cls.vapi.sw_interface_set_l2_bridge( diff --git a/test/test_l2_flood.py b/test/test_l2_flood.py index db4af607451..9e77fa17266 100644 --- a/test/test_l2_flood.py +++ b/test/test_l2_flood.py @@ -57,7 +57,9 @@ class TestL2Flood(VppTestCase): # # Create a single bridge Domain # - self.vapi.bridge_domain_add_del(bd_id=1) + self.vapi.bridge_domain_add_del_v2( + bd_id=1, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 + ) # # add each interface to the BD. 3 interfaces per split horizon group @@ -169,7 +171,7 @@ class TestL2Flood(VppTestCase): enable=0, ) - self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) def test_flood_one(self): """L2 no-Flood Test""" @@ -177,7 +179,9 @@ class TestL2Flood(VppTestCase): # # Create a single bridge Domain # - self.vapi.bridge_domain_add_del(bd_id=1) + self.vapi.bridge_domain_add_del_v2( + bd_id=1, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 + ) # # add 2 interfaces to the BD. this means a flood goes to only @@ -207,7 +211,7 @@ class TestL2Flood(VppTestCase): self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=i.sw_if_index, bd_id=1, enable=0 ) - self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) def test_uu_fwd(self): """UU Flood""" @@ -215,7 +219,9 @@ class TestL2Flood(VppTestCase): # # Create a single bridge Domain # - self.vapi.bridge_domain_add_del(bd_id=1, uu_flood=1) + self.vapi.bridge_domain_add_del_v2( + bd_id=1, is_add=1, uu_flood=1, flood=1, forward=1, learn=1 + ) # # add each interface to the BD. 3 interfaces per split horizon group @@ -352,7 +358,7 @@ class TestL2Flood(VppTestCase): rx_sw_if_index=i.sw_if_index, bd_id=1, enable=0 ) - self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) if __name__ == "__main__": diff --git a/test/test_l2bd_arp_term.py b/test/test_l2bd_arp_term.py index 598203950d9..ec0165a0338 100644 --- a/test/test_l2bd_arp_term.py +++ b/test/test_l2bd_arp_term.py @@ -132,14 +132,16 @@ class TestL2bdArpTerm(VppTestCase): def bd_add_del(self, bd_id=1, is_add=1): if is_add: - self.vapi.bridge_domain_add_del(bd_id=bd_id, is_add=is_add) + self.vapi.bridge_domain_add_del_v2( + bd_id=bd_id, is_add=is_add, flood=1, uu_flood=1, forward=1, learn=1 + ) for swif in self.bd_swifs(bd_id): swif_idx = swif.sw_if_index self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=swif_idx, bd_id=bd_id, enable=is_add ) if not is_add: - self.vapi.bridge_domain_add_del(bd_id=bd_id, is_add=is_add) + self.vapi.bridge_domain_add_del_v2(bd_id=bd_id, is_add=is_add) @classmethod def arp_req(cls, src_host, host): diff --git a/test/test_l2bd_learnlimit.py b/test/test_l2bd_learnlimit.py index 1ae25da2686..79660f6c591 100644 --- a/test/test_l2bd_learnlimit.py +++ b/test/test_l2bd_learnlimit.py @@ -77,8 +77,12 @@ class TestL2LearnLimit(VppTestCase): def setUp(self): super(TestL2LearnLimit, self).setUp() - self.vapi.bridge_domain_add_del(bd_id=1) - self.vapi.bridge_domain_add_del(bd_id=2) + self.vapi.bridge_domain_add_del_v2( + bd_id=1, is_add=1, flood=1, forward=1, learn=1, uu_flood=1 + ) + self.vapi.bridge_domain_add_del_v2( + bd_id=2, is_add=1, flood=1, forward=1, learn=1, uu_flood=1 + ) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[0].sw_if_index, bd_id=1) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[1].sw_if_index, bd_id=2) @@ -91,8 +95,8 @@ class TestL2LearnLimit(VppTestCase): self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=self.pg_interfaces[1].sw_if_index, bd_id=2, enable=0 ) - self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) - self.vapi.bridge_domain_add_del(bd_id=2, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=2, is_add=0) if __name__ == "__main__": diff --git a/test/test_l2bd_learnlimit_bdenabled.py b/test/test_l2bd_learnlimit_bdenabled.py index 0578cedbe4a..36c49edcaf2 100644 --- a/test/test_l2bd_learnlimit_bdenabled.py +++ b/test/test_l2bd_learnlimit_bdenabled.py @@ -69,7 +69,9 @@ class TestL2LearnLimitBdEnable(VppTestCase): """L2BD test with bridge domain limit""" self.vapi.want_l2_macs_events(enable_disable=1, learn_limit=1000) self.vapi.bridge_domain_set_default_learn_limit(4) - self.vapi.bridge_domain_add_del(bd_id=3) + self.vapi.bridge_domain_add_del_v2( + bd_id=3, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 + ) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[2].sw_if_index, bd_id=3) self.vapi.bridge_domain_set_learn_limit(2, 5) @@ -95,13 +97,17 @@ class TestL2LearnLimitBdEnable(VppTestCase): self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=self.pg_interfaces[2].sw_if_index, bd_id=3, enable=0 ) - self.vapi.bridge_domain_add_del(is_add=0, bd_id=3) + self.vapi.bridge_domain_add_del_v2(is_add=0, bd_id=3) def setUp(self): super(TestL2LearnLimitBdEnable, self).setUp() - self.vapi.bridge_domain_add_del(bd_id=1) - self.vapi.bridge_domain_add_del(bd_id=2) + self.vapi.bridge_domain_add_del_v2( + bd_id=1, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 + ) + self.vapi.bridge_domain_add_del_v2( + bd_id=2, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 + ) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[0].sw_if_index, bd_id=1) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[1].sw_if_index, bd_id=2) @@ -114,8 +120,8 @@ class TestL2LearnLimitBdEnable(VppTestCase): self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=self.pg_interfaces[1].sw_if_index, bd_id=2, enable=0 ) - self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) - self.vapi.bridge_domain_add_del(bd_id=2, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=2, is_add=0) if __name__ == "__main__": diff --git a/test/test_l2bd_learnlimit_enabled.py b/test/test_l2bd_learnlimit_enabled.py index 8bb3b4029b0..0e23f82fe8f 100644 --- a/test/test_l2bd_learnlimit_enabled.py +++ b/test/test_l2bd_learnlimit_enabled.py @@ -89,8 +89,12 @@ class TestL2LearnLimitEnable(VppTestCase): def setUp(self): super(TestL2LearnLimitEnable, self).setUp() - self.vapi.bridge_domain_add_del(bd_id=1) - self.vapi.bridge_domain_add_del(bd_id=2) + self.vapi.bridge_domain_add_del_v2( + bd_id=1, is_add=1, flood=1, forward=1, uu_flood=1, learn=1 + ) + self.vapi.bridge_domain_add_del_v2( + bd_id=2, is_add=1, flood=1, forward=1, uu_flood=1, learn=1 + ) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[0].sw_if_index, bd_id=1) self.vapi.sw_interface_set_l2_bridge(self.pg_interfaces[1].sw_if_index, bd_id=2) @@ -103,8 +107,8 @@ class TestL2LearnLimitEnable(VppTestCase): self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=self.pg_interfaces[1].sw_if_index, bd_id=2, enable=0 ) - self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) - self.vapi.bridge_domain_add_del(bd_id=2, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) + self.vapi.bridge_domain_add_del_v2(bd_id=2, is_add=0) if __name__ == "__main__": diff --git a/test/test_l2bd_multi_instance.py b/test/test_l2bd_multi_instance.py index 1266afcb690..daf77ec9794 100644 --- a/test/test_l2bd_multi_instance.py +++ b/test/test_l2bd_multi_instance.py @@ -132,6 +132,9 @@ class TestL2bdMultiInst(VppTestCase): # Create list of BDs self.bd_list = [] + # Create dict of BDs + self.bd_map = {} + # Create list of deleted BDs self.bd_deleted_list = [] @@ -186,19 +189,29 @@ class TestL2bdMultiInst(VppTestCase): (Default value = 1) """ for b in range(start, start + count): - self.vapi.bridge_domain_add_del(bd_id=b) - self.logger.info("Bridge domain ID %d created" % b) - if self.bd_list.count(b) == 0: - self.bd_list.append(b) - if self.bd_deleted_list.count(b) == 1: - self.bd_deleted_list.remove(b) + if b == start: + self.vapi.bridge_domain_add_del_v2( + bd_id=b, flood=1, uu_flood=1, forward=1, learn=1, is_add=1 + ) + bd_id = b + else: + ret = self.vapi.bridge_domain_add_del_v2( + bd_id=0xFFFFFFFF, flood=1, uu_flood=1, forward=1, learn=1, is_add=1 + ) + bd_id = ret.bd_id + self.logger.info("Bridge domain ID %d created" % bd_id) + if self.bd_list.count(bd_id) == 0: + self.bd_map[b] = bd_id + self.bd_list.append(bd_id) + if self.bd_deleted_list.count(bd_id) == 1: + self.bd_deleted_list.remove(bd_id) for j in self.bd_if_range(b): pg_if = self.pg_interfaces[j] self.vapi.sw_interface_set_l2_bridge( - rx_sw_if_index=pg_if.sw_if_index, bd_id=b + rx_sw_if_index=pg_if.sw_if_index, bd_id=bd_id ) self.logger.info( - "pg-interface %s added to bridge domain ID %d" % (pg_if.name, b) + "pg-interface %s added to bridge domain ID %d" % (pg_if.name, bd_id) ) self.pg_in_bd.append(pg_if) hosts = self.hosts_by_pg_idx[pg_if.sw_if_index] @@ -220,16 +233,22 @@ class TestL2bdMultiInst(VppTestCase): (Default value = 1) """ for b in range(start, start + count): + bd_id = self.bd_map[b] for j in self.bd_if_range(b): pg_if = self.pg_interfaces[j] self.vapi.sw_interface_set_l2_bridge( - rx_sw_if_index=pg_if.sw_if_index, bd_id=b, enable=0 + rx_sw_if_index=pg_if.sw_if_index, bd_id=bd_id, enable=0 ) self.pg_in_bd.remove(pg_if) - self.vapi.bridge_domain_add_del(bd_id=b, is_add=0) - self.bd_list.remove(b) - self.bd_deleted_list.append(b) - self.logger.info("Bridge domain ID %d deleted" % b) + self.logger.info( + "pg-interface %s removed from bridge domain ID %d" + % (pg_if.name, bd_id) + ) + self.vapi.bridge_domain_add_del_v2(bd_id=bd_id, is_add=0) + self.bd_map.pop(b) + self.bd_list.remove(bd_id) + self.bd_deleted_list.append(bd_id) + self.logger.info("Bridge domain ID %d deleted" % bd_id) def create_stream(self, src_if): """ diff --git a/test/vpp_l2.py b/test/vpp_l2.py index 872f42851b9..21972bf4148 100644 --- a/test/vpp_l2.py +++ b/test/vpp_l2.py @@ -84,7 +84,7 @@ class VppBridgeDomain(VppObject): self.arp_ufwd = arp_ufwd def add_vpp_config(self): - self._test.vapi.bridge_domain_add_del( + self._test.vapi.bridge_domain_add_del_v2( bd_id=self.bd_id, flood=self.flood, uu_flood=self.uu_flood, @@ -98,7 +98,7 @@ class VppBridgeDomain(VppObject): return self def remove_vpp_config(self): - self._test.vapi.bridge_domain_add_del(bd_id=self.bd_id, is_add=0) + self._test.vapi.bridge_domain_add_del_v2(bd_id=self.bd_id, is_add=0) def query_vpp_config(self): return find_bridge_domain(self._test, self.bd_id) diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index db2b32e1d38..148eca2053b 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -50,13 +50,6 @@ defaultmapping = { "bier_table_add_del": { "is_add": 1, }, - "bridge_domain_add_del": { - "flood": 1, - "uu_flood": 1, - "forward": 1, - "learn": 1, - "is_add": 1, - }, "bvi_delete": {}, "geneve_add_del_tunnel": { "mcast_sw_if_index": 4294967295, |