summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_l2_fib.py18
-rw-r--r--test/vpp_papi_provider.py9
2 files changed, 27 insertions, 0 deletions
diff --git a/test/test_l2_fib.py b/test/test_l2_fib.py
index 9249a2ced23..52bf9c864ae 100644
--- a/test/test_l2_fib.py
+++ b/test/test_l2_fib.py
@@ -519,6 +519,24 @@ class TestL2fib(VppTestCase):
self.run_verify_negat_test(bd_id=1, dst_hosts=flushed)
self.run_verify_negat_test(bd_id=2, dst_hosts=flushed)
+ def test_l2_fib_09(self):
+ """ L2 FIB test 9 - mac learning events
+ """
+ self.create_hosts(10, subnet=39)
+
+ self.vapi.want_macs_learn_events()
+ self.learn_hosts(bd_id=1, n_hosts_per_if=10)
+
+ self.sleep(1)
+ self.logger.info(self.vapi.ppcli("show l2fib"))
+ evs = self.vapi.collect_events()
+ learned_macs = {
+ e.mac[i].mac_addr for e in evs for i in range(e.n_macs)}
+ macs = {h.bin_mac for swif_hs in self.learned_hosts.itervalues()
+ for h in swif_hs}
+ self.vapi.want_macs_learn_events(enable_disable=0)
+ 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 634dabeafda..b6759ec349e 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -431,6 +431,15 @@ class VppPapiProvider(object):
'address': address,
'pid': os.getpid(), })
+ def want_macs_learn_events(self, enable_disable=1, scan_delay=0,
+ max_macs_in_event=0, learn_limit=0):
+ return self.api(self.papi.want_l2_macs_events,
+ {'enable_disable': enable_disable,
+ 'scan_delay': scan_delay,
+ 'max_macs_in_event': max_macs_in_event,
+ 'learn_limit': learn_limit,
+ 'pid': os.getpid(), })
+
def l2fib_add_del(self, mac, bd_id, sw_if_index, is_add=1, static_mac=0,
filter_mac=0, bvi_mac=0):
"""Create/delete L2 FIB entry.