X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fext%2Fvom_test.cpp;h=7d7325413bda90817f72866560fdc5aac394468e;hb=e21463d87979a49720bf1eb1744f01261ffea620;hp=3374259cd609ff144df232bcee191d4ac2293cc6;hpb=762d83c198c6c24cce4eb94a6d027f520d0b8383;p=vpp.git diff --git a/test/ext/vom_test.cpp b/test/ext/vom_test.cpp index 3374259cd60..7d7325413bd 100644 --- a/test/ext/vom_test.cpp +++ b/test/ext/vom_test.cpp @@ -56,6 +56,10 @@ #include "vom/arp_proxy_binding.hpp" #include "vom/arp_proxy_config_cmds.hpp" #include "vom/arp_proxy_binding_cmds.hpp" +#include "vom/igmp_binding.hpp" +#include "vom/igmp_binding_cmds.hpp" +#include "vom/igmp_listen.hpp" +#include "vom/igmp_listen_cmds.hpp" #include "vom/ip_punt_redirect.hpp" #include "vom/ip_punt_redirect_cmds.hpp" #include "vom/ip_unnumbered.hpp" @@ -91,10 +95,10 @@ public: class MockListener : public interface::event_listener, public interface::stat_listener { - void handle_interface_stat(interface_cmds::stats_enable_cmd *cmd) + void handle_interface_stat(const interface& itf) { } - void handle_interface_event(interface_cmds::events_cmd *cmd) + void handle_interface_event(std::vector events) { } }; @@ -379,6 +383,22 @@ public: { rc = handle_derived(f_exp, f_act); } + else if (typeid(*f_exp) == typeid(igmp_binding_cmds::bind_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(igmp_binding_cmds::unbind_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(igmp_listen_cmds::listen_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(igmp_listen_cmds::unlisten_cmd)) + { + rc = handle_derived(f_exp, f_act); + } else if (typeid(*f_exp) == typeid(ip_punt_redirect_cmds::config_cmd)) { rc = handle_derived(f_exp, f_act); @@ -1136,7 +1156,8 @@ BOOST_AUTO_TEST_CASE(test_vxlan) { vxlan_tunnel vxt(ep.src, ep.dst, ep.vni); HW::item hw_vxt(3, rc_t::OK); - ADD_EXPECT(vxlan_tunnel_cmds::create_cmd(hw_vxt, "don't-care", ep)); + ADD_EXPECT(vxlan_tunnel_cmds::create_cmd(hw_vxt, "don't-care", ep, + handle_t::INVALID)); TRY_CHECK_RC(OM::write(franz, vxt)); @@ -1322,6 +1343,51 @@ BOOST_AUTO_TEST_CASE(test_acl) { TRY_CHECK(OM::remove(fyodor)); } +BOOST_AUTO_TEST_CASE(test_igmp) { + VppInit vi; + const std::string Isaiah = "IsaiahBerlin"; + rc_t rc = rc_t::OK; + + boost::asio::ip::address_v4 gaddr = boost::asio::ip::address_v4::from_string("232.0.0.1"); + boost::asio::ip::address_v4 saddr1 = boost::asio::ip::address_v4::from_string("192.168.0.20"); + boost::asio::ip::address_v4 saddr2 = boost::asio::ip::address_v4::from_string("192.168.0.30"); + + std::string itf3_name = "host3"; + interface itf3(itf3_name, + interface::type_t::AFPACKET, + interface::admin_state_t::UP); + HW::item hw_ifh(2, rc_t::OK); + HW::item hw_as_up(interface::admin_state_t::UP, rc_t::OK); + ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf3_name)); + ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh)); + TRY_CHECK_RC(OM::write(Isaiah, itf3)); + + igmp_binding *ib = new igmp_binding(itf3); + HW::item hw_binding(true, rc_t::OK); + ADD_EXPECT(igmp_binding_cmds::bind_cmd(hw_binding, hw_ifh.data())); + TRY_CHECK_RC(OM::write(Isaiah, *ib)); + + igmp_listen::src_addrs_t saddrs = {saddr1, saddr2}; + + igmp_listen *il = new igmp_listen(*ib, gaddr, saddrs); + HW::item hw_as_listen(true, rc_t::OK); + ADD_EXPECT(igmp_listen_cmds::listen_cmd(hw_as_listen, hw_ifh.data(), gaddr, saddrs)); + TRY_CHECK_RC(OM::write(Isaiah, *il)); + + delete il; + delete ib; + + HW::item hw_as_down(interface::admin_state_t::DOWN, + rc_t::OK); + STRICT_ORDER_OFF(); + ADD_EXPECT(igmp_listen_cmds::unlisten_cmd(hw_as_listen, hw_ifh.data(), gaddr)); + ADD_EXPECT(igmp_binding_cmds::unbind_cmd(hw_binding, hw_ifh.data())); + ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh)); + ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf3_name)); + + TRY_CHECK(OM::remove(Isaiah)); +} + BOOST_AUTO_TEST_CASE(test_arp_proxy) { VppInit vi; const std::string kurt = "KurtVonnegut";