From c17c1873a92f41ddf4fbb6680a7e8922f7f21b35 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 23 Jul 2019 01:48:55 -0700 Subject: vom: QoS support Type: feature Change-Id: If517d10c318fc17fdbd797fac8d974d9851f6442 Signed-off-by: Neale Ranns --- test/ext/vom_test.cpp | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'test') diff --git a/test/ext/vom_test.cpp b/test/ext/vom_test.cpp index 77fbf014231..6b6a1d7dab0 100644 --- a/test/ext/vom_test.cpp +++ b/test/ext/vom_test.cpp @@ -78,6 +78,12 @@ #include "vom/nat_binding_cmds.hpp" #include "vom/pipe.hpp" #include "vom/pipe_cmds.hpp" +#include "vom/qos_mark.hpp" +#include "vom/qos_mark_cmds.hpp" +#include "vom/qos_map.hpp" +#include "vom/qos_map_cmds.hpp" +#include "vom/qos_record.hpp" +#include "vom/qos_record_cmds.hpp" using namespace boost; using namespace VOM; @@ -486,6 +492,30 @@ public: { rc = handle_derived(f_exp, f_act); } + else if (typeid(*f_exp) == typeid(QoS::mark_cmds::create_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(QoS::mark_cmds::delete_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(QoS::record_cmds::create_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(QoS::record_cmds::delete_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(QoS::map_cmds::create_cmd)) + { + rc = handle_derived(f_exp, f_act); + } + else if (typeid(*f_exp) == typeid(QoS::map_cmds::delete_cmd)) + { + rc = handle_derived(f_exp, f_act); + } else { throw ExpException(2); @@ -2187,4 +2217,53 @@ BOOST_AUTO_TEST_CASE(test_pipes) { TRY_CHECK(OM::remove(gk)); } +BOOST_AUTO_TEST_CASE(test_qos) { + VppInit vi; + const std::string albert = "AlbertCamus"; + rc_t rc = rc_t::OK; + + /* + * Create an interface on which to enable QoS + */ + std::string itf_name = "host1"; + interface itf(itf_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); + HW::item hw_as_down(interface::admin_state_t::DOWN, rc_t::OK); + ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf_name)); + ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh)); + TRY_CHECK_RC(OM::write(albert, itf)); + + QoS::map::outputs_t out; + out[0][5] = 5; + out[3][6] = 6; + + QoS::map qem(1, out); + + HW::item hw_qem(true, rc_t::OK); + ADD_EXPECT(QoS::map_cmds::create_cmd(hw_qem, 1, out)); + TRY_CHECK_RC(OM::write(albert, qem)); + + QoS::record *qr = new QoS::record(itf, QoS::source_t::IP); + HW::item hw_qr(true, rc_t::OK); + ADD_EXPECT(QoS::record_cmds::create_cmd(hw_qr, hw_ifh.data(), QoS::source_t::IP)); + TRY_CHECK_RC(OM::write(albert, *qr)); + + QoS::mark *qm = new QoS::mark(itf, qem, QoS::source_t::IP); + HW::item hw_qm(true, rc_t::OK); + ADD_EXPECT(QoS::mark_cmds::create_cmd(hw_qm, hw_ifh.data(), 1, QoS::source_t::IP)); + TRY_CHECK_RC(OM::write(albert, *qm)); + + delete qr; + delete qm; + ADD_EXPECT(QoS::mark_cmds::delete_cmd(hw_qm, hw_ifh.data(), QoS::source_t::IP)); + ADD_EXPECT(QoS::map_cmds::delete_cmd(hw_qem, 1)); + ADD_EXPECT(QoS::record_cmds::delete_cmd(hw_qr, hw_ifh.data(), QoS::source_t::IP)); + ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh)); + ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf_name)); + TRY_CHECK(OM::remove(albert)); +} + BOOST_AUTO_TEST_SUITE_END() -- cgit 1.2.3-korg