summaryrefslogtreecommitdiffstats
path: root/test/ext
diff options
context:
space:
mode:
Diffstat (limited to 'test/ext')
-rw-r--r--test/ext/vom_test.cpp50
1 files changed, 46 insertions, 4 deletions
diff --git a/test/ext/vom_test.cpp b/test/ext/vom_test.cpp
index 91769155040..f12f871a904 100644
--- a/test/ext/vom_test.cpp
+++ b/test/ext/vom_test.cpp
@@ -736,6 +736,7 @@ BOOST_AUTO_TEST_CASE(test_bridge) {
VppInit vi;
const std::string franz = "FranzKafka";
const std::string dante = "Dante";
+ const std::string jkr = "jkrowling";
rc_t rc = rc_t::OK;
/*
@@ -801,7 +802,8 @@ BOOST_AUTO_TEST_CASE(test_bridge) {
HW::item<bool> hw_be1(true, rc_t::OK);
mac_address_t mac1({0,1,2,3,4,5});
bridge_domain_entry *be1 = new bridge_domain_entry(bd1, mac1, itf2);
- ADD_EXPECT(bridge_domain_entry_cmds::create_cmd(hw_be1, mac1, bd1.id(), hw_ifh2.data()));
+ ADD_EXPECT(bridge_domain_entry_cmds::create_cmd(hw_be1, mac1, bd1.id(), hw_ifh2.data(),
+ false));
TRY_CHECK_RC(OM::write(dante, *be1));
// Add some entries to the bridge-domain ARP termination table
@@ -827,13 +829,53 @@ BOOST_AUTO_TEST_CASE(test_bridge) {
delete be1;
delete bea1;
STRICT_ORDER_OFF();
+ ADD_EXPECT(bridge_domain_arp_entry_cmds::delete_cmd(hw_be1, bd1.id(), mac1, ip1));
+ ADD_EXPECT(bridge_domain_entry_cmds::delete_cmd(hw_be1, mac1, bd1.id(), false));
ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_bind, hw_ifh2.data(), hw_bd.data(), false));
+
+ ADD_EXPECT(bridge_domain_cmds::delete_cmd(hw_bd));
ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh2));
ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(bridge_domain_entry_cmds::delete_cmd(hw_be1, mac1, bd1.id()));
- ADD_EXPECT(bridge_domain_arp_entry_cmds::delete_cmd(hw_be1, bd1.id(), mac1, ip1));
- ADD_EXPECT(bridge_domain_cmds::delete_cmd(hw_bd));
TRY_CHECK(OM::remove(dante));
+
+ // test the BVI entry in l2fib
+ bridge_domain bd2(99);
+
+ HW::item<uint32_t> hw_bd2(99, rc_t::OK);
+ ADD_EXPECT(bridge_domain_cmds::create_cmd(hw_bd2, bridge_domain::learning_mode_t::ON));
+
+ TRY_CHECK_RC(OM::write(jkr, bd2));
+
+ std::string itf3_name = "bvi";
+ interface itf3(itf3_name,
+ interface::type_t::BVI,
+ interface::admin_state_t::UP);
+
+ HW::item<handle_t> hw_ifh3(5, rc_t::OK);
+ ADD_EXPECT(interface_cmds::loopback_create_cmd(hw_ifh3, itf3_name));
+ ADD_EXPECT(interface_cmds::set_tag(hw_ifh3, itf3_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh3));
+ TRY_CHECK_RC(OM::write(jkr, itf3));
+
+ l2_binding *l2itf3 = new l2_binding(itf3, bd2);
+ ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_bind, hw_ifh3.data(), hw_bd2.data(), true));
+ TRY_CHECK_RC(OM::write(jkr, *l2itf3));
+
+ HW::item<bool> hw_be2(true, rc_t::OK);
+ mac_address_t mac2({0,1,2,3,4,5});
+ bridge_domain_entry *be2 = new bridge_domain_entry(bd2, mac2, itf3);
+ ADD_EXPECT(bridge_domain_entry_cmds::create_cmd(hw_be2, mac2, bd2.id(), hw_ifh3.data(), true));
+ TRY_CHECK_RC(OM::write(jkr, *be2));
+
+ delete l2itf3;
+ delete be2;
+ STRICT_ORDER_OFF();
+ ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_bind, hw_ifh3.data(), hw_bd2.data(), true));
+ ADD_EXPECT(bridge_domain_entry_cmds::delete_cmd(hw_be2, mac2, bd2.id(), true));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh3));
+ ADD_EXPECT(interface_cmds::loopback_delete_cmd(hw_ifh3));
+ ADD_EXPECT(bridge_domain_cmds::delete_cmd(hw_bd2));
+ TRY_CHECK(OM::remove(jkr));
}
BOOST_AUTO_TEST_CASE(test_vxlan) {