summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-02-22 02:48:25 -0800
committerNeale Ranns <nranns@cisco.com>2019-02-22 13:45:38 +0000
commit533220058344d0dadc05ec82f7de6dbbf8b8b397 (patch)
tree828c4d26ac919f57ea70e29bf078f60bedd63943 /extras
parentfb2e07d89a95272fbf166a500566a699a5fdfd5b (diff)
VOM: fix tests and namespacify l2_vtr
Change-Id: Ie59220a622c3a5195485cd6857b45f57d6eeaf95 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/vom/vom/interface.cpp2
-rw-r--r--extras/vom/vom/l2_binding.cpp12
-rw-r--r--extras/vom/vom/l2_binding.hpp4
-rw-r--r--extras/vom/vom/l2_vtr.cpp27
-rw-r--r--extras/vom/vom/l2_vtr.hpp30
-rw-r--r--extras/vom/vom/l2_vtr_cmds.cpp18
-rw-r--r--extras/vom/vom/l2_vtr_cmds.hpp14
-rw-r--r--extras/vom/vom/l2_xconnect.cpp8
-rw-r--r--extras/vom/vom/l2_xconnect.hpp4
9 files changed, 63 insertions, 56 deletions
diff --git a/extras/vom/vom/interface.cpp b/extras/vom/vom/interface.cpp
index a94be683424..ec6204f1e0c 100644
--- a/extras/vom/vom/interface.cpp
+++ b/extras/vom/vom/interface.cpp
@@ -394,7 +394,7 @@ interface::set(const admin_state_t& state)
void
interface::set(const l2_address_t& addr)
{
- m_l2_address.update(addr);
+ m_l2_address = { addr, rc_t::NOOP };
}
void
diff --git a/extras/vom/vom/l2_binding.cpp b/extras/vom/vom/l2_binding.cpp
index 5f0c7a79f94..37039a0b930 100644
--- a/extras/vom/vom/l2_binding.cpp
+++ b/extras/vom/vom/l2_binding.cpp
@@ -47,7 +47,7 @@ l2_binding::l2_binding(const interface& itf, const bridge_domain& bd)
, m_bd(bd.singular())
, m_port_type(l2_port_type_t::L2_PORT_TYPE_NORMAL)
, m_binding(0)
- , m_vtr_op(l2_vtr_op_t::L2_VTR_DISABLED, rc_t::UNSET)
+ , m_vtr_op(l2_vtr::option_t::DISABLED, rc_t::UNSET)
, m_vtr_op_tag(0)
{
if (interface::type_t::BVI == m_itf->type())
@@ -64,7 +64,7 @@ l2_binding::l2_binding(const interface& itf,
, m_bd(bd.singular())
, m_port_type(port_type)
, m_binding(0)
- , m_vtr_op(l2_vtr_op_t::L2_VTR_DISABLED, rc_t::UNSET)
+ , m_vtr_op(l2_vtr::option_t::DISABLED, rc_t::UNSET)
, m_vtr_op_tag(0)
{
}
@@ -119,7 +119,8 @@ l2_binding::replay()
}
if (m_vtr_op && handle_t::INVALID != m_itf->handle()) {
- HW::enqueue(new set_vtr_op_cmd(m_vtr_op, m_itf->handle(), m_vtr_op_tag));
+ HW::enqueue(
+ new l2_vtr_cmds::set_cmd(m_vtr_op, m_itf->handle(), m_vtr_op_tag));
}
}
@@ -142,7 +143,7 @@ l2_binding::to_string() const
}
void
-l2_binding::set(const l2_vtr_op_t& op, uint16_t tag)
+l2_binding::set(const l2_vtr::option_t& op, uint16_t tag)
{
assert(rc_t::UNSET == m_vtr_op.rc());
m_vtr_op.set(rc_t::NOOP);
@@ -174,7 +175,8 @@ l2_binding::update(const l2_binding& desired)
* set the VTR operation if request
*/
if (m_vtr_op.update(desired.m_vtr_op)) {
- HW::enqueue(new set_vtr_op_cmd(m_vtr_op, m_itf->handle(), m_vtr_op_tag));
+ HW::enqueue(
+ new l2_vtr_cmds::set_cmd(m_vtr_op, m_itf->handle(), m_vtr_op_tag));
}
}
diff --git a/extras/vom/vom/l2_binding.hpp b/extras/vom/vom/l2_binding.hpp
index 19082892f5b..de3608a2626 100644
--- a/extras/vom/vom/l2_binding.hpp
+++ b/extras/vom/vom/l2_binding.hpp
@@ -98,7 +98,7 @@ public:
/**
* Set the VTR operation on the binding/interface
*/
- void set(const l2_vtr_op_t& op, uint16_t tag);
+ void set(const l2_vtr::option_t& op, uint16_t tag);
/**
* Static function to find the bridge_domain in the model
@@ -199,7 +199,7 @@ private:
/**
* HW configuration for the VTR option
*/
- HW::item<l2_vtr_op_t> m_vtr_op;
+ HW::item<l2_vtr::option_t> m_vtr_op;
/**
* The Dot1q tag for the VTR operation
diff --git a/extras/vom/vom/l2_vtr.cpp b/extras/vom/vom/l2_vtr.cpp
index 707a2239ebe..61505f68210 100644
--- a/extras/vom/vom/l2_vtr.cpp
+++ b/extras/vom/vom/l2_vtr.cpp
@@ -16,25 +16,28 @@
#include "vom/l2_vtr.hpp"
namespace VOM {
+namespace l2_vtr {
/*
* Make sure these are in sync with the smae enum in VPP
*/
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_DISABLED(0, "disabled");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_PUSH_1(1, "push-1");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_PUSH_2(2, "push-2");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_POP_1(3, "pop-1");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_POP_2(4, "pop-2");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_TRANSLATE_1_1(5, "translate-1-1");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_TRANSLATE_1_2(6, "translate-1-2");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_TRANSLATE_2_1(7, "translate-2-1");
-const l2_vtr_op_t l2_vtr_op_t::L2_VTR_TRANSLATE_2_2(5, "translate-2-2");
+const option_t option_t::DISABLED(0, "disabled");
+const option_t option_t::PUSH_1(1, "push-1");
+const option_t option_t::PUSH_2(2, "push-2");
+const option_t option_t::POP_1(3, "pop-1");
+const option_t option_t::POP_2(4, "pop-2");
+const option_t option_t::TRANSLATE_1_1(5, "translate-1-1");
+const option_t option_t::TRANSLATE_1_2(6, "translate-1-2");
+const option_t option_t::TRANSLATE_2_1(7, "translate-2-1");
+const option_t option_t::TRANSLATE_2_2(5, "translate-2-2");
-l2_vtr_op_t::l2_vtr_op_t(int v, const std::string s)
- : enum_base<l2_vtr_op_t>(v, s)
+option_t::option_t(int v, const std::string s)
+ : enum_base<option_t>(v, s)
{
}
-}
+
+}; // namespace l2_vtr
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
diff --git a/extras/vom/vom/l2_vtr.hpp b/extras/vom/vom/l2_vtr.hpp
index 540cc83fd07..688e87a8108 100644
--- a/extras/vom/vom/l2_vtr.hpp
+++ b/extras/vom/vom/l2_vtr.hpp
@@ -20,25 +20,27 @@
#include "vom/om.hpp"
namespace VOM {
-struct l2_vtr_op_t : public enum_base<l2_vtr_op_t>
+namespace l2_vtr {
+struct option_t : public enum_base<option_t>
{
- l2_vtr_op_t(const l2_vtr_op_t& l) = default;
- ~l2_vtr_op_t() = default;
+ option_t(const option_t& l) = default;
+ ~option_t() = default;
- const static l2_vtr_op_t L2_VTR_DISABLED;
- const static l2_vtr_op_t L2_VTR_PUSH_1;
- const static l2_vtr_op_t L2_VTR_PUSH_2;
- const static l2_vtr_op_t L2_VTR_POP_1;
- const static l2_vtr_op_t L2_VTR_POP_2;
- const static l2_vtr_op_t L2_VTR_TRANSLATE_1_1;
- const static l2_vtr_op_t L2_VTR_TRANSLATE_1_2;
- const static l2_vtr_op_t L2_VTR_TRANSLATE_2_1;
- const static l2_vtr_op_t L2_VTR_TRANSLATE_2_2;
+ const static option_t DISABLED;
+ const static option_t PUSH_1;
+ const static option_t PUSH_2;
+ const static option_t POP_1;
+ const static option_t POP_2;
+ const static option_t TRANSLATE_1_1;
+ const static option_t TRANSLATE_1_2;
+ const static option_t TRANSLATE_2_1;
+ const static option_t TRANSLATE_2_2;
private:
- l2_vtr_op_t(int v, const std::string s);
-};
+ option_t(int v, const std::string s);
};
+}; // namespace l2_vtr
+}; // namesapce VOM
/*
* fd.io coding-style-patch-verification: ON
diff --git a/extras/vom/vom/l2_vtr_cmds.cpp b/extras/vom/vom/l2_vtr_cmds.cpp
index df50ae46fe7..1c76cf0e490 100644
--- a/extras/vom/vom/l2_vtr_cmds.cpp
+++ b/extras/vom/vom/l2_vtr_cmds.cpp
@@ -16,10 +16,11 @@
#include "vom/l2_vtr_cmds.hpp"
namespace VOM {
+namespace l2_vtr_cmds {
-set_vtr_op_cmd::set_vtr_op_cmd(HW::item<l2_vtr_op_t>& item,
- const handle_t& itf,
- uint16_t tag)
+set_cmd::set_cmd(HW::item<l2_vtr::option_t>& item,
+ const handle_t& itf,
+ uint16_t tag)
: rpc_cmd(item)
, m_itf(itf)
, m_tag(tag)
@@ -27,7 +28,7 @@ set_vtr_op_cmd::set_vtr_op_cmd(HW::item<l2_vtr_op_t>& item,
}
bool
-set_vtr_op_cmd::operator==(const set_vtr_op_cmd& other) const
+set_cmd::operator==(const set_cmd& other) const
{
return (
(m_hw_item.data() == other.m_hw_item.data() && m_itf == other.m_itf) &&
@@ -35,7 +36,7 @@ set_vtr_op_cmd::operator==(const set_vtr_op_cmd& other) const
}
rc_t
-set_vtr_op_cmd::issue(connection& con)
+set_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
@@ -51,15 +52,16 @@ set_vtr_op_cmd::issue(connection& con)
}
std::string
-set_vtr_op_cmd::to_string() const
+set_cmd::to_string() const
{
std::ostringstream s;
- s << "L2-set-vtr-op: " << m_hw_item.to_string()
- << " itf:" << m_itf.to_string() << " tag:" << m_tag;
+ s << "L2-vtr-set: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
+ << " tag:" << m_tag;
return (s.str());
}
+}; // namespace vtr_cmds
}; // namespace VOM
/*
diff --git a/extras/vom/vom/l2_vtr_cmds.hpp b/extras/vom/vom/l2_vtr_cmds.hpp
index d26b7195817..14477fd43f4 100644
--- a/extras/vom/vom/l2_vtr_cmds.hpp
+++ b/extras/vom/vom/l2_vtr_cmds.hpp
@@ -20,23 +20,20 @@
#include "vom/rpc_cmd.hpp"
#include <vapi/l2.api.vapi.hpp>
-#include <vapi/vpe.api.vapi.hpp>
namespace VOM {
-
+namespace l2_vtr_cmds {
/**
* A cmd class sets the VTR operation
*/
-class set_vtr_op_cmd
- : public rpc_cmd<HW::item<l2_vtr_op_t>, vapi::L2_interface_vlan_tag_rewrite>
+class set_cmd : public rpc_cmd<HW::item<l2_vtr::option_t>,
+ vapi::L2_interface_vlan_tag_rewrite>
{
public:
/**
* Constructor
*/
- set_vtr_op_cmd(HW::item<l2_vtr_op_t>& item,
- const handle_t& itf,
- uint16_t tag);
+ set_cmd(HW::item<l2_vtr::option_t>& item, const handle_t& itf, uint16_t tag);
/**
* Issue the command to VPP/HW
@@ -51,7 +48,7 @@ public:
/**
* Comparison operator - only used for UT
*/
- bool operator==(const set_vtr_op_cmd& i) const;
+ bool operator==(const set_cmd& i) const;
private:
/**
@@ -65,6 +62,7 @@ private:
uint16_t m_tag;
};
+}; // namespace vtr_cmds
}; // namespace VOM
/*
diff --git a/extras/vom/vom/l2_xconnect.cpp b/extras/vom/vom/l2_xconnect.cpp
index 1bdb651ff9b..f54da6c8abf 100644
--- a/extras/vom/vom/l2_xconnect.cpp
+++ b/extras/vom/vom/l2_xconnect.cpp
@@ -34,7 +34,7 @@ l2_xconnect::l2_xconnect(const interface& east_itf, const interface& west_itf)
, m_west_itf(west_itf.singular())
, m_xconnect_east(0)
, m_xconnect_west(0)
- , m_vtr_op(l2_vtr_op_t::L2_VTR_DISABLED, rc_t::UNSET)
+ , m_vtr_op(l2_vtr::option_t::DISABLED, rc_t::UNSET)
, m_vtr_op_tag(0)
{
}
@@ -98,7 +98,7 @@ l2_xconnect::replay()
if (m_vtr_op && handle_t::INVALID != m_east_itf->handle()) {
HW::enqueue(
- new set_vtr_op_cmd(m_vtr_op, m_east_itf->handle(), m_vtr_op_tag));
+ new l2_vtr_cmds::set_cmd(m_vtr_op, m_east_itf->handle(), m_vtr_op_tag));
}
}
@@ -122,7 +122,7 @@ l2_xconnect::to_string() const
}
void
-l2_xconnect::set(const l2_vtr_op_t& op, uint16_t tag)
+l2_xconnect::set(const l2_vtr::option_t& op, uint16_t tag)
{
assert(rc_t::UNSET == m_vtr_op.rc());
m_vtr_op.set(rc_t::NOOP);
@@ -148,7 +148,7 @@ l2_xconnect::update(const l2_xconnect& desired)
*/
if (m_vtr_op.update(desired.m_vtr_op)) {
HW::enqueue(
- new set_vtr_op_cmd(m_vtr_op, m_east_itf->handle(), m_vtr_op_tag));
+ new l2_vtr_cmds::set_cmd(m_vtr_op, m_east_itf->handle(), m_vtr_op_tag));
}
}
diff --git a/extras/vom/vom/l2_xconnect.hpp b/extras/vom/vom/l2_xconnect.hpp
index 32acd61dd8e..89acc1c32e6 100644
--- a/extras/vom/vom/l2_xconnect.hpp
+++ b/extras/vom/vom/l2_xconnect.hpp
@@ -81,7 +81,7 @@ public:
/**
* Set the VTR operation on the binding/interface
*/
- void set(const l2_vtr_op_t& op, uint16_t tag);
+ void set(const l2_vtr::option_t& op, uint16_t tag);
/**
* Static function to find the bridge_domain in the model
@@ -183,7 +183,7 @@ private:
/**
* HW configuration for the VTR option
*/
- HW::item<l2_vtr_op_t> m_vtr_op;
+ HW::item<l2_vtr::option_t> m_vtr_op;
/**
* The Dot1q tag for the VTR operation