+BOOST_AUTO_TEST_CASE(test_pipes) {
+ VppInit vi;
+ const std::string gk = "GKChesterton";
+
+ const std::string pipe_name_1 = "pipe1";
+ VOM::pipe pipe1(1, interface::admin_state_t::UP);
+ HW::item<handle_t> hw_hdl(4, rc_t::OK);
+ HW::item<pipe::handle_pair_t> hw_hdl_pair(std::make_pair(5,6), rc_t::OK);
+
+ HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP,
+ rc_t::OK);
+ HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN,
+ rc_t::OK);
+ ADD_EXPECT(pipe_cmds::create_cmd(hw_hdl, pipe_name_1, 1, hw_hdl_pair));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_hdl));
+ TRY_CHECK_RC(OM::write(gk, pipe1));
+
+ pipe1.set_ends(hw_hdl_pair.data());
+
+ // put each end of the pipe in a BD
+ bridge_domain bd1(33, bridge_domain::learning_mode_t::OFF,
+ bridge_domain::arp_term_mode_t::OFF,
+ bridge_domain::flood_mode_t::OFF,
+ bridge_domain::mac_age_mode_t::ON);
+
+ HW::item<uint32_t> hw_bd(33, rc_t::OK);
+ ADD_EXPECT(bridge_domain_cmds::create_cmd(hw_bd,
+ bridge_domain::learning_mode_t::OFF,
+ bridge_domain::arp_term_mode_t::OFF,
+ bridge_domain::flood_mode_t::OFF,
+ bridge_domain::mac_age_mode_t::ON));
+
+ TRY_CHECK_RC(OM::write(gk, bd1));
+
+ l2_binding *l2_1 = new l2_binding(*pipe1.east(), bd1);
+ HW::item<bool> hw_l2_1_bind(true, rc_t::OK);
+
+ ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_1_bind,
+ pipe1.east()->handle(),
+ hw_bd.data(),
+ l2_binding::l2_port_type_t::L2_PORT_TYPE_NORMAL));
+ TRY_CHECK_RC(OM::write(gk, *l2_1));
+
+ l2_binding *l2_2 = new l2_binding(*pipe1.west(), bd1);
+ HW::item<bool> hw_l2_2_bind(true, rc_t::OK);
+
+ ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_2_bind,
+ pipe1.west()->handle(),
+ hw_bd.data(),
+ l2_binding::l2_port_type_t::L2_PORT_TYPE_NORMAL));
+ TRY_CHECK_RC(OM::write(gk, *l2_2));
+
+ STRICT_ORDER_OFF();
+
+ delete l2_1;
+ delete l2_2;
+ ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_1_bind,
+ pipe1.east()->handle(),
+ hw_bd.data(),
+ l2_binding::l2_port_type_t::L2_PORT_TYPE_NORMAL));
+ ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_1_bind,
+ pipe1.west()->handle(),
+ hw_bd.data(),
+ l2_binding::l2_port_type_t::L2_PORT_TYPE_NORMAL));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_hdl));
+ ADD_EXPECT(pipe_cmds::delete_cmd(hw_hdl, hw_hdl_pair));
+ ADD_EXPECT(bridge_domain_cmds::delete_cmd(hw_bd));
+ TRY_CHECK(OM::remove(gk));
+}
+