aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-12-11 08:40:20 -0800
committerNeale Ranns <nranns@cisco.com>2018-12-12 12:05:49 +0000
commitcf3ecb1a42c9c40f386ed59964117c3dab15fa5c (patch)
tree1de7366c7d4682b226f1955d5b074f3d6ce3f224 /extras
parent11312ef90b334c43966c057591c5a54750d911d2 (diff)
VOM: vxlan-tunnel takes egress interface for multicast
Change-Id: I23b44d883fbd7919bf55b96b180f97837fd6dae9 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/vom/vom/vxlan_gbp_tunnel_cmds.cpp6
-rw-r--r--extras/vom/vom/vxlan_gbp_tunnel_cmds.hpp4
-rw-r--r--extras/vom/vom/vxlan_tunnel.cpp31
-rw-r--r--extras/vom/vom/vxlan_tunnel.hpp15
-rw-r--r--extras/vom/vom/vxlan_tunnel_cmds.cpp6
-rw-r--r--extras/vom/vom/vxlan_tunnel_cmds.hpp4
6 files changed, 49 insertions, 17 deletions
diff --git a/extras/vom/vom/vxlan_gbp_tunnel_cmds.cpp b/extras/vom/vom/vxlan_gbp_tunnel_cmds.cpp
index 14470806665..a646eac34a0 100644
--- a/extras/vom/vom/vxlan_gbp_tunnel_cmds.cpp
+++ b/extras/vom/vom/vxlan_gbp_tunnel_cmds.cpp
@@ -23,9 +23,11 @@ namespace vxlan_gbp_tunnel_cmds {
create_cmd::create_cmd(HW::item<handle_t>& item,
const std::string& name,
- const vxlan_tunnel::endpoint_t& ep)
+ const vxlan_tunnel::endpoint_t& ep,
+ handle_t mcast_itf)
: interface::create_cmd<vapi::Vxlan_gbp_tunnel_add_del>(item, name)
, m_ep(ep)
+ , m_mcast_itf(mcast_itf)
{
}
@@ -46,7 +48,7 @@ create_cmd::issue(connection& con)
to_api(m_ep.src, payload.tunnel.src);
to_api(m_ep.src, payload.tunnel.dst);
- payload.tunnel.mcast_sw_if_index = ~0;
+ payload.tunnel.mcast_sw_if_index = m_mcast_itf.value();
payload.tunnel.encap_table_id = 0;
payload.tunnel.vni = m_ep.vni;
diff --git a/extras/vom/vom/vxlan_gbp_tunnel_cmds.hpp b/extras/vom/vom/vxlan_gbp_tunnel_cmds.hpp
index 34407f61bda..c7ec87245df 100644
--- a/extras/vom/vom/vxlan_gbp_tunnel_cmds.hpp
+++ b/extras/vom/vom/vxlan_gbp_tunnel_cmds.hpp
@@ -37,7 +37,8 @@ public:
*/
create_cmd(HW::item<handle_t>& item,
const std::string& name,
- const vxlan_tunnel::endpoint_t& ep);
+ const vxlan_tunnel::endpoint_t& ep,
+ handle_t mcast_itf);
/**
* Issue the command to VPP/HW
@@ -58,6 +59,7 @@ private:
* Enpoint values of the tunnel to be created
*/
const vxlan_tunnel::endpoint_t m_ep;
+ handle_t m_mcast_itf;
};
/**
diff --git a/extras/vom/vom/vxlan_tunnel.cpp b/extras/vom/vom/vxlan_tunnel.cpp
index 2abff7615eb..2bc386c1ba7 100644
--- a/extras/vom/vom/vxlan_tunnel.cpp
+++ b/extras/vom/vom/vxlan_tunnel.cpp
@@ -91,6 +91,21 @@ vxlan_tunnel::vxlan_tunnel(const boost::asio::ip::address& src,
interface::admin_state_t::UP)
, m_tep(src, dst, vni)
, m_mode(mode)
+ , m_mcast_itf()
+{
+}
+
+vxlan_tunnel::vxlan_tunnel(const boost::asio::ip::address& src,
+ const boost::asio::ip::address& dst,
+ uint32_t vni,
+ const interface& mcast_itf,
+ const mode_t& mode)
+ : interface(mk_name(src, dst, mode, vni),
+ interface::type_t::VXLAN,
+ interface::admin_state_t::UP)
+ , m_tep(src, dst, vni)
+ , m_mode(mode)
+ , m_mcast_itf(mcast_itf.singular())
{
}
@@ -130,9 +145,13 @@ vxlan_tunnel::replay()
{
if (m_hdl) {
if (mode_t::STANDARD == m_mode)
- HW::enqueue(new vxlan_tunnel_cmds::create_cmd(m_hdl, name(), m_tep));
+ HW::enqueue(new vxlan_tunnel_cmds::create_cmd(
+ m_hdl, name(), m_tep,
+ (m_mcast_itf ? m_mcast_itf->handle() : handle_t::INVALID)));
else if (mode_t::GBP == m_mode)
- HW::enqueue(new vxlan_gbp_tunnel_cmds::create_cmd(m_hdl, name(), m_tep));
+ HW::enqueue(new vxlan_gbp_tunnel_cmds::create_cmd(
+ m_hdl, name(), m_tep,
+ (m_mcast_itf ? m_mcast_itf->handle() : handle_t::INVALID)));
}
}
@@ -160,9 +179,13 @@ vxlan_tunnel::update(const vxlan_tunnel& desired)
*/
if (!m_hdl) {
if (mode_t::STANDARD == m_mode)
- HW::enqueue(new vxlan_tunnel_cmds::create_cmd(m_hdl, name(), m_tep));
+ HW::enqueue(new vxlan_tunnel_cmds::create_cmd(
+ m_hdl, name(), m_tep,
+ (m_mcast_itf ? m_mcast_itf->handle() : handle_t::INVALID)));
else if (mode_t::GBP == m_mode)
- HW::enqueue(new vxlan_gbp_tunnel_cmds::create_cmd(m_hdl, name(), m_tep));
+ HW::enqueue(new vxlan_gbp_tunnel_cmds::create_cmd(
+ m_hdl, name(), m_tep,
+ (m_mcast_itf ? m_mcast_itf->handle() : handle_t::INVALID)));
}
}
diff --git a/extras/vom/vom/vxlan_tunnel.hpp b/extras/vom/vom/vxlan_tunnel.hpp
index 136f0380e6d..63124e73426 100644
--- a/extras/vom/vom/vxlan_tunnel.hpp
+++ b/extras/vom/vom/vxlan_tunnel.hpp
@@ -97,15 +97,10 @@ public:
const boost::asio::ip::address& dst,
uint32_t vni,
const mode_t& mode = mode_t::STANDARD);
-
- /**
- * Construct a new object matching the desried state with a handle
- * read from VPP
- */
- vxlan_tunnel(const handle_t& hdl,
- const boost::asio::ip::address& src,
+ vxlan_tunnel(const boost::asio::ip::address& src,
const boost::asio::ip::address& dst,
uint32_t vni,
+ const interface& mcast_itf,
const mode_t& mode = mode_t::STANDARD);
/*
@@ -221,6 +216,12 @@ private:
mode_t m_mode;
/**
+ * The interface on which to send the packets if the destination
+ * is multicast
+ */
+ std::shared_ptr<interface> m_mcast_itf;
+
+ /**
* Construct a unique name for the tunnel
*/
static std::string mk_name(const boost::asio::ip::address& src,
diff --git a/extras/vom/vom/vxlan_tunnel_cmds.cpp b/extras/vom/vom/vxlan_tunnel_cmds.cpp
index dcc06e71797..e45b6046355 100644
--- a/extras/vom/vom/vxlan_tunnel_cmds.cpp
+++ b/extras/vom/vom/vxlan_tunnel_cmds.cpp
@@ -22,9 +22,11 @@ namespace vxlan_tunnel_cmds {
create_cmd::create_cmd(HW::item<handle_t>& item,
const std::string& name,
- const vxlan_tunnel::endpoint_t& ep)
+ const vxlan_tunnel::endpoint_t& ep,
+ handle_t mcast_itf)
: interface::create_cmd<vapi::Vxlan_add_del_tunnel>(item, name)
, m_ep(ep)
+ , m_mcast_itf(mcast_itf)
{
}
@@ -44,7 +46,7 @@ create_cmd::issue(connection& con)
payload.is_ipv6 = 0;
to_bytes(m_ep.src, &payload.is_ipv6, payload.src_address);
to_bytes(m_ep.dst, &payload.is_ipv6, payload.dst_address);
- payload.mcast_sw_if_index = ~0;
+ payload.mcast_sw_if_index = m_mcast_itf.value();
payload.encap_vrf_id = 0;
payload.decap_next_index = ~0;
payload.vni = m_ep.vni;
diff --git a/extras/vom/vom/vxlan_tunnel_cmds.hpp b/extras/vom/vom/vxlan_tunnel_cmds.hpp
index 4a8e5990391..423fcdac950 100644
--- a/extras/vom/vom/vxlan_tunnel_cmds.hpp
+++ b/extras/vom/vom/vxlan_tunnel_cmds.hpp
@@ -38,7 +38,8 @@ public:
*/
create_cmd(HW::item<handle_t>& item,
const std::string& name,
- const vxlan_tunnel::endpoint_t& ep);
+ const vxlan_tunnel::endpoint_t& ep,
+ handle_t mcast_itf);
/**
* Issue the command to VPP/HW
@@ -59,6 +60,7 @@ private:
* Enpoint values of the tunnel to be created
*/
const vxlan_tunnel::endpoint_t m_ep;
+ handle_t m_mcast_itf;
};
/**