split the VOM into two halves; a top/front-end and a bottom/backend.
Only the backend includes the auto-generated VAPI.
This serves two purposes:
1 - improves ompile times for VOM, since the VAPI is included
only in the backend.
2 - does not expose VAPI to users of VOM
Change-Id: I17b93aeaef10c0eba8612016d9034aca5628d9f7
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
connection.cpp \
dhcp_config_cmds.cpp \
dhcp_config.cpp \
+ hw_cmds.cpp \
hw.cpp \
inspect.cpp \
interface_cmds.cpp \
*/
#include "vom/acl_binding.hpp"
-#include "vom/om.hpp"
+#include "vom/acl_binding_cmds.hpp"
namespace VOM {
namespace ACL {
/*
* dump VPP Bridge domains
*/
- std::shared_ptr<l2_binding::dump_cmd> cmd(new l2_binding::dump_cmd());
+ std::shared_ptr<binding_cmds::l2_dump_cmd> cmd(
+ new binding_cmds::l2_dump_cmd());
HW::enqueue(cmd);
HW::write();
void
l3_binding::event_handler::handle_populate(const client_db::key_t& key)
{
- std::shared_ptr<l3_binding::dump_cmd> cmd(new l3_binding::dump_cmd());
+ std::shared_ptr<binding_cmds::l3_dump_cmd> cmd(
+ new binding_cmds::l3_dump_cmd());
HW::enqueue(cmd);
HW::write();
}
}
}
+
+template <>
+void
+l3_binding::update(const binding& obj)
+{
+ if (!m_binding) {
+ HW::enqueue(new binding_cmds::l3_bind_cmd(
+ m_binding, m_direction, m_itf->handle(), m_acl->handle()));
+ }
+ HW::write();
+}
+
+template <>
+void
+l3_binding::sweep(void)
+{
+ if (m_binding) {
+ HW::enqueue(new binding_cmds::l3_unbind_cmd(
+ m_binding, m_direction, m_itf->handle(), m_acl->handle()));
+ }
+ HW::write();
+}
+
+template <>
+void
+l3_binding::replay(void)
+{
+ if (m_binding) {
+ HW::enqueue(new binding_cmds::l3_bind_cmd(
+ m_binding, m_direction, m_itf->handle(), m_acl->handle()));
+ }
+}
+
+template <>
+void
+l2_binding::update(const binding& obj)
+{
+ if (!m_binding) {
+ HW::enqueue(new binding_cmds::l2_bind_cmd(
+ m_binding, m_direction, m_itf->handle(), m_acl->handle()));
+ }
+ HW::write();
+}
+
+template <>
+void
+l2_binding::sweep(void)
+{
+ if (m_binding) {
+ HW::enqueue(new binding_cmds::l2_unbind_cmd(
+ m_binding, m_direction, m_itf->handle(), m_acl->handle()));
+ }
+ HW::write();
+}
+
+template <>
+void
+l2_binding::replay(void)
+{
+ if (m_binding) {
+ HW::enqueue(new binding_cmds::l2_bind_cmd(
+ m_binding, m_direction, m_itf->handle(), m_acl->handle()));
+ }
+}
};
std::ostream&
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
namespace VOM {
* A binding between an ACL and an interface.
* A representation of the application of the ACL to the interface.
*/
-template <typename LIST, typename BIND, typename DUMP>
+template <typename LIST>
class binding : public object_base
{
public:
*/
static void dump(std::ostream& os) { m_db.dump(os); }
- /**
- * A command class that binds the ACL to the interface
- */
- class bind_cmd : public rpc_cmd<HW::item<bool>, rc_t, BIND>
- {
- public:
- /**
- * Constructor
- */
- bind_cmd(HW::item<bool>& item,
- const direction_t& direction,
- const handle_t& itf,
- const handle_t& acl)
- : rpc_cmd<HW::item<bool>, rc_t, BIND>(item)
- , m_direction(direction)
- , m_itf(itf)
- , m_acl(acl)
- {
- }
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const
- {
- std::ostringstream s;
- s << "acl-bind:[" << m_direction.to_string()
- << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
-
- return (s.str());
- }
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_cmd& other) const
- {
- return ((m_itf == other.m_itf) && (m_acl == m_acl));
- }
-
- private:
- /**
- * The direction of the binding
- */
- const direction_t m_direction;
-
- /**
- * The interface to bind to
- */
- const handle_t m_itf;
-
- /**
- * The ACL to bind
- */
- const handle_t m_acl;
- };
-
- /**
- * A command class that binds the ACL to the interface
- */
- class unbind_cmd : public rpc_cmd<HW::item<bool>, rc_t, BIND>
- {
- public:
- /**
- * Constructor
- */
- unbind_cmd(HW::item<bool>& item,
- const direction_t& direction,
- const handle_t& itf,
- const handle_t& acl)
- : rpc_cmd<HW::item<bool>, rc_t, BIND>(item)
- , m_direction(direction)
- , m_itf(itf)
- , m_acl(acl)
- {
- }
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const
- {
- std::ostringstream s;
- s << "acl-unbind:[" << m_direction.to_string()
- << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
-
- return (s.str());
- }
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_cmd& other) const
- {
- return ((m_itf == other.m_itf) && (m_acl == m_acl));
- }
-
- private:
- /**
- * The direction of the binding
- */
- const direction_t m_direction;
-
- /**
- * The interface to bind to
- */
- const handle_t m_itf;
-
- /**
- * The ACL to bind
- */
- const handle_t m_acl;
- };
-
- /**
- * A cmd class that Dumps all the ACLs
- */
- class dump_cmd : public VOM::dump_cmd<DUMP>
- {
- public:
- /**
- * Constructor
- */
- dump_cmd() = default;
- dump_cmd(const dump_cmd& d) = default;
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const { return ("acl-bind-dump"); }
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
/**
* Enquue commonds to the VPP command Q for the update
*/
- void update(const binding& obj)
- {
- if (!m_binding) {
- HW::enqueue(
- new bind_cmd(m_binding, m_direction, m_itf->handle(), m_acl->handle()));
- }
- HW::write();
- }
+ void update(const binding& obj);
/**
* Find or Add the instance in the DB
/**
* Sweep/reap the object if still stale
*/
- void sweep(void)
- {
- if (m_binding) {
- HW::enqueue(new unbind_cmd(m_binding, m_direction, m_itf->handle(),
- m_acl->handle()));
- }
- HW::write();
- }
+ void sweep(void);
/**
* Replay the objects state to HW
*/
- void replay(void)
- {
- if (m_binding) {
- HW::enqueue(
- new bind_cmd(m_binding, m_direction, m_itf->handle(), m_acl->handle()));
- }
- }
+ void replay(void);
/**
* The direction the of the packets on which to apply the ACL
/**
* Typedef the L3 binding type
*/
-typedef binding<l3_list,
- vapi::Acl_interface_add_del,
- vapi::Acl_interface_list_dump>
- l3_binding;
+typedef binding<l3_list> l3_binding;
/**
* Typedef the L2 binding type
*/
-typedef binding<l2_list,
- vapi::Macip_acl_interface_add_del,
- vapi::Macip_acl_interface_list_dump>
- l2_binding;
+typedef binding<l2_list> l2_binding;
/**
* Definition of the static Singular DB for ACL bindings
*/
-template <typename LIST, typename BIND, typename DUMP>
-singular_db<typename ACL::binding<LIST, BIND, DUMP>::key_t,
- ACL::binding<LIST, BIND, DUMP>>
- binding<LIST, BIND, DUMP>::m_db;
-
-template <typename LIST, typename BIND, typename DUMP>
-typename ACL::binding<LIST, BIND, DUMP>::event_handler
- binding<LIST, BIND, DUMP>::m_evh;
+template <typename LIST>
+singular_db<typename ACL::binding<LIST>::key_t, ACL::binding<LIST>>
+ binding<LIST>::m_db;
+
+template <typename LIST>
+typename ACL::binding<LIST>::event_handler binding<LIST>::m_evh;
};
std::ostream& operator<<(
* limitations under the License.
*/
-#include "vom/acl_binding.hpp"
+#include "vom/acl_binding_cmds.hpp"
DEFINE_VAPI_MSG_IDS_ACL_API_JSON;
namespace VOM {
namespace ACL {
+namespace binding_cmds {
template <>
rc_t
-l3_binding::bind_cmd::issue(connection& con)
+l3_bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
template <>
rc_t
-l3_binding::unbind_cmd::issue(connection& con)
+l3_unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
template <>
rc_t
-l3_binding::dump_cmd::issue(connection& con)
+l3_dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
template <>
rc_t
-l2_binding::bind_cmd::issue(connection& con)
+l2_bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
template <>
rc_t
-l2_binding::unbind_cmd::issue(connection& con)
+l2_unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
template <>
rc_t
-l2_binding::dump_cmd::issue(connection& con)
+l2_dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
return rc_t::OK;
}
-}
-}
+
+}; // namespace binding_cmds
+}; // namespace ACL
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_ACL_BINDING_CMDS_H__
+#define __VOM_ACL_BINDING_CMDS_H__
+
+#include "vom/acl_binding.hpp"
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/acl.api.vapi.hpp>
+
+namespace VOM {
+namespace ACL {
+namespace binding_cmds {
+/**
+ * A command class that binds the ACL to the interface
+ */
+template <typename BIND>
+class bind_cmd : public rpc_cmd<HW::item<bool>, rc_t, BIND>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_cmd(HW::item<bool>& item,
+ const direction_t& direction,
+ const handle_t& itf,
+ const handle_t& acl)
+ : rpc_cmd<HW::item<bool>, rc_t, BIND>(item)
+ , m_direction(direction)
+ , m_itf(itf)
+ , m_acl(acl)
+ {
+ }
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const
+ {
+ std::ostringstream s;
+ s << "acl-bind:[" << m_direction.to_string() << " itf:" << m_itf.to_string()
+ << " acl:" << m_acl.to_string() << "]";
+
+ return (s.str());
+ }
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_cmd& other) const
+ {
+ return ((m_itf == other.m_itf) && (m_acl == m_acl));
+ }
+
+private:
+ /**
+ * The direction of the binding
+ */
+ const direction_t m_direction;
+
+ /**
+ * The interface to bind to
+ */
+ const handle_t m_itf;
+
+ /**
+ * The ACL to bind
+ */
+ const handle_t m_acl;
+};
+
+/**
+ * A command class that binds the ACL to the interface
+ */
+template <typename BIND>
+class unbind_cmd : public rpc_cmd<HW::item<bool>, rc_t, BIND>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_cmd(HW::item<bool>& item,
+ const direction_t& direction,
+ const handle_t& itf,
+ const handle_t& acl)
+ : rpc_cmd<HW::item<bool>, rc_t, BIND>(item)
+ , m_direction(direction)
+ , m_itf(itf)
+ , m_acl(acl)
+ {
+ }
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const
+ {
+ std::ostringstream s;
+ s << "acl-unbind:[" << m_direction.to_string()
+ << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
+
+ return (s.str());
+ }
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_cmd& other) const
+ {
+ return ((m_itf == other.m_itf) && (m_acl == m_acl));
+ }
+
+private:
+ /**
+ * The direction of the binding
+ */
+ const direction_t m_direction;
+
+ /**
+ * The interface to bind to
+ */
+ const handle_t m_itf;
+
+ /**
+ * The ACL to bind
+ */
+ const handle_t m_acl;
+};
+
+/**
+ * A cmd class that Dumps all the ACLs
+ */
+template <typename DUMP>
+class dump_cmd : public VOM::dump_cmd<DUMP>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd() = default;
+ dump_cmd(const dump_cmd& d) = default;
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const { return ("acl-bind-dump"); }
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+
+/**
+ * Typedef the L3 ACL binding commands
+ */
+typedef bind_cmd<vapi::Acl_interface_add_del> l3_bind_cmd;
+typedef unbind_cmd<vapi::Acl_interface_add_del> l3_unbind_cmd;
+typedef dump_cmd<vapi::Acl_interface_list_dump> l3_dump_cmd;
+
+/**
+ * Typedef the L2 binding type
+ */
+typedef bind_cmd<vapi::Macip_acl_interface_add_del> l2_bind_cmd;
+typedef unbind_cmd<vapi::Macip_acl_interface_add_del> l2_unbind_cmd;
+typedef dump_cmd<vapi::Macip_acl_interface_list_dump> l2_dump_cmd;
+
+}; // namespace binding_cmds
+}; // namespace ACL
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
return (other.m_priority < m_priority);
}
-void
-l2_rule::to_vpp(vapi_type_macip_acl_rule& rule) const
-{
- rule.is_permit = m_action.value();
- m_src_ip.to_vpp(&rule.is_ipv6, rule.src_ip_addr, &rule.src_ip_prefix_len);
- m_mac.to_bytes(rule.src_mac, 6);
- m_mac_mask.to_bytes(rule.src_mac_mask, 6);
-}
-
bool
l2_rule::operator==(const l2_rule& rule) const
{
return (s.str());
}
+
+uint32_t
+l2_rule::priority() const
+{
+ return m_priority;
+}
+
+action_t
+l2_rule::action() const
+{
+ return m_action;
+}
+
+const route::prefix_t&
+l2_rule::src_ip() const
+{
+ return m_src_ip;
+}
+
+const mac_address_t&
+l2_rule::mac() const
+{
+ return m_mac;
+}
+
+const mac_address_t&
+l2_rule::mac_mask() const
+{
+ return m_mac_mask;
+}
}
}
/*
#include "vom/acl_types.hpp"
#include "vom/prefix.hpp"
-#include <vapi/acl.api.vapi.hpp>
-
namespace VOM {
namespace ACL {
/**
bool operator==(const l2_rule& rule) const;
/**
- * Convert to VPP API fromat
+ * Getters
*/
- void to_vpp(vapi_type_macip_acl_rule& rule) const;
+ uint32_t priority() const;
+ action_t action() const;
+ const route::prefix_t& src_ip() const;
+ const mac_address_t& mac() const;
+ const mac_address_t& mac_mask() const;
private:
/**
return (other.m_priority < m_priority);
}
-void
-l3_rule::to_vpp(vapi_type_acl_rule& rule) const
-{
- rule.is_permit = m_action.value();
- m_src.to_vpp(&rule.is_ipv6, rule.src_ip_addr, &rule.src_ip_prefix_len);
- m_dst.to_vpp(&rule.is_ipv6, rule.dst_ip_addr, &rule.dst_ip_prefix_len);
-
- rule.proto = m_proto;
- rule.srcport_or_icmptype_first = m_srcport_or_icmptype_first;
- rule.srcport_or_icmptype_last = m_srcport_or_icmptype_last;
- rule.dstport_or_icmpcode_first = m_dstport_or_icmpcode_first;
- rule.dstport_or_icmpcode_last = m_dstport_or_icmpcode_last;
-
- rule.tcp_flags_mask = m_tcp_flags_mask;
- rule.tcp_flags_value = m_tcp_flags_value;
-}
-
bool
l3_rule::operator==(const l3_rule& rule) const
{
{
m_tcp_flags_value = tcp_flags_value;
}
+
+const route::prefix_t&
+l3_rule::src() const
+{
+ return m_src;
+}
+
+uint32_t
+l3_rule::priority() const
+{
+ return m_priority;
+}
+
+action_t
+l3_rule::action() const
+{
+ return m_action;
+}
+
+const route::prefix_t&
+l3_rule::dst() const
+{
+ return m_dst;
+}
+
+uint8_t
+l3_rule::proto() const
+{
+ return m_proto;
+}
+
+uint16_t
+l3_rule::srcport_or_icmptype_first() const
+{
+ return m_srcport_or_icmptype_first;
+}
+
+uint16_t
+l3_rule::srcport_or_icmptype_last() const
+{
+ return m_srcport_or_icmptype_last;
}
+
+uint16_t
+l3_rule::dstport_or_icmpcode_first() const
+{
+ return m_dstport_or_icmpcode_first;
}
+uint16_t
+l3_rule::dstport_or_icmpcode_last() const
+{
+ return m_dstport_or_icmpcode_last;
+}
+
+uint8_t
+l3_rule::tcp_flags_mask() const
+{
+ return m_tcp_flags_mask;
+}
+
+uint8_t
+l3_rule::tcp_flags_value() const
+{
+ return m_tcp_flags_value;
+}
+
+}; // namespace ACL
+}; // namespace VOM
+
/*
* fd.io coding-style-patch-verification: ON
*
#include "vom/acl_types.hpp"
#include "vom/prefix.hpp"
-#include <vapi/acl.api.vapi.hpp>
-
namespace VOM {
namespace ACL {
/**
*/
bool operator==(const l3_rule& rule) const;
- /**
- * Convert to VPP API fromat
- */
- void to_vpp(vapi_type_acl_rule& rule) const;
-
/**
* Set Src Ip Address
*/
*/
void set_tcp_flags_value(uint8_t tcp_flags_value);
+ /**
+ * Getters
+ */
+ const route::prefix_t& src() const;
+ uint32_t priority() const;
+ action_t action() const;
+ const route::prefix_t& dst() const;
+ uint8_t proto() const;
+ uint16_t srcport_or_icmptype_first() const;
+ uint16_t srcport_or_icmptype_last() const;
+ uint16_t dstport_or_icmpcode_first() const;
+ uint16_t dstport_or_icmpcode_last() const;
+ uint8_t tcp_flags_mask() const;
+ uint8_t tcp_flags_value() const;
+
private:
/**
* Priority. Used to sort the rules in a list in the order
*/
#include "vom/acl_list.hpp"
+#include "vom/acl_list_cmds.hpp"
#include "vom/logger.hpp"
namespace VOM {
/*
* dump VPP Bridge domains
*/
- std::shared_ptr<l2_list::dump_cmd> cmd(new l2_list::dump_cmd());
+ std::shared_ptr<list_cmds::l2_dump_cmd> cmd(new list_cmds::l2_dump_cmd());
HW::enqueue(cmd);
HW::write();
/*
* dump VPP Bridge domains
*/
- std::shared_ptr<l3_list::dump_cmd> cmd(new l3_list::dump_cmd());
+ std::shared_ptr<list_cmds::l3_dump_cmd> cmd(new list_cmds::l3_dump_cmd());
HW::enqueue(cmd);
HW::write();
OM::commit(key, acl);
}
}
-};
-};
+
+template <>
+void
+l3_list::update(const l3_list& obj)
+{
+ /*
+ * always update the instance with the latest rule set
+ */
+ if (!m_hdl || obj.m_rules != m_rules) {
+ HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules));
+ }
+ /*
+ * We don't, can't, read the priority from VPP,
+ * so the is equals check above does not include the priorty.
+ * but we save it now.
+ */
+ m_rules = obj.m_rules;
+}
+template <>
+void
+l2_list::update(const l2_list& obj)
+{
+ /*
+ * always update the instance with the latest rule set
+ */
+ if (!m_hdl || obj.m_rules != m_rules) {
+ HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules));
+ }
+ /*
+ * We don't, can't, read the priority from VPP,
+ * so the is equals check above does not include the priorty.
+ * but we save it now.
+ */
+ m_rules = obj.m_rules;
+}
+/**
+ * Sweep/reap the object if still stale
+ */
+template <>
+void
+l3_list::sweep(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l3_delete_cmd(m_hdl));
+ }
+ HW::write();
+}
+template <>
+void
+l2_list::sweep(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l2_delete_cmd(m_hdl));
+ }
+ HW::write();
+}
+
+/**
+ * Replay the objects state to HW
+ */
+template <>
+void
+l3_list::replay(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l3_update_cmd(m_hdl, m_key, m_rules));
+ }
+}
+template <>
+void
+l2_list::replay(void)
+{
+ if (m_hdl) {
+ HW::enqueue(new list_cmds::l2_update_cmd(m_hdl, m_key, m_rules));
+ }
+}
+
+}; // namespace ACL
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
#include "vom/acl_l2_rule.hpp"
#include "vom/acl_l3_rule.hpp"
#include "vom/acl_types.hpp"
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/acl.api.vapi.hpp>
-
namespace VOM {
namespace ACL {
/**
* packets.
* A list is bound to a given interface.
*/
-template <typename RULE, typename UPDATE, typename DELETE, typename DUMP>
+template <typename RULE>
class list : public object_base
{
public:
*/
const handle_t& handle() const { return m_hdl.data(); }
- /**
- * A command class that Create the list
- */
- class update_cmd
- : public rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>
- {
- public:
- /**
- * Constructor
- */
- update_cmd(HW::item<handle_t>& item, const key_t& key, const rules_t& rules)
- : rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>(item)
- , m_key(key)
- , m_rules(rules)
- {
- }
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const
- {
- std::ostringstream s;
- s << "ACL-list-update: " << this->item().to_string();
-
- return (s.str());
- }
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const update_cmd& other) const
- {
- return ((m_key == other.m_key) && (m_rules == other.m_rules));
- }
-
- void complete()
- {
- std::shared_ptr<list> sp = find(m_key);
- if (sp && this->item()) {
- list::add(this->item().data(), sp);
- }
- }
-
- void succeeded()
- {
- rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>::succeeded();
- complete();
- }
-
- /**
- * A callback function for handling ACL creates
- */
- virtual vapi_error_e operator()(UPDATE& reply)
- {
- int acl_index = reply.get_response().get_payload().acl_index;
- int retval = reply.get_response().get_payload().retval;
-
- VOM_LOG(log_level_t::DEBUG) << this->to_string() << " " << retval;
-
- HW::item<handle_t> res(acl_index, rc_t::from_vpp_retval(retval));
-
- this->fulfill(res);
-
- return (VAPI_OK);
- }
-
- private:
- /**
- * The key.
- */
- const key_t& m_key;
-
- /**
- * The rules
- */
- const rules_t& m_rules;
- };
-
- /**
- * A cmd class that Deletes an ACL
- */
- class delete_cmd : public rpc_cmd<HW::item<handle_t>, rc_t, DELETE>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<handle_t>& item)
- : rpc_cmd<HW::item<handle_t>, rc_t, DELETE>(item)
- {
- }
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con) { return (rc_t::INVALID); }
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const
- {
- std::ostringstream s;
- s << "ACL-list-delete: " << this->item().to_string();
-
- return (s.str());
- }
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& other) const
- {
- return (this->item().data() == other.item().data());
- }
- };
-
- /**
- * A cmd class that Dumps all the ACLs
- */
- class dump_cmd : public VOM::dump_cmd<DUMP>
- {
- public:
- /**
- * Constructor
- */
- dump_cmd() = default;
- dump_cmd(const dump_cmd& d) = default;
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con) { return rc_t::INVALID; }
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const { return ("acl-list-dump"); }
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
static std::shared_ptr<list> find(const handle_t& handle)
{
return (m_hdl_db[handle].lock());
static event_handler m_evh;
/**
- * Enquue commonds to the VPP command Q for the update
+ * Enqueue commands to the VPP command Q for the update
*/
- void update(const list& obj)
- {
- /*
- * always update the instance with the latest rule set
- */
- if (!m_hdl || obj.m_rules != m_rules) {
- HW::enqueue(new update_cmd(m_hdl, m_key, m_rules));
- }
- /*
- * We don't, can't, read the priority from VPP,
- * so the is equals check above does not include the priorty.
- * but we save it now.
- */
- m_rules = obj.m_rules;
- }
+ void update(const list& obj);
/**
* HW assigned handle
/**
* Sweep/reap the object if still stale
*/
- void sweep(void)
- {
- if (m_hdl) {
- HW::enqueue(new delete_cmd(m_hdl));
- }
- HW::write();
- }
+ void sweep(void);
/**
* Replay the objects state to HW
*/
- void replay(void)
- {
- if (m_hdl) {
- HW::enqueue(new update_cmd(m_hdl, m_key, m_rules));
- }
- }
+ void replay(void);
/**
* A map of all ACL's against the client's key
/**
* Typedef the L3 ACL type
*/
-typedef list<l3_rule, vapi::Acl_add_replace, vapi::Acl_del, vapi::Acl_dump>
- l3_list;
+typedef list<l3_rule> l3_list;
/**
* Typedef the L2 ACL type
*/
-typedef list<l2_rule,
- vapi::Macip_acl_add,
- vapi::Macip_acl_del,
- vapi::Macip_acl_dump>
- l2_list;
+typedef list<l2_rule> l2_list;
/**
* Definition of the static singular_db for ACL Lists
*/
-template <typename RULE, typename UPDATE, typename DELETE, typename DUMP>
-singular_db<typename ACL::list<RULE, UPDATE, DELETE, DUMP>::key_t,
- ACL::list<RULE, UPDATE, DELETE, DUMP>>
- list<RULE, UPDATE, DELETE, DUMP>::m_db;
+template <typename RULE>
+singular_db<typename ACL::list<RULE>::key_t, ACL::list<RULE>> list<RULE>::m_db;
/**
* Definition of the static per-handle DB for ACL Lists
*/
-template <typename RULE, typename UPDATE, typename DELETE, typename DUMP>
-std::map<const handle_t, std::weak_ptr<ACL::list<RULE, UPDATE, DELETE, DUMP>>>
- list<RULE, UPDATE, DELETE, DUMP>::m_hdl_db;
+template <typename RULE>
+std::map<const handle_t, std::weak_ptr<ACL::list<RULE>>> list<RULE>::m_hdl_db;
-template <typename RULE, typename UPDATE, typename DELETE, typename DUMP>
-typename ACL::list<RULE, UPDATE, DELETE, DUMP>::event_handler
- list<RULE, UPDATE, DELETE, DUMP>::m_evh;
+template <typename RULE>
+typename ACL::list<RULE>::event_handler list<RULE>::m_evh;
};
};
* limitations under the License.
*/
-#include "vom/acl_list.hpp"
+#include "vom/acl_list_cmds.hpp"
namespace VOM {
namespace ACL {
+namespace list_cmds {
+/*
+ * Jumping through hoops to not expose the VAPI types publically
+ */
+static void
+to_vpp(const l2_rule& rule, vapi_type_macip_acl_rule& payload)
+{
+ payload.is_permit = rule.action().value();
+ rule.src_ip().to_vpp(&payload.is_ipv6, payload.src_ip_addr,
+ &payload.src_ip_prefix_len);
+ rule.mac().to_bytes(payload.src_mac, 6);
+ rule.mac_mask().to_bytes(payload.src_mac_mask, 6);
+}
+
+static void
+to_vpp(const l3_rule& rule, vapi_type_acl_rule& payload)
+{
+ payload.is_permit = rule.action().value();
+ rule.src().to_vpp(&payload.is_ipv6, payload.src_ip_addr,
+ &payload.src_ip_prefix_len);
+ rule.dst().to_vpp(&payload.is_ipv6, payload.dst_ip_addr,
+ &payload.dst_ip_prefix_len);
+
+ payload.proto = rule.proto();
+ payload.srcport_or_icmptype_first = rule.srcport_or_icmptype_first();
+ payload.srcport_or_icmptype_last = rule.srcport_or_icmptype_last();
+ payload.dstport_or_icmpcode_first = rule.dstport_or_icmpcode_first();
+ payload.dstport_or_icmpcode_last = rule.dstport_or_icmpcode_last();
+
+ payload.tcp_flags_mask = rule.tcp_flags_mask();
+ payload.tcp_flags_value = rule.tcp_flags_value();
+}
+
template <>
rc_t
-l3_list::update_cmd::issue(connection& con)
+l3_update_cmd::issue(connection& con)
{
msg_t req(con.ctx(), m_rules.size(), std::ref(*this));
uint32_t ii = 0;
auto it = m_rules.cbegin();
while (it != m_rules.cend()) {
- it->to_vpp(payload.r[ii]);
+ to_vpp(*it, payload.r[ii]);
++it;
++ii;
}
template <>
rc_t
-l3_list::delete_cmd::issue(connection& con)
+l3_delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
template <>
rc_t
-l3_list::dump_cmd::issue(connection& con)
+l3_dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
template <>
rc_t
-l2_list::update_cmd::issue(connection& con)
+l2_update_cmd::issue(connection& con)
{
msg_t req(con.ctx(), m_rules.size(), std::ref(*this));
uint32_t ii = 0;
auto it = m_rules.cbegin();
while (it != m_rules.cend()) {
- it->to_vpp(payload.r[ii]);
+ to_vpp(*it, payload.r[ii]);
++it;
++ii;
}
template <>
rc_t
-l2_list::delete_cmd::issue(connection& con)
+l2_delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
template <>
rc_t
-l2_list::dump_cmd::issue(connection& con)
+l2_dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
return rc_t::OK;
}
-}
-}
+
+}; // namespace list_cmds
+}; // namespace ACL
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_ACL_LIST_CMDS_H__
+#define __VOM_ACL_LIST_CMDS_H__
+
+#include "vom/acl_list.hpp"
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/acl.api.vapi.hpp>
+
+namespace VOM {
+namespace ACL {
+namespace list_cmds {
+/**
+ * A command class that Create the list
+ */
+template <typename RULE, typename UPDATE>
+class update_cmd
+ : public rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>
+{
+public:
+ typedef typename list<RULE>::rules_t cmd_rules_t;
+ typedef typename list<RULE>::key_t cmd_key_t;
+
+ /**
+ * Constructor
+ */
+ update_cmd(HW::item<handle_t>& item,
+ const cmd_key_t& key,
+ const cmd_rules_t& rules)
+ : rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>(item)
+ , m_key(key)
+ , m_rules(rules)
+ {
+ }
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const
+ {
+ std::ostringstream s;
+ s << "ACL-list-update: " << this->item().to_string();
+
+ return (s.str());
+ }
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const update_cmd& other) const
+ {
+ return ((m_key == other.m_key) && (m_rules == other.m_rules));
+ }
+
+ void complete()
+ {
+ std::shared_ptr<list<RULE>> sp = list<RULE>::find(m_key);
+ if (sp && this->item()) {
+ list<RULE>::add(this->item().data(), sp);
+ }
+ }
+
+ void succeeded()
+ {
+ rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>::succeeded();
+ complete();
+ }
+
+ /**
+ * A callback function for handling ACL creates
+ */
+ virtual vapi_error_e operator()(UPDATE& reply)
+ {
+ int acl_index = reply.get_response().get_payload().acl_index;
+ int retval = reply.get_response().get_payload().retval;
+
+ VOM_LOG(log_level_t::DEBUG) << this->to_string() << " " << retval;
+
+ HW::item<handle_t> res(acl_index, rc_t::from_vpp_retval(retval));
+
+ this->fulfill(res);
+
+ return (VAPI_OK);
+ }
+
+private:
+ /**
+ * The key.
+ */
+ const cmd_key_t& m_key;
+
+ /**
+ * The rules
+ */
+ const cmd_rules_t& m_rules;
+};
+
+/**
+ * A cmd class that Deletes an ACL
+ */
+template <typename DELETE>
+class delete_cmd : public rpc_cmd<HW::item<handle_t>, rc_t, DELETE>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<handle_t>& item)
+ : rpc_cmd<HW::item<handle_t>, rc_t, DELETE>(item)
+ {
+ }
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con) { return (rc_t::INVALID); }
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const
+ {
+ std::ostringstream s;
+ s << "ACL-list-delete: " << this->item().to_string();
+
+ return (s.str());
+ }
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& other) const
+ {
+ return (this->item().data() == other.item().data());
+ }
+};
+
+/**
+ * A cmd class that Dumps all the ACLs
+ */
+template <typename DUMP>
+class dump_cmd : public VOM::dump_cmd<DUMP>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd() = default;
+ dump_cmd(const dump_cmd& d) = default;
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con) { return rc_t::INVALID; }
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const { return ("acl-list-dump"); }
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+
+/**
+ * Typedef the L3 ACL commands
+ */
+typedef update_cmd<l3_rule, vapi::Acl_add_replace> l3_update_cmd;
+typedef delete_cmd<vapi::Acl_del> l3_delete_cmd;
+typedef dump_cmd<vapi::Acl_dump> l3_dump_cmd;
+
+/**
+ * Typedef the L2 ACL commands
+ */
+typedef update_cmd<l2_rule, vapi::Macip_acl_add> l2_update_cmd;
+typedef delete_cmd<vapi::Macip_acl_del> l2_delete_cmd;
+typedef dump_cmd<vapi::Macip_acl_dump> l2_dump_cmd;
+
+}; // namespace list_cmds
+}; // namespace ACL
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/arp_proxy_binding.hpp"
-#include "vom/cmd.hpp"
+#include "vom/arp_proxy_binding_cmds.hpp"
namespace VOM {
/**
- * A DB of all LLDP configs
+ * A DB of all ARP proxy bindings configs
*/
singular_db<interface::key_type, arp_proxy_binding> arp_proxy_binding::m_db;
arp_proxy_binding::sweep()
{
if (m_binding) {
- HW::enqueue(new unbind_cmd(m_binding, m_itf->handle()));
+ HW::enqueue(
+ new arp_proxy_binding_cmds::unbind_cmd(m_binding, m_itf->handle()));
}
HW::write();
}
arp_proxy_binding::replay()
{
if (m_binding) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle()));
+ HW::enqueue(
+ new arp_proxy_binding_cmds::bind_cmd(m_binding, m_itf->handle()));
}
}
* the desired state is always that the interface should be created
*/
if (!m_binding) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle()));
+ HW::enqueue(
+ new arp_proxy_binding_cmds::bind_cmd(m_binding, m_itf->handle()));
}
}
#define __VOM_ARP_PROXY_BINDING_H__
#include "vom/arp_proxy_config.hpp"
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/vpe.api.vapi.hpp>
-
namespace VOM {
/**
* A representation of LLDP client configuration on an interface
*/
static void dump(std::ostream& os);
- /**
- * A command class that binds the LLDP config to the interface
- */
- class bind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_intfc_enable_disable>
- {
- public:
- /**
- * Constructor
- */
- bind_cmd(HW::item<bool>& item, const handle_t& itf);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_cmd& i) const;
-
- private:
- /**
- * Reference to the HW::item of the interface to bind
- */
- const handle_t& m_itf;
- };
-
- /**
- * A cmd class that Unbinds ArpProxy Config from an interface
- */
- class unbind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_intfc_enable_disable>
- {
- public:
- /**
- * Constructor
- */
- unbind_cmd(HW::item<bool>& item, const handle_t& itf);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_cmd& i) const;
-
- private:
- /**
- * Reference to the HW::item of the interface to unbind
- */
- const handle_t& m_itf;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/arp_proxy_binding.hpp"
+#include "vom/arp_proxy_binding_cmds.hpp"
namespace VOM {
+namespace arp_proxy_binding_cmds {
-arp_proxy_binding::bind_cmd::bind_cmd(HW::item<bool>& item, const handle_t& itf)
+bind_cmd::bind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item)
, m_itf(itf)
{
}
bool
-arp_proxy_binding::bind_cmd::operator==(const bind_cmd& other) const
+bind_cmd::operator==(const bind_cmd& other) const
{
return (m_itf == other.m_itf);
}
rc_t
-arp_proxy_binding::bind_cmd::issue(connection& con)
+bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-arp_proxy_binding::bind_cmd::to_string() const
+bind_cmd::to_string() const
{
std::ostringstream s;
s << "ARP-proxy-bind: " << m_hw_item.to_string()
return (s.str());
}
-arp_proxy_binding::unbind_cmd::unbind_cmd(HW::item<bool>& item,
- const handle_t& itf)
+unbind_cmd::unbind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item)
, m_itf(itf)
{
}
bool
-arp_proxy_binding::unbind_cmd::operator==(const unbind_cmd& other) const
+unbind_cmd::operator==(const unbind_cmd& other) const
{
return (m_itf == other.m_itf);
}
rc_t
-arp_proxy_binding::unbind_cmd::issue(connection& con)
+unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-arp_proxy_binding::unbind_cmd::to_string() const
+unbind_cmd::to_string() const
{
std::ostringstream s;
s << "ARP-proxy-unbind: " << m_hw_item.to_string()
return (s.str());
}
-}
+
+}; // namespace arp_proxy_binding_cmds
+}; // namespace VOM
+
/*
* fd.io coding-style-patch-verification: ON
*
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_ARP_PROXY_BINDING_CMDS_H__
+#define __VOM_ARP_PROXY_BINDING_CMDS_H__
+
+#include "vom/arp_proxy_binding.hpp"
+
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+namespace arp_proxy_binding_cmds {
+/**
+ * A command class that binds the LLDP config to the interface
+ */
+class bind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_intfc_enable_disable>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_cmd(HW::item<bool>& item, const handle_t& itf);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the HW::item of the interface to bind
+ */
+ const handle_t& m_itf;
+};
+
+/**
+ * A cmd class that Unbinds ArpProxy Config from an interface
+ */
+class unbind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_intfc_enable_disable>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_cmd(HW::item<bool>& item, const handle_t& itf);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the HW::item of the interface to unbind
+ */
+ const handle_t& m_itf;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/arp_proxy_config.hpp"
-#include "vom/cmd.hpp"
+#include "vom/arp_proxy_config_cmds.hpp"
namespace VOM {
-/**
- * A DB of all LLDP configs
- */
singular_db<arp_proxy_config::key_t, arp_proxy_config> arp_proxy_config::m_db;
arp_proxy_config::event_handler arp_proxy_config::m_evh;
arp_proxy_config::sweep()
{
if (m_config) {
- HW::enqueue(new unconfig_cmd(m_config, m_low, m_high));
+ HW::enqueue(
+ new arp_proxy_config_cmds::unconfig_cmd(m_config, m_low, m_high));
}
HW::write();
}
arp_proxy_config::replay()
{
if (m_config) {
- HW::enqueue(new config_cmd(m_config, m_low, m_high));
+ HW::enqueue(new arp_proxy_config_cmds::config_cmd(m_config, m_low, m_high));
}
}
arp_proxy_config::update(const arp_proxy_config& desired)
{
if (!m_config) {
- HW::enqueue(new config_cmd(m_config, m_low, m_high));
+ HW::enqueue(new arp_proxy_config_cmds::config_cmd(m_config, m_low, m_high));
}
}
#ifndef __VOM_ARP_PROXY_CONFIG_H__
#define __VOM_ARP_PROXY_CONFIG_H__
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/vpe.api.vapi.hpp>
-
namespace VOM {
/**
* A representation of LLDP client configuration on an interface
*/
static void dump(std::ostream& os);
- /**
- * A command class that adds the ARP Proxy config
- */
- class config_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
- {
- public:
- /**
- * Constructor
- */
- config_cmd(HW::item<bool>& item,
- const boost::asio::ip::address_v4& lo,
- const boost::asio::ip::address_v4& high);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const config_cmd& i) const;
-
- private:
- /**
- * Address range
- */
- const boost::asio::ip::address_v4 m_low;
- const boost::asio::ip::address_v4 m_high;
- };
-
- /**
- * A cmd class that Unconfigs ArpProxy Config from an interface
- */
- class unconfig_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
- {
- public:
- /**
- * Constructor
- */
- unconfig_cmd(HW::item<bool>& item,
- const boost::asio::ip::address_v4& lo,
- const boost::asio::ip::address_v4& hig);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unconfig_cmd& i) const;
-
- private:
- /**
- * Address range
- */
- const boost::asio::ip::address_v4 m_low;
- const boost::asio::ip::address_v4 m_high;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/arp_proxy_config.hpp"
-
-#include <vapi/vpe.api.vapi.hpp>
+#include "vom/arp_proxy_config_cmds.hpp"
namespace VOM {
-arp_proxy_config::config_cmd::config_cmd(
- HW::item<bool>& item,
- const boost::asio::ip::address_v4& low,
- const boost::asio::ip::address_v4& high)
+namespace arp_proxy_config_cmds {
+
+config_cmd::config_cmd(HW::item<bool>& item,
+ const boost::asio::ip::address_v4& low,
+ const boost::asio::ip::address_v4& high)
: rpc_cmd(item)
, m_low(low)
, m_high(high)
}
bool
-arp_proxy_config::config_cmd::operator==(const config_cmd& o) const
+config_cmd::operator==(const config_cmd& o) const
{
return ((m_low == o.m_low) && (m_high == o.m_high));
}
rc_t
-arp_proxy_config::config_cmd::issue(connection& con)
+config_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-arp_proxy_config::config_cmd::to_string() const
+config_cmd::to_string() const
{
std::ostringstream s;
s << "ARP-proxy-config: " << m_hw_item.to_string()
return (s.str());
}
-arp_proxy_config::unconfig_cmd::unconfig_cmd(
- HW::item<bool>& item,
- const boost::asio::ip::address_v4& low,
- const boost::asio::ip::address_v4& high)
+unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
+ const boost::asio::ip::address_v4& low,
+ const boost::asio::ip::address_v4& high)
: rpc_cmd(item)
, m_low(low)
, m_high(high)
}
bool
-arp_proxy_config::unconfig_cmd::operator==(const unconfig_cmd& o) const
+unconfig_cmd::operator==(const unconfig_cmd& o) const
{
return ((m_low == o.m_low) && (m_high == o.m_high));
}
rc_t
-arp_proxy_config::unconfig_cmd::issue(connection& con)
+unconfig_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-arp_proxy_config::unconfig_cmd::to_string() const
+unconfig_cmd::to_string() const
{
std::ostringstream s;
s << "ARP-proxy-unconfig: " << m_hw_item.to_string()
return (s.str());
}
}
+}
+
/*
* fd.io coding-style-patch-verification: ON
*
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_ARP_PROXY_CONFIG_CMDS_H__
+#define __VOM_ARP_PROXY_CONFIG_CMDS_H__
+
+#include "vom/arp_proxy_config.hpp"
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+namespace arp_proxy_config_cmds {
+/**
+ * A command class that adds the ARP Proxy config
+ */
+class config_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ config_cmd(HW::item<bool>& item,
+ const boost::asio::ip::address_v4& lo,
+ const boost::asio::ip::address_v4& high);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const config_cmd& i) const;
+
+private:
+ /**
+ * Address range
+ */
+ const boost::asio::ip::address_v4 m_low;
+ const boost::asio::ip::address_v4 m_high;
+};
+
+/**
+ * A cmd class that Unconfigs ArpProxy Config from an interface
+ */
+class unconfig_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ unconfig_cmd(HW::item<bool>& item,
+ const boost::asio::ip::address_v4& lo,
+ const boost::asio::ip::address_v4& hig);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unconfig_cmd& i) const;
+
+private:
+ /**
+ * Address range
+ */
+ const boost::asio::ip::address_v4 m_low;
+ const boost::asio::ip::address_v4 m_high;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/bridge_domain.hpp"
-#include "vom/cmd.hpp"
+#include "vom/bridge_domain_cmds.hpp"
#include "vom/interface.hpp"
#include "vom/l2_binding.hpp"
-#include "vom/logger.hpp"
namespace VOM {
/**
bridge_domain::sweep()
{
if (rc_t::OK == m_id.rc()) {
- HW::enqueue(new delete_cmd(m_id));
+ HW::enqueue(new bridge_domain_cmds::delete_cmd(m_id));
}
HW::write();
}
bridge_domain::replay()
{
if (rc_t::OK == m_id.rc()) {
- HW::enqueue(new create_cmd(m_id));
+ HW::enqueue(new bridge_domain_cmds::create_cmd(m_id));
}
}
* the desired state is always that the interface should be created
*/
if (rc_t::OK != m_id.rc()) {
- HW::enqueue(new create_cmd(m_id));
+ HW::enqueue(new bridge_domain_cmds::create_cmd(m_id));
}
}
/*
* dump VPP Bridge domains
*/
- std::shared_ptr<bridge_domain::dump_cmd> cmd(new bridge_domain::dump_cmd());
+ std::shared_ptr<bridge_domain_cmds::dump_cmd> cmd(
+ new bridge_domain_cmds::dump_cmd());
HW::enqueue(cmd);
HW::write();
#ifndef __VOM_BRIDGE_DOMAIN_H__
#define __VOM_BRIDGE_DOMAIN_H__
-#include "vom/dump_cmd.hpp"
#include "vom/enum_base.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/l2.api.vapi.hpp>
-
namespace VOM {
/**
* A base class for all object_base in the VPP object_base-Model.
*/
static void dump(std::ostream& os);
- /**
- * A command class that creates an Bridge-Domain
- */
- class create_cmd
- : public rpc_cmd<HW::item<uint32_t>, rc_t, vapi::Bridge_domain_add_del>
- {
- public:
- /**
- * Constructor
- */
- create_cmd(HW::item<uint32_t>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
- };
-
- /**
- * A cmd class that Delete an Bridge-Domain
- */
- class delete_cmd
- : public rpc_cmd<HW::item<uint32_t>, rc_t, vapi::Bridge_domain_add_del>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<uint32_t>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
- };
-
- /**
- * A cmd class that Dumps all the IPv4 L3 configs
- */
- class dump_cmd : public VOM::dump_cmd<vapi::Bridge_domain_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_cmd();
- dump_cmd(const dump_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
*/
#include "vom/bridge_domain_arp_entry.hpp"
+#include "vom/bridge_domain_arp_entry_cmds.hpp"
namespace VOM {
bridge_domain_arp_entry::sweep()
{
if (m_hw) {
- HW::enqueue(new delete_cmd(m_hw, m_bd->id(), m_mac, m_ip_addr));
+ HW::enqueue(new bridge_domain_arp_entry_cmds::delete_cmd(m_hw, m_bd->id(),
+ m_mac, m_ip_addr));
}
HW::write();
}
bridge_domain_arp_entry::replay()
{
if (m_hw) {
- HW::enqueue(new create_cmd(m_hw, m_bd->id(), m_mac, m_ip_addr));
+ HW::enqueue(new bridge_domain_arp_entry_cmds::create_cmd(m_hw, m_bd->id(),
+ m_mac, m_ip_addr));
}
}
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(new create_cmd(m_hw, m_bd->id(), m_mac, m_ip_addr));
+ HW::enqueue(new bridge_domain_arp_entry_cmds::create_cmd(m_hw, m_bd->id(),
+ m_mac, m_ip_addr));
}
}
#include "vom/singular_db.hpp"
#include "vom/types.hpp"
-#include <vapi/l2.api.vapi.hpp>
-
namespace VOM {
/**
* A entry in the ARP termination table of a Bridge Domain
*/
std::string to_string() const;
- /**
- * A command class that creates or updates the bridge domain ARP Entry
- */
- class create_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
- {
- public:
- /**
- * Constructor
- */
- create_cmd(HW::item<bool>& item,
- uint32_t id,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
-
- private:
- uint32_t m_bd;
- mac_address_t m_mac;
- boost::asio::ip::address m_ip_addr;
- };
-
- /**
- * A cmd class that deletes a bridge domain ARP entry
- */
- class delete_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<bool>& item,
- uint32_t id,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- uint32_t m_bd;
- mac_address_t m_mac;
- boost::asio::ip::address m_ip_addr;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/bridge_domain_arp_entry.hpp"
+#include "vom/bridge_domain_arp_entry_cmds.hpp"
namespace VOM {
+namespace bridge_domain_arp_entry_cmds {
-bridge_domain_arp_entry::create_cmd::create_cmd(
- HW::item<bool>& item,
- uint32_t bd,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr)
+create_cmd::create_cmd(HW::item<bool>& item,
+ uint32_t bd,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr)
: rpc_cmd(item)
, m_bd(bd)
, m_mac(mac)
}
bool
-bridge_domain_arp_entry::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
(m_bd == other.m_bd));
}
rc_t
-bridge_domain_arp_entry::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-bridge_domain_arp_entry::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "bridge-domain-arp-entry-create: " << m_hw_item.to_string()
return (s.str());
}
-bridge_domain_arp_entry::delete_cmd::delete_cmd(
- HW::item<bool>& item,
- uint32_t bd,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr)
+delete_cmd::delete_cmd(HW::item<bool>& item,
+ uint32_t bd,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr)
: rpc_cmd(item)
, m_bd(bd)
, m_mac(mac)
}
bool
-bridge_domain_arp_entry::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
(m_bd == other.m_bd));
}
rc_t
-bridge_domain_arp_entry::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-bridge_domain_arp_entry::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "bridge-domain-arp-entry-delete: " << m_hw_item.to_string()
return (s.str());
}
-}
+
+}; // namespace bridge_domain_arp_entry
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_BRIDGE_DOMAIN_ARP_ENTRY_CMDS_H__
+#define __VOM_BRIDGE_DOMAIN_ARP_ENTRY_CMDS_H__
+
+#include "vom/bridge_domain_arp_entry.hpp"
+
+#include <vapi/l2.api.vapi.hpp>
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+namespace bridge_domain_arp_entry_cmds {
+
+/**
+* A command class that creates or updates the bridge domain ARP Entry
+*/
+class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ create_cmd(HW::item<bool>& item,
+ uint32_t id,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+
+private:
+ uint32_t m_bd;
+ mac_address_t m_mac;
+ boost::asio::ip::address m_ip_addr;
+};
+
+/**
+ * A cmd class that deletes a bridge domain ARP entry
+ */
+class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<bool>& item,
+ uint32_t id,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+
+private:
+ uint32_t m_bd;
+ mac_address_t m_mac;
+ boost::asio::ip::address m_ip_addr;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
* limitations under the License.
*/
-#include "vom/bridge_domain.hpp"
-#include "vom/cmd.hpp"
+#include "vom/bridge_domain_cmds.hpp"
DEFINE_VAPI_MSG_IDS_L2_API_JSON;
namespace VOM {
-bridge_domain::create_cmd::create_cmd(HW::item<uint32_t>& item)
+namespace bridge_domain_cmds {
+create_cmd::create_cmd(HW::item<uint32_t>& item)
: rpc_cmd(item)
{
}
bool
-bridge_domain::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return (m_hw_item.data() == other.m_hw_item.data());
}
rc_t
-bridge_domain::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-bridge_domain::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "bridge-domain-create: " << m_hw_item.to_string();
return (s.str());
}
-bridge_domain::delete_cmd::delete_cmd(HW::item<uint32_t>& item)
+delete_cmd::delete_cmd(HW::item<uint32_t>& item)
: rpc_cmd(item)
{
}
bool
-bridge_domain::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return (m_hw_item == other.m_hw_item);
}
rc_t
-bridge_domain::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-bridge_domain::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "bridge-domain-delete: " << m_hw_item.to_string();
return (s.str());
}
-bridge_domain::dump_cmd::dump_cmd()
+dump_cmd::dump_cmd()
{
}
bool
-bridge_domain::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-bridge_domain::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-bridge_domain::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("bridge-domain-dump");
}
}
+}
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_BRIDGE_DOMAIN_CMDS_H__
+#define __VOM_BRIDGE_DOMAIN_CMDS_H__
+
+#include "vom/bridge_domain.hpp"
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/l2.api.vapi.hpp>
+
+namespace VOM {
+namespace bridge_domain_cmds {
+/**
+ * A command class that creates an Bridge-Domain
+ */
+class create_cmd
+ : public rpc_cmd<HW::item<uint32_t>, rc_t, vapi::Bridge_domain_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ create_cmd(HW::item<uint32_t>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+};
+
+/**
+ * A cmd class that Delete an Bridge-Domain
+ */
+class delete_cmd
+ : public rpc_cmd<HW::item<uint32_t>, rc_t, vapi::Bridge_domain_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<uint32_t>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+};
+
+/**
+ * A cmd class that Dumps all the IPv4 L3 configs
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Bridge_domain_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd();
+ dump_cmd(const dump_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/bridge_domain_entry.hpp"
+#include "vom/bridge_domain_entry_cmds.hpp"
namespace VOM {
singular_db<bridge_domain_entry::key_t, bridge_domain_entry>
bridge_domain_entry::sweep()
{
if (m_hw) {
- HW::enqueue(new delete_cmd(m_hw, m_mac, m_bd->id()));
+ HW::enqueue(
+ new bridge_domain_entry_cmds::delete_cmd(m_hw, m_mac, m_bd->id()));
}
HW::write();
}
bridge_domain_entry::replay()
{
if (m_hw) {
- HW::enqueue(new create_cmd(m_hw, m_mac, m_bd->id(), m_tx_itf->handle()));
+ HW::enqueue(new bridge_domain_entry_cmds::create_cmd(
+ m_hw, m_mac, m_bd->id(), m_tx_itf->handle()));
}
}
std::string
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(new create_cmd(m_hw, m_mac, m_bd->id(), m_tx_itf->handle()));
+ HW::enqueue(new bridge_domain_entry_cmds::create_cmd(
+ m_hw, m_mac, m_bd->id(), m_tx_itf->handle()));
}
}
void
bridge_domain_entry::event_handler::handle_populate(const client_db::key_t& key)
{
- std::shared_ptr<bridge_domain_entry::dump_cmd> cmd(
- new bridge_domain_entry::dump_cmd());
+ std::shared_ptr<bridge_domain_entry_cmds::dump_cmd> cmd(
+ new bridge_domain_entry_cmds::dump_cmd());
HW::enqueue(cmd);
HW::write();
#include "vom/interface.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/l2.api.vapi.hpp>
-
namespace VOM {
/**
* A MAC forwarding entry in the bridge-domain/L2-FIB
*/
std::string to_string() const;
- /**
- * A command class that creates or updates the bridge_domain
- */
- class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::L2fib_add_del>
- {
- public:
- /**
- * Constructor
- */
- create_cmd(HW::item<bool>& item,
- const mac_address_t& mac,
- uint32_t id,
- handle_t tx_intf);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
-
- private:
- mac_address_t m_mac;
- uint32_t m_bd;
- handle_t m_tx_itf;
- };
-
- /**
- * A cmd class that deletes a bridge_domain
- */
- class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::L2fib_add_del>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<bool>& item, const mac_address_t& mac, uint32_t id);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- mac_address_t m_mac;
- uint32_t m_bd;
- };
-
- /**
- * A cmd class that Dumps all the interface spans
- */
- class dump_cmd : public VOM::dump_cmd<vapi::L2_fib_table_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_cmd();
- dump_cmd(const dump_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/bridge_domain_entry.hpp"
+#include "vom/bridge_domain_entry_cmds.hpp"
namespace VOM {
-bridge_domain_entry::create_cmd::create_cmd(HW::item<bool>& item,
- const mac_address_t& mac,
- uint32_t bd,
- handle_t tx_itf)
+namespace bridge_domain_entry_cmds {
+create_cmd::create_cmd(HW::item<bool>& item,
+ const mac_address_t& mac,
+ uint32_t bd,
+ handle_t tx_itf)
: rpc_cmd(item)
, m_mac(mac)
, m_bd(bd)
}
bool
-bridge_domain_entry::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return ((m_mac == other.m_mac) && (m_tx_itf == other.m_tx_itf) &&
(m_bd == other.m_bd));
}
rc_t
-bridge_domain_entry::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-bridge_domain_entry::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "bridge-domain-entry-create: " << m_hw_item.to_string() << " bd:" << m_bd
return (s.str());
}
-bridge_domain_entry::delete_cmd::delete_cmd(HW::item<bool>& item,
- const mac_address_t& mac,
- uint32_t bd)
+delete_cmd::delete_cmd(HW::item<bool>& item,
+ const mac_address_t& mac,
+ uint32_t bd)
: rpc_cmd(item)
, m_mac(mac)
, m_bd(bd)
}
bool
-bridge_domain_entry::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return ((m_mac == other.m_mac) && (m_bd == other.m_bd));
}
rc_t
-bridge_domain_entry::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-bridge_domain_entry::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "bridge-domain-entry-delete: " << m_hw_item.to_string() << " bd:" << m_bd
return (s.str());
}
-bridge_domain_entry::dump_cmd::dump_cmd()
+dump_cmd::dump_cmd()
{
}
bool
-bridge_domain_entry::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-bridge_domain_entry::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-bridge_domain_entry::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("bridge-domain-entry-dump");
}
}
+}
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_BRIDGE_DOMAIN_ENTRY_CMDS_H__
+#define __VOM_BRIDGE_DOMAIN_ENTRY_CMDS_H__
+
+#include "vom/bridge_domain_entry.hpp"
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/l2.api.vapi.hpp>
+
+namespace VOM {
+namespace bridge_domain_entry_cmds {
+
+/**
+* A command class that creates or updates the bridge_domain
+*/
+class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::L2fib_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ create_cmd(HW::item<bool>& item,
+ const mac_address_t& mac,
+ uint32_t id,
+ handle_t tx_intf);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+
+private:
+ mac_address_t m_mac;
+ uint32_t m_bd;
+ handle_t m_tx_itf;
+};
+
+/**
+ * A cmd class that deletes a bridge_domain
+ */
+class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::L2fib_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<bool>& item, const mac_address_t& mac, uint32_t id);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+
+private:
+ mac_address_t m_mac;
+ uint32_t m_bd;
+};
+
+/**
+ * A cmd class that Dumps all the interface spans
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::L2_fib_table_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd();
+ dump_cmd(const dump_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/dhcp_config.hpp"
-#include "vom/cmd.hpp"
+#include "vom/dhcp_config_cmds.hpp"
namespace VOM {
/**
dhcp_config::sweep()
{
if (m_binding) {
- HW::enqueue(new unbind_cmd(m_binding, m_itf->handle(), m_hostname));
+ HW::enqueue(
+ new dhcp_config_cmds::unbind_cmd(m_binding, m_itf->handle(), m_hostname));
}
HW::write();
}
dhcp_config::replay()
{
if (m_binding) {
- HW::enqueue(
- new bind_cmd(m_binding, m_itf->handle(), m_hostname, m_client_id));
+ HW::enqueue(new dhcp_config_cmds::bind_cmd(m_binding, m_itf->handle(),
+ m_hostname, m_client_id));
}
}
* the desired state is always that the interface should be created
*/
if (!m_binding) {
- HW::enqueue(
- new bind_cmd(m_binding, m_itf->handle(), m_hostname, m_client_id));
+ HW::enqueue(new dhcp_config_cmds::bind_cmd(m_binding, m_itf->handle(),
+ m_hostname, m_client_id));
}
}
* limitations under the License.
*/
-#ifndef __VOM_DHCP_INTERFACE_H__
-#define __VOM_DHCP_INTERFACE_H__
+#ifndef __VOM_DHCP_CONFIG_H__
+#define __VOM_DHCP_CONFIG_H__
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include "vom/sub_interface.hpp"
-
-#include <vapi/dhcp.api.vapi.hpp>
namespace VOM {
+namespace dhcp_config_cmds {
+class events_cmd;
+};
/**
* A representation of DHCP client configuration on an interface
*/
*/
static void dump(std::ostream& os);
- /**
- * A command class that binds the DHCP config to the interface
- */
- class bind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Dhcp_client_config>
- {
- public:
- /**
- * Constructor
- */
- bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const std::string& hostname,
- const l2_address_t& client_id);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_cmd& i) const;
-
- private:
- /**
- * Reference to the HW::item of the interface to bind
- */
- const handle_t& m_itf;
-
- /**
- * The DHCP client's hostname
- */
- const std::string m_hostname;
-
- /**
- * The DHCP client's ID
- */
- const l2_address_t m_client_id;
- };
-
- /**
- * A cmd class that Unbinds Dhcp Config from an interface
- */
- class unbind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Dhcp_client_config>
- {
- public:
- /**
- * Constructor
- */
- unbind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const std::string& hostname);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_cmd& i) const;
-
- private:
- /**
- * Reference to the HW::item of the interface to unbind
- */
- const handle_t& m_itf;
-
- /**
- * The DHCP client's hostname
- */
- const std::string m_hostname;
- };
-
- /**
- * Forward declartion of the Event Command
- */
- class events_cmd;
-
/**
* A class that listens to DHCP Events
*/
* listener's virtual function invoked when a DHCP event is
* available to read
*/
- virtual void handle_dhcp_event(events_cmd* cmd) = 0;
+ virtual void handle_dhcp_event(dhcp_config_cmds::events_cmd* cmd) = 0;
/**
* Return the HW::item associated with this command
HW::item<bool> m_status;
};
- /**
- * A functor class represents our desire to recieve interface events
- */
- class events_cmd
- : public event_cmd<vapi::Control_ping, vapi::Dhcp_compl_event>
- {
- public:
- /**
- * Constructor
- */
- events_cmd(event_listener& el);
-
- /**
- * Issue the command to VPP/HW - subscribe to DHCP events
- */
- rc_t issue(connection& con);
-
- /**
- * Retire the command - unsubscribe
- */
- void retire(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const events_cmd& i) const;
-
- /**
- * called in the VAPI RX thread when data is available.
- */
- void notify();
-
- private:
- void succeeded() {}
- /**
- * The listner of this command
- */
- event_listener& m_listener;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/dhcp_config.hpp"
+#include "vom/dhcp_config_cmds.hpp"
DEFINE_VAPI_MSG_IDS_DHCP_API_JSON;
namespace VOM {
-dhcp_config::bind_cmd::bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const std::string& hostname,
- const l2_address_t& client_id)
+namespace dhcp_config_cmds {
+
+bind_cmd::bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const std::string& hostname,
+ const l2_address_t& client_id)
: rpc_cmd(item)
, m_itf(itf)
, m_hostname(hostname)
}
bool
-dhcp_config::bind_cmd::operator==(const bind_cmd& other) const
+bind_cmd::operator==(const bind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_hostname == other.m_hostname));
}
rc_t
-dhcp_config::bind_cmd::issue(connection& con)
+bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-dhcp_config::bind_cmd::to_string() const
+bind_cmd::to_string() const
{
std::ostringstream s;
s << "Dhcp-config-bind: " << m_hw_item.to_string()
return (s.str());
}
-dhcp_config::unbind_cmd::unbind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const std::string& hostname)
+unbind_cmd::unbind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const std::string& hostname)
: rpc_cmd(item)
, m_itf(itf)
, m_hostname(hostname)
}
bool
-dhcp_config::unbind_cmd::operator==(const unbind_cmd& other) const
+unbind_cmd::operator==(const unbind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_hostname == other.m_hostname));
}
rc_t
-dhcp_config::unbind_cmd::issue(connection& con)
+unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-dhcp_config::unbind_cmd::to_string() const
+unbind_cmd::to_string() const
{
std::ostringstream s;
s << "Dhcp-config-unbind: " << m_hw_item.to_string()
return (s.str());
}
-dhcp_config::events_cmd::events_cmd(event_listener& el)
+events_cmd::events_cmd(dhcp_config::event_listener& el)
: event_cmd(el.status())
, m_listener(el)
{
}
bool
-dhcp_config::events_cmd::operator==(const events_cmd& other) const
+events_cmd::operator==(const events_cmd& other) const
{
return (true);
}
rc_t
-dhcp_config::events_cmd::issue(connection& con)
+events_cmd::issue(connection& con)
{
/*
* Set the call back to handle DHCP complete envets.
}
void
-dhcp_config::events_cmd::retire(connection& con)
+events_cmd::retire(connection& con)
{
}
void
-dhcp_config::events_cmd::notify()
+events_cmd::notify()
{
m_listener.handle_dhcp_event(this);
}
std::string
-dhcp_config::events_cmd::to_string() const
+events_cmd::to_string() const
{
return ("dhcp-events");
}
}
-
+};
/*
* fd.io coding-style-patch-verification: ON
*
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_DHCP_CONFIG_CMDS_H__
+#define __VOM_DHCP_CONFIG_CMDS_H__
+
+#include "vom/dhcp_config.hpp"
+#include "vom/event_cmd.hpp"
+
+#include <vapi/dhcp.api.vapi.hpp>
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+namespace dhcp_config_cmds {
+
+/**
+ * A command class that binds the DHCP config to the interface
+ */
+class bind_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Dhcp_client_config>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const std::string& hostname,
+ const l2_address_t& client_id);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the HW::item of the interface to bind
+ */
+ const handle_t& m_itf;
+
+ /**
+ * The DHCP client's hostname
+ */
+ const std::string m_hostname;
+
+ /**
+ * The DHCP client's ID
+ */
+ const l2_address_t m_client_id;
+};
+
+/**
+ * A cmd class that Unbinds Dhcp Config from an interface
+ */
+class unbind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Dhcp_client_config>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const std::string& hostname);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the HW::item of the interface to unbind
+ */
+ const handle_t& m_itf;
+
+ /**
+ * The DHCP client's hostname
+ */
+ const std::string m_hostname;
+};
+
+/**
+ * A functor class represents our desire to recieve interface events
+ */
+class events_cmd : public event_cmd<vapi::Control_ping, vapi::Dhcp_compl_event>
+{
+public:
+ /**
+ * Constructor
+ */
+ events_cmd(dhcp_config::event_listener& el);
+
+ /**
+ * Issue the command to VPP/HW - subscribe to DHCP events
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * Retire the command - unsubscribe
+ */
+ void retire(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const events_cmd& i) const;
+
+ /**
+ * called in the VAPI RX thread when data is available.
+ */
+ void notify();
+
+private:
+ void succeeded() {}
+ /**
+ * The listner of this command
+ */
+ dhcp_config::event_listener& m_listener;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/hw.hpp"
+#include "vom/hw_cmds.hpp"
#include "vom/logger.hpp"
-#include <vapi/vpe.api.vapi.hpp>
-
namespace VOM {
HW::cmd_q::cmd_q()
: m_enabled(true)
bool
HW::poll()
{
- std::shared_ptr<cmd> poll(new Poll(m_poll_state));
+ std::shared_ptr<cmd> poll(new hw_cmds::poll(m_poll_state));
HW::enqueue(poll);
HW::write();
return (m_poll_state);
+ return (true);
}
template <>
<< "rc:" << item_rc.to_string() << " data:" << item_data << "]";
return (os.str());
}
-
-HW::Poll::Poll(HW::item<bool>& item)
- : rpc_cmd(item)
-{
-}
-
-rc_t
-HW::Poll::issue(connection& con)
-{
- msg_t req(con.ctx(), std::ref(*this));
-
- VAPI_CALL(req.execute());
-
- m_hw_item.set(wait());
-
- return (rc_t::OK);
-}
-
-std::string
-HW::Poll::to_string() const
-{
- std::ostringstream s;
-
- s << "poll: " << m_hw_item.to_string();
-
- return (s.str());
-}
}
/*
#include <string>
#include <thread>
-#include <vapi/vapi.hpp>
-#include <vapi/vpe.api.vapi.hpp>
-
#include "vom/connection.hpp"
-#include "vom/rpc_cmd.hpp"
+#include "vom/types.hpp"
namespace VOM {
+
+class cmd;
class HW
{
public:
* Only the OM can enable/disable HW
*/
friend class OM;
-
- /**
- * A command pool the HW for liveness
- */
- class Poll : public rpc_cmd<HW::item<bool>, rc_t, vapi::Control_ping>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- */
- Poll(HW::item<bool>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const Poll& i) const;
- };
};
/**
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "vom/hw_cmds.hpp"
+
+namespace VOM {
+namespace hw_cmds {
+
+poll::poll(HW::item<bool>& item)
+ : rpc_cmd(item)
+{
+}
+
+rc_t
+poll::issue(connection& con)
+{
+ msg_t req(con.ctx(), std::ref(*this));
+
+ VAPI_CALL(req.execute());
+
+ m_hw_item.set(wait());
+
+ return (rc_t::OK);
+}
+
+std::string
+poll::to_string() const
+{
+ std::ostringstream s;
+
+ s << "poll: " << m_hw_item.to_string();
+
+ return (s.str());
+}
+}
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_HW_CMDS_H__
+#define __VOM_HW_CMDS_H__
+
+#include <vapi/vapi.hpp>
+#include <vapi/vpe.api.vapi.hpp>
+
+#include "vom/hw.hpp"
+#include "vom/rpc_cmd.hpp"
+
+namespace VOM {
+namespace hw_cmds {
+/**
+*A command poll the HW for liveness
+*/
+class poll : public rpc_cmd<HW::item<bool>, rc_t, vapi::Control_ping>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ */
+ poll(HW::item<bool>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const poll& i) const;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/interface.hpp"
-#include "vom/cmd.hpp"
-#include "vom/l3_binding.hpp"
+#include "vom/interface_cmds.hpp"
+#include "vom/interface_factory.hpp"
+#include "vom/l3_binding_cmds.hpp"
#include "vom/logger.hpp"
#include "vom/prefix.hpp"
{
if (m_table_id) {
m_table_id.data() = route::DEFAULT_TABLE;
- HW::enqueue(new set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
- HW::enqueue(new set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
+ HW::enqueue(
+ new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
+ HW::enqueue(
+ new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
}
// If the interface is up, bring it down
if (m_state && interface::admin_state_t::UP == m_state.data()) {
m_state.data() = interface::admin_state_t::DOWN;
- HW::enqueue(new state_change_cmd(m_state, m_hdl));
+ HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
}
if (m_hdl) {
std::queue<cmd*> cmds;
}
if (m_state && interface::admin_state_t::UP == m_state.data()) {
- HW::enqueue(new state_change_cmd(m_state, m_hdl));
+ HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
}
if (m_table_id) {
- HW::enqueue(new set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
- HW::enqueue(new set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
+ HW::enqueue(
+ new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
+ HW::enqueue(
+ new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
}
}
interface::mk_create_cmd(std::queue<cmd*>& q)
{
if (type_t::LOOPBACK == m_type) {
- q.push(new loopback_create_cmd(m_hdl, m_name));
+ q.push(new interface_cmds::loopback_create_cmd(m_hdl, m_name));
} else if (type_t::BVI == m_type) {
- q.push(new loopback_create_cmd(m_hdl, m_name));
- q.push(new set_tag(m_hdl, m_name));
+ q.push(new interface_cmds::loopback_create_cmd(m_hdl, m_name));
+ q.push(new interface_cmds::set_tag(m_hdl, m_name));
} else if (type_t::AFPACKET == m_type) {
- q.push(new af_packet_create_cmd(m_hdl, m_name));
+ q.push(new interface_cmds::af_packet_create_cmd(m_hdl, m_name));
} else if (type_t::TAP == m_type) {
- q.push(new tap_create_cmd(m_hdl, m_name));
+ q.push(new interface_cmds::tap_create_cmd(m_hdl, m_name));
}
return (q);
interface::mk_delete_cmd(std::queue<cmd*>& q)
{
if ((type_t::LOOPBACK == m_type) || (type_t::BVI == m_type)) {
- q.push(new loopback_delete_cmd(m_hdl));
+ q.push(new interface_cmds::loopback_delete_cmd(m_hdl));
} else if (type_t::AFPACKET == m_type) {
- q.push(new af_packet_delete_cmd(m_hdl, m_name));
+ q.push(new interface_cmds::af_packet_delete_cmd(m_hdl, m_name));
} else if (type_t::TAP == m_type) {
- q.push(new tap_delete_cmd(m_hdl));
+ q.push(new interface_cmds::tap_delete_cmd(m_hdl));
}
return (q);
* change the interface state to that which is deisred
*/
if (m_state.update(desired.m_state)) {
- HW::enqueue(new state_change_cmd(m_state, m_hdl));
+ HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
}
/*
* change the interface state to that which is deisred
*/
if (m_l2_address.update(desired.m_l2_address)) {
- HW::enqueue(new set_mac_cmd(m_l2_address, m_hdl));
+ HW::enqueue(new interface_cmds::set_mac_cmd(m_l2_address, m_hdl));
}
/*
* table ID
*/
if (!m_table_id && m_rd) {
- HW::enqueue(new set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
- HW::enqueue(new set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
+ HW::enqueue(
+ new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
+ HW::enqueue(
+ new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV6, m_hdl));
}
}
/*
* dump VPP current states
*/
- std::shared_ptr<interface::dump_cmd> cmd(new interface::dump_cmd());
+ std::shared_ptr<interface_cmds::dump_cmd> cmd(new interface_cmds::dump_cmd());
HW::enqueue(cmd);
HW::write();
for (auto& itf_record : *cmd) {
std::unique_ptr<interface> itf =
- interface::new_interface(itf_record.get_payload());
+ interface_factory::new_interface(itf_record.get_payload());
if (itf && interface::type_t::LOCAL != itf->type()) {
VOM_LOG(log_level_t::DEBUG) << "dump: " << itf->to_string();
/**
* Get the address configured on the interface
*/
- std::shared_ptr<l3_binding::dump_v4_cmd> dcmd =
- std::make_shared<l3_binding::dump_v4_cmd>(
- l3_binding::dump_v4_cmd(itf->handle()));
+ std::shared_ptr<l3_binding_cmds::dump_v4_cmd> dcmd =
+ std::make_shared<l3_binding_cmds::dump_v4_cmd>(
+ l3_binding_cmds::dump_v4_cmd(itf->handle()));
HW::enqueue(dcmd);
HW::write();
#ifndef __VOM_INTERFACE_H__
#define __VOM_INTERFACE_H__
-#include "vom/dump_cmd.hpp"
#include "vom/enum_base.hpp"
-#include "vom/event_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/object_base.hpp"
#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/af_packet.api.vapi.hpp>
-#include <vapi/interface.api.vapi.hpp>
-#include <vapi/stats.api.vapi.hpp>
-#include <vapi/tap.api.vapi.hpp>
-#include <vapi/vapi.hpp>
-#include <vapi/vpe.api.vapi.hpp>
-
namespace VOM {
+/**
+ * Forward declaration of the stats and events command
+ */
+namespace interface_cmds {
+class stats_cmd;
+class events_cmd;
+};
+
/**
* A representation of an interface in VPP
*/
interface::add(m_name, this->item());
}
+ /**
+ * add the created interface to the DB
+ */
+ void insert_interface() { interface::add(m_name, this->item()); }
+
virtual vapi_error_e operator()(MSG& reply)
{
int sw_if_index = reply.get_response().get_payload().sw_if_index;
const std::string& m_name;
};
- /**
- * A command class to create Loopback interfaces in VPP
- */
- class loopback_create_cmd : public create_cmd<vapi::Create_loopback>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the name of the interface to create
- */
- loopback_create_cmd(HW::item<handle_t>& item, const std::string& name);
- ~loopback_create_cmd() = default;
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
- /**
- * A command class to create af_packet interfaces in VPP
- */
- class af_packet_create_cmd : public create_cmd<vapi::Af_packet_create>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the name of the interface to create
- */
- af_packet_create_cmd(HW::item<handle_t>& item, const std::string& name);
- ~af_packet_create_cmd() = default;
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
- /**
- * A command class to create TAP interfaces in VPP
- */
- class tap_create_cmd : public create_cmd<vapi::Tap_connect>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the name of the interface to create
- */
- tap_create_cmd(HW::item<handle_t>& item, const std::string& name);
- ~tap_create_cmd() = default;
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
/**
* Base class for intterface Delete commands
*/
*/
void succeeded() {}
- protected:
/**
- * The name of the interface to be created
+ * add the created interface to the DB
*/
- const std::string m_name;
- };
-
- /**
- * A command class to delete loopback interfaces in VPP
- */
- class loopback_delete_cmd : public delete_cmd<vapi::Delete_loopback>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- */
- loopback_delete_cmd(HW::item<handle_t>& item);
+ void remove_interface() { interface::remove(this->item()); }
+ protected:
/**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
- /**
- * A command class to delete af-packet interfaces in VPP
- */
- class af_packet_delete_cmd : public delete_cmd<vapi::Af_packet_delete>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the name of the interface to delete
- */
- af_packet_delete_cmd(HW::item<handle_t>& item, const std::string& name);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
- /**
- * A command class to delete TAP interfaces in VPP
- */
- class tap_delete_cmd : public delete_cmd<vapi::Tap_delete>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- */
- tap_delete_cmd(HW::item<handle_t>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
- /**
- * A command class to delete TAP interfaces in VPP
- */
- class set_tag
- : public rpc_cmd<HW::item<handle_t>, rc_t, vapi::Sw_interface_tag_add_del>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- */
- set_tag(HW::item<handle_t>& item, const std::string& name);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const set_tag& i) const;
-
- private:
- /**
- * The tag to add
+ * The name of the interface to be created
*/
const std::string m_name;
};
- /**
- * A cmd class that changes the admin state
- */
- class state_change_cmd : public rpc_cmd<HW::item<admin_state_t>,
- rc_t,
- vapi::Sw_interface_set_flags>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the name handle of the interface whose state is to change
- */
- state_change_cmd(HW::item<admin_state_t>& s, const HW::item<handle_t>& h);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const state_change_cmd& i) const;
-
- private:
- /**
- * the handle of the interface to update
- */
- const HW::item<handle_t>& m_hdl;
- };
-
- /**
- * A command class that binds an interface to an L3 table
- */
- class set_table_cmd : public rpc_cmd<HW::item<route::table_id_t>,
- rc_t,
- vapi::Sw_interface_set_table>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the name handle of the interface whose table is to change
- */
- set_table_cmd(HW::item<route::table_id_t>& item,
- const l3_proto_t& proto,
- const HW::item<handle_t>& h);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const set_table_cmd& i) const;
-
- private:
- /**
- * the handle of the interface to update
- */
- const HW::item<handle_t>& m_hdl;
-
- /**
- * The L3 protocol of the table
- */
- l3_proto_t m_proto;
- };
-
- /**
- * A command class that binds an interface to an L3 table
- */
- class set_mac_cmd : public rpc_cmd<HW::item<l2_address_t>,
- rc_t,
- vapi::Sw_interface_set_mac_address>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- * and the handle of the interface
- */
- set_mac_cmd(HW::item<l2_address_t>& item, const HW::item<handle_t>& h);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const set_mac_cmd& i) const;
-
- private:
- /**
- * the handle of the interface to update
- */
- const HW::item<handle_t>& m_hdl;
- };
-
- /**
- * Forward declaration of the Event command
- */
- class events_cmd;
-
/**
* A class that listens to interface Events
*/
* Virtual function called on the listener when the command has data
* ready to process
*/
- virtual void handle_interface_event(events_cmd* cmd) = 0;
+ virtual void handle_interface_event(interface_cmds::events_cmd* cmd) = 0;
/**
* Return the HW::item representing the status
HW::item<bool> m_status;
};
- /**
- * A command class represents our desire to recieve interface events
- */
- class events_cmd
- : public event_cmd<vapi::Want_interface_events, vapi::Sw_interface_event>
- {
- public:
- /**
- * Constructor taking the listner to notify
- */
- events_cmd(event_listener& el);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * Retires the command - unsubscribe from the events.
- */
- void retire(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const events_cmd& i) const;
-
- /**
- * Called when it's time to poke the listeners
- */
- void notify();
-
- private:
- /**
- * The listeners to notify when data/events arrive
- */
- event_listener& m_listener;
- };
-
- /**
- * Forward declaration of the stat command
- */
- class stats_cmd;
-
/**
* A class that listens to interface Stats
*/
* Virtual function called on the listener when the command has data
* ready to process
*/
- virtual void handle_interface_stat(stats_cmd* cmd) = 0;
+ virtual void handle_interface_stat(interface_cmds::stats_cmd* cmd) = 0;
/**
* Return the HW::item representing the status
HW::item<bool> m_status;
};
- /**
- * A command class represents our desire to recieve interface stats
- */
- class stats_cmd : public event_cmd<vapi::Want_per_interface_combined_stats,
- vapi::Vnet_per_interface_combined_counters>
- {
- public:
- /**
- * Constructor taking the listner to notify
- */
- stats_cmd(stat_listener& el, const std::vector<handle_t>& interfaces);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * Retires the command - unsubscribe from the stats.
- */
- void retire(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const stats_cmd& i) const;
-
- /**
- * Called when it's time to poke the listeners
- */
- void notify();
-
- private:
- /**
- * The listeners to notify when data/stats arrive
- */
- stat_listener& m_listener;
-
- std::vector<handle_t> m_swifindex;
- };
-
- /**
- * A cmd class that Dumps all the Vpp interfaces
- */
- class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_dump>
- {
- public:
- /**
- * Default Constructor
- */
- dump_cmd();
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
- };
-
/**
* The the singular instance of the interface in the object_base-Model
*/
*/
static void dump(std::ostream& os);
- /**
- * Factory method to construct a new interface from the VPP record
- */
- static std::unique_ptr<interface> new_interface(
- const vapi_payload_sw_interface_details& vd);
-
protected:
/**
* Construct an interface object with a handle and a HW address
const std::string& name,
type_t type,
admin_state_t state);
+ friend class interface_factory;
/**
* The SW interface handle VPP has asigned to the interface
* limitations under the License.
*/
-#include "vom/interface.hpp"
+#include "vom/interface_cmds.hpp"
#include "vom/cmd.hpp"
DEFINE_VAPI_MSG_IDS_VPE_API_JSON;
DEFINE_VAPI_MSG_IDS_STATS_API_JSON;
namespace VOM {
-interface::loopback_create_cmd::loopback_create_cmd(HW::item<handle_t>& item,
- const std::string& name)
+namespace interface_cmds {
+loopback_create_cmd::loopback_create_cmd(HW::item<handle_t>& item,
+ const std::string& name)
: create_cmd(item, name)
{
}
rc_t
-interface::loopback_create_cmd::issue(connection& con)
+loopback_create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
m_hw_item = wait();
if (m_hw_item.rc() == rc_t::OK) {
- interface::add(m_name, m_hw_item);
+ insert_interface();
}
return rc_t::OK;
}
std::string
-interface::loopback_create_cmd::to_string() const
+loopback_create_cmd::to_string() const
{
std::ostringstream s;
s << "loopback-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
return (s.str());
}
-interface::af_packet_create_cmd::af_packet_create_cmd(HW::item<handle_t>& item,
- const std::string& name)
+af_packet_create_cmd::af_packet_create_cmd(HW::item<handle_t>& item,
+ const std::string& name)
: create_cmd(item, name)
{
}
rc_t
-interface::af_packet_create_cmd::issue(connection& con)
+af_packet_create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
m_hw_item = wait();
if (m_hw_item.rc() == rc_t::OK) {
- interface::add(m_name, m_hw_item);
+ insert_interface();
}
return rc_t::OK;
}
std::string
-interface::af_packet_create_cmd::to_string() const
+af_packet_create_cmd::to_string() const
{
std::ostringstream s;
s << "af-packet-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
return (s.str());
}
-interface::tap_create_cmd::tap_create_cmd(HW::item<handle_t>& item,
- const std::string& name)
+tap_create_cmd::tap_create_cmd(HW::item<handle_t>& item,
+ const std::string& name)
: create_cmd(item, name)
{
}
rc_t
-interface::tap_create_cmd::issue(connection& con)
+tap_create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
m_hw_item = wait();
if (m_hw_item.rc() == rc_t::OK) {
- interface::add(m_name, m_hw_item);
+ insert_interface();
}
return rc_t::OK;
}
std::string
-interface::tap_create_cmd::to_string() const
+tap_create_cmd::to_string() const
{
std::ostringstream s;
s << "tap-intf-create: " << m_hw_item.to_string() << " name:" << m_name;
return (s.str());
}
-interface::loopback_delete_cmd::loopback_delete_cmd(HW::item<handle_t>& item)
+loopback_delete_cmd::loopback_delete_cmd(HW::item<handle_t>& item)
: delete_cmd(item)
{
}
rc_t
-interface::loopback_delete_cmd::issue(connection& con)
+loopback_delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
wait();
m_hw_item.set(rc_t::NOOP);
- interface::remove(m_hw_item);
+ remove_interface();
return rc_t::OK;
}
std::string
-interface::loopback_delete_cmd::to_string() const
+loopback_delete_cmd::to_string() const
{
std::ostringstream s;
s << "loopback-itf-delete: " << m_hw_item.to_string();
return (s.str());
}
-interface::af_packet_delete_cmd::af_packet_delete_cmd(HW::item<handle_t>& item,
- const std::string& name)
+af_packet_delete_cmd::af_packet_delete_cmd(HW::item<handle_t>& item,
+ const std::string& name)
: delete_cmd(item, name)
{
}
rc_t
-interface::af_packet_delete_cmd::issue(connection& con)
+af_packet_delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
wait();
m_hw_item.set(rc_t::NOOP);
- interface::remove(m_hw_item);
+ remove_interface();
return rc_t::OK;
}
std::string
-interface::af_packet_delete_cmd::to_string() const
+af_packet_delete_cmd::to_string() const
{
std::ostringstream s;
s << "af_packet-itf-delete: " << m_hw_item.to_string();
return (s.str());
}
-interface::tap_delete_cmd::tap_delete_cmd(HW::item<handle_t>& item)
+tap_delete_cmd::tap_delete_cmd(HW::item<handle_t>& item)
: delete_cmd(item)
{
}
rc_t
-interface::tap_delete_cmd::issue(connection& con)
+tap_delete_cmd::issue(connection& con)
{
// finally... call VPP
- interface::remove(m_hw_item);
+ remove_interface();
return rc_t::OK;
}
std::string
-interface::tap_delete_cmd::to_string() const
+tap_delete_cmd::to_string() const
{
std::ostringstream s;
s << "tap-itf-delete: " << m_hw_item.to_string();
return (s.str());
}
-interface::state_change_cmd::state_change_cmd(
- HW::item<interface::admin_state_t>& state,
- const HW::item<handle_t>& hdl)
+state_change_cmd::state_change_cmd(HW::item<interface::admin_state_t>& state,
+ const HW::item<handle_t>& hdl)
: rpc_cmd(state)
, m_hdl(hdl)
{
}
bool
-interface::state_change_cmd::operator==(const state_change_cmd& other) const
+state_change_cmd::operator==(const state_change_cmd& other) const
{
return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item));
}
rc_t
-interface::state_change_cmd::issue(connection& con)
+state_change_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-interface::state_change_cmd::to_string() const
+state_change_cmd::to_string() const
{
std::ostringstream s;
s << "itf-state-change: " << m_hw_item.to_string()
return (s.str());
}
-interface::set_table_cmd::set_table_cmd(HW::item<route::table_id_t>& table,
- const l3_proto_t& proto,
- const HW::item<handle_t>& hdl)
+set_table_cmd::set_table_cmd(HW::item<route::table_id_t>& table,
+ const l3_proto_t& proto,
+ const HW::item<handle_t>& hdl)
: rpc_cmd(table)
, m_hdl(hdl)
, m_proto(proto)
}
bool
-interface::set_table_cmd::operator==(const set_table_cmd& other) const
+set_table_cmd::operator==(const set_table_cmd& other) const
{
return ((m_hdl == other.m_hdl) && (m_proto == other.m_proto) &&
(m_hw_item == other.m_hw_item));
}
rc_t
-interface::set_table_cmd::issue(connection& con)
+set_table_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-interface::set_table_cmd::to_string() const
+set_table_cmd::to_string() const
{
std::ostringstream s;
s << "itf-set-table: " << m_hw_item.to_string()
return (s.str());
}
-interface::set_mac_cmd::set_mac_cmd(HW::item<l2_address_t>& mac,
- const HW::item<handle_t>& hdl)
+set_mac_cmd::set_mac_cmd(HW::item<l2_address_t>& mac,
+ const HW::item<handle_t>& hdl)
: rpc_cmd(mac)
, m_hdl(hdl)
{
}
bool
-interface::set_mac_cmd::operator==(const set_mac_cmd& other) const
+set_mac_cmd::operator==(const set_mac_cmd& other) const
{
return ((m_hdl == other.m_hdl) && (m_hw_item == other.m_hw_item));
}
rc_t
-interface::set_mac_cmd::issue(connection& con)
+set_mac_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-interface::set_mac_cmd::to_string() const
+set_mac_cmd::to_string() const
{
std::ostringstream s;
s << "itf-set-mac: " << m_hw_item.to_string() << " hdl:" << m_hdl.to_string();
return (s.str());
}
-interface::events_cmd::events_cmd(event_listener& el)
+events_cmd::events_cmd(interface::event_listener& el)
: event_cmd(el.status())
, m_listener(el)
{
}
bool
-interface::events_cmd::operator==(const events_cmd& other) const
+events_cmd::operator==(const events_cmd& other) const
{
return (true);
}
rc_t
-interface::events_cmd::issue(connection& con)
+events_cmd::issue(connection& con)
{
/*
* First set the call back to handle the interface events
}
void
-interface::events_cmd::retire(connection& con)
+events_cmd::retire(connection& con)
{
/*
* disable interface events.
}
void
-interface::events_cmd::notify()
+events_cmd::notify()
{
m_listener.handle_interface_event(this);
}
std::string
-interface::events_cmd::to_string() const
+events_cmd::to_string() const
{
return ("itf-events");
}
/**
* Interface statistics
*/
-interface::stats_cmd::stats_cmd(stat_listener& el,
- const std::vector<handle_t>& interfaces)
+stats_cmd::stats_cmd(interface::stat_listener& el,
+ const std::vector<handle_t>& interfaces)
: event_cmd(el.status())
, m_listener(el)
, m_swifindex(interfaces)
}
bool
-interface::stats_cmd::operator==(const stats_cmd& other) const
+stats_cmd::operator==(const stats_cmd& other) const
{
return (true);
}
rc_t
-interface::stats_cmd::issue(connection& con)
+stats_cmd::issue(connection& con)
{
/*
* First set the clal back to handle the interface stats
}
void
-interface::stats_cmd::retire(connection& con)
+stats_cmd::retire(connection& con)
{
}
void
-interface::stats_cmd::notify()
+stats_cmd::notify()
{
m_listener.handle_interface_stat(this);
}
std::string
-interface::stats_cmd::to_string() const
+stats_cmd::to_string() const
{
return ("itf-stats");
}
-interface::dump_cmd::dump_cmd()
+dump_cmd::dump_cmd()
{
}
bool
-interface::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-interface::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-interface::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("itf-dump");
}
-interface::set_tag::set_tag(HW::item<handle_t>& item, const std::string& name)
+set_tag::set_tag(HW::item<handle_t>& item, const std::string& name)
: rpc_cmd(item)
, m_name(name)
{
}
rc_t
-interface::set_tag::issue(connection& con)
+set_tag::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
return rc_t::OK;
}
std::string
-interface::set_tag::to_string() const
+set_tag::to_string() const
{
std::ostringstream s;
s << "itf-set-tag: " << m_hw_item.to_string() << " name:" << m_name;
}
bool
-interface::set_tag::operator==(const set_tag& o) const
+set_tag::operator==(const set_tag& o) const
{
return ((m_name == o.m_name) && (m_hw_item.data() == o.m_hw_item.data()));
}
-}
+}; // namespace interface_cmds
+}; // namespace VOM
+
/*
* fd.io coding-style-patch-verification: ON
*
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_INTERFACE_CMDS_H__
+#define __VOM_INTERFACE_CMDS_H__
+
+#include <vapi/vapi.hpp>
+
+#include "vom/dump_cmd.hpp"
+#include "vom/event_cmd.hpp"
+#include "vom/interface.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/af_packet.api.vapi.hpp>
+#include <vapi/interface.api.vapi.hpp>
+#include <vapi/stats.api.vapi.hpp>
+#include <vapi/tap.api.vapi.hpp>
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+
+namespace interface_cmds {
+/**
+ * Factory method to construct a new interface from the VPP record
+ */
+std::unique_ptr<interface> new_interface(
+ const vapi_payload_sw_interface_details& vd);
+
+/**
+ * A command class to create Loopback interfaces in VPP
+ */
+class loopback_create_cmd : public interface::create_cmd<vapi::Create_loopback>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the name of the interface to create
+ */
+ loopback_create_cmd(HW::item<handle_t>& item, const std::string& name);
+ ~loopback_create_cmd() = default;
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+ * A command class to create af_packet interfaces in VPP
+ */
+class af_packet_create_cmd
+ : public interface::create_cmd<vapi::Af_packet_create>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the name of the interface to create
+ */
+ af_packet_create_cmd(HW::item<handle_t>& item, const std::string& name);
+ ~af_packet_create_cmd() = default;
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+* A command class to create TAP interfaces in VPP
+*/
+class tap_create_cmd : public interface::create_cmd<vapi::Tap_connect>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the name of the interface to create
+ */
+ tap_create_cmd(HW::item<handle_t>& item, const std::string& name);
+ ~tap_create_cmd() = default;
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+ * A command class to delete loopback interfaces in VPP
+ */
+class loopback_delete_cmd : public interface::delete_cmd<vapi::Delete_loopback>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ */
+ loopback_delete_cmd(HW::item<handle_t>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+ * A command class to delete af-packet interfaces in VPP
+ */
+class af_packet_delete_cmd
+ : public interface::delete_cmd<vapi::Af_packet_delete>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the name of the interface to delete
+ */
+ af_packet_delete_cmd(HW::item<handle_t>& item, const std::string& name);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+* A command class to delete TAP interfaces in VPP
+*/
+class tap_delete_cmd : public interface::delete_cmd<vapi::Tap_delete>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ */
+ tap_delete_cmd(HW::item<handle_t>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+ * A command class to set tag on interfaces
+ */
+class set_tag
+ : public rpc_cmd<HW::item<handle_t>, rc_t, vapi::Sw_interface_tag_add_del>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ */
+ set_tag(HW::item<handle_t>& item, const std::string& name);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const set_tag& i) const;
+
+private:
+ /**
+ * The tag to add
+ */
+ const std::string m_name;
+};
+
+/**
+ * A cmd class that changes the admin state
+ */
+class state_change_cmd : public rpc_cmd<HW::item<interface::admin_state_t>,
+ rc_t,
+ vapi::Sw_interface_set_flags>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the name handle of the interface whose state is to change
+ */
+ state_change_cmd(HW::item<interface::admin_state_t>& s,
+ const HW::item<handle_t>& h);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const state_change_cmd& i) const;
+
+private:
+ /**
+ * the handle of the interface to update
+ */
+ const HW::item<handle_t>& m_hdl;
+};
+
+/**
+ * A command class that binds an interface to an L3 table
+ */
+class set_table_cmd : public rpc_cmd<HW::item<route::table_id_t>,
+ rc_t,
+ vapi::Sw_interface_set_table>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the name handle of the interface whose table is to change
+ */
+ set_table_cmd(HW::item<route::table_id_t>& item,
+ const l3_proto_t& proto,
+ const HW::item<handle_t>& h);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const set_table_cmd& i) const;
+
+private:
+ /**
+ * the handle of the interface to update
+ */
+ const HW::item<handle_t>& m_hdl;
+
+ /**
+ * The L3 protocol of the table
+ */
+ l3_proto_t m_proto;
+};
+
+/**
+ * A command class that binds an interface to an L3 table
+ */
+class set_mac_cmd : public rpc_cmd<HW::item<l2_address_t>,
+ rc_t,
+ vapi::Sw_interface_set_mac_address>
+{
+public:
+ /**
+ * Constructor taking the HW::item to update
+ * and the handle of the interface
+ */
+ set_mac_cmd(HW::item<l2_address_t>& item, const HW::item<handle_t>& h);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const set_mac_cmd& i) const;
+
+private:
+ /**
+ * the handle of the interface to update
+ */
+ const HW::item<handle_t>& m_hdl;
+};
+
+/**
+ * A command class represents our desire to recieve interface events
+ */
+class events_cmd
+ : public event_cmd<vapi::Want_interface_events, vapi::Sw_interface_event>
+{
+public:
+ /**
+ * Constructor taking the listner to notify
+ */
+ events_cmd(interface::event_listener& el);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * Retires the command - unsubscribe from the events.
+ */
+ void retire(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const events_cmd& i) const;
+
+ /**
+ * Called when it's time to poke the listeners
+ */
+ void notify();
+
+private:
+ /**
+ * The listeners to notify when data/events arrive
+ */
+ interface::interface::event_listener& m_listener;
+};
+
+/**
+ * A command class represents our desire to recieve interface stats
+ */
+class stats_cmd : public event_cmd<vapi::Want_per_interface_combined_stats,
+ vapi::Vnet_per_interface_combined_counters>
+{
+public:
+ /**
+ * Constructor taking the listner to notify
+ */
+ stats_cmd(interface::stat_listener& el,
+ const std::vector<handle_t>& interfaces);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * Retires the command - unsubscribe from the stats.
+ */
+ void retire(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const stats_cmd& i) const;
+
+ /**
+ * Called when it's time to poke the listeners
+ */
+ void notify();
+
+private:
+ /**
+ * The listeners to notify when data/stats arrive
+ */
+ interface::interface::stat_listener& m_listener;
+
+ std::vector<handle_t> m_swifindex;
+};
+
+/**
+ * A cmd class that Dumps all the Vpp interfaces
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_dump>
+{
+public:
+ /**
+ * Default Constructor
+ */
+ dump_cmd();
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+};
+};
+};
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+#endif
#include <boost/algorithm/string.hpp>
-#include "vom/interface.hpp"
+#include "vom/interface_factory.hpp"
#include "vom/sub_interface.hpp"
#include "vom/tap_interface.hpp"
namespace VOM {
std::unique_ptr<interface>
-interface::new_interface(const vapi_payload_sw_interface_details& vd)
+interface_factory::new_interface(const vapi_payload_sw_interface_details& vd)
{
std::unique_ptr<interface> up_itf;
* Determine the interface type from the name and VLAN attributes
*/
std::string name = reinterpret_cast<const char*>(vd.interface_name);
- type_t type = interface::type_t::from_string(name);
- admin_state_t state = interface::admin_state_t::from_int(vd.link_up_down);
+ interface::type_t type = interface::type_t::from_string(name);
+ interface::admin_state_t state =
+ interface::admin_state_t::from_int(vd.link_up_down);
handle_t hdl(vd.sw_if_index);
l2_address_t l2_address(vd.l2_address, vd.l2_address_length);
- if (type_t::AFPACKET == type) {
+ if (interface::type_t::AFPACKET == type) {
/*
* need to strip VPP's "host-" prefix from the interface name
*/
/*
* pull out the other special cases
*/
- if (type_t::TAP == type) {
+ if (interface::type_t::TAP == type) {
/*
* TAP interface
*/
interface parent(parts[0], type, state);
up_itf.reset(new sub_interface(hdl, parent, state, vd.sub_id));
- } else if (type_t::VXLAN == type) {
+ } else if (interface::type_t::VXLAN == type) {
/*
* there's not enough inforation in a SW interface record to
* construct
return (up_itf);
}
-}
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_INTERFACE_FACTORY_H__
+#define __VOM_INTERFACE_FACTORY_H__
+
+#include <vapi/vapi.hpp>
+
+#include "vom/interface.hpp"
+
+#include <vapi/interface.api.vapi.hpp>
+
+namespace VOM {
+
+class interface_factory
+{
+public:
+ /**
+ * Factory method to construct a new interface from the VPP record
+ */
+ static std::unique_ptr<interface> new_interface(
+ const vapi_payload_sw_interface_details& vd);
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+#endif
#include "vom/singular_db.hpp"
#include "vom/sub_interface.hpp"
-#include <vapi/ip.api.vapi.hpp>
-
namespace VOM {
/**
* A representation of L3 configuration on an interface
*/
#include "vom/interface_span.hpp"
-#include "vom/cmd.hpp"
+#include "vom/interface_span_cmds.hpp"
namespace VOM {
/**
interface_span::sweep()
{
if (m_config) {
- HW::enqueue(
- new unconfig_cmd(m_config, m_itf_from->handle(), m_itf_to->handle()));
+ HW::enqueue(new interface_span_cmds::unconfig_cmd(
+ m_config, m_itf_from->handle(), m_itf_to->handle()));
}
HW::write();
}
interface_span::replay()
{
if (m_config) {
- HW::enqueue(new config_cmd(m_config, m_itf_from->handle(),
- m_itf_to->handle(), m_state));
+ HW::enqueue(new interface_span_cmds::config_cmd(
+ m_config, m_itf_from->handle(), m_itf_to->handle(), m_state));
}
}
interface_span::update(const interface_span& desired)
{
if (!m_config) {
- HW::enqueue(new config_cmd(m_config, m_itf_from->handle(),
- m_itf_to->handle(), m_state));
+ HW::enqueue(new interface_span_cmds::config_cmd(
+ m_config, m_itf_from->handle(), m_itf_to->handle(), m_state));
}
}
void
interface_span::event_handler::handle_populate(const client_db::key_t& key)
{
- std::shared_ptr<interface_span::dump_cmd> cmd(new interface_span::dump_cmd());
+ std::shared_ptr<interface_span_cmds::dump_cmd> cmd(
+ new interface_span_cmds::dump_cmd());
HW::enqueue(cmd);
HW::write();
#ifndef __VOM_INTERFACE_SPAN_H__
#define __VOM_INTERFACE_SPAN_H__
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/span.api.vapi.hpp>
-
namespace VOM {
/**
* A representation of interface span configuration
*/
static std::shared_ptr<interface_span> find(const interface& i);
- /**
- * A command class that configures the interface span
- */
- class config_cmd : public rpc_cmd<HW::item<bool>,
- rc_t,
- vapi::Sw_interface_span_enable_disable>
- {
- public:
- /**
- * Constructor
- */
- config_cmd(HW::item<bool>& item,
- const handle_t& itf_from,
- const handle_t& itf_to,
- const state_t& state);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const config_cmd& i) const;
-
- private:
- /**
- * Reference to the interface to be mirrored
- */
- const handle_t& m_itf_from;
- /**
- * Reference to the interface where the traffic is mirrored
- */
- const handle_t& m_itf_to;
- /**
- * the state (rx, tx or both) of the interface to be mirrored
- */
- const state_t& m_state;
- };
-
- /**
- * A cmd class that Unconfigs interface span
- */
- class unconfig_cmd : public rpc_cmd<HW::item<bool>,
- rc_t,
- vapi::Sw_interface_span_enable_disable>
- {
- public:
- /**
- * Constructor
- */
- unconfig_cmd(HW::item<bool>& item,
- const handle_t& itf_from,
- const handle_t& itf_to);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unconfig_cmd& i) const;
-
- private:
- /**
- * Reference to the interface to be mirrored
- */
- const handle_t& m_itf_from;
- /**
- * Reference to the interface where the traffic is mirrored
- */
- const handle_t& m_itf_to;
- };
-
- /**
- * A cmd class that Dumps all the interface spans
- */
- class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_span_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_cmd();
- dump_cmd(const dump_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/interface_span.hpp"
+#include "vom/interface_span_cmds.hpp"
DEFINE_VAPI_MSG_IDS_SPAN_API_JSON;
namespace VOM {
-interface_span::config_cmd::config_cmd(HW::item<bool>& item,
- const handle_t& itf_from,
- const handle_t& itf_to,
- const interface_span::state_t& state)
+namespace interface_span_cmds {
+
+config_cmd::config_cmd(HW::item<bool>& item,
+ const handle_t& itf_from,
+ const handle_t& itf_to,
+ const interface_span::state_t& state)
: rpc_cmd(item)
, m_itf_from(itf_from)
, m_itf_to(itf_to)
}
bool
-interface_span::config_cmd::operator==(const config_cmd& o) const
+config_cmd::operator==(const config_cmd& o) const
{
return ((m_itf_from == o.m_itf_from) && (m_itf_to == o.m_itf_to) &&
(m_state == o.m_state));
}
rc_t
-interface_span::config_cmd::issue(connection& con)
+config_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-interface_span::config_cmd::to_string() const
+config_cmd::to_string() const
{
std::ostringstream s;
s << "itf-span-config: " << m_hw_item.to_string()
return (s.str());
}
-interface_span::unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
- const handle_t& itf_from,
- const handle_t& itf_to)
+unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
+ const handle_t& itf_from,
+ const handle_t& itf_to)
: rpc_cmd(item)
, m_itf_from(itf_from)
, m_itf_to(itf_to)
}
bool
-interface_span::unconfig_cmd::operator==(const unconfig_cmd& o) const
+unconfig_cmd::operator==(const unconfig_cmd& o) const
{
return ((m_itf_from == o.m_itf_from) && (m_itf_to == o.m_itf_to));
}
rc_t
-interface_span::unconfig_cmd::issue(connection& con)
+unconfig_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-interface_span::unconfig_cmd::to_string() const
+unconfig_cmd::to_string() const
{
std::ostringstream s;
s << "itf-span-unconfig: " << m_hw_item.to_string()
return (s.str());
}
-interface_span::dump_cmd::dump_cmd()
+dump_cmd::dump_cmd()
{
}
bool
-interface_span::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-interface_span::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-interface_span::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("interface-span-dump");
}
-}
+
+}; // namespace interface_span_cmds
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_INTERFACE_SPAN_CMDS_H__
+#define __VOM_INTERFACE_SPAN_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/interface_span.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/span.api.vapi.hpp>
+
+namespace VOM {
+namespace interface_span_cmds {
+
+/**
+ * A command class that configures the interface span
+ */
+class config_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_span_enable_disable>
+{
+public:
+ /**
+ * Constructor
+ */
+ config_cmd(HW::item<bool>& item,
+ const handle_t& itf_from,
+ const handle_t& itf_to,
+ const interface_span::state_t& state);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const config_cmd& i) const;
+
+private:
+ /**
+ * Reference to the interface to be mirrored
+ */
+ const handle_t& m_itf_from;
+ /**
+ * Reference to the interface where the traffic is mirrored
+ */
+ const handle_t& m_itf_to;
+ /**
+ * the state (rx, tx or both) of the interface to be mirrored
+ */
+ const interface_span::state_t& m_state;
+};
+
+/**
+ * A cmd class that Unconfigs interface span
+ */
+class unconfig_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_span_enable_disable>
+{
+public:
+ /**
+ * Constructor
+ */
+ unconfig_cmd(HW::item<bool>& item,
+ const handle_t& itf_from,
+ const handle_t& itf_to);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unconfig_cmd& i) const;
+
+private:
+ /**
+ * Reference to the interface to be mirrored
+ */
+ const handle_t& m_itf_from;
+ /**
+ * Reference to the interface where the traffic is mirrored
+ */
+ const handle_t& m_itf_to;
+};
+
+/**
+ * A cmd class that Dumps all the interface spans
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_span_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd();
+ dump_cmd(const dump_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+};
+};
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/ip_unnumbered.hpp"
-#include "vom/cmd.hpp"
+#include "vom/ip_unnumbered_cmds.hpp"
namespace VOM {
/**
ip_unnumbered::sweep()
{
if (m_config) {
- HW::enqueue(
- new unconfig_cmd(m_config, m_itf->handle(), m_l3_itf->handle()));
+ HW::enqueue(new ip_unnumbered_cmds::unconfig_cmd(m_config, m_itf->handle(),
+ m_l3_itf->handle()));
}
HW::write();
}
ip_unnumbered::replay()
{
if (m_config) {
- HW::enqueue(new config_cmd(m_config, m_itf->handle(), m_l3_itf->handle()));
+ HW::enqueue(new ip_unnumbered_cmds::config_cmd(m_config, m_itf->handle(),
+ m_l3_itf->handle()));
}
}
ip_unnumbered::update(const ip_unnumbered& desired)
{
if (!m_config) {
- HW::enqueue(new config_cmd(m_config, m_itf->handle(), m_l3_itf->handle()));
+ HW::enqueue(new ip_unnumbered_cmds::config_cmd(m_config, m_itf->handle(),
+ m_l3_itf->handle()));
}
}
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
namespace VOM {
*/
static std::shared_ptr<ip_unnumbered> find(const interface& i);
- /**
- * A command class that configures the IP unnumbered
- */
- class config_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_unnumbered>
- {
- public:
- /**
- * Constructor
- */
- config_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const handle_t& l3_itf);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const config_cmd& i) const;
-
- private:
- /**
- * Reference to the interface for which the address is required
- */
- const handle_t& m_itf;
- /**
- * Reference to the interface which has an address
- */
- const handle_t& m_l3_itf;
- };
-
- /**
- * A cmd class that Unconfigs L3 Config from an interface
- */
- class unconfig_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_unnumbered>
- {
- public:
- /**
- * Constructor
- */
- unconfig_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const handle_t& l3_itf);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unconfig_cmd& i) const;
-
- private:
- /**
- * Reference to the interface for which the address is required
- */
- const handle_t& m_itf;
- /**
- * Reference to the interface which has an address
- */
- const handle_t& m_l3_itf;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/ip_unnumbered.hpp"
+#include "vom/ip_unnumbered_cmds.hpp"
#include <vapi/vpe.api.vapi.hpp>
namespace VOM {
-ip_unnumbered::config_cmd::config_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const handle_t& l3_itf)
+namespace ip_unnumbered_cmds {
+
+config_cmd::config_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const handle_t& l3_itf)
: rpc_cmd(item)
, m_itf(itf)
, m_l3_itf(l3_itf)
}
bool
-ip_unnumbered::config_cmd::operator==(const config_cmd& o) const
+config_cmd::operator==(const config_cmd& o) const
{
return ((m_itf == o.m_itf) && (m_l3_itf == o.m_l3_itf));
}
rc_t
-ip_unnumbered::config_cmd::issue(connection& con)
+config_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-ip_unnumbered::config_cmd::to_string() const
+config_cmd::to_string() const
{
std::ostringstream s;
s << "IP-unnumberd-config: " << m_hw_item.to_string()
return (s.str());
}
-ip_unnumbered::unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const handle_t& l3_itf)
+unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const handle_t& l3_itf)
: rpc_cmd(item)
, m_itf(itf)
, m_l3_itf(l3_itf)
}
bool
-ip_unnumbered::unconfig_cmd::operator==(const unconfig_cmd& o) const
+unconfig_cmd::operator==(const unconfig_cmd& o) const
{
return ((m_itf == o.m_itf) && (m_l3_itf == o.m_l3_itf));
}
rc_t
-ip_unnumbered::unconfig_cmd::issue(connection& con)
+unconfig_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-ip_unnumbered::unconfig_cmd::to_string() const
+unconfig_cmd::to_string() const
{
std::ostringstream s;
s << "IP-unnumberd-unconfig: " << m_hw_item.to_string()
return (s.str());
}
-}
+
+}; // namespace ip_unnumbered_cmds
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_IP_UNNUMBERED_CMDS_H__
+#define __VOM_IP_UNNUMBERED_CMDS_H__
+
+#include "vom/ip_unnumbered.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/interface.api.vapi.hpp>
+
+namespace VOM {
+namespace ip_unnumbered_cmds {
+
+/**
+*A command class that configures the IP unnumbered
+*/
+class config_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_unnumbered>
+{
+public:
+ /**
+ * Constructor
+ */
+ config_cmd(HW::item<bool>& item, const handle_t& itf, const handle_t& l3_itf);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const config_cmd& i) const;
+
+private:
+ /**
+ * Reference to the interface for which the address is required
+ */
+ const handle_t& m_itf;
+ /**
+ * Reference to the interface which has an address
+ */
+ const handle_t& m_l3_itf;
+};
+
+/**
+ * A cmd class that Unconfigs L3 Config from an interface
+ */
+class unconfig_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_unnumbered>
+{
+public:
+ /**
+ * Constructor
+ */
+ unconfig_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const handle_t& l3_itf);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unconfig_cmd& i) const;
+
+private:
+ /**
+ * Reference to the interface for which the address is required
+ */
+ const handle_t& m_itf;
+ /**
+ * Reference to the interface which has an address
+ */
+ const handle_t& m_l3_itf;
+};
+
+}; // namespace ip_unnumbered_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/l2_binding.hpp"
-#include "vom/cmd.hpp"
+#include "vom/l2_binding_cmds.hpp"
namespace VOM {
/**
l2_binding::sweep()
{
if (m_binding && handle_t::INVALID != m_itf->handle()) {
- HW::enqueue(new unbind_cmd(m_binding, m_itf->handle(), m_bd->id(),
- interface::type_t::BVI == m_itf->type()));
+ HW::enqueue(
+ new l2_binding_cmds::unbind_cmd(m_binding, m_itf->handle(), m_bd->id(),
+ interface::type_t::BVI == m_itf->type()));
}
// no need to undo the VTR operation.
l2_binding::replay()
{
if (m_binding && handle_t::INVALID != m_itf->handle()) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle(), m_bd->id(),
- interface::type_t::BVI == m_itf->type()));
+ HW::enqueue(
+ new l2_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_bd->id(),
+ interface::type_t::BVI == m_itf->type()));
}
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_binding_cmds::set_vtr_op_cmd(m_vtr_op, m_itf->handle(),
+ m_vtr_op_tag));
}
}
* the desired state is always that the interface should be created
*/
if (rc_t::OK != m_binding.rc()) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle(), m_bd->id(),
- interface::type_t::BVI == m_itf->type()));
+ HW::enqueue(
+ new l2_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_bd->id(),
+ interface::type_t::BVI == m_itf->type()));
}
/*
* set the VTR operation is 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_binding_cmds::set_vtr_op_cmd(m_vtr_op, m_itf->handle(),
+ m_vtr_op_tag));
}
}
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include "vom/vxlan_tunnel.hpp"
namespace VOM {
/**
*/
void set(const l2_vtr_op_t& op, uint16_t tag);
- /**
- * A functor class that binds L2 configuration to an interface
- */
- class bind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
- {
- public:
- /**
- * Constructor
- */
- bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- uint32_t bd,
- bool is_bvi);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_cmd& i) const;
-
- private:
- /**
- * The interface to bind
- */
- const handle_t m_itf;
-
- /**
- * The bridge-domain to bind to
- */
- uint32_t m_bd;
-
- /**
- * Is it a BVI interface that is being bound
- */
- bool m_is_bvi;
- };
-
- /**
- * A cmd class that Unbinds L2 configuration from an interface
- */
- class unbind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
- {
- public:
- /**
- * Constructor
- */
- unbind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- uint32_t bd,
- bool is_bvi);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_cmd& i) const;
-
- private:
- /**
- * The interface to bind
- */
- const handle_t m_itf;
-
- /**
- * The bridge-domain to bind to
- */
- uint32_t m_bd;
-
- /**
- * Is it a BVI interface that is being bound
- */
- bool m_is_bvi;
- };
-
- /**
- * A cmd class sets the VTR operation
- */
- class set_vtr_op_cmd : public rpc_cmd<HW::item<l2_vtr_op_t>,
- rc_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);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const set_vtr_op_cmd& i) const;
-
- private:
- /**
- * The interface to bind
- */
- const handle_t m_itf;
-
- /**
- * The tag for the operation
- */
- uint16_t m_tag;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/l2_binding.hpp"
+#include "vom/l2_binding_cmds.hpp"
namespace VOM {
-l2_binding::bind_cmd::bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- uint32_t bd,
- bool is_bvi)
+namespace l2_binding_cmds {
+bind_cmd::bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ uint32_t bd,
+ bool is_bvi)
: rpc_cmd(item)
, m_itf(itf)
, m_bd(bd)
}
bool
-l2_binding::bind_cmd::operator==(const bind_cmd& other) const
+bind_cmd::operator==(const bind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_bd == other.m_bd) &&
(m_is_bvi == other.m_is_bvi));
}
rc_t
-l2_binding::bind_cmd::issue(connection& con)
+bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-l2_binding::bind_cmd::to_string() const
+bind_cmd::to_string() const
{
std::ostringstream s;
s << "L2-bind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
return (s.str());
}
-l2_binding::unbind_cmd::unbind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- uint32_t bd,
- bool is_bvi)
+unbind_cmd::unbind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ uint32_t bd,
+ bool is_bvi)
: rpc_cmd(item)
, m_itf(itf)
, m_bd(bd)
}
bool
-l2_binding::unbind_cmd::operator==(const unbind_cmd& other) const
+unbind_cmd::operator==(const unbind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_bd == other.m_bd) &&
(m_is_bvi == other.m_is_bvi));
}
rc_t
-l2_binding::unbind_cmd::issue(connection& con)
+unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-l2_binding::unbind_cmd::to_string() const
+unbind_cmd::to_string() const
{
std::ostringstream s;
s << "L2-unbind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
return (s.str());
}
-l2_binding::set_vtr_op_cmd::set_vtr_op_cmd(HW::item<l2_vtr_op_t>& item,
- const handle_t& itf,
- uint16_t tag)
+set_vtr_op_cmd::set_vtr_op_cmd(HW::item<l2_binding::l2_vtr_op_t>& item,
+ const handle_t& itf,
+ uint16_t tag)
: rpc_cmd(item)
, m_itf(itf)
, m_tag(tag)
}
bool
-l2_binding::set_vtr_op_cmd::operator==(const set_vtr_op_cmd& other) const
+set_vtr_op_cmd::operator==(const set_vtr_op_cmd& other) const
{
return (
(m_hw_item.data() == other.m_hw_item.data() && m_itf == other.m_itf) &&
}
rc_t
-l2_binding::set_vtr_op_cmd::issue(connection& con)
+set_vtr_op_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-l2_binding::set_vtr_op_cmd::to_string() const
+set_vtr_op_cmd::to_string() const
{
std::ostringstream s;
s << "L2-set-vtr-op: " << m_hw_item.to_string()
return (s.str());
}
-}
+
+}; // namespace l2_binding_cmds
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_L2_BINDING_CMDS_H__
+#define __VOM_L2_BINDING_CMDS_H__
+
+#include "vom/l2_binding.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/l2.api.vapi.hpp>
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+namespace l2_binding_cmds {
+
+/**
+ * A functor class that binds L2 configuration to an interface
+ */
+class bind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_cmd(HW::item<bool>& item, const handle_t& itf, uint32_t bd, bool is_bvi);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_cmd& i) const;
+
+private:
+ /**
+ * The interface to bind
+ */
+ const handle_t m_itf;
+
+ /**
+ * The bridge-domain to bind to
+ */
+ uint32_t m_bd;
+
+ /**
+ * Is it a BVI interface that is being bound
+ */
+ bool m_is_bvi;
+};
+
+/**
+ * A cmd class that Unbinds L2 configuration from an interface
+ */
+class unbind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ uint32_t bd,
+ bool is_bvi);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_cmd& i) const;
+
+private:
+ /**
+ * The interface to bind
+ */
+ const handle_t m_itf;
+
+ /**
+ * The bridge-domain to bind to
+ */
+ uint32_t m_bd;
+
+ /**
+ * Is it a BVI interface that is being bound
+ */
+ bool m_is_bvi;
+};
+
+/**
+ * A cmd class sets the VTR operation
+ */
+class set_vtr_op_cmd : public rpc_cmd<HW::item<l2_binding::l2_vtr_op_t>,
+ rc_t,
+ vapi::L2_interface_vlan_tag_rewrite>
+{
+public:
+ /**
+ * Constructor
+ */
+ set_vtr_op_cmd(HW::item<l2_binding::l2_vtr_op_t>& item,
+ const handle_t& itf,
+ uint16_t tag);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const set_vtr_op_cmd& i) const;
+
+private:
+ /**
+ * The interface to bind
+ */
+ const handle_t m_itf;
+
+ /**
+ * The tag for the operation
+ */
+ uint16_t m_tag;
+};
+
+}; // namespace l2_binding_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/l3_binding.hpp"
-#include "vom/cmd.hpp"
+#include "vom/l3_binding_cmds.hpp"
namespace VOM {
singular_db<l3_binding::key_type_t, l3_binding> l3_binding::m_db;
l3_binding::sweep()
{
if (m_binding) {
- HW::enqueue(new unbind_cmd(m_binding, m_itf->handle(), m_pfx));
+ HW::enqueue(
+ new l3_binding_cmds::unbind_cmd(m_binding, m_itf->handle(), m_pfx));
}
HW::write();
}
l3_binding::replay()
{
if (m_binding) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle(), m_pfx));
+ HW::enqueue(
+ new l3_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_pfx));
}
}
* the desired state is always that the interface should be created
*/
if (!m_binding) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle(), m_pfx));
+ HW::enqueue(
+ new l3_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_pfx));
}
}
#ifndef __VOM_L3_BINDING_H__
#define __VOM_L3_BINDING_H__
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/ip.api.vapi.hpp>
-
namespace VOM {
/**
* A representation of L3 configuration on an interface
*/
static std::deque<std::shared_ptr<l3_binding>> find(const interface& i);
- /**
- * A functor class that binds the L3 config to the interface
- */
- class bind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_add_del_address>
- {
- public:
- /**
- * Constructor
- */
- bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const route::prefix_t& pfx);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_cmd& i) const;
-
- private:
- /**
- * Reference to the interface to bind to
- */
- const handle_t& m_itf;
-
- /**
- * The prefix to bind
- */
- const route::prefix_t& m_pfx;
- };
-
- /**
- * A cmd class that Unbinds L3 Config from an interface
- */
- class unbind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_add_del_address>
- {
- public:
- /**
- * Constructor
- */
- unbind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const route::prefix_t& pfx);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_cmd& i) const;
-
- private:
- /**
- * Reference to the interface to unbind fomr
- */
- const handle_t& m_itf;
-
- /**
- * The prefix to unbind
- */
- const route::prefix_t& m_pfx;
- };
-
- /**
- * A cmd class that Dumps all the IPv4 L3 configs
- */
- class dump_v4_cmd : public dump_cmd<vapi::Ip_address_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_v4_cmd(const handle_t& itf);
- dump_v4_cmd(const dump_v4_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_v4_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
-
- /**
- * The interface to get the addresses for
- */
- const handle_t& m_itf;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/l3_binding.hpp"
+#include "vom/l3_binding_cmds.hpp"
DEFINE_VAPI_MSG_IDS_IP_API_JSON;
namespace VOM {
-l3_binding::bind_cmd::bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const route::prefix_t& pfx)
+namespace l3_binding_cmds {
+bind_cmd::bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const route::prefix_t& pfx)
: rpc_cmd(item)
, m_itf(itf)
, m_pfx(pfx)
}
bool
-l3_binding::bind_cmd::operator==(const bind_cmd& other) const
+bind_cmd::operator==(const bind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_pfx == other.m_pfx));
}
rc_t
-l3_binding::bind_cmd::issue(connection& con)
+bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-l3_binding::bind_cmd::to_string() const
+bind_cmd::to_string() const
{
std::ostringstream s;
s << "L3-bind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
return (s.str());
}
-l3_binding::unbind_cmd::unbind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const route::prefix_t& pfx)
+unbind_cmd::unbind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const route::prefix_t& pfx)
: rpc_cmd(item)
, m_itf(itf)
, m_pfx(pfx)
}
bool
-l3_binding::unbind_cmd::operator==(const unbind_cmd& other) const
+unbind_cmd::operator==(const unbind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_pfx == other.m_pfx));
}
rc_t
-l3_binding::unbind_cmd::issue(connection& con)
+unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-l3_binding::unbind_cmd::to_string() const
+unbind_cmd::to_string() const
{
std::ostringstream s;
s << "L3-unbind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
return (s.str());
}
-l3_binding::dump_v4_cmd::dump_v4_cmd(const handle_t& hdl)
+dump_v4_cmd::dump_v4_cmd(const handle_t& hdl)
: m_itf(hdl)
{
}
-l3_binding::dump_v4_cmd::dump_v4_cmd(const dump_v4_cmd& d)
+dump_v4_cmd::dump_v4_cmd(const dump_v4_cmd& d)
: m_itf(d.m_itf)
{
}
bool
-l3_binding::dump_v4_cmd::operator==(const dump_v4_cmd& other) const
+dump_v4_cmd::operator==(const dump_v4_cmd& other) const
{
return (true);
}
rc_t
-l3_binding::dump_v4_cmd::issue(connection& con)
+dump_v4_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-l3_binding::dump_v4_cmd::to_string() const
+dump_v4_cmd::to_string() const
{
return ("L3-binding-dump");
}
-}
+
+}; // namespace l3_binding_cmds
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_L3_BINDING_CMDS_H__
+#define __VOM_L3_BINDING_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/l3_binding.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/interface.api.vapi.hpp>
+#include <vapi/ip.api.vapi.hpp>
+
+namespace VOM {
+namespace l3_binding_cmds {
+
+/**
+ * A functor class that binds the L3 config to the interface
+ */
+class bind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_add_del_address>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const route::prefix_t& pfx);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the interface to bind to
+ */
+ const handle_t& m_itf;
+
+ /**
+ * The prefix to bind
+ */
+ const route::prefix_t& m_pfx;
+};
+
+/**
+ * A cmd class that Unbinds L3 Config from an interface
+ */
+class unbind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_add_del_address>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const route::prefix_t& pfx);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the interface to unbind fomr
+ */
+ const handle_t& m_itf;
+
+ /**
+ * The prefix to unbind
+ */
+ const route::prefix_t& m_pfx;
+};
+
+/**
+ * A cmd class that Dumps all the IPv4 L3 configs
+ */
+class dump_v4_cmd : public dump_cmd<vapi::Ip_address_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_v4_cmd(const handle_t& itf);
+ dump_v4_cmd(const dump_v4_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_v4_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+
+ /**
+ * The interface to get the addresses for
+ */
+ const handle_t& m_itf;
+};
+
+}; // namespace l3_binding_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/lldp_binding.hpp"
-#include "vom/cmd.hpp"
+#include "vom/lldp_binding_cmds.hpp"
namespace VOM {
/**
lldp_binding::sweep()
{
if (m_binding) {
- HW::enqueue(new unbind_cmd(m_binding, m_itf->handle()));
+ HW::enqueue(new lldp_binding_cmds::unbind_cmd(m_binding, m_itf->handle()));
}
HW::write();
}
lldp_binding::replay()
{
if (m_binding) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle(), m_port_desc));
+ HW::enqueue(
+ new lldp_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_port_desc));
}
}
* the desired state is always that the interface should be created
*/
if (!m_binding) {
- HW::enqueue(new bind_cmd(m_binding, m_itf->handle(), m_port_desc));
+ HW::enqueue(
+ new lldp_binding_cmds::bind_cmd(m_binding, m_itf->handle(), m_port_desc));
}
}
#ifndef __VOM_LLDP_BINDING_H__
#define __VOM_LLDP_BINDING_H__
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include "vom/sub_interface.hpp"
-
-#include <vapi/lldp.api.vapi.hpp>
namespace VOM {
/**
*/
static void dump(std::ostream& os);
- /**
- * A command class that binds the LLDP config to the interface
- */
- class bind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_lldp>
- {
- public:
- /**
- * Constructor
- */
- bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const std::string& port_desc);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_cmd& i) const;
-
- private:
- /**
- * Reference to the HW::item of the interface to bind
- */
- const handle_t& m_itf;
-
- /**
- * The LLDP client's hostname
- */
- const std::string m_port_desc;
- };
-
- /**
- * A cmd class that Unbinds Lldp Config from an interface
- */
- class unbind_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_lldp>
- {
- public:
- /**
- * Constructor
- */
- unbind_cmd(HW::item<bool>& item, const handle_t& itf);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_cmd& i) const;
-
- private:
- /**
- * Reference to the HW::item of the interface to unbind
- */
- const handle_t& m_itf;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/lldp_binding.hpp"
+#include "vom/lldp_binding_cmds.hpp"
DEFINE_VAPI_MSG_IDS_LLDP_API_JSON;
namespace VOM {
-lldp_binding::bind_cmd::bind_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const std::string& port_desc)
+namespace lldp_binding_cmds {
+
+bind_cmd::bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const std::string& port_desc)
: rpc_cmd(item)
, m_itf(itf)
, m_port_desc(port_desc)
}
bool
-lldp_binding::bind_cmd::operator==(const bind_cmd& other) const
+bind_cmd::operator==(const bind_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_port_desc == other.m_port_desc));
}
rc_t
-lldp_binding::bind_cmd::issue(connection& con)
+bind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-lldp_binding::bind_cmd::to_string() const
+bind_cmd::to_string() const
{
std::ostringstream s;
s << "Lldp-bind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
return (s.str());
}
-lldp_binding::unbind_cmd::unbind_cmd(HW::item<bool>& item, const handle_t& itf)
+unbind_cmd::unbind_cmd(HW::item<bool>& item, const handle_t& itf)
: rpc_cmd(item)
, m_itf(itf)
{
}
bool
-lldp_binding::unbind_cmd::operator==(const unbind_cmd& other) const
+unbind_cmd::operator==(const unbind_cmd& other) const
{
return (m_itf == other.m_itf);
}
rc_t
-lldp_binding::unbind_cmd::issue(connection& con)
+unbind_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-lldp_binding::unbind_cmd::to_string() const
+unbind_cmd::to_string() const
{
std::ostringstream s;
s << "Lldp-unbind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string();
return (s.str());
}
-}
+
+}; // namespace lldp_binding_cmds
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_LLDP_BINDING_CMDS_H__
+#define __VOM_LLDP_BINDING_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/lldp_binding.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/lldp.api.vapi.hpp>
+
+namespace VOM {
+namespace lldp_binding_cmds {
+
+/**
+*A command class that binds the LLDP config to the interface
+*/
+class bind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_lldp>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const std::string& port_desc);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the HW::item of the interface to bind
+ */
+ const handle_t& m_itf;
+
+ /**
+ * The LLDP client's hostname
+ */
+ const std::string m_port_desc;
+};
+
+/**
+ * A cmd class that Unbinds Lldp Config from an interface
+ */
+class unbind_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_lldp>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_cmd(HW::item<bool>& item, const handle_t& itf);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_cmd& i) const;
+
+private:
+ /**
+ * Reference to the HW::item of the interface to unbind
+ */
+ const handle_t& m_itf;
+};
+
+}; // namespace lldp_binding_cmds
+}; // naemspace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/lldp_global.hpp"
-#include "vom/cmd.hpp"
+#include "vom/lldp_global_cmds.hpp"
namespace VOM {
/**
lldp_global::replay()
{
if (m_binding) {
- HW::enqueue(
- new config_cmd(m_binding, m_system_name, m_tx_hold, m_tx_interval));
+ HW::enqueue(new lldp_global_cmds::config_cmd(m_binding, m_system_name,
+ m_tx_hold, m_tx_interval));
}
}
lldp_global::update(const lldp_global& desired)
{
if (!m_binding) {
- HW::enqueue(
- new config_cmd(m_binding, m_system_name, m_tx_hold, m_tx_interval));
+ HW::enqueue(new lldp_global_cmds::config_cmd(m_binding, m_system_name,
+ m_tx_hold, m_tx_interval));
}
}
#ifndef __VOM_LLDP_GLOBAL_H__
#define __VOM_LLDP_GLOBAL_H__
-#include "vom/dump_cmd.hpp"
#include "vom/hw.hpp"
#include "vom/inspect.hpp"
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
#include "vom/sub_interface.hpp"
* limitations under the License.
*/
-#include "vom/lldp_global.hpp"
+#include "vom/lldp_global_cmds.hpp"
namespace VOM {
-lldp_global::config_cmd::config_cmd(HW::item<bool>& item,
- const std::string& system_name,
- uint32_t tx_hold,
- uint32_t tx_interval)
+namespace lldp_global_cmds {
+config_cmd::config_cmd(HW::item<bool>& item,
+ const std::string& system_name,
+ uint32_t tx_hold,
+ uint32_t tx_interval)
: rpc_cmd(item)
, m_system_name(system_name)
, m_tx_hold(tx_hold)
}
bool
-lldp_global::config_cmd::operator==(const config_cmd& other) const
+config_cmd::operator==(const config_cmd& other) const
{
return (m_system_name == other.m_system_name);
}
rc_t
-lldp_global::config_cmd::issue(connection& con)
+config_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-lldp_global::config_cmd::to_string() const
+config_cmd::to_string() const
{
std::ostringstream s;
s << "Lldp-global-config: " << m_hw_item.to_string()
return (s.str());
}
-}
+
+}; // namespace lldp_global_cmds
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_LLDP_GLOBAL_CMDS_H__
+#define __VOM_LLDP_GLOBAL_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/lldp_global.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/lldp.api.vapi.hpp>
+
+namespace VOM {
+namespace lldp_global_cmds {
+
+/**
+* A command class that binds the LLDP global to the interface
+*/
+class config_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Lldp_config>
+{
+public:
+ /**
+ * Constructor
+ */
+ config_cmd(HW::item<bool>& item,
+ const std::string& system_name,
+ uint32_t tx_hold,
+ uint32_t tx_interval);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const config_cmd& i) const;
+
+private:
+ /**
+ * The system name
+ */
+ const std::string m_system_name;
+
+ /**
+ * TX timer configs
+ */
+ uint32_t m_tx_hold;
+ uint32_t m_tx_interval;
+};
+
+}; // namespace lldp_global_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
#include "vom/nat_binding.hpp"
#include "vom/cmd.hpp"
+#include "vom/nat_binding_cmds.hpp"
namespace VOM {
singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db;
{
if (m_binding) {
if (direction_t::INPUT == m_dir) {
- HW::enqueue(new unbind_44_input_cmd(m_binding, m_itf->handle(), m_zone));
+ HW::enqueue(new nat_binding_cmds::unbind_44_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
} else {
assert(!"Unimplemented");
}
{
if (m_binding) {
if (direction_t::INPUT == m_dir) {
- HW::enqueue(new bind_44_input_cmd(m_binding, m_itf->handle(), m_zone));
+ HW::enqueue(new nat_binding_cmds::bind_44_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
} else {
assert(!"Unimplemented");
}
*/
if (!m_binding) {
if (direction_t::INPUT == m_dir) {
- HW::enqueue(new bind_44_input_cmd(m_binding, m_itf->handle(), m_zone));
+ HW::enqueue(new nat_binding_cmds::bind_44_input_cmd(
+ m_binding, m_itf->handle(), m_zone));
} else {
assert(!"Unimplemented");
}
#include "vom/interface.hpp"
#include "vom/object_base.hpp"
#include "vom/om.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/nat.api.vapi.hpp>
-
namespace VOM {
/**
- * A Clas representing the binding of an L2 interface to a bridge-domain
+ * A Class representing the binding of an L2 interface to a bridge-domain
* and the properties of that binding.
*/
class nat_binding : public object_base
*/
static void dump(std::ostream& os);
- /**
- * A functor class that binds L2 configuration to an interface
- */
- class bind_44_input_cmd
- : public rpc_cmd<HW::item<bool>,
- rc_t,
- vapi::Nat44_interface_add_del_feature>
- {
- public:
- /**
- * Constructor
- */
- bind_44_input_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const zone_t& zone);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const bind_44_input_cmd& i) const;
-
- private:
- /**
- * The interface to bind
- */
- const handle_t m_itf;
-
- /**
- * The zone the interface is in
- */
- const zone_t m_zone;
- };
-
- /**
- * A cmd class that Unbinds L2 configuration from an interface
- */
- class unbind_44_input_cmd
- : public rpc_cmd<HW::item<bool>,
- rc_t,
- vapi::Nat44_interface_add_del_feature>
- {
- public:
- /**
- * Constructor
- */
- unbind_44_input_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const zone_t& zone);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const unbind_44_input_cmd& i) const;
-
- private:
- /**
- * The interface to bind
- */
- const handle_t m_itf;
-
- /**
- * The zone the interface is in
- */
- const zone_t m_zone;
- };
-
- /**
- * A cmd class that Dumps all the nat_statics
- */
- class dump_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_44_cmd();
- dump_44_cmd(const dump_44_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_44_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
/**
* HW configuration for the binding. The bool representing the
* do/don't bind.
- */
+ */
HW::item<bool> m_binding;
/**
* limitations under the License.
*/
-#include "vom/nat_binding.hpp"
+#include "vom/nat_binding_cmds.hpp"
namespace VOM {
-nat_binding::bind_44_input_cmd::bind_44_input_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const zone_t& zone)
+namespace nat_binding_cmds {
+bind_44_input_cmd::bind_44_input_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const nat_binding::zone_t& zone)
: rpc_cmd(item)
, m_itf(itf)
, m_zone(zone)
}
bool
-nat_binding::bind_44_input_cmd::operator==(const bind_44_input_cmd& other) const
+bind_44_input_cmd::operator==(const bind_44_input_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_zone == other.m_zone));
}
rc_t
-nat_binding::bind_44_input_cmd::issue(connection& con)
+bind_44_input_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
auto& payload = req.get_request().get_payload();
payload.is_add = 1;
- payload.is_inside = (zone_t::INSIDE == m_zone ? 1 : 0);
+ payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0);
payload.sw_if_index = m_itf.value();
VAPI_CALL(req.execute());
}
std::string
-nat_binding::bind_44_input_cmd::to_string() const
+bind_44_input_cmd::to_string() const
{
std::ostringstream s;
s << "nat-44-input-binding-create: " << m_hw_item.to_string()
return (s.str());
}
-nat_binding::unbind_44_input_cmd::unbind_44_input_cmd(HW::item<bool>& item,
- const handle_t& itf,
- const zone_t& zone)
+unbind_44_input_cmd::unbind_44_input_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const nat_binding::zone_t& zone)
: rpc_cmd(item)
, m_itf(itf)
, m_zone(zone)
}
bool
-nat_binding::unbind_44_input_cmd::operator==(
- const unbind_44_input_cmd& other) const
+unbind_44_input_cmd::operator==(const unbind_44_input_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_zone == other.m_zone));
}
rc_t
-nat_binding::unbind_44_input_cmd::issue(connection& con)
+unbind_44_input_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
auto& payload = req.get_request().get_payload();
payload.is_add = 0;
- payload.is_inside = (zone_t::INSIDE == m_zone ? 1 : 0);
+ payload.is_inside = (nat_binding::zone_t::INSIDE == m_zone ? 1 : 0);
payload.sw_if_index = m_itf.value();
VAPI_CALL(req.execute());
}
std::string
-nat_binding::unbind_44_input_cmd::to_string() const
+unbind_44_input_cmd::to_string() const
{
std::ostringstream s;
s << "nat-44-input-binding-create: " << m_hw_item.to_string()
return (s.str());
}
-nat_binding::dump_44_cmd::dump_44_cmd()
+dump_44_cmd::dump_44_cmd()
{
}
-nat_binding::dump_44_cmd::dump_44_cmd(const dump_44_cmd& d)
+dump_44_cmd::dump_44_cmd(const dump_44_cmd& d)
{
}
bool
-nat_binding::dump_44_cmd::operator==(const dump_44_cmd& other) const
+dump_44_cmd::operator==(const dump_44_cmd& other) const
{
return (true);
}
rc_t
-nat_binding::dump_44_cmd::issue(connection& con)
+dump_44_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-nat_binding::dump_44_cmd::to_string() const
+dump_44_cmd::to_string() const
{
return ("nat-binding-dump");
}
}
+}
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+#ifndef __VOM_NAT_BINDING_CMDS_H__
+#define __VOM_NAT_BINDING_CMDS_H__
+
+#include "vom/nat_binding.hpp"
+#include "vom/rpc_cmd.hpp"
+#include "vom/dump_cmd.hpp"
+
+#include <vapi/nat.api.vapi.hpp>
+
+namespace VOM {
+namespace nat_binding_cmds {
+/**
+ * A functor class that binds L2 configuration to an interface
+ */
+class bind_44_input_cmd
+ : public rpc_cmd<HW::item<bool>,
+ rc_t,
+ vapi::Nat44_interface_add_del_feature>
+{
+public:
+ /**
+ * Constructor
+ */
+ bind_44_input_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const nat_binding::zone_t& zone);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const bind_44_input_cmd& i) const;
+
+private:
+ /**
+ * The interface to bind
+ */
+ const handle_t m_itf;
+
+ /**
+ * The zone the interface is in
+ */
+ const nat_binding::zone_t m_zone;
+};
+
+/**
+ * A cmd class that Unbinds L2 configuration from an interface
+ */
+class unbind_44_input_cmd
+ : public rpc_cmd<HW::item<bool>,
+ rc_t,
+ vapi::Nat44_interface_add_del_feature>
+{
+public:
+ /**
+ * Constructor
+ */
+ unbind_44_input_cmd(HW::item<bool>& item,
+ const handle_t& itf,
+ const nat_binding::zone_t& zone);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const unbind_44_input_cmd& i) const;
+
+private:
+ /**
+ * The interface to bind
+ */
+ const handle_t m_itf;
+
+ /**
+ * The zone the interface is in
+ */
+ const nat_binding::zone_t m_zone;
+};
+
+/**
+ * A cmd class that Dumps all the nat_statics
+ */
+class dump_44_cmd : public dump_cmd<vapi::Nat44_interface_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_44_cmd();
+ dump_44_cmd(const dump_44_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_44_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+};
+};
+
+#endif
*/
#include "vom/nat_static.hpp"
+#include "vom/nat_static_cmds.hpp"
namespace VOM {
singular_db<nat_static::key_t, nat_static> nat_static::m_db;
{
if (m_hw) {
if (m_inside.is_v4()) {
- HW::enqueue(
- new delete_44_cmd(m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
+ HW::enqueue(new nat_static_cmds::delete_44_cmd(
+ m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
}
}
HW::write();
{
if (m_hw) {
if (m_inside.is_v4()) {
- HW::enqueue(
- new create_44_cmd(m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
+ HW::enqueue(new nat_static_cmds::create_44_cmd(
+ m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
}
}
}
*/
if (rc_t::OK != m_hw.rc()) {
if (m_inside.is_v4()) {
- HW::enqueue(
- new create_44_cmd(m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
+ HW::enqueue(new nat_static_cmds::create_44_cmd(
+ m_hw, m_rd->table_id(), m_inside.to_v4(), m_outside));
}
}
}
#ifndef __VOM_NAT_STATIC_H__
#define __VOM_NAT_STATIC_H__
-#include "vom/dump_cmd.hpp"
#include "vom/route.hpp"
#include "vom/singular_db.hpp"
#include "vom/types.hpp"
-#include <vapi/nat.api.vapi.hpp>
-
namespace VOM {
/**
* A entry in the ARP termination table of a Bridge Domain
*/
std::string to_string() const;
- /**
- * A command class that creates NAT 44 static mapping
- */
- class create_44_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_add_del_static_mapping>
- {
- public:
- /**
- * Constructor
- */
- create_44_cmd(HW::item<bool>& item,
- route::table_id_t id,
- const boost::asio::ip::address_v4& inside,
- const boost::asio::ip::address_v4& outside);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_44_cmd& i) const;
-
- private:
- route::table_id_t m_id;
- const boost::asio::ip::address_v4 m_inside;
- const boost::asio::ip::address_v4 m_outside;
- };
-
- /**
- * A cmd class that deletes a NAT 44 static mapping
- */
- class delete_44_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_add_del_static_mapping>
- {
- public:
- /**
- * Constructor
- */
- delete_44_cmd(HW::item<bool>& item,
- route::table_id_t id,
- const boost::asio::ip::address_v4& inside,
- const boost::asio::ip::address_v4& outside);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_44_cmd& i) const;
-
- private:
- route::table_id_t m_id;
- const boost::asio::ip::address_v4 m_inside;
- const boost::asio::ip::address_v4 m_outside;
- };
-
- /**
- * A cmd class that Dumps all the nat_statics
- */
- class dump_44_cmd : public dump_cmd<vapi::Nat44_static_mapping_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_44_cmd();
- dump_44_cmd(const dump_44_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_44_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/nat_static.hpp"
+#include "vom/nat_static_cmds.hpp"
DEFINE_VAPI_MSG_IDS_NAT_API_JSON;
namespace VOM {
-nat_static::create_44_cmd::create_44_cmd(
- HW::item<bool>& item,
- route::table_id_t id,
- const boost::asio::ip::address_v4& inside,
- const boost::asio::ip::address_v4& outside)
+namespace nat_static_cmds {
+
+create_44_cmd::create_44_cmd(HW::item<bool>& item,
+ route::table_id_t id,
+ const boost::asio::ip::address_v4& inside,
+ const boost::asio::ip::address_v4& outside)
: rpc_cmd(item)
, m_id(id)
, m_inside(inside)
}
bool
-nat_static::create_44_cmd::operator==(const create_44_cmd& other) const
+create_44_cmd::operator==(const create_44_cmd& other) const
{
return ((m_id == other.m_id) && (m_inside == other.m_inside) &&
(m_outside == other.m_outside));
}
rc_t
-nat_static::create_44_cmd::issue(connection& con)
+create_44_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-nat_static::create_44_cmd::to_string() const
+create_44_cmd::to_string() const
{
std::ostringstream s;
s << "nat-44-static-create: " << m_hw_item.to_string() << " table:" << m_id
return (s.str());
}
-nat_static::delete_44_cmd::delete_44_cmd(
- HW::item<bool>& item,
- route::table_id_t id,
- const boost::asio::ip::address_v4& inside,
- const boost::asio::ip::address_v4& outside)
+delete_44_cmd::delete_44_cmd(HW::item<bool>& item,
+ route::table_id_t id,
+ const boost::asio::ip::address_v4& inside,
+ const boost::asio::ip::address_v4& outside)
: rpc_cmd(item)
, m_id(id)
, m_inside(inside)
}
bool
-nat_static::delete_44_cmd::operator==(const delete_44_cmd& other) const
+delete_44_cmd::operator==(const delete_44_cmd& other) const
{
return ((m_id == other.m_id) && (m_inside == other.m_inside) &&
(m_outside == other.m_outside));
}
rc_t
-nat_static::delete_44_cmd::issue(connection& con)
+delete_44_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-nat_static::delete_44_cmd::to_string() const
+delete_44_cmd::to_string() const
{
std::ostringstream s;
s << "nat-44-static-delete: " << m_hw_item.to_string() << " table:" << m_id
return (s.str());
}
-nat_static::dump_44_cmd::dump_44_cmd()
+dump_44_cmd::dump_44_cmd()
{
}
-nat_static::dump_44_cmd::dump_44_cmd(const dump_44_cmd& d)
+dump_44_cmd::dump_44_cmd(const dump_44_cmd& d)
{
}
bool
-nat_static::dump_44_cmd::operator==(const dump_44_cmd& other) const
+dump_44_cmd::operator==(const dump_44_cmd& other) const
{
return (true);
}
rc_t
-nat_static::dump_44_cmd::issue(connection& con)
+dump_44_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-nat_static::dump_44_cmd::to_string() const
+dump_44_cmd::to_string() const
{
return ("nat-static-dump");
}
-}
+} // namespace nat_static_cmds
+} // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_NAT_STATIC_CMDS_H__
+#define __VOM_NAT_STATIC_CMDS_H__
+
+#include "nat_static.hpp"
+#include "vom/dump_cmd.hpp"
+
+#include <vapi/nat.api.vapi.hpp>
+
+namespace VOM {
+namespace nat_static_cmds {
+
+/**
+ * A command class that creates NAT 44 static mapping
+ */
+class create_44_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_add_del_static_mapping>
+{
+public:
+ /**
+ * Constructor
+ */
+ create_44_cmd(HW::item<bool>& item,
+ route::table_id_t id,
+ const boost::asio::ip::address_v4& inside,
+ const boost::asio::ip::address_v4& outside);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_44_cmd& i) const;
+
+private:
+ route::table_id_t m_id;
+ const boost::asio::ip::address_v4 m_inside;
+ const boost::asio::ip::address_v4 m_outside;
+};
+
+/**
+ * A cmd class that deletes a NAT 44 static mapping
+ */
+class delete_44_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Nat44_add_del_static_mapping>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_44_cmd(HW::item<bool>& item,
+ route::table_id_t id,
+ const boost::asio::ip::address_v4& inside,
+ const boost::asio::ip::address_v4& outside);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_44_cmd& i) const;
+
+private:
+ route::table_id_t m_id;
+ const boost::asio::ip::address_v4 m_inside;
+ const boost::asio::ip::address_v4 m_outside;
+};
+
+/**
+ * A cmd class that Dumps all the nat_statics
+ */
+class dump_44_cmd : public dump_cmd<vapi::Nat44_static_mapping_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_44_cmd();
+ dump_44_cmd(const dump_44_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_44_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+}; // namespace nat_static_cmds
+}; // namespace vom
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/neighbour.hpp"
+#include "vom/neighbour_cmds.hpp"
namespace VOM {
singular_db<neighbour::key_t, neighbour> neighbour::m_db;
neighbour::sweep()
{
if (m_hw) {
- HW::enqueue(new delete_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
+ HW::enqueue(
+ new neighbour_cmds::delete_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
}
HW::write();
}
neighbour::replay()
{
if (m_hw) {
- HW::enqueue(new create_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
+ HW::enqueue(
+ new neighbour_cmds::create_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
}
}
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(new create_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
+ HW::enqueue(
+ new neighbour_cmds::create_cmd(m_hw, m_itf->handle(), m_mac, m_ip_addr));
}
}
/*
* dump VPP current states
*/
- std::shared_ptr<neighbour::dump_cmd> cmd =
- std::make_shared<neighbour::dump_cmd>(
- neighbour::dump_cmd(itf->handle(), proto));
+ std::shared_ptr<neighbour_cmds::dump_cmd> cmd =
+ std::make_shared<neighbour_cmds::dump_cmd>(
+ neighbour_cmds::dump_cmd(itf->handle(), proto));
HW::enqueue(cmd);
HW::write();
#ifndef __VOM_NEIGHBOUR_H__
#define __VOM_NEIGHBOUR_H__
-#include "vom/dump_cmd.hpp"
#include "vom/interface.hpp"
#include "vom/singular_db.hpp"
#include "vom/types.hpp"
-#include <vapi/l2.api.vapi.hpp>
-
namespace VOM {
/**
* A entry in the ARP termination table of a Bridge Domain
*/
std::string to_string() const;
- /**
- * A command class that creates or updates the bridge domain ARP Entry
- */
- class create_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_neighbor_add_del>
- {
- public:
- /**
- * Constructor
- */
- create_cmd(HW::item<bool>& item,
- handle_t itf,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
-
- private:
- handle_t m_itf;
- mac_address_t m_mac;
- boost::asio::ip::address m_ip_addr;
- };
-
- /**
- * A cmd class that deletes a bridge domain ARP entry
- */
- class delete_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_neighbor_add_del>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<bool>& item,
- handle_t itf,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- handle_t m_itf;
- mac_address_t m_mac;
- boost::asio::ip::address m_ip_addr;
- };
-
- /**
- * A cmd class that Dumps all the neighbours
- */
- class dump_cmd : public VOM::dump_cmd<vapi::Ip_neighbor_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_cmd(const handle_t& itf, const l3_proto_t& proto);
- dump_cmd(const dump_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
-
- /**
- * The interface to dump
- */
- handle_t m_itf;
-
- /**
- * V4 or V6
- */
- l3_proto_t m_proto;
- };
-
private:
/**
* Class definition for listeners to OM events
* limitations under the License.
*/
-#include "vom/neighbour.hpp"
+#include "vom/neighbour_cmds.hpp"
namespace VOM {
-neighbour::create_cmd::create_cmd(HW::item<bool>& item,
- handle_t itf,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr)
+namespace neighbour_cmds {
+create_cmd::create_cmd(HW::item<bool>& item,
+ handle_t itf,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr)
: rpc_cmd(item)
, m_itf(itf)
, m_mac(mac)
}
bool
-neighbour::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
(m_itf == other.m_itf));
}
rc_t
-neighbour::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-neighbour::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "nieghbour-create: " << m_hw_item.to_string()
return (s.str());
}
-neighbour::delete_cmd::delete_cmd(HW::item<bool>& item,
- handle_t itf,
- const mac_address_t& mac,
- const boost::asio::ip::address& ip_addr)
+delete_cmd::delete_cmd(HW::item<bool>& item,
+ handle_t itf,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr)
: rpc_cmd(item)
, m_itf(itf)
, m_mac(mac)
}
bool
-neighbour::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
(m_itf == other.m_itf));
}
rc_t
-neighbour::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-neighbour::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "neighbour-delete: " << m_hw_item.to_string()
return (s.str());
}
-neighbour::dump_cmd::dump_cmd(const handle_t& hdl, const l3_proto_t& proto)
+dump_cmd::dump_cmd(const handle_t& hdl, const l3_proto_t& proto)
: m_itf(hdl)
, m_proto(proto)
{
}
-neighbour::dump_cmd::dump_cmd(const dump_cmd& d)
+dump_cmd::dump_cmd(const dump_cmd& d)
: m_itf(d.m_itf)
, m_proto(d.m_proto)
{
}
bool
-neighbour::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-neighbour::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-neighbour::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("neighbour-dump");
}
-}
+} // namespace neighbour_cmds
+} // namespace vom
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_NEIGHBOUR_CMDS_H__
+#define __VOM_NEIGHBOUR_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "neighbour.hpp"
+
+#include <vapi/ip.api.vapi.hpp>
+
+namespace VOM {
+namespace neighbour_cmds {
+
+/**
+ * A command class that creates or updates the bridge domain ARP Entry
+ */
+class create_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_neighbor_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ create_cmd(HW::item<bool>& item,
+ handle_t itf,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+
+private:
+ handle_t m_itf;
+ mac_address_t m_mac;
+ boost::asio::ip::address m_ip_addr;
+};
+
+/**
+ * A cmd class that deletes a bridge domain ARP entry
+ */
+class delete_cmd
+ : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_neighbor_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<bool>& item,
+ handle_t itf,
+ const mac_address_t& mac,
+ const boost::asio::ip::address& ip_addr);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+
+private:
+ handle_t m_itf;
+ mac_address_t m_mac;
+ boost::asio::ip::address m_ip_addr;
+};
+
+/**
+ * A cmd class that Dumps all the neighbours
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Ip_neighbor_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd(const handle_t& itf, const l3_proto_t& proto);
+ dump_cmd(const dump_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+
+ /**
+ * The interface to dump
+ */
+ handle_t m_itf;
+
+ /**
+ * V4 or V6
+ */
+ l3_proto_t m_proto;
+};
+
+}; // namespace neighbour_cmds
+}; // namespace vom
+#endif
+
*/
#include "vom/route.hpp"
+#include "vom/route_cmds.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/ip.api.vapi.hpp>
-
namespace VOM {
namespace route {
singular_db<ip_route::key_t, ip_route> ip_route::m_db;
return (false);
}
-void
-path::to_vpp(vapi_payload_ip_add_del_route& payload) const
-{
- payload.is_drop = 0;
- payload.is_unreach = 0;
- payload.is_prohibit = 0;
- payload.is_local = 0;
- payload.is_classify = 0;
- payload.is_multipath = 0;
- payload.is_resolve_host = 0;
- payload.is_resolve_attached = 0;
-
- if (nh_proto_t::ETHERNET == m_nh_proto) {
- payload.is_l2_bridged = 1;
- }
-
- if (special_t::STANDARD == m_type) {
- uint8_t path_v6;
- to_bytes(m_nh, &path_v6, payload.next_hop_address);
-
- if (m_rd) {
- payload.next_hop_table_id = m_rd->table_id();
- }
- if (m_interface) {
- payload.next_hop_sw_if_index = m_interface->handle().value();
- }
- } else if (special_t::DROP == m_type) {
- payload.is_drop = 1;
- } else if (special_t::UNREACH == m_type) {
- payload.is_unreach = 1;
- } else if (special_t::PROHIBIT == m_type) {
- payload.is_prohibit = 1;
- } else if (special_t::LOCAL == m_type) {
- payload.is_local = 1;
- }
- payload.next_hop_weight = m_weight;
- payload.next_hop_preference = m_preference;
- payload.next_hop_via_label = 0;
- payload.classify_table_index = 0;
-}
-
std::string
path::to_string() const
{
return (s.str());
}
+path::special_t
+path::type() const
+{
+ return m_type;
+}
+
+nh_proto_t
+path::nh_proto() const
+{
+ return m_nh_proto;
+}
+
+const boost::asio::ip::address&
+path::nh() const
+{
+ return m_nh;
+}
+
+std::shared_ptr<route_domain>
+path::rd() const
+{
+ return m_rd;
+}
+
+std::shared_ptr<interface>
+path::itf() const
+{
+ return m_interface;
+}
+
+uint8_t
+path::weight() const
+{
+ return m_weight;
+}
+
+uint8_t
+path::preference() const
+{
+ return m_preference;
+}
+
ip_route::ip_route(const prefix_t& prefix)
: m_hw(false)
, m_rd(route_domain::get_default())
ip_route::sweep()
{
if (m_hw) {
- HW::enqueue(new delete_cmd(m_hw, m_rd->table_id(), m_prefix));
+ HW::enqueue(
+ new ip_route_cmds::delete_cmd(m_hw, m_rd->table_id(), m_prefix));
}
HW::write();
}
ip_route::replay()
{
if (m_hw) {
- HW::enqueue(new update_cmd(m_hw, m_rd->table_id(), m_prefix, m_paths));
+ HW::enqueue(
+ new ip_route_cmds::update_cmd(m_hw, m_rd->table_id(), m_prefix, m_paths));
}
}
std::string
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(new update_cmd(m_hw, m_rd->table_id(), m_prefix, m_paths));
+ HW::enqueue(
+ new ip_route_cmds::update_cmd(m_hw, m_rd->table_id(), m_prefix, m_paths));
}
}
void
ip_route::event_handler::handle_populate(const client_db::key_t& key)
{
- std::shared_ptr<ip_route::dump_v4_cmd> cmd_v4(new ip_route::dump_v4_cmd());
- std::shared_ptr<ip_route::dump_v6_cmd> cmd_v6(new ip_route::dump_v6_cmd());
+ std::shared_ptr<ip_route_cmds::dump_v4_cmd> cmd_v4(
+ new ip_route_cmds::dump_v4_cmd());
+ std::shared_ptr<ip_route_cmds::dump_v6_cmd> cmd_v6(
+ new ip_route_cmds::dump_v6_cmd());
HW::enqueue(cmd_v4);
HW::enqueue(cmd_v6);
#include "vom/route_domain.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/ip.api.vapi.hpp>
-
namespace VOM {
/**
* Types belonging to Routing
/**
* Convert the path into the VPP API representation
*/
- void to_vpp(vapi_type_fib_path& path) const;
void to_vpp(vapi_payload_ip_add_del_route& payload) const;
/**
*/
std::string to_string() const;
+ /**
+ * Getters
+ */
+ special_t type() const;
+ nh_proto_t nh_proto() const;
+ const boost::asio::ip::address& nh() const;
+ std::shared_ptr<route_domain> rd() const;
+ std::shared_ptr<interface> itf() const;
+ uint8_t weight() const;
+ uint8_t preference() const;
+
private:
/**
* The special path tpye
*/
std::string to_string() const;
- /**
- * A command class that creates or updates the route
- */
- class update_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_add_del_route>
- {
- public:
- /**
- * Constructor
- */
- update_cmd(HW::item<bool>& item,
- table_id_t id,
- const prefix_t& prefix,
- const path_list_t& paths);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const update_cmd& i) const;
-
- private:
- route::table_id_t m_id;
- prefix_t m_prefix;
- const path_list_t m_paths;
- };
-
- /**
- * A cmd class that deletes a route
- */
- class delete_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_add_del_route>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<bool>& item, table_id_t id, const prefix_t& prefix);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- route::table_id_t m_id;
- prefix_t m_prefix;
- };
-
- /**
- * A cmd class that Dumps ipv4 fib
- */
- class dump_v4_cmd : public VOM::dump_cmd<vapi::Ip_fib_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_v4_cmd();
- dump_v4_cmd(const dump_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_v4_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
- /**
- * A cmd class that Dumps ipv6 fib
- */
- class dump_v6_cmd : public VOM::dump_cmd<vapi::Ip6_fib_dump>
- {
- public:
- /**
- * Constructor
- */
- dump_v6_cmd();
- dump_v6_cmd(const dump_cmd& d);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_v6_cmd& i) const;
-
- private:
- /**
- * HW reutrn code
- */
- HW::item<bool> item;
- };
-
private:
/**
* Class definition for listeners to OM events
#include <sstream>
-#include "vom/route.hpp"
+#include "vom/route_cmds.hpp"
namespace VOM {
namespace route {
-ip_route::update_cmd::update_cmd(HW::item<bool>& item,
- table_id_t id,
- const prefix_t& prefix,
- const path_list_t& paths)
+namespace ip_route_cmds {
+
+static void
+to_vpp(const route::path& p, vapi_payload_ip_add_del_route& payload)
+{
+ payload.is_drop = 0;
+ payload.is_unreach = 0;
+ payload.is_prohibit = 0;
+ payload.is_local = 0;
+ payload.is_classify = 0;
+ payload.is_multipath = 0;
+ payload.is_resolve_host = 0;
+ payload.is_resolve_attached = 0;
+
+ if (nh_proto_t::ETHERNET == p.nh_proto()) {
+ payload.is_l2_bridged = 1;
+ }
+
+ if (route::path::special_t::STANDARD == p.type()) {
+ uint8_t path_v6;
+ to_bytes(p.nh(), &path_v6, payload.next_hop_address);
+
+ if (p.rd()) {
+ payload.next_hop_table_id = p.rd()->table_id();
+ }
+ if (p.itf()) {
+ payload.next_hop_sw_if_index = p.itf()->handle().value();
+ }
+ } else if (route::path::special_t::DROP == p.type()) {
+ payload.is_drop = 1;
+ } else if (route::path::special_t::UNREACH == p.type()) {
+ payload.is_unreach = 1;
+ } else if (route::path::special_t::PROHIBIT == p.type()) {
+ payload.is_prohibit = 1;
+ } else if (route::path::special_t::LOCAL == p.type()) {
+ payload.is_local = 1;
+ }
+ payload.next_hop_weight = p.weight();
+ payload.next_hop_preference = p.preference();
+ payload.next_hop_via_label = 0;
+ payload.classify_table_index = 0;
+}
+
+update_cmd::update_cmd(HW::item<bool>& item,
+ table_id_t id,
+ const prefix_t& prefix,
+ const path_list_t& paths)
: rpc_cmd(item)
, m_id(id)
, m_prefix(prefix)
}
bool
-ip_route::update_cmd::operator==(const update_cmd& other) const
+update_cmd::operator==(const update_cmd& other) const
{
return ((m_prefix == other.m_prefix) && (m_id == other.m_id));
}
rc_t
-ip_route::update_cmd::issue(connection& con)
+update_cmd::issue(connection& con)
{
msg_t req(con.ctx(), 0, std::ref(*this));
&payload.dst_address_length);
for (auto& p : m_paths)
- p.to_vpp(payload);
+ to_vpp(p, payload);
VAPI_CALL(req.execute());
}
std::string
-ip_route::update_cmd::to_string() const
+update_cmd::to_string() const
{
std::ostringstream s;
s << "ip-route-create: " << m_hw_item.to_string() << " table-id:" << m_id
return (s.str());
}
-ip_route::delete_cmd::delete_cmd(HW::item<bool>& item,
- table_id_t id,
- const prefix_t& prefix)
+delete_cmd::delete_cmd(HW::item<bool>& item,
+ table_id_t id,
+ const prefix_t& prefix)
: rpc_cmd(item)
, m_id(id)
, m_prefix(prefix)
}
bool
-ip_route::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return ((m_prefix == other.m_prefix) && (m_id == other.m_id));
}
rc_t
-ip_route::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), 0, std::ref(*this));
}
std::string
-ip_route::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "ip-route-delete: " << m_hw_item.to_string() << " id:" << m_id
return (s.str());
}
-ip_route::dump_v4_cmd::dump_v4_cmd()
+dump_v4_cmd::dump_v4_cmd()
{
}
bool
-ip_route::dump_v4_cmd::operator==(const dump_v4_cmd& other) const
+dump_v4_cmd::operator==(const dump_v4_cmd& other) const
{
return (true);
}
rc_t
-ip_route::dump_v4_cmd::issue(connection& con)
+dump_v4_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-ip_route::dump_v4_cmd::to_string() const
+dump_v4_cmd::to_string() const
{
return ("ip-route-v4-dump");
}
-ip_route::dump_v6_cmd::dump_v6_cmd()
+dump_v6_cmd::dump_v6_cmd()
{
}
bool
-ip_route::dump_v6_cmd::operator==(const dump_v6_cmd& other) const
+dump_v6_cmd::operator==(const dump_v6_cmd& other) const
{
return (true);
}
rc_t
-ip_route::dump_v6_cmd::issue(connection& con)
+dump_v6_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-ip_route::dump_v6_cmd::to_string() const
+dump_v6_cmd::to_string() const
{
return ("ip-route-v6-dump");
}
-}
-}
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "mozilla")
- * End:
- */
+} // namespace ip_route_cmds
+} // namespace route
+} // namespace vom
+ /*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_ROUTE_CMDS_H__
+#define __VOM_ROUTE_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/route.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/ip.api.vapi.hpp>
+
+namespace VOM {
+namespace route {
+namespace ip_route_cmds {
+
+/**
+ * A command class that creates or updates the route
+ */
+class update_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_add_del_route>
+{
+public:
+ /**
+ * Constructor
+ */
+ update_cmd(HW::item<bool>& item,
+ table_id_t id,
+ const prefix_t& prefix,
+ const path_list_t& paths);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const update_cmd& i) const;
+
+private:
+ route::table_id_t m_id;
+ prefix_t m_prefix;
+ const path_list_t m_paths;
+};
+
+/**
+ * A cmd class that deletes a route
+ */
+class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_add_del_route>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<bool>& item, table_id_t id, const prefix_t& prefix);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+
+private:
+ route::table_id_t m_id;
+ prefix_t m_prefix;
+};
+
+/**
+ * A cmd class that Dumps ipv4 fib
+ */
+class dump_v4_cmd : public VOM::dump_cmd<vapi::Ip_fib_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_v4_cmd();
+ dump_v4_cmd(const dump_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_v4_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+
+/**
+ * A cmd class that Dumps ipv6 fib
+ */
+class dump_v6_cmd : public VOM::dump_cmd<vapi::Ip6_fib_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_v6_cmd();
+ dump_v6_cmd(const dump_cmd& d);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_v6_cmd& i) const;
+
+private:
+ /**
+ * HW reutrn code
+ */
+ HW::item<bool> item;
+};
+
+}; // namespace ip_route_cmds
+}; // namespace route
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
#include "vom/route_domain.hpp"
#include "vom/cmd.hpp"
+#include "vom/route_domain_cmds.hpp"
namespace VOM {
/**
route_domain::sweep()
{
if (m_hw_v4) {
- HW::enqueue(new delete_cmd(m_hw_v4, l3_proto_t::IPV4, m_table_id));
+ HW::enqueue(
+ new route_domain_cmds::delete_cmd(m_hw_v4, l3_proto_t::IPV4, m_table_id));
}
if (m_hw_v6) {
- HW::enqueue(new delete_cmd(m_hw_v6, l3_proto_t::IPV6, m_table_id));
+ HW::enqueue(
+ new route_domain_cmds::delete_cmd(m_hw_v6, l3_proto_t::IPV6, m_table_id));
}
HW::write();
}
route_domain::replay()
{
if (m_hw_v4) {
- HW::enqueue(new create_cmd(m_hw_v4, l3_proto_t::IPV4, m_table_id));
+ HW::enqueue(
+ new route_domain_cmds::create_cmd(m_hw_v4, l3_proto_t::IPV4, m_table_id));
}
if (m_hw_v6) {
- HW::enqueue(new create_cmd(m_hw_v6, l3_proto_t::IPV6, m_table_id));
+ HW::enqueue(
+ new route_domain_cmds::create_cmd(m_hw_v6, l3_proto_t::IPV6, m_table_id));
}
}
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw_v4.rc()) {
- HW::enqueue(new create_cmd(m_hw_v4, l3_proto_t::IPV4, m_table_id));
+ HW::enqueue(
+ new route_domain_cmds::create_cmd(m_hw_v4, l3_proto_t::IPV4, m_table_id));
}
if (rc_t::OK != m_hw_v6.rc()) {
- HW::enqueue(new create_cmd(m_hw_v6, l3_proto_t::IPV6, m_table_id));
+ HW::enqueue(
+ new route_domain_cmds::create_cmd(m_hw_v6, l3_proto_t::IPV6, m_table_id));
}
}
*/
void replay(void);
- /**
- * A command class that creates the IP table
- */
- class create_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del>
- {
- public:
- /**
- * Constructor
- */
- create_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
-
- private:
- /**
- * table-ID to create
- */
- route::table_id_t m_id;
-
- /**
- * L3 protocol of the table
- */
- l3_proto_t m_proto;
- };
-
- /**
- * A cmd class that Deletes the IP Table
- */
- class delete_cmd
- : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- /**
- * table-ID to create
- */
- route::table_id_t m_id;
-
- /**
- * L3 protocol of the table
- */
- l3_proto_t m_proto;
- };
-
private:
/**
* Commit the acculmulated changes into VPP. i.e. to a 'HW" write.
*/
static singular_db<route::table_id_t, route_domain> m_db;
};
-};
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
* limitations under the License.
*/
-#include "vom/route_domain.hpp"
+#include "vom/route_domain_cmds.hpp"
namespace VOM {
+namespace route_domain_cmds {
-route_domain::create_cmd::create_cmd(HW::item<bool>& item,
- l3_proto_t proto,
- route::table_id_t id)
+create_cmd::create_cmd(HW::item<bool>& item,
+ l3_proto_t proto,
+ route::table_id_t id)
: rpc_cmd(item)
, m_id(id)
, m_proto(proto)
}
bool
-route_domain::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return (m_id == other.m_id);
}
rc_t
-route_domain::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-route_domain::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "ip-table-create: " << m_hw_item.to_string() << " id:" << m_id
return (s.str());
}
-route_domain::delete_cmd::delete_cmd(HW::item<bool>& item,
- l3_proto_t proto,
- route::table_id_t id)
+delete_cmd::delete_cmd(HW::item<bool>& item,
+ l3_proto_t proto,
+ route::table_id_t id)
: rpc_cmd(item)
, m_id(id)
, m_proto(proto)
}
bool
-route_domain::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return (m_id == other.m_id);
}
rc_t
-route_domain::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-route_domain::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "ip-table-delete: " << m_hw_item.to_string() << " id:" << m_id
return (s.str());
}
-}
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "mozilla")
- * End:
- */
+} // namespace route_domain_cmds
+} // namespace VOM
+ /*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_ROUTE_DOMAIN_CMDS_H__
+#define __VOM_ROUTE_DOMAIN_CMDS_H__
+
+#include "vom/route_domain.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/ip.api.vapi.hpp>
+
+namespace VOM {
+namespace route_domain_cmds {
+
+/**
+ * A command class that creates the IP table
+ */
+class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ create_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+
+private:
+ /**
+ * table-ID to create
+ */
+ route::table_id_t m_id;
+
+ /**
+ * L3 protocol of the table
+ */
+ l3_proto_t m_proto;
+};
+
+/**
+ * A cmd class that Deletes the IP Table
+ */
+class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+
+private:
+ /**
+ * table-ID to create
+ */
+ route::table_id_t m_id;
+
+ /**
+ * L3 protocol of the table
+ */
+ l3_proto_t m_proto;
+};
+
+}; // namespace route_domain_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
#include <memory>
#include <ostream>
+#include "vom/logger.hpp"
+
namespace VOM {
/**
* A Database to store the unique 'singular' instances of a single object
*/
#include "vom/sub_interface.hpp"
+#include "vom/sub_interface_cmds.hpp"
namespace VOM {
/**
std::queue<cmd*>&
sub_interface::mk_create_cmd(std::queue<cmd*>& q)
{
- q.push(new create_cmd(m_hdl, name(), m_parent->handle(), m_vlan));
+ q.push(new sub_interface_cmds::create_cmd(m_hdl, name(), m_parent->handle(),
+ m_vlan));
return (q);
}
std::queue<cmd*>&
sub_interface::mk_delete_cmd(std::queue<cmd*>& q)
{
- q.push(new delete_cmd(m_hdl));
+ q.push(new sub_interface_cmds::delete_cmd(m_hdl));
return (q);
}
*/
std::shared_ptr<sub_interface> singular() const;
- /**
- * A functor class that creates an interface
- */
- class create_cmd : public interface::create_cmd<vapi::Create_vlan_subif>
- {
- public:
- /**
- * Cstrunctor taking the reference to the parent
- * and the sub-interface's VLAN
- */
- create_cmd(HW::item<handle_t>& item,
- const std::string& name,
- const handle_t& parent,
- uint16_t vlan);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
-
- private:
- /**
- * Refernece to the parents handle
- */
- const handle_t& m_parent;
-
- /**
- * The VLAN of the sub-interface
- */
- uint16_t m_vlan;
- };
-
- /**
- * A cmd class that Delete an interface
- */
- class delete_cmd : public interface::delete_cmd<vapi::Delete_subif>
- {
- public:
- /**
- * Constructor
- */
- delete_cmd(HW::item<handle_t>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
- };
-
private:
/**
* Construct with handle
const interface& parent,
admin_state_t state,
vlan_id_t vlan);
+ friend class interface_factory;
+
/**
* The interface class can construct interfaces with handles
*/
* limitations under the License.
*/
-#include "vom/sub_interface.hpp"
+#include "vom/sub_interface_cmds.hpp"
#include "vom/cmd.hpp"
#include <vapi/vpe.api.vapi.hpp>
namespace VOM {
-sub_interface::create_cmd::create_cmd(HW::item<handle_t>& item,
- const std::string& name,
- const handle_t& parent,
- uint16_t vlan)
+namespace sub_interface_cmds {
+
+create_cmd::create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ const handle_t& parent,
+ uint16_t vlan)
: interface::create_cmd<vapi::Create_vlan_subif>(item, name)
, m_parent(parent)
, m_vlan(vlan)
}
bool
-sub_interface::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return ((m_name == other.m_name) && (m_parent == other.m_parent) &&
(m_vlan == other.m_vlan));
}
rc_t
-sub_interface::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
m_hw_item = wait();
if (m_hw_item.rc() == rc_t::OK) {
- interface::add(m_name, m_hw_item);
+ insert_interface();
}
return rc_t::OK;
}
std::string
-sub_interface::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "sub-itf-create: " << m_hw_item.to_string() << " parent:" << m_parent
return (s.str());
}
-sub_interface::delete_cmd::delete_cmd(HW::item<handle_t>& item)
+delete_cmd::delete_cmd(HW::item<handle_t>& item)
: interface::delete_cmd<vapi::Delete_subif>(item)
{
}
bool
-sub_interface::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return (m_hw_item == other.m_hw_item);
}
rc_t
-sub_interface::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
wait();
m_hw_item.set(rc_t::NOOP);
- interface::remove(m_hw_item);
+ remove_interface();
return (rc_t::OK);
}
std::string
-sub_interface::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
return (s.str());
}
-}
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "mozilla")
- * End:
- */
+} // namespace sub_interface_cmds
+} // namespace VOM
+ /*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_SUB_INTERFACE_CMDS_H__
+#define __VOM_SUB_INTERFACE_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+#include "vom/sub_interface.hpp"
+
+#include <vapi/vpe.api.vapi.hpp>
+
+namespace VOM {
+namespace sub_interface_cmds {
+
+/**
+ * A functor class that creates an interface
+ */
+class create_cmd : public interface::create_cmd<vapi::Create_vlan_subif>
+{
+public:
+ /**
+ * Cstrunctor taking the reference to the parent
+ * and the sub-interface's VLAN
+ */
+ create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ const handle_t& parent,
+ uint16_t vlan);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+
+private:
+ /**
+ * Refernece to the parents handle
+ */
+ const handle_t& m_parent;
+
+ /**
+ * The VLAN of the sub-interface
+ */
+ uint16_t m_vlan;
+};
+
+/**
+ * A cmd class that Delete an interface
+ */
+class delete_cmd : public interface::delete_cmd<vapi::Delete_subif>
+{
+public:
+ /**
+ * Constructor
+ */
+ delete_cmd(HW::item<handle_t>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+};
+
+}; // namespace sub_interface_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
*/
#include "vom/tap_interface.hpp"
-#include "vom/cmd.hpp"
+#include "vom/tap_interface_cmds.hpp"
#include <vapi/vpe.api.vapi.hpp>
std::queue<cmd*>&
tap_interface::mk_create_cmd(std::queue<cmd*>& q)
{
- q.push(new create_cmd(m_hdl, name(), m_prefix, m_l2_address));
+ q.push(
+ new tap_interface_cmds::create_cmd(m_hdl, name(), m_prefix, m_l2_address));
return (q);
}
std::queue<cmd*>&
tap_interface::mk_delete_cmd(std::queue<cmd*>& q)
{
- q.push(new delete_cmd(m_hdl));
+ q.push(new tap_interface_cmds::delete_cmd(m_hdl));
return (q);
}
/*
* dump VPP current states
*/
- std::shared_ptr<tap_interface::dump_cmd> cmd(new tap_interface::dump_cmd());
+ std::shared_ptr<tap_interface_cmds::dump_cmd> cmd(
+ new tap_interface_cmds::dump_cmd());
HW::enqueue(cmd);
HW::write();
*/
std::shared_ptr<tap_interface> singular() const;
- /**
- * A functor class that creates an interface
- */
- class create_cmd : public interface::create_cmd<vapi::Tap_connect>
- {
- public:
- create_cmd(HW::item<handle_t>& item,
- const std::string& name,
- route::prefix_t& prefix,
- const l2_address_t& l2_address);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- private:
- route::prefix_t& m_prefix;
- const l2_address_t& m_l2_address;
- };
-
- /**
- *
- */
- class delete_cmd : public interface::delete_cmd<vapi::Tap_delete>
- {
- public:
- delete_cmd(HW::item<handle_t>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
- };
-
- /**
- * A cmd class that Dumps all the Vpp Interfaces
- */
- class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_dump>
- {
- public:
- /**
- * Default Constructor
- */
- dump_cmd();
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
- };
-
private:
/**
* Class definition for listeners to OM events
admin_state_t state,
route::prefix_t prefix);
+ friend class interface_factory;
+
/**
* Ip Prefix
*/
* limitations under the License.
*/
-#include "vom/tap_interface.hpp"
-#include "vom/cmd.hpp"
+#include "vom/tap_interface_cmds.hpp"
#include <vapi/tap.api.vapi.hpp>
namespace VOM {
-tap_interface::create_cmd::create_cmd(HW::item<handle_t>& item,
- const std::string& name,
- route::prefix_t& prefix,
- const l2_address_t& l2_address)
+namespace tap_interface_cmds {
+create_cmd::create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ route::prefix_t& prefix,
+ const l2_address_t& l2_address)
: interface::create_cmd<vapi::Tap_connect>(item, name)
, m_prefix(prefix)
, m_l2_address(l2_address)
}
rc_t
-tap_interface::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
}
std::string
-tap_interface::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "tap-intf-create: " << m_hw_item.to_string()
return (s.str());
}
-tap_interface::delete_cmd::delete_cmd(HW::item<handle_t>& item)
+delete_cmd::delete_cmd(HW::item<handle_t>& item)
: interface::delete_cmd<vapi::Tap_delete>(item)
{
}
rc_t
-tap_interface::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
// finally... call VPP
return rc_t::OK;
}
std::string
-tap_interface::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "tap-itf-delete: " << m_hw_item.to_string();
return (s.str());
}
-tap_interface::dump_cmd::dump_cmd()
+dump_cmd::dump_cmd()
{
}
bool
-tap_interface::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-tap_interface::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-tap_interface::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("tap-itf-dump");
}
-}
+} // namespace tap_interface_cmds
+} // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_TAP_INTERFACE_CMDS_H__
+#define __VOM_TAP_INTERFACE_CMDS_H__
+
+#include "vom/interface.hpp"
+#include "vom/tap_interface.hpp"
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+
+#include <vapi/interface.api.vapi.hpp>
+#include <vapi/tap.api.vapi.hpp>
+
+namespace VOM {
+namespace tap_interface_cmds {
+
+/**
+ * A functor class that creates an interface
+ */
+class create_cmd : public interface::create_cmd<vapi::Tap_connect>
+{
+public:
+ create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ route::prefix_t& prefix,
+ const l2_address_t& l2_address);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+private:
+ route::prefix_t& m_prefix;
+ const l2_address_t& m_l2_address;
+};
+
+/**
+ * A functor class that deletes a Tap interface
+ */
+class delete_cmd : public interface::delete_cmd<vapi::Tap_delete>
+{
+public:
+ delete_cmd(HW::item<handle_t>& item);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+};
+
+/**
+ * A cmd class that Dumps all the Vpp Interfaces
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_dump>
+{
+public:
+ /**
+ * Default Constructor
+ */
+ dump_cmd();
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+};
+
+}; // namespace tap_interface_cmds
+}; // namespace VOM
+
+#endif
#include "vom/vxlan_tunnel.hpp"
#include "vom/logger.hpp"
+#include "vom/vxlan_tunnel_cmds.hpp"
namespace VOM {
const std::string VXLAN_TUNNEL_NAME = "vxlan-tunnel-itf";
vxlan_tunnel::sweep()
{
if (m_hdl) {
- HW::enqueue(new delete_cmd(m_hdl, m_tep));
+ HW::enqueue(new vxlan_tunnel_cmds::delete_cmd(m_hdl, m_tep));
}
HW::write();
}
vxlan_tunnel::replay()
{
if (m_hdl) {
- HW::enqueue(new create_cmd(m_hdl, name(), m_tep));
+ HW::enqueue(new vxlan_tunnel_cmds::create_cmd(m_hdl, name(), m_tep));
}
}
* the desired state is always that the interface should be created
*/
if (!m_hdl) {
- HW::enqueue(new create_cmd(m_hdl, name(), m_tep));
+ HW::enqueue(new vxlan_tunnel_cmds::create_cmd(m_hdl, name(), m_tep));
}
}
/*
* dump VPP current states
*/
- std::shared_ptr<vxlan_tunnel::dump_cmd> cmd(new vxlan_tunnel::dump_cmd());
+ std::shared_ptr<vxlan_tunnel_cmds::dump_cmd> cmd(
+ new vxlan_tunnel_cmds::dump_cmd());
HW::enqueue(cmd);
HW::write();
#include "vom/om.hpp"
#include "vom/prefix.hpp"
#include "vom/route_domain.hpp"
-#include "vom/rpc_cmd.hpp"
#include "vom/singular_db.hpp"
-#include <vapi/vxlan.api.vapi.hpp>
-
namespace VOM {
/**
* A representation of a VXLAN Tunnel in VPP
*/
static void dump(std::ostream& os);
- /**
- * A Command class that creates an VXLAN tunnel
- */
- class create_cmd : public interface::create_cmd<vapi::Vxlan_add_del_tunnel>
- {
- public:
- /**
- * Create command constructor taking HW item to update and the
- * endpoint values
- */
- create_cmd(HW::item<handle_t>& item,
- const std::string& name,
- const endpoint_t& ep);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const create_cmd& i) const;
-
- private:
- /**
- * Enpoint values of the tunnel to be created
- */
- const endpoint_t m_ep;
- };
-
- /**
- * A functor class that creates an VXLAN tunnel
- */
- class delete_cmd : public interface::delete_cmd<vapi::Vxlan_add_del_tunnel>
- {
- public:
- /**
- * delete command constructor taking HW item to update and the
- * endpoint values
- */
- delete_cmd(HW::item<handle_t>& item, const endpoint_t& ep);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const delete_cmd& i) const;
-
- private:
- /**
- * Enpoint values of the tunnel to be deleted
- */
- const endpoint_t m_ep;
- };
-
- /**
- * A cmd class that Dumps all the Vpp interfaces
- */
- class dump_cmd : public VOM::dump_cmd<vapi::Vxlan_tunnel_dump>
- {
- public:
- /**
- * Default Constructor
- */
- dump_cmd();
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const dump_cmd& i) const;
- };
-
private:
/**
* Class definition for listeners to OM events
* Ostream output for a tunnel endpoint
*/
std::ostream& operator<<(std::ostream& os, const vxlan_tunnel::endpoint_t& ep);
-};
+
+}; // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
* limitations under the License.
*/
-#include "vom/vxlan_tunnel.hpp"
+#include "vom/vxlan_tunnel_cmds.hpp"
DEFINE_VAPI_MSG_IDS_VXLAN_API_JSON;
namespace VOM {
-vxlan_tunnel::create_cmd::create_cmd(HW::item<handle_t>& item,
- const std::string& name,
- const endpoint_t& ep)
+namespace vxlan_tunnel_cmds {
+
+create_cmd::create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ const vxlan_tunnel::endpoint_t& ep)
: interface::create_cmd<vapi::Vxlan_add_del_tunnel>(item, name)
, m_ep(ep)
{
}
bool
-vxlan_tunnel::create_cmd::operator==(const create_cmd& other) const
+create_cmd::operator==(const create_cmd& other) const
{
return (m_ep == other.m_ep);
}
rc_t
-vxlan_tunnel::create_cmd::issue(connection& con)
+create_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
m_hw_item = wait();
if (m_hw_item) {
- interface::add(m_name, m_hw_item);
+ insert_interface();
}
return rc_t::OK;
}
std::string
-vxlan_tunnel::create_cmd::to_string() const
+create_cmd::to_string() const
{
std::ostringstream s;
s << "vxlan-tunnel-create: " << m_hw_item.to_string() << m_ep.to_string();
return (s.str());
}
-vxlan_tunnel::delete_cmd::delete_cmd(HW::item<handle_t>& item,
- const endpoint_t& ep)
+delete_cmd::delete_cmd(HW::item<handle_t>& item,
+ const vxlan_tunnel::endpoint_t& ep)
: interface::delete_cmd<vapi::Vxlan_add_del_tunnel>(item)
, m_ep(ep)
{
}
bool
-vxlan_tunnel::delete_cmd::operator==(const delete_cmd& other) const
+delete_cmd::operator==(const delete_cmd& other) const
{
return (m_ep == other.m_ep);
}
rc_t
-vxlan_tunnel::delete_cmd::issue(connection& con)
+delete_cmd::issue(connection& con)
{
msg_t req(con.ctx(), std::ref(*this));
wait();
m_hw_item.set(rc_t::NOOP);
- interface::remove(m_hw_item);
+ remove_interface();
return (rc_t::OK);
}
std::string
-vxlan_tunnel::delete_cmd::to_string() const
+delete_cmd::to_string() const
{
std::ostringstream s;
s << "vxlan-tunnel-delete: " << m_hw_item.to_string() << m_ep.to_string();
return (s.str());
}
-vxlan_tunnel::dump_cmd::dump_cmd()
+dump_cmd::dump_cmd()
{
}
bool
-vxlan_tunnel::dump_cmd::operator==(const dump_cmd& other) const
+dump_cmd::operator==(const dump_cmd& other) const
{
return (true);
}
rc_t
-vxlan_tunnel::dump_cmd::issue(connection& con)
+dump_cmd::issue(connection& con)
{
m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
}
std::string
-vxlan_tunnel::dump_cmd::to_string() const
+dump_cmd::to_string() const
{
return ("Vpp-vxlan_tunnels-Dump");
}
-}
+} // namespace vxlan_tunnel_cmds
+} // namespace VOM
/*
* fd.io coding-style-patch-verification: ON
--- /dev/null
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VOM_VXLAN_TUNNEL_CMDS_H__
+#define __VOM_VXLAN_TUNNEL_CMDS_H__
+
+#include "vom/dump_cmd.hpp"
+#include "vom/rpc_cmd.hpp"
+#include "vom/vxlan_tunnel.hpp"
+
+#include <vapi/vapi.hpp>
+#include <vapi/vxlan.api.vapi.hpp>
+
+namespace VOM {
+namespace vxlan_tunnel_cmds {
+
+/**
+ * A Command class that creates an VXLAN tunnel
+ */
+class create_cmd : public interface::create_cmd<vapi::Vxlan_add_del_tunnel>
+{
+public:
+ /**
+ * Create command constructor taking HW item to update and the
+ * endpoint values
+ */
+ create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ const vxlan_tunnel::endpoint_t& ep);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const create_cmd& i) const;
+
+private:
+ /**
+ * Enpoint values of the tunnel to be created
+ */
+ const vxlan_tunnel::endpoint_t m_ep;
+};
+
+/**
+ * A functor class that creates an VXLAN tunnel
+ */
+class delete_cmd : public interface::delete_cmd<vapi::Vxlan_add_del_tunnel>
+{
+public:
+ /**
+ * delete command constructor taking HW item to update and the
+ * endpoint values
+ */
+ delete_cmd(HW::item<handle_t>& item, const vxlan_tunnel::endpoint_t& ep);
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const delete_cmd& i) const;
+
+private:
+ /**
+ * Enpoint values of the tunnel to be deleted
+ */
+ const vxlan_tunnel::endpoint_t m_ep;
+};
+
+/**
+ * A cmd class that Dumps all the Vpp interfaces
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Vxlan_tunnel_dump>
+{
+public:
+ /**
+ * Default Constructor
+ */
+ dump_cmd();
+
+ /**
+ * Issue the command to VPP/HW
+ */
+ rc_t issue(connection& con);
+ /**
+ * convert to string format for debug purposes
+ */
+ std::string to_string() const;
+
+ /**
+ * Comparison operator - only used for UT
+ */
+ bool operator==(const dump_cmd& i) const;
+};
+
+}; // namespace vxlan_tunnel_cmds
+}; // namespace VOM
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "mozilla")
+ * End:
+ */
+
+#endif
-lboost_unit_test_framework \
$(VAPI_LIBS)
+VOM_CPPFLAGS = \
+ -I $(WS_ROOT)/src/vpp-api/ \
+ $(CPPFLAGS)
+
$(VOM_BIN): $(VOM_CPPSRC) $(VOM_BINDIR) $(LIB_VOM) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so
- $(CXX) -o $@ $(CPPFLAGS) -DBOOST_LOG_DYN_LINK -O0 -g $(VOM_CPPSRC) $(VOM_LIBS)
+ $(CXX) -o $@ $(VOM_CPPFLAGS) -DBOOST_LOG_DYN_LINK -O0 -g $(VOM_CPPSRC) $(VOM_LIBS)
clean:
rm -rf $(VAPI_BINDIR) $(VOM_BINDIR)
#include "vom/om.hpp"
#include "vom/interface.hpp"
+#include "vom/interface_cmds.hpp"
#include "vom/l2_binding.hpp"
+#include "vom/l2_binding_cmds.hpp"
#include "vom/l3_binding.hpp"
+#include "vom/l3_binding_cmds.hpp"
#include "vom/bridge_domain.hpp"
#include "vom/bridge_domain_entry.hpp"
#include "vom/bridge_domain_arp_entry.hpp"
+#include "vom/bridge_domain_cmds.hpp"
+#include "vom/bridge_domain_entry_cmds.hpp"
+#include "vom/bridge_domain_arp_entry_cmds.hpp"
#include "vom/prefix.hpp"
#include "vom/route.hpp"
+#include "vom/route_cmds.hpp"
#include "vom/route_domain.hpp"
+#include "vom/route_domain_cmds.hpp"
#include "vom/vxlan_tunnel.hpp"
+#include "vom/vxlan_tunnel_cmds.hpp"
#include "vom/sub_interface.hpp"
+#include "vom/sub_interface_cmds.hpp"
#include "vom/acl_list.hpp"
#include "vom/acl_binding.hpp"
+#include "vom/acl_list_cmds.hpp"
+#include "vom/acl_binding_cmds.hpp"
#include "vom/acl_l3_rule.hpp"
#include "vom/acl_l2_rule.hpp"
#include "vom/arp_proxy_config.hpp"
#include "vom/arp_proxy_binding.hpp"
+#include "vom/arp_proxy_config_cmds.hpp"
+#include "vom/arp_proxy_binding_cmds.hpp"
#include "vom/ip_unnumbered.hpp"
+#include "vom/ip_unnumbered_cmds.hpp"
#include "vom/interface_ip6_nd.hpp"
#include "vom/interface_span.hpp"
+#include "vom/interface_span_cmds.hpp"
#include "vom/neighbour.hpp"
+#include "vom/neighbour_cmds.hpp"
#include "vom/nat_static.hpp"
+#include "vom/nat_static_cmds.hpp"
#include "vom/nat_binding.hpp"
+#include "vom/nat_binding_cmds.hpp"
using namespace boost;
using namespace VOM;
class MockListener : public interface::event_listener,
public interface::stat_listener
{
- void handle_interface_stat(interface::stats_cmd *cmd)
+ void handle_interface_stat(interface_cmds::stats_cmd *cmd)
{
}
- void handle_interface_event(interface::events_cmd *cmd)
+ void handle_interface_event(interface_cmds::events_cmd *cmd)
{
}
};
throw ExpException(1);
}
- if (typeid(*f_exp) == typeid(interface::af_packet_create_cmd))
+ if (typeid(*f_exp) == typeid(interface_cmds::af_packet_create_cmd))
{
- rc = handle_derived<interface::af_packet_create_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::af_packet_create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::loopback_create_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::loopback_create_cmd))
{
- rc = handle_derived<interface::loopback_create_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::loopback_create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::loopback_delete_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::loopback_delete_cmd))
{
- rc = handle_derived<interface::loopback_delete_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::loopback_delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::af_packet_delete_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::af_packet_delete_cmd))
{
- rc = handle_derived<interface::af_packet_delete_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::af_packet_delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::state_change_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::state_change_cmd))
{
- rc = handle_derived<interface::state_change_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::state_change_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::set_table_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::set_table_cmd))
{
- rc = handle_derived<interface::set_table_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::set_table_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::set_mac_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::set_mac_cmd))
{
- rc = handle_derived<interface::set_mac_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::set_mac_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::set_tag))
+ else if (typeid(*f_exp) == typeid(interface_cmds::set_tag))
{
- rc = handle_derived<interface::set_tag>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::set_tag>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(route_domain::create_cmd))
+ else if (typeid(*f_exp) == typeid(route_domain_cmds::create_cmd))
{
- rc = handle_derived<route_domain::create_cmd>(f_exp, f_act);
+ rc = handle_derived<route_domain_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(route_domain::delete_cmd))
+ else if (typeid(*f_exp) == typeid(route_domain_cmds::delete_cmd))
{
- rc = handle_derived<route_domain::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<route_domain_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(route::ip_route::update_cmd))
+ else if (typeid(*f_exp) == typeid(route::ip_route_cmds::update_cmd))
{
- rc = handle_derived<route::ip_route::update_cmd>(f_exp, f_act);
+ rc = handle_derived<route::ip_route_cmds::update_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(route::ip_route::delete_cmd))
+ else if (typeid(*f_exp) == typeid(route::ip_route_cmds::delete_cmd))
{
- rc = handle_derived<route::ip_route::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<route::ip_route_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(neighbour::create_cmd))
+ else if (typeid(*f_exp) == typeid(neighbour_cmds::create_cmd))
{
- rc = handle_derived<neighbour::create_cmd>(f_exp, f_act);
+ rc = handle_derived<neighbour_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(neighbour::delete_cmd))
+ else if (typeid(*f_exp) == typeid(neighbour_cmds::delete_cmd))
{
- rc = handle_derived<neighbour::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<neighbour_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(l3_binding::bind_cmd))
+ else if (typeid(*f_exp) == typeid(l3_binding_cmds::bind_cmd))
{
- rc = handle_derived<l3_binding::bind_cmd>(f_exp, f_act);
+ rc = handle_derived<l3_binding_cmds::bind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(l3_binding::unbind_cmd))
+ else if (typeid(*f_exp) == typeid(l3_binding_cmds::unbind_cmd))
{
- rc = handle_derived<l3_binding::unbind_cmd>(f_exp, f_act);
+ rc = handle_derived<l3_binding_cmds::unbind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(bridge_domain::create_cmd))
+ else if (typeid(*f_exp) == typeid(bridge_domain_cmds::create_cmd))
{
- rc = handle_derived<bridge_domain::create_cmd>(f_exp, f_act);
+ rc = handle_derived<bridge_domain_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(bridge_domain::delete_cmd))
+ else if (typeid(*f_exp) == typeid(bridge_domain_cmds::delete_cmd))
{
- rc = handle_derived<bridge_domain::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<bridge_domain_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(bridge_domain_entry::create_cmd))
+ else if (typeid(*f_exp) == typeid(bridge_domain_entry_cmds::create_cmd))
{
- rc = handle_derived<bridge_domain_entry::create_cmd>(f_exp, f_act);
+ rc = handle_derived<bridge_domain_entry_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(bridge_domain_entry::delete_cmd))
+ else if (typeid(*f_exp) == typeid(bridge_domain_entry_cmds::delete_cmd))
{
- rc = handle_derived<bridge_domain_entry::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<bridge_domain_entry_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(bridge_domain_arp_entry::create_cmd))
+ else if (typeid(*f_exp) == typeid(bridge_domain_arp_entry_cmds::create_cmd))
{
- rc = handle_derived<bridge_domain_arp_entry::create_cmd>(f_exp, f_act);
+ rc = handle_derived<bridge_domain_arp_entry_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(bridge_domain_arp_entry::delete_cmd))
+ else if (typeid(*f_exp) == typeid(bridge_domain_arp_entry_cmds::delete_cmd))
{
- rc = handle_derived<bridge_domain_arp_entry::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<bridge_domain_arp_entry_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(l2_binding::bind_cmd))
+ else if (typeid(*f_exp) == typeid(l2_binding_cmds::bind_cmd))
{
- rc = handle_derived<l2_binding::bind_cmd>(f_exp, f_act);
+ rc = handle_derived<l2_binding_cmds::bind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(l2_binding::unbind_cmd))
+ else if (typeid(*f_exp) == typeid(l2_binding_cmds::unbind_cmd))
{
- rc = handle_derived<l2_binding::unbind_cmd>(f_exp, f_act);
+ rc = handle_derived<l2_binding_cmds::unbind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(l2_binding::set_vtr_op_cmd))
+ else if (typeid(*f_exp) == typeid(l2_binding_cmds::set_vtr_op_cmd))
{
- rc = handle_derived<l2_binding::set_vtr_op_cmd>(f_exp, f_act);
+ rc = handle_derived<l2_binding_cmds::set_vtr_op_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(vxlan_tunnel::create_cmd))
+ else if (typeid(*f_exp) == typeid(vxlan_tunnel_cmds::create_cmd))
{
- rc = handle_derived<vxlan_tunnel::create_cmd>(f_exp, f_act);
+ rc = handle_derived<vxlan_tunnel_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(vxlan_tunnel::delete_cmd))
+ else if (typeid(*f_exp) == typeid(vxlan_tunnel_cmds::delete_cmd))
{
- rc = handle_derived<vxlan_tunnel::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<vxlan_tunnel_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(sub_interface::create_cmd))
+ else if (typeid(*f_exp) == typeid(sub_interface_cmds::create_cmd))
{
- rc = handle_derived<sub_interface::create_cmd>(f_exp, f_act);
+ rc = handle_derived<sub_interface_cmds::create_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(sub_interface::delete_cmd))
+ else if (typeid(*f_exp) == typeid(sub_interface_cmds::delete_cmd))
{
- rc = handle_derived<sub_interface::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<sub_interface_cmds::delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l3_list::update_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::list_cmds::l3_update_cmd))
{
- rc = handle_derived<ACL::l3_list::update_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::list_cmds::l3_update_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l3_list::delete_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::list_cmds::l3_delete_cmd))
{
- rc = handle_derived<ACL::l3_list::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::list_cmds::l3_delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l3_binding::bind_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::binding_cmds::l3_bind_cmd))
{
- rc = handle_derived<ACL::l3_binding::bind_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::binding_cmds::l3_bind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l3_binding::unbind_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::binding_cmds::l3_unbind_cmd))
{
- rc = handle_derived<ACL::l3_binding::unbind_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::binding_cmds::l3_unbind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l2_list::update_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::list_cmds::l2_update_cmd))
{
- rc = handle_derived<ACL::l2_list::update_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::list_cmds::l2_update_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l2_list::delete_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::list_cmds::l2_delete_cmd))
{
- rc = handle_derived<ACL::l2_list::delete_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::list_cmds::l2_delete_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l2_binding::bind_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::binding_cmds::l2_bind_cmd))
{
- rc = handle_derived<ACL::l2_binding::bind_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::binding_cmds::l2_bind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ACL::l2_binding::unbind_cmd))
+ else if (typeid(*f_exp) == typeid(ACL::binding_cmds::l2_unbind_cmd))
{
- rc = handle_derived<ACL::l2_binding::unbind_cmd>(f_exp, f_act);
+ rc = handle_derived<ACL::binding_cmds::l2_unbind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(arp_proxy_binding::bind_cmd))
+ else if (typeid(*f_exp) == typeid(arp_proxy_binding_cmds::bind_cmd))
{
- rc = handle_derived<arp_proxy_binding::bind_cmd>(f_exp, f_act);
+ rc = handle_derived<arp_proxy_binding_cmds::bind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(arp_proxy_binding::unbind_cmd))
+ else if (typeid(*f_exp) == typeid(arp_proxy_binding_cmds::unbind_cmd))
{
- rc = handle_derived<arp_proxy_binding::unbind_cmd>(f_exp, f_act);
+ rc = handle_derived<arp_proxy_binding_cmds::unbind_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(arp_proxy_config::config_cmd))
+ else if (typeid(*f_exp) == typeid(arp_proxy_config_cmds::config_cmd))
{
- rc = handle_derived<arp_proxy_config::config_cmd>(f_exp, f_act);
+ rc = handle_derived<arp_proxy_config_cmds::config_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(arp_proxy_config::unconfig_cmd))
+ else if (typeid(*f_exp) == typeid(arp_proxy_config_cmds::unconfig_cmd))
{
- rc = handle_derived<arp_proxy_config::unconfig_cmd>(f_exp, f_act);
+ rc = handle_derived<arp_proxy_config_cmds::unconfig_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ip_unnumbered::config_cmd))
+ else if (typeid(*f_exp) == typeid(ip_unnumbered_cmds::config_cmd))
{
- rc = handle_derived<ip_unnumbered::config_cmd>(f_exp, f_act);
+ rc = handle_derived<ip_unnumbered_cmds::config_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(ip_unnumbered::unconfig_cmd))
+ else if (typeid(*f_exp) == typeid(ip_unnumbered_cmds::unconfig_cmd))
{
- rc = handle_derived<ip_unnumbered::unconfig_cmd>(f_exp, f_act);
+ rc = handle_derived<ip_unnumbered_cmds::unconfig_cmd>(f_exp, f_act);
}
else if (typeid(*f_exp) == typeid(ip6nd_ra_config::config_cmd))
{
{
rc = handle_derived<ip6nd_ra_prefix::unconfig_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface_span::config_cmd))
+ else if (typeid(*f_exp) == typeid(interface_span_cmds::config_cmd))
{
- rc = handle_derived<interface_span::config_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_span_cmds::config_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface_span::unconfig_cmd))
+ else if (typeid(*f_exp) == typeid(interface_span_cmds::unconfig_cmd))
{
- rc = handle_derived<interface_span::unconfig_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_span_cmds::unconfig_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(nat_static::create_44_cmd))
+ else if (typeid(*f_exp) == typeid(nat_static_cmds::create_44_cmd))
{
- rc = handle_derived<nat_static::create_44_cmd>(f_exp, f_act);
+ rc = handle_derived<nat_static_cmds::create_44_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(nat_static::delete_44_cmd))
+ else if (typeid(*f_exp) == typeid(nat_static_cmds::delete_44_cmd))
{
- rc = handle_derived<nat_static::delete_44_cmd>(f_exp, f_act);
+ rc = handle_derived<nat_static_cmds::delete_44_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(nat_binding::bind_44_input_cmd))
+ else if (typeid(*f_exp) == typeid(nat_binding_cmds::bind_44_input_cmd))
{
- rc = handle_derived<nat_binding::bind_44_input_cmd>(f_exp, f_act);
+ rc = handle_derived<nat_binding_cmds::bind_44_input_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(nat_binding::unbind_44_input_cmd))
+ else if (typeid(*f_exp) == typeid(nat_binding_cmds::unbind_44_input_cmd))
{
- rc = handle_derived<nat_binding::unbind_44_input_cmd>(f_exp, f_act);
+ rc = handle_derived<nat_binding_cmds::unbind_44_input_cmd>(f_exp, f_act);
}
- else if (typeid(*f_exp) == typeid(interface::events_cmd))
+ else if (typeid(*f_exp) == typeid(interface_cmds::events_cmd))
{
- rc = handle_derived<interface::events_cmd>(f_exp, f_act);
+ rc = handle_derived<interface_cmds::events_cmd>(f_exp, f_act);
}
else
{
* 2 is the interface handle VPP [mock] assigns
*/
HW::item<handle_t> hw_ifh(2, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(go, itf1));
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN, rc_t::OK);
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(go));
interface::type_t::AFPACKET,
interface::admin_state_t::DOWN);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(go, itf1));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
TRY_CHECK_RC(OM::write(js, itf1b));
TRY_CHECK(OM::remove(go));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(js));
/*
* George adds an interface, then we flush all of Geroge's state
*/
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(go, itf1));
TRY_CHECK(OM::mark(go));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::sweep(go));
/*
* George adds an interface. mark stale. update the same interface. sweep
* and expect no delete
*/
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
TRY_CHECK_RC(OM::write(go, itf1b));
TRY_CHECK(OM::mark(go));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(go, itf1));
TRY_CHECK(OM::sweep(go));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(go));
/*
* George adds an insterface, then we mark that state. Add a second interface
* an flush the first that is now stale.
*/
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(go, itf1));
TRY_CHECK(OM::mark(go));
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh2(3, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh2));
TRY_CHECK_RC(OM::write(go, itf2));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::sweep(go));
TRY_CHECK(OM::mark(go));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh2));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf2_name));
TRY_CHECK(OM::sweep(go));
}
HW::item<handle_t> hw_ifh(4, rc_t::OK);
HW::item<route::prefix_t> hw_pfx_10(pfx_10, rc_t::OK);
- ADD_EXPECT(interface::loopback_create_cmd(hw_ifh, bvi_name));
- ADD_EXPECT(interface::set_tag(hw_ifh, bvi_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::loopback_create_cmd(hw_ifh, bvi_name));
+ ADD_EXPECT(interface_cmds::set_tag(hw_ifh, bvi_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(ernest, itf));
l3 = new l3_binding(itf, pfx_10);
HW::item<bool> hw_l3_bind(true, rc_t::OK);
HW::item<bool> hw_l3_unbind(false, rc_t::OK);
- ADD_EXPECT(l3_binding::bind_cmd(hw_l3_bind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(l3_binding_cmds::bind_cmd(hw_l3_bind, hw_ifh.data(), pfx_10));
TRY_CHECK_RC(OM::write(ernest, *l3));
// change the MAC address on the BVI
l2_address_t l2_addr({0,1,2,3,4,5});
HW::item<l2_address_t> hw_mac(l2_addr, rc_t::OK);
itf_new_mac.set(l2_addr);
- ADD_EXPECT(interface::set_mac_cmd(hw_mac, hw_ifh));
+ ADD_EXPECT(interface_cmds::set_mac_cmd(hw_mac, hw_ifh));
TRY_CHECK_RC(OM::write(ernest, itf_new_mac));
// create/write the interface to the OM again but with an unset MAC
l2_address_t l2_addr2({0,1,2,3,4,6});
HW::item<l2_address_t> hw_mac2(l2_addr2, rc_t::OK);
itf_new_mac2.set(l2_addr2);
- ADD_EXPECT(interface::set_mac_cmd(hw_mac2, hw_ifh));
+ ADD_EXPECT(interface_cmds::set_mac_cmd(hw_mac2, hw_ifh));
TRY_CHECK_RC(OM::write(ernest, itf_new_mac2));
delete l3;
- ADD_EXPECT(l3_binding::unbind_cmd(hw_l3_unbind, hw_ifh.data(), pfx_10));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::loopback_delete_cmd(hw_ifh));
+ ADD_EXPECT(l3_binding_cmds::unbind_cmd(hw_l3_unbind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::loopback_delete_cmd(hw_ifh));
TRY_CHECK(OM::remove(ernest));
/*
HW::item<route::table_id_t> hw_rd4_unbind(route::DEFAULT_TABLE, rc_t::OK);
HW::item<route::table_id_t> hw_rd6_bind(1, rc_t::OK);
HW::item<route::table_id_t> hw_rd6_unbind(route::DEFAULT_TABLE, rc_t::OK);
- ADD_EXPECT(route_domain::create_cmd(hw_rd4_create, l3_proto_t::IPV4, 1));
- ADD_EXPECT(route_domain::create_cmd(hw_rd6_create, l3_proto_t::IPV6, 1));
+ ADD_EXPECT(route_domain_cmds::create_cmd(hw_rd4_create, l3_proto_t::IPV4, 1));
+ ADD_EXPECT(route_domain_cmds::create_cmd(hw_rd6_create, l3_proto_t::IPV6, 1));
TRY_CHECK_RC(OM::write(graham, rd));
const std::string bvi2_name = "bvi2";
rd);
HW::item<handle_t> hw_ifh2(5, rc_t::OK);
- ADD_EXPECT(interface::loopback_create_cmd(hw_ifh2, bvi2_name));
- ADD_EXPECT(interface::set_tag(hw_ifh2, bvi2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh2));
- ADD_EXPECT(interface::set_table_cmd(hw_rd4_bind, l3_proto_t::IPV4, hw_ifh2));
- ADD_EXPECT(interface::set_table_cmd(hw_rd6_bind, l3_proto_t::IPV6, hw_ifh2));
+ ADD_EXPECT(interface_cmds::loopback_create_cmd(hw_ifh2, bvi2_name));
+ ADD_EXPECT(interface_cmds::set_tag(hw_ifh2, bvi2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh2));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd4_bind, l3_proto_t::IPV4, hw_ifh2));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd6_bind, l3_proto_t::IPV6, hw_ifh2));
TRY_CHECK_RC(OM::write(graham, *itf2));
l3 = new l3_binding(*itf2, pfx_10);
- ADD_EXPECT(l3_binding::bind_cmd(hw_l3_bind, hw_ifh2.data(), pfx_10));
+ ADD_EXPECT(l3_binding_cmds::bind_cmd(hw_l3_bind, hw_ifh2.data(), pfx_10));
TRY_CHECK_RC(OM::write(graham, *l3));
delete l3;
delete itf2;
- ADD_EXPECT(l3_binding::unbind_cmd(hw_l3_unbind, hw_ifh2.data(), pfx_10));
- ADD_EXPECT(interface::set_table_cmd(hw_rd4_unbind, l3_proto_t::IPV4, hw_ifh2));
- ADD_EXPECT(interface::set_table_cmd(hw_rd6_unbind, l3_proto_t::IPV6, hw_ifh2));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh2));
- ADD_EXPECT(interface::loopback_delete_cmd(hw_ifh2));
- ADD_EXPECT(route_domain::delete_cmd(hw_rd4_delete, l3_proto_t::IPV4, 1));
- ADD_EXPECT(route_domain::delete_cmd(hw_rd6_delete, l3_proto_t::IPV6, 1));
+ ADD_EXPECT(l3_binding_cmds::unbind_cmd(hw_l3_unbind, hw_ifh2.data(), pfx_10));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd4_unbind, l3_proto_t::IPV4, hw_ifh2));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd6_unbind, l3_proto_t::IPV6, hw_ifh2));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh2));
+ ADD_EXPECT(interface_cmds::loopback_delete_cmd(hw_ifh2));
+ ADD_EXPECT(route_domain_cmds::delete_cmd(hw_rd4_delete, l3_proto_t::IPV4, 1));
+ ADD_EXPECT(route_domain_cmds::delete_cmd(hw_rd6_delete, l3_proto_t::IPV6, 1));
TRY_CHECK(OM::remove(graham));
}
HW::item<handle_t> hw_ifh(3, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP,
rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(franz, itf1));
bridge_domain bd1(33);
HW::item<uint32_t> hw_bd(33, rc_t::OK);
- ADD_EXPECT(bridge_domain::create_cmd(hw_bd));
+ ADD_EXPECT(bridge_domain_cmds::create_cmd(hw_bd));
TRY_CHECK_RC(OM::write(franz, bd1));
l2_binding *l2itf = new l2_binding(itf1, bd1);
HW::item<bool> hw_l2_bind(true, rc_t::OK);
- ADD_EXPECT(l2_binding::bind_cmd(hw_l2_bind, hw_ifh.data(), hw_bd.data(), false));
+ ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_bind, hw_ifh.data(), hw_bd.data(), false));
TRY_CHECK_RC(OM::write(franz, *l2itf));
/*
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh2(4, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh2));
TRY_CHECK_RC(OM::write(dante, itf2));
// BD add is a no-op since it exists
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);
- ADD_EXPECT(l2_binding::bind_cmd(hw_l2_bind, hw_ifh2.data(), hw_bd.data(), false));
- ADD_EXPECT(l2_binding::set_vtr_op_cmd(hw_set_vtr, hw_ifh2.data(), 68));
+ ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_bind, hw_ifh2.data(), hw_bd.data(), false));
+ ADD_EXPECT(l2_binding_cmds::set_vtr_op_cmd(hw_set_vtr, hw_ifh2.data(), 68));
TRY_CHECK_RC(OM::write(dante, *l2itf2));
// Add some static entries to the bridge-domain
HW::item<bool> hw_be1(true, rc_t::OK);
mac_address_t mac1({0,1,2,3,4,5});
bridge_domain_entry *be1 = new bridge_domain_entry(bd1, mac1, itf2);
- ADD_EXPECT(bridge_domain_entry::create_cmd(hw_be1, mac1, bd1.id(), hw_ifh2.data()));
+ ADD_EXPECT(bridge_domain_entry_cmds::create_cmd(hw_be1, mac1, bd1.id(), hw_ifh2.data()));
TRY_CHECK_RC(OM::write(dante, *be1));
// Add some entries to the bridge-domain ARP termination table
boost::asio::ip::address ip1 = boost::asio::ip::address::from_string("10.10.10.10");
bridge_domain_arp_entry *bea1 = new bridge_domain_arp_entry(bd1, mac1, ip1);
- ADD_EXPECT(bridge_domain_arp_entry::create_cmd(hw_be1, bd1.id(), mac1, ip1));
+ ADD_EXPECT(bridge_domain_arp_entry_cmds::create_cmd(hw_be1, bd1.id(), mac1, ip1));
TRY_CHECK_RC(OM::write(dante, *bea1));
// flush Franz's state
delete l2itf;
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN,
rc_t::OK);
- ADD_EXPECT(l2_binding::unbind_cmd(hw_l2_bind, hw_ifh.data(), hw_bd.data(), false));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_bind, hw_ifh.data(), hw_bd.data(), false));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(franz));
// flush Dante's state - the order the interface and BD are deleted
delete be1;
delete bea1;
STRICT_ORDER_OFF();
- ADD_EXPECT(l2_binding::unbind_cmd(hw_l2_bind, hw_ifh2.data(), hw_bd.data(), false));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh2));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(bridge_domain_entry::delete_cmd(hw_be1, mac1, bd1.id()));
- ADD_EXPECT(bridge_domain_arp_entry::delete_cmd(hw_be1, bd1.id(), mac1, ip1));
- ADD_EXPECT(bridge_domain::delete_cmd(hw_bd));
+ ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_bind, hw_ifh2.data(), hw_bd.data(), false));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(bridge_domain_entry_cmds::delete_cmd(hw_be1, mac1, bd1.id()));
+ ADD_EXPECT(bridge_domain_arp_entry_cmds::delete_cmd(hw_be1, bd1.id(), mac1, ip1));
+ ADD_EXPECT(bridge_domain_cmds::delete_cmd(hw_bd));
TRY_CHECK(OM::remove(dante));
}
vxlan_tunnel vxt(ep.src, ep.dst, ep.vni);
HW::item<handle_t> hw_vxt(3, rc_t::OK);
- ADD_EXPECT(vxlan_tunnel::create_cmd(hw_vxt, "don't-care", ep));
+ ADD_EXPECT(vxlan_tunnel_cmds::create_cmd(hw_vxt, "don't-care", ep));
TRY_CHECK_RC(OM::write(franz, vxt));
bridge_domain bd1(33);
HW::item<uint32_t> hw_bd(33, rc_t::OK);
- ADD_EXPECT(bridge_domain::create_cmd(hw_bd));
+ ADD_EXPECT(bridge_domain_cmds::create_cmd(hw_bd));
TRY_CHECK_RC(OM::write(franz, bd1));
l2_binding *l2itf = new l2_binding(vxt, bd1);
HW::item<bool> hw_l2_bind(true, rc_t::OK);
- ADD_EXPECT(l2_binding::bind_cmd(hw_l2_bind, hw_vxt.data(), hw_bd.data(), false));
+ ADD_EXPECT(l2_binding_cmds::bind_cmd(hw_l2_bind, hw_vxt.data(), hw_bd.data(), false));
TRY_CHECK_RC(OM::write(franz, *l2itf));
// flush Franz's state
delete l2itf;
HW::item<handle_t> hw_vxtdel(3, rc_t::NOOP);
STRICT_ORDER_OFF();
- ADD_EXPECT(l2_binding::unbind_cmd(hw_l2_bind, hw_vxt.data(), hw_bd.data(), false));
- ADD_EXPECT(bridge_domain::delete_cmd(hw_bd));
- ADD_EXPECT(vxlan_tunnel::delete_cmd(hw_vxtdel, ep));
+ ADD_EXPECT(l2_binding_cmds::unbind_cmd(hw_l2_bind, hw_vxt.data(), hw_bd.data(), false));
+ ADD_EXPECT(bridge_domain_cmds::delete_cmd(hw_bd));
+ ADD_EXPECT(vxlan_tunnel_cmds::delete_cmd(hw_vxtdel, ep));
TRY_CHECK(OM::remove(franz));
}
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh(2, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(noam, itf1));
33);
HW::item<handle_t> hw_vl33(3, rc_t::OK);
- ADD_EXPECT(sub_interface::create_cmd(hw_vl33, itf1_name+".33", hw_ifh.data(), 33));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_vl33));
+ ADD_EXPECT(sub_interface_cmds::create_cmd(hw_vl33, itf1_name+".33", hw_ifh.data(), 33));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_vl33));
TRY_CHECK_RC(OM::write(noam, *vl33));
delete vl33;
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN, rc_t::OK);
HW::item<handle_t> hw_vl33_down(3, rc_t::NOOP);
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_vl33));
- ADD_EXPECT(sub_interface::delete_cmd(hw_vl33_down));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_vl33));
+ ADD_EXPECT(sub_interface_cmds::delete_cmd(hw_vl33_down));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(noam));
}
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh(2, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(fyodor, itf1));
route::prefix_t src("10.10.10.10", 32);
ACL::l3_list::rules_t rules = {r1, r2};
HW::item<handle_t> hw_acl(2, rc_t::OK);
- ADD_EXPECT(ACL::l3_list::update_cmd(hw_acl, acl_name, rules));
+ ADD_EXPECT(ACL::list_cmds::l3_update_cmd(hw_acl, acl_name, rules));
TRY_CHECK_RC(OM::write(fyodor, acl1));
ACL::l3_binding *l3b = new ACL::l3_binding(direction_t::INPUT, itf1, acl1);
HW::item<bool> hw_binding(true, rc_t::OK);
- ADD_EXPECT(ACL::l3_binding::bind_cmd(hw_binding, direction_t::INPUT,
- hw_ifh.data(), hw_acl.data()));
+ ADD_EXPECT(ACL::binding_cmds::l3_bind_cmd(hw_binding, direction_t::INPUT,
+ hw_ifh.data(), hw_acl.data()));
TRY_CHECK_RC(OM::write(fyodor, *l3b));
/**
ACL::l2_list::rules_t l2_rules = {l2_r1, l2_r2};
HW::item<handle_t> l2_hw_acl(3, rc_t::OK);
- ADD_EXPECT(ACL::l2_list::update_cmd(l2_hw_acl, l2_acl_name, l2_rules));
+ ADD_EXPECT(ACL::list_cmds::l2_update_cmd(l2_hw_acl, l2_acl_name, l2_rules));
TRY_CHECK_RC(OM::write(leo, l2_acl));
ACL::l2_binding *l2b = new ACL::l2_binding(direction_t::OUTPUT, itf1, l2_acl);
HW::item<bool> l2_hw_binding(true, rc_t::OK);
- ADD_EXPECT(ACL::l2_binding::bind_cmd(l2_hw_binding, direction_t::OUTPUT,
+ ADD_EXPECT(ACL::binding_cmds::l2_bind_cmd(l2_hw_binding, direction_t::OUTPUT,
hw_ifh.data(), l2_hw_acl.data()));
TRY_CHECK_RC(OM::write(leo, *l2b));
delete l2b;
- ADD_EXPECT(ACL::l2_binding::unbind_cmd(l2_hw_binding, direction_t::OUTPUT,
- hw_ifh.data(), l2_hw_acl.data()));
- ADD_EXPECT(ACL::l2_list::delete_cmd(l2_hw_acl));
+ ADD_EXPECT(ACL::binding_cmds::l2_unbind_cmd(l2_hw_binding, direction_t::OUTPUT,
+ hw_ifh.data(), l2_hw_acl.data()));
+ ADD_EXPECT(ACL::list_cmds::l2_delete_cmd(l2_hw_acl));
TRY_CHECK(OM::remove(leo));
delete l3b;
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN,
rc_t::OK);
STRICT_ORDER_OFF();
- ADD_EXPECT(ACL::l3_binding::unbind_cmd(hw_binding, direction_t::INPUT,
+ ADD_EXPECT(ACL::binding_cmds::l3_unbind_cmd(hw_binding, direction_t::INPUT,
hw_ifh.data(), hw_acl.data()));
- ADD_EXPECT(ACL::l3_list::delete_cmd(hw_acl));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(ACL::list_cmds::l3_delete_cmd(hw_acl));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(fyodor));
}
arp_proxy_config ap(low, high);
HW::item<bool> hw_ap_cfg(true, rc_t::OK);
- ADD_EXPECT(arp_proxy_config::config_cmd(hw_ap_cfg, low, high));
+ ADD_EXPECT(arp_proxy_config_cmds::config_cmd(hw_ap_cfg, low, high));
TRY_CHECK_RC(OM::write(kurt, ap));
std::string itf3_name = "host3";
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh(2, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf3_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf3_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(kurt, itf3));
arp_proxy_binding *apb = new arp_proxy_binding(itf3, ap);
HW::item<bool> hw_binding(true, rc_t::OK);
- ADD_EXPECT(arp_proxy_binding::bind_cmd(hw_binding, hw_ifh.data()));
+ ADD_EXPECT(arp_proxy_binding_cmds::bind_cmd(hw_binding, hw_ifh.data()));
TRY_CHECK_RC(OM::write(kurt, *apb));
delete apb;
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN,
rc_t::OK);
STRICT_ORDER_OFF();
- ADD_EXPECT(arp_proxy_binding::unbind_cmd(hw_binding, hw_ifh.data()));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf3_name));
- ADD_EXPECT(arp_proxy_config::unconfig_cmd(hw_ap_cfg, low, high));
+ ADD_EXPECT(arp_proxy_binding_cmds::unbind_cmd(hw_binding, hw_ifh.data()));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf3_name));
+ ADD_EXPECT(arp_proxy_config_cmds::unconfig_cmd(hw_ap_cfg, low, high));
TRY_CHECK(OM::remove(kurt));
}
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh(2, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(eric, itf1));
route::prefix_t pfx_10("10.10.10.10", 24);
l3_binding *l3 = new l3_binding(itf1, pfx_10);
HW::item<bool> hw_l3_bind(true, rc_t::OK);
HW::item<bool> hw_l3_unbind(false, rc_t::OK);
- ADD_EXPECT(l3_binding::bind_cmd(hw_l3_bind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(l3_binding_cmds::bind_cmd(hw_l3_bind, hw_ifh.data(), pfx_10));
TRY_CHECK_RC(OM::write(eric, *l3));
/*
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh2(4, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh2));
TRY_CHECK_RC(OM::write(eric, itf2));
ip_unnumbered *ipun = new ip_unnumbered(itf2, itf1);
HW::item<bool> hw_ip_cfg(true, rc_t::OK);
HW::item<bool> hw_ip_uncfg(false, rc_t::OK);
- ADD_EXPECT(ip_unnumbered::config_cmd(hw_ip_cfg, hw_ifh2.data(), hw_ifh.data()));
+ ADD_EXPECT(ip_unnumbered_cmds::config_cmd(hw_ip_cfg, hw_ifh2.data(), hw_ifh.data()));
TRY_CHECK_RC(OM::write(eric, *ipun));
delete l3;
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN, rc_t::OK);
STRICT_ORDER_OFF();
- ADD_EXPECT(ip_unnumbered::unconfig_cmd(hw_ip_uncfg, hw_ifh2.data(), hw_ifh.data()));
- ADD_EXPECT(l3_binding::unbind_cmd(hw_l3_unbind, hw_ifh.data(), pfx_10));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh2));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(ip_unnumbered_cmds::unconfig_cmd(hw_ip_uncfg, hw_ifh2.data(), hw_ifh.data()));
+ ADD_EXPECT(l3_binding_cmds::unbind_cmd(hw_l3_unbind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
TRY_CHECK(OM::remove(eric));
}
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh(3, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ 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(paulo, itf));
route::prefix_t pfx_10("fd8f:69d8:c12c:ca62::3", 128);
l3_binding *l3 = new l3_binding(itf, pfx_10);
HW::item<bool> hw_l3_bind(true, rc_t::OK);
HW::item<bool> hw_l3_unbind(false, rc_t::OK);
- ADD_EXPECT(l3_binding::bind_cmd(hw_l3_bind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(l3_binding_cmds::bind_cmd(hw_l3_bind, hw_ifh.data(), pfx_10));
TRY_CHECK_RC(OM::write(paulo, *l3));
ra_config ra(0, 1, 0, 4);
STRICT_ORDER_OFF();
ADD_EXPECT(ip6nd_ra_config::unconfig_cmd(hw_ip6nd_ra_config_unconfig, hw_ifh.data(), ra));
- ADD_EXPECT(l3_binding::unbind_cmd(hw_l3_unbind, hw_ifh.data(), pfx_10));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf_name));
+ ADD_EXPECT(l3_binding_cmds::unbind_cmd(hw_l3_unbind, hw_ifh.data(), pfx_10));
+ 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(paulo));
}
interface::admin_state_t::UP);
HW::item<handle_t> hw_ifh(2, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(elif, itf1));
/*
HW::item<handle_t> hw_ifh2(4, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up2(interface::admin_state_t::UP, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up2, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up2, hw_ifh2));
TRY_CHECK_RC(OM::write(elif, itf2));
interface_span *itf_span = new interface_span(itf1, itf2, interface_span::state_t::TX_RX_ENABLED);
HW::item<bool> hw_is_cfg(true, rc_t::OK);
HW::item<bool> hw_is_uncfg(true, rc_t::OK);
- ADD_EXPECT(interface_span::config_cmd(hw_is_cfg, hw_ifh.data(), hw_ifh2.data(), interface_span::state_t::TX_RX_ENABLED));
+ ADD_EXPECT(interface_span_cmds::config_cmd(hw_is_cfg, hw_ifh.data(), hw_ifh2.data(), interface_span::state_t::TX_RX_ENABLED));
TRY_CHECK_RC(OM::write(elif, *itf_span));
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN, rc_t::OK);
delete itf_span;
STRICT_ORDER_OFF();
- ADD_EXPECT(interface_span::unconfig_cmd(hw_is_uncfg, hw_ifh.data(), hw_ifh2.data()));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down2, hw_ifh2));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_span_cmds::unconfig_cmd(hw_is_uncfg, hw_ifh.data(), hw_ifh2.data()));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down2, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf2_name));
TRY_CHECK(OM::remove(elif));
}
HW::item<route::table_id_t> hw_rd4_unbind(route::DEFAULT_TABLE, rc_t::OK);
HW::item<route::table_id_t> hw_rd6_bind(1, rc_t::OK);
HW::item<route::table_id_t> hw_rd7_unbind(route::DEFAULT_TABLE, rc_t::OK);
- ADD_EXPECT(route_domain::create_cmd(hw_rd4_create, l3_proto_t::IPV4, 1));
- ADD_EXPECT(route_domain::create_cmd(hw_rd6_create, l3_proto_t::IPV6, 1));
+ ADD_EXPECT(route_domain_cmds::create_cmd(hw_rd4_create, l3_proto_t::IPV4, 1));
+ ADD_EXPECT(route_domain_cmds::create_cmd(hw_rd6_create, l3_proto_t::IPV6, 1));
TRY_CHECK_RC(OM::write(ian, rd4));
/*
HW::item<handle_t> hw_ifh(2, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(ian, itf1));
std::string itf2_name = "af2";
HW::item<handle_t> hw_ifh2(4, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up2(interface::admin_state_t::UP, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_down2(interface::admin_state_t::DOWN, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up2, hw_ifh2));
- ADD_EXPECT(interface::set_table_cmd(hw_rd4_bind, l3_proto_t::IPV4, hw_ifh2));
- ADD_EXPECT(interface::set_table_cmd(hw_rd6_bind, l3_proto_t::IPV6, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up2, hw_ifh2));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd4_bind, l3_proto_t::IPV4, hw_ifh2));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd6_bind, l3_proto_t::IPV6, hw_ifh2));
TRY_CHECK_RC(OM::write(ian, *itf2));
/*
l3_binding *l3_10 = new l3_binding(itf1, pfx_10);
HW::item<bool> hw_l3_10_bind(true, rc_t::OK);
HW::item<bool> hw_l3_10_unbind(false, rc_t::OK);
- ADD_EXPECT(l3_binding::bind_cmd(hw_l3_10_bind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(l3_binding_cmds::bind_cmd(hw_l3_10_bind, hw_ifh.data(), pfx_10));
TRY_CHECK_RC(OM::write(ian, *l3_10));
route::prefix_t pfx_11("11.11.11.11", 24);
l3_binding *l3_11 = new l3_binding(*itf2, pfx_11);
HW::item<bool> hw_l3_11_bind(true, rc_t::OK);
HW::item<bool> hw_l3_11_unbind(false, rc_t::OK);
- ADD_EXPECT(l3_binding::bind_cmd(hw_l3_11_bind, hw_ifh2.data(), pfx_11));
+ ADD_EXPECT(l3_binding_cmds::bind_cmd(hw_l3_11_bind, hw_ifh2.data(), pfx_11));
TRY_CHECK_RC(OM::write(ian, *l3_11));
/*
route::ip_route *route_5 = new route::ip_route(pfx_5);
route_5->add(*path_10);
HW::item<bool> hw_route_5(true, rc_t::OK);
- ADD_EXPECT(route::ip_route::update_cmd(hw_route_5, 0, pfx_5, {*path_10}));
+ ADD_EXPECT(route::ip_route_cmds::update_cmd(hw_route_5, 0, pfx_5, {*path_10}));
TRY_CHECK_RC(OM::write(ian, *route_5));
/*
route::ip_route *route_5_2 = new route::ip_route(rd4, pfx_5);
route_5_2->add(*path_11);
HW::item<bool> hw_route_5_2(true, rc_t::OK);
- ADD_EXPECT(route::ip_route::update_cmd(hw_route_5_2, 1, pfx_5, {*path_11}));
+ ADD_EXPECT(route::ip_route_cmds::update_cmd(hw_route_5_2, 1, pfx_5, {*path_11}));
TRY_CHECK_RC(OM::write(ian, *route_5_2));
/*
HW::item<bool> hw_neighbour(true, rc_t::OK);
mac_address_t mac_n({0,1,2,4,5,6});
neighbour *ne = new neighbour(itf1, mac_n, nh_10);
- ADD_EXPECT(neighbour::create_cmd(hw_neighbour, hw_ifh.data(), mac_n, nh_10));
+ ADD_EXPECT(neighbour_cmds::create_cmd(hw_neighbour, hw_ifh.data(), mac_n, nh_10));
TRY_CHECK_RC(OM::write(ian, *ne));
/*
route::ip_route *route_dvr = new route::ip_route(pfx_6);
route_dvr->add(*path_l2);
HW::item<bool> hw_route_dvr(true, rc_t::OK);
- ADD_EXPECT(route::ip_route::update_cmd(hw_route_dvr, 0, pfx_6, {*path_l2}));
+ ADD_EXPECT(route::ip_route_cmds::update_cmd(hw_route_dvr, 0, pfx_6, {*path_l2}));
TRY_CHECK_RC(OM::write(ian, *route_dvr));
STRICT_ORDER_OFF();
delete route_dvr;
delete path_l2;
delete ne;
- ADD_EXPECT(neighbour::delete_cmd(hw_neighbour, hw_ifh.data(), mac_n, nh_10));
- ADD_EXPECT(route::ip_route::delete_cmd(hw_route_dvr, 0, pfx_6));
- ADD_EXPECT(route::ip_route::delete_cmd(hw_route_5_2, 1, pfx_5));
- ADD_EXPECT(route::ip_route::delete_cmd(hw_route_5, 0, pfx_5));
- ADD_EXPECT(l3_binding::unbind_cmd(hw_l3_10_unbind, hw_ifh.data(), pfx_10));
- ADD_EXPECT(l3_binding::unbind_cmd(hw_l3_11_unbind, hw_ifh2.data(), pfx_11));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf1_name));
- ADD_EXPECT(interface::set_table_cmd(hw_rd4_unbind, l3_proto_t::IPV4, hw_ifh2));
- ADD_EXPECT(interface::set_table_cmd(hw_rd4_unbind, l3_proto_t::IPV6, hw_ifh2));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down2, hw_ifh2));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh2, itf2_name));
- ADD_EXPECT(route_domain::delete_cmd(hw_rd4_delete, l3_proto_t::IPV4, 1));
- ADD_EXPECT(route_domain::delete_cmd(hw_rd6_delete, l3_proto_t::IPV6, 1));
+ ADD_EXPECT(neighbour_cmds::delete_cmd(hw_neighbour, hw_ifh.data(), mac_n, nh_10));
+ ADD_EXPECT(route::ip_route_cmds::delete_cmd(hw_route_dvr, 0, pfx_6));
+ ADD_EXPECT(route::ip_route_cmds::delete_cmd(hw_route_5_2, 1, pfx_5));
+ ADD_EXPECT(route::ip_route_cmds::delete_cmd(hw_route_5, 0, pfx_5));
+ ADD_EXPECT(l3_binding_cmds::unbind_cmd(hw_l3_10_unbind, hw_ifh.data(), pfx_10));
+ ADD_EXPECT(l3_binding_cmds::unbind_cmd(hw_l3_11_unbind, hw_ifh2.data(), pfx_11));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf1_name));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd4_unbind, l3_proto_t::IPV4, hw_ifh2));
+ ADD_EXPECT(interface_cmds::set_table_cmd(hw_rd4_unbind, l3_proto_t::IPV6, hw_ifh2));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down2, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf2_name));
+ ADD_EXPECT(route_domain_cmds::delete_cmd(hw_rd4_delete, l3_proto_t::IPV4, 1));
+ ADD_EXPECT(route_domain_cmds::delete_cmd(hw_rd6_delete, l3_proto_t::IPV6, 1));
TRY_CHECK(OM::remove(ian));
}
HW::item<handle_t> hw_ifh(2, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_up(interface::admin_state_t::UP, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_down(interface::admin_state_t::DOWN, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh, itf_in_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh, itf_in_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up, hw_ifh));
TRY_CHECK_RC(OM::write(gs, itf_in));
/*
HW::item<interface::admin_state_t> hw_as_up2(interface::admin_state_t::UP, rc_t::OK);
HW::item<interface::admin_state_t> hw_as_down2(interface::admin_state_t::DOWN, rc_t::OK);
- ADD_EXPECT(interface::af_packet_create_cmd(hw_ifh2, itf_out_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_up2, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_create_cmd(hw_ifh2, itf_out_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_up2, hw_ifh2));
TRY_CHECK_RC(OM::write(gs, itf_out));
/*
nat_static ns(in_addr, out_addr);
HW::item<bool> hw_ns(true, rc_t::OK);
- ADD_EXPECT(nat_static::create_44_cmd(hw_ns, 0, in_addr.to_v4(), out_addr));
+ ADD_EXPECT(nat_static_cmds::create_44_cmd(hw_ns, 0, in_addr.to_v4(), out_addr));
TRY_CHECK_RC(OM::write(gs, ns));
/*
nat_binding::zone_t::INSIDE);
HW::item<bool> hw_nb_in(true, rc_t::OK);
- ADD_EXPECT(nat_binding::bind_44_input_cmd(hw_nb_in, hw_ifh.data().value(),
- nat_binding::zone_t::INSIDE));
+ ADD_EXPECT(nat_binding_cmds::bind_44_input_cmd(hw_nb_in,
+ hw_ifh.data().value(),
+ nat_binding::zone_t::INSIDE));
TRY_CHECK_RC(OM::write(gs, *nb_in));
nat_binding *nb_out = new nat_binding(itf_out,
nat_binding::zone_t::OUTSIDE);
HW::item<bool> hw_nb_out(true, rc_t::OK);
- ADD_EXPECT(nat_binding::bind_44_input_cmd(hw_nb_out, hw_ifh2.data().value(),
- nat_binding::zone_t::OUTSIDE));
+ ADD_EXPECT(nat_binding_cmds::bind_44_input_cmd(hw_nb_out,
+ hw_ifh2.data().value(),
+ nat_binding::zone_t::OUTSIDE));
TRY_CHECK_RC(OM::write(gs, *nb_out));
STRICT_ORDER_OFF();
delete nb_in;
delete nb_out;
- ADD_EXPECT(nat_binding::unbind_44_input_cmd(hw_nb_in, hw_ifh.data().value(),
- nat_binding::zone_t::INSIDE));
- ADD_EXPECT(nat_binding::unbind_44_input_cmd(hw_nb_out, hw_ifh2.data().value(),
- nat_binding::zone_t::OUTSIDE));
- ADD_EXPECT(nat_static::delete_44_cmd(hw_ns, 0, in_addr.to_v4(), out_addr));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down, hw_ifh));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh, itf_in_name));
- ADD_EXPECT(interface::state_change_cmd(hw_as_down2, hw_ifh2));
- ADD_EXPECT(interface::af_packet_delete_cmd(hw_ifh2, itf_out_name));
+ ADD_EXPECT(nat_binding_cmds::unbind_44_input_cmd(hw_nb_in,
+ hw_ifh.data().value(),
+ nat_binding::zone_t::INSIDE));
+ ADD_EXPECT(nat_binding_cmds::unbind_44_input_cmd(hw_nb_out,
+ hw_ifh2.data().value(),
+ nat_binding::zone_t::OUTSIDE));
+ ADD_EXPECT(nat_static_cmds::delete_44_cmd(hw_ns, 0, in_addr.to_v4(), out_addr));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down, hw_ifh));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh, itf_in_name));
+ ADD_EXPECT(interface_cmds::state_change_cmd(hw_as_down2, hw_ifh2));
+ ADD_EXPECT(interface_cmds::af_packet_delete_cmd(hw_ifh2, itf_out_name));
TRY_CHECK(OM::remove(gs));
}
HW::item<bool> hw_want(true, rc_t::OK);
- ADD_EXPECT(interface::events_cmd(ml));
- cmd* itf = new interface::events_cmd(ml);
+ ADD_EXPECT(interface_cmds::events_cmd(ml));
+ cmd* itf = new interface_cmds::events_cmd(ml);
HW::enqueue(itf);
HW::write();