summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_l2_fib.py52
-rw-r--r--test/vpp_papi_provider.py1
2 files changed, 53 insertions, 0 deletions
diff --git a/test/test_l2_fib.py b/test/test_l2_fib.py
index 51c17470966..9ce289f1652 100644
--- a/test/test_l2_fib.py
+++ b/test/test_l2_fib.py
@@ -498,6 +498,29 @@ class TestL2fib(VppTestCase):
self.vapi.want_l2_macs_events(enable_disable=0)
self.assertEqual(len(learned_macs ^ macs), 0)
+ def test_l2_fib_mac_learn_evs2(self):
+ """ L2 FIB - mac learning events using want_l2_macs_events2
+ """
+ bd1 = 1
+ hosts = self.create_hosts(10, subnet=39)
+
+ self.vapi.l2fib_set_scan_delay(scan_delay=10)
+ self.vapi.want_l2_macs_events2()
+ self.sleep(1)
+ self.learn_hosts(bd1, hosts)
+
+ self.sleep(1)
+ self.logger.info(self.vapi.ppcli("show l2fib"))
+ evs = self.vapi.collect_events()
+ action = VppEnum.vl_api_mac_event_action_t.MAC_EVENT_ACTION_API_ADD
+ learned_macs = {
+ e.mac[i].mac_addr.packed for e in evs for i in range(e.n_macs)
+ if e.mac[i].action == action}
+ macs = {h.bin_mac for swif in self.bd_ifs(bd1)
+ for h in hosts[self.pg_interfaces[swif].sw_if_index]}
+ self.vapi.want_l2_macs_events2(enable_disable=0)
+ self.assertEqual(len(learned_macs ^ macs), 0)
+
def test_l2_fib_macs_learn_max(self):
""" L2 FIB - mac learning max macs in event
"""
@@ -525,6 +548,35 @@ class TestL2fib(VppTestCase):
self.assertLess(len(e), ev_macs * 10)
self.assertEqual(len(learned_macs ^ macs), 0)
+ def test_l2_fib_macs_learn_max2(self):
+ """ L2 FIB - mac learning max macs in event using want_l2_macs_events2
+ """
+ bd1 = 1
+ hosts = self.create_hosts(10, subnet=40)
+
+ ev_macs = 1
+ self.vapi.l2fib_set_scan_delay(scan_delay=10)
+ self.vapi.want_l2_macs_events2(max_macs_in_event=ev_macs)
+ self.sleep(1)
+ self.learn_hosts(bd1, hosts)
+
+ self.sleep(1)
+ self.logger.info(self.vapi.ppcli("show l2fib"))
+ evs = self.vapi.collect_events()
+ self.vapi.want_l2_macs_events2(enable_disable=0)
+
+ self.assertGreater(len(evs), 0)
+ action = VppEnum.vl_api_mac_event_action_t.MAC_EVENT_ACTION_API_ADD
+ learned_macs = {
+ e.mac[i].mac_addr.packed for e in evs for i in range(e.n_macs)
+ if e.mac[i].action == action}
+ macs = {h.bin_mac for swif in self.bd_ifs(bd1)
+ for h in hosts[self.pg_interfaces[swif].sw_if_index]}
+
+ for e in evs:
+ self.assertLess(len(e), ev_macs * 10)
+ self.assertEqual(len(learned_macs ^ macs), 0)
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index d1a4eaf7fc6..c5e8ff0e068 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -104,6 +104,7 @@ defaultmapping = {
'want_igmp_events': {'enable': 1, },
'want_interface_events': {'enable_disable': 1, },
'want_l2_macs_events': {'enable_disable': 1, 'pid': os.getpid(), },
+ 'want_l2_macs_events2': {'enable_disable': 1, 'pid': os.getpid(), },
}