summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/VppUplink.cpp32
-rw-r--r--src/test/VppManager_test.cpp21
2 files changed, 48 insertions, 5 deletions
diff --git a/src/VppUplink.cpp b/src/VppUplink.cpp
index 4026d73..fcaddf7 100644
--- a/src/VppUplink.cpp
+++ b/src/VppUplink.cpp
@@ -22,6 +22,9 @@
#include "vom/neighbour.hpp"
#include "vom/sub_interface.hpp"
#include <vom/bond_group_binding.hpp>
+#include <vom/qos_mark.hpp>
+#include <vom/qos_map.hpp>
+#include <vom/qos_record.hpp>
#include "VppSpineProxy.hpp"
#include "VppUplink.hpp"
@@ -32,6 +35,11 @@ using namespace VOM;
namespace VPP
{
+/**
+ * THe DSCP and VLAN CoS value opflex wants for its control packets
+ */
+const static u8 opflex_cp_dscp = 5;
+
static const std::string UPLINK_KEY = "__uplink__";
Uplink::Uplink(opflexagent::Agent &agent)
@@ -111,6 +119,12 @@ Uplink::configure_tap(const route::prefix_t &pfx)
ip_punt_redirect ipPunt(*m_subitf, itf, pfx.address());
VOM::OM::write(UPLINK_KEY, ipPunt);
+
+ /**
+ * record the QoS bits for packets from the TAP
+ */
+ QoS::record qr(itf, QoS::source_t::IP);
+ OM::write(UPLINK_KEY, qr);
}
void
@@ -266,7 +280,8 @@ Uplink::configure(const std::string &fqdn)
* Configure DHCP on the uplink subinterface
* We must use the MAC address of the uplink interface as the DHCP client-ID
*/
- dhcp_client dc(*m_subitf, hostname, m_uplink->l2_address(), true, this);
+ dhcp_client dc(*m_subitf, hostname, m_uplink->l2_address(), true,
+ ip_dscp_t(opflex_cp_dscp), this);
OM::write(UPLINK_KEY, dc);
/**
@@ -287,6 +302,21 @@ Uplink::configure(const std::string &fqdn)
{
LOG(opflexagent::DEBUG) << "DHCP awaiting lease";
}
+
+ /**
+ * set up the QoS marking for CP packets - VLAN CoS=5
+ */
+ QoS::map::outputs_t outputs;
+
+ for (auto &x : outputs)
+ for (auto &y : x)
+ y = opflex_cp_dscp;
+
+ QoS::map qem(1, outputs);
+ OM::write(UPLINK_KEY, qem);
+
+ QoS::mark qm(*m_subitf, qem, QoS::source_t::IP);
+ OM::write(UPLINK_KEY, qm);
}
void
diff --git a/src/test/VppManager_test.cpp b/src/test/VppManager_test.cpp
index 4ef06c9..335eb5f 100644
--- a/src/test/VppManager_test.cpp
+++ b/src/test/VppManager_test.cpp
@@ -50,6 +50,9 @@
#include <vom/route_domain.hpp>
#include <vom/stat_reader.hpp>
#include <vom/sub_interface.hpp>
+#include <vom/qos_map.hpp>
+#include <vom/qos_mark.hpp>
+#include <vom/qos_record.hpp>
#include "VppManager.hpp"
#include "opflexagent/test/ModbFixture.h"
@@ -237,9 +240,9 @@ print_obj(const T &obj, const std::string &s)
}
#define WAIT_FOR_MATCH(obj) \
- WAIT_FOR_ONFAIL(is_match(obj), 1000, print_obj(obj, "Not Found: "))
+ WAIT_FOR_ONFAIL(is_match(obj), 10, print_obj(obj, "Not Found: "))
#define WAIT_FOR_NOT_PRESENT(obj) \
- WAIT_FOR_ONFAIL(!is_present(obj), 1000, print_obj(obj, "Still present: "))
+ WAIT_FOR_ONFAIL(!is_present(obj), 10, print_obj(obj, "Still present: "))
class VppManagerFixture : public ModbFixture
{
@@ -560,7 +563,7 @@ class VppManagerFixture : public ModbFixture
WAIT_FOR_MATCH(v_sub);
std::string fqdn = boost::asio::ip::host_name();
- WAIT_FOR_MATCH(dhcp_client(v_sub, fqdn));
+ WAIT_FOR_MATCH(dhcp_client(v_sub, fqdn, true, ip_dscp_t(5)));
WAIT_FOR_MATCH(lldp_global(fqdn, 5, 2));
WAIT_FOR_MATCH(lldp_binding(v_phy, "uplink-interface"));
@@ -695,9 +698,19 @@ BOOST_FIXTURE_TEST_CASE(start, VppStitchedManagerFixture)
WAIT_FOR_MATCH(v_sub);
std::string fqdn = boost::asio::ip::host_name();
- WAIT_FOR_MATCH(dhcp_client(v_sub, fqdn));
+ WAIT_FOR_MATCH(dhcp_client(v_sub, fqdn, true, ip_dscp_t(5)));
WAIT_FOR_MATCH(lldp_global(fqdn, 5, 2));
WAIT_FOR_MATCH(lldp_binding(v_phy, "uplink-interface"));
+
+ QoS::map::outputs_t outputs;
+ for (int ii = 0; ii < 4; ii++)
+ {
+ for (int jj = 0; jj < 256; jj++)
+ {
+ outputs[ii][jj] = 5;
+ }
+ }
+ WAIT_FOR_MATCH(QoS::map(1, outputs));
}
BOOST_FIXTURE_TEST_CASE(endpoint_group_add_del, VppStitchedManagerFixture)