+ def test_l2_fib_program100(self):
+ """L2 FIB - program 100 MACs"""
+ bd_id = 1
+ hosts = self.create_hosts(100, subnet=17)
+ self.config_l2_fib_entries(bd_id, hosts)
+ self.run_verify_test(bd_id, hosts, hosts)
+
+ def test_l2_fib_program100_delete12(self):
+ """L2 FIB - program 100, delete 12 MACs"""
+ bd_id = 1
+ hosts = self.create_hosts(100, subnet=17)
+ self.config_l2_fib_entries(bd_id, hosts)
+ del_hosts = self.split_hosts(hosts, 12)
+ self.delete_l2_fib_entry(bd_id, del_hosts)
+
+ self.run_verify_test(bd_id, hosts, hosts)
+ self.run_verify_negat_test(bd_id, hosts, del_hosts)
+
+ def test_l2_fib_program100_add100(self):
+ """L2 FIB - program 100, add 100 MACs"""
+ bd_id = 1
+ hosts = self.create_hosts(100, subnet=17)
+ self.config_l2_fib_entries(bd_id, hosts)
+ hosts2 = self.create_hosts(100, subnet=22)
+ self.config_l2_fib_entries(bd_id, hosts2)
+ self.run_verify_test(bd_id, hosts, hosts2)
+
+ def test_l2_fib_program10_learn10(self):
+ """L2 FIB - program 10 MACs, learn 10"""
+ hosts = self.create_hosts(20, subnet=35)
+ lhosts = self.split_hosts(hosts, 10)
+
+ bd1 = 1
+ bd2 = 2
+ self.learn_hosts(bd1, lhosts)
+ self.learn_hosts(bd2, lhosts)
+ self.config_l2_fib_entries(bd1, hosts)
+ self.config_l2_fib_entries(bd2, hosts)
+ self.run_verify_test(bd1, lhosts, hosts)
+ self.run_verify_test(bd2, lhosts, hosts)
+
+ def test_l2_fib_flush_int(self):
+ """L2 FIB - flush interface"""
+ hosts = self.create_hosts(20, subnet=36)
+ lhosts = self.split_hosts(hosts, 10)
+
+ bd1 = 1
+ self.learn_hosts(bd1, lhosts)
+ self.config_l2_fib_entries(bd1, hosts)
+ self.run_verify_test(bd1, lhosts, hosts)
+ flushed = self.flush_int(self.pg_interfaces[0].sw_if_index, lhosts)
+ self.run_verify_test(bd1, hosts, lhosts)
+ self.run_verify_negat_test(bd1, hosts, flushed)
+
+ def test_l2_fib_flush_bd(self):
+ """L2 FIB - flush BD"""
+ hosts = self.create_hosts(20, subnet=37)
+ lhosts = self.split_hosts(hosts, 10)
+
+ bd1 = 1
+ self.learn_hosts(bd1, lhosts)
+ self.config_l2_fib_entries(bd1, hosts)
+ self.run_verify_test(bd1, lhosts, hosts)
+ flushed = self.flush_bd(bd1, lhosts)
+ self.run_verify_negat_test(bd1, hosts, flushed)
+
+ def test_l2_fib_flush_all(self):
+ """L2 FIB - flush all"""
+ hosts = self.create_hosts(20, subnet=38)
+ lhosts = self.split_hosts(hosts, 10)
+
+ bd1 = 1
+ bd2 = 2
+ self.learn_hosts(bd1, lhosts)
+ self.learn_hosts(bd2, lhosts)
+ self.config_l2_fib_entries(bd1, hosts)
+ self.config_l2_fib_entries(bd2, hosts)
+ self.run_verify_test(bd1, hosts, lhosts)
+ self.run_verify_test(bd2, hosts, lhosts)
+
+ self.flush_all()
+
+ self.run_verify_negat_test(bd1, hosts, lhosts)
+ self.run_verify_negat_test(bd2, hosts, lhosts)
+
+ def test_l2_fib_mac_learn_evs(self):
+ """L2 FIB - mac learning events"""
+ bd1 = 1
+ hosts = self.create_hosts(10, subnet=39)
+
+ self.vapi.want_l2_macs_events()
+ self.learn_hosts(bd1, hosts)
+
+ self.virtual_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_events(enable_disable=0)
+ self.assertEqual(len(learned_macs ^ macs), 0)