aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/interface_cmds.cpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2017-11-03 04:39:05 -0700
committerNeale Ranns <nranns@cisco.com>2017-11-06 17:44:21 +0000
commit9ef1c0adbf9399c55deeede3cf629dd4e8c20304 (patch)
tree0eeed8f869eee35a48797b6b837c16222a627e46 /src/vpp-api/vom/interface_cmds.cpp
parentaddb55b9e0533c5f720b1cc1bdeeb4bbd0e6bf2a (diff)
VOM reshuffle
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>
Diffstat (limited to 'src/vpp-api/vom/interface_cmds.cpp')
-rw-r--r--src/vpp-api/vom/interface_cmds.cpp138
1 files changed, 70 insertions, 68 deletions
diff --git a/src/vpp-api/vom/interface_cmds.cpp b/src/vpp-api/vom/interface_cmds.cpp
index 306f987429b..4f6286f7bef 100644
--- a/src/vpp-api/vom/interface_cmds.cpp
+++ b/src/vpp-api/vom/interface_cmds.cpp
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "vom/interface.hpp"
+#include "vom/interface_cmds.hpp"
#include "vom/cmd.hpp"
DEFINE_VAPI_MSG_IDS_VPE_API_JSON;
@@ -23,14 +23,15 @@ DEFINE_VAPI_MSG_IDS_TAP_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));
@@ -39,13 +40,13 @@ interface::loopback_create_cmd::issue(connection& con)
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;
@@ -53,14 +54,14 @@ interface::loopback_create_cmd::to_string() const
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));
@@ -76,13 +77,13 @@ interface::af_packet_create_cmd::issue(connection& con)
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;
@@ -90,14 +91,14 @@ interface::af_packet_create_cmd::to_string() const
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));
@@ -113,14 +114,14 @@ interface::tap_create_cmd::issue(connection& con)
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;
@@ -128,13 +129,13 @@ interface::tap_create_cmd::to_string() const
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));
@@ -146,12 +147,12 @@ interface::loopback_delete_cmd::issue(connection& con)
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();
@@ -159,14 +160,14 @@ interface::loopback_delete_cmd::to_string() const
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));
@@ -180,11 +181,11 @@ interface::af_packet_delete_cmd::issue(connection& con)
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();
@@ -192,21 +193,21 @@ interface::af_packet_delete_cmd::to_string() const
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();
@@ -214,22 +215,21 @@ interface::tap_delete_cmd::to_string() const
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));
@@ -245,7 +245,7 @@ interface::state_change_cmd::issue(connection& con)
}
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()
@@ -253,9 +253,9 @@ interface::state_change_cmd::to_string() const
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)
@@ -263,14 +263,14 @@ interface::set_table_cmd::set_table_cmd(HW::item<route::table_id_t>& table,
}
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));
@@ -287,7 +287,7 @@ interface::set_table_cmd::issue(connection& con)
}
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()
@@ -295,21 +295,21 @@ interface::set_table_cmd::to_string() const
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));
@@ -326,27 +326,27 @@ interface::set_mac_cmd::issue(connection& con)
}
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
@@ -370,7 +370,7 @@ interface::events_cmd::issue(connection& con)
}
void
-interface::events_cmd::retire(connection& con)
+events_cmd::retire(connection& con)
{
/*
* disable interface events.
@@ -387,13 +387,13 @@ interface::events_cmd::retire(connection& con)
}
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");
}
@@ -401,8 +401,8 @@ interface::events_cmd::to_string() const
/**
* 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)
@@ -410,13 +410,13 @@ interface::stats_cmd::stats_cmd(stat_listener& el,
}
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
@@ -451,34 +451,34 @@ interface::stats_cmd::issue(connection& con)
}
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)));
@@ -493,19 +493,19 @@ interface::dump_cmd::issue(connection& con)
}
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));
@@ -521,7 +521,7 @@ interface::set_tag::issue(connection& con)
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;
@@ -530,11 +530,13 @@ interface::set_tag::to_string() const
}
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
*