void
interface::set(const l2_address_t& addr)
{
- m_l2_address.update(addr);
+ m_l2_address = { addr, rc_t::NOOP };
}
void
, 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())
, 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)
{
}
}
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));
}
}
}
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);
* 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));
}
}
/**
* 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
/**
* 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
#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
#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
#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)
}
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) &&
}
rc_t
-set_vtr_op_cmd::issue(connection& con)
+set_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
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
/*
#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
/**
* Comparison operator - only used for UT
*/
- bool operator==(const set_vtr_op_cmd& i) const;
+ bool operator==(const set_cmd& i) const;
private:
/**
uint16_t m_tag;
};
+}; // namespace vtr_cmds
}; // namespace VOM
/*
, 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)
{
}
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));
}
}
}
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);
*/
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));
}
}
/**
* 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
/**
* 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
#include "vom/bond_group_binding_cmds.hpp"
#include "vom/l2_binding.hpp"
#include "vom/l2_binding_cmds.hpp"
+#include "vom/l2_vtr_cmds.hpp"
#include "vom/l2_xconnect.hpp"
#include "vom/l2_xconnect_cmds.hpp"
#include "vom/l3_binding.hpp"
{
rc = handle_derived<l2_binding_cmds::unbind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(l2_binding_cmds::set_vtr_op_cmd))
+ else if (typeid(*f_exp) == typeid(l2_vtr_cmds::set_cmd))
{
- rc = handle_derived<l2_binding_cmds::set_vtr_op_cmd>(f_exp, f_act);
+ rc = handle_derived<l2_vtr_cmds::set_cmd>(f_exp, f_act);
}
else if (typeid(*f_exp) == typeid(l2_xconnect_cmds::bind_cmd))
{
TRY_CHECK_RC(OM::write(dante, bd1));
l2_binding *l2itf2 = new l2_binding(itf2, bd1);
- HW::item<l2_binding::l2_vtr_op_t> hw_set_vtr(l2_binding::l2_vtr_op_t::L2_VTR_POP_1, rc_t::OK);
- l2itf2->set(l2_binding::l2_vtr_op_t::L2_VTR_POP_1, 68);
+ HW::item<l2_vtr::option_t> hw_set_vtr(l2_vtr::option_t::POP_1, rc_t::OK);
+ l2itf2->set(l2_vtr::option_t::POP_1, 68);
ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_bind,
hw_ifh2.data(),
hw_bd.data(),
l2_binding::l2_port_type_t::L2_PORT_TYPE_NORMAL));
- ADD_EXPECT(l2_binding_cmds::set_vtr_op_cmd(hw_set_vtr, hw_ifh2.data(), 68));
+ ADD_EXPECT(l2_vtr_cmds::set_cmd(hw_set_vtr, hw_ifh2.data(), 68));
TRY_CHECK_RC(OM::write(dante, *l2itf2));
// Add some static entries to the bridge-domain