aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/vom/interface_cmds.cpp
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-02-20 08:10:44 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-22 19:57:08 +0000
commit4ef4226282685a049aad439080ca5478da09ac06 (patch)
treed9cefcdd79d9d5195b3862e56924ce8abb9218e8 /src/vpp-api/vom/interface_cmds.cpp
parentde0203edd2177f627cc655b52ffdf921d94d5d26 (diff)
VOM: vhost-use interfaces
Change-Id: Iee1574d1f0f081ccc4a90fd9825a0b5e254aa642 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.cpp110
1 files changed, 106 insertions, 4 deletions
diff --git a/src/vpp-api/vom/interface_cmds.cpp b/src/vpp-api/vom/interface_cmds.cpp
index 031aaea7288..df3415408d9 100644
--- a/src/vpp-api/vom/interface_cmds.cpp
+++ b/src/vpp-api/vom/interface_cmds.cpp
@@ -20,6 +20,7 @@ DEFINE_VAPI_MSG_IDS_VPE_API_JSON;
DEFINE_VAPI_MSG_IDS_INTERFACE_API_JSON;
DEFINE_VAPI_MSG_IDS_AF_PACKET_API_JSON;
DEFINE_VAPI_MSG_IDS_TAP_API_JSON;
+DEFINE_VAPI_MSG_IDS_VHOST_USER_API_JSON;
DEFINE_VAPI_MSG_IDS_STATS_API_JSON;
namespace VOM {
@@ -129,6 +130,50 @@ tap_create_cmd::to_string() const
return (s.str());
}
+vhost_create_cmd::vhost_create_cmd(HW::item<handle_t>& item,
+ const std::string& name,
+ const std::string& tag)
+ : create_cmd(item, name)
+ , m_tag(tag)
+{
+}
+
+rc_t
+vhost_create_cmd::issue(connection& con)
+{
+ msg_t req(con.ctx(), std::ref(*this));
+
+ auto& payload = req.get_request().get_payload();
+ memset(payload.sock_filename, 0, sizeof(payload.sock_filename));
+ memcpy(payload.sock_filename, m_name.c_str(),
+ std::min(m_name.length(), sizeof(payload.sock_filename)));
+ memset(payload.tag, 0, sizeof(payload.tag));
+
+ if (!m_tag.empty())
+ memcpy(payload.tag, m_tag.c_str(),
+ std::min(m_tag.length(), sizeof(payload.tag)));
+
+ payload.is_server = 1;
+ payload.use_custom_mac = 0;
+ payload.renumber = 0;
+
+ VAPI_CALL(req.execute());
+
+ m_hw_item = wait();
+
+ return rc_t::OK;
+}
+
+std::string
+vhost_create_cmd::to_string() const
+{
+ std::ostringstream s;
+ s << "vhost-intf-create: " << m_hw_item.to_string() << " name:" << m_name
+ << " tag:" << m_tag;
+
+ return (s.str());
+}
+
loopback_delete_cmd::loopback_delete_cmd(HW::item<handle_t>& item)
: delete_cmd(item)
{
@@ -215,6 +260,35 @@ tap_delete_cmd::to_string() const
return (s.str());
}
+vhost_delete_cmd::vhost_delete_cmd(HW::item<handle_t>& item,
+ const std::string& name)
+ : delete_cmd(item, name)
+{
+}
+
+rc_t
+vhost_delete_cmd::issue(connection& con)
+{
+ msg_t req(con.ctx(), std::ref(*this));
+
+ auto& payload = req.get_request().get_payload();
+ payload.sw_if_index = m_hw_item.data().value();
+
+ VAPI_CALL(req.execute());
+
+ wait();
+
+ return rc_t::OK;
+}
+std::string
+vhost_delete_cmd::to_string() const
+{
+ std::ostringstream s;
+ s << "vhost-itf-delete: " << m_hw_item.to_string() << " name:" << m_name;
+
+ return (s.str());
+}
+
state_change_cmd::state_change_cmd(HW::item<interface::admin_state_t>& state,
const HW::item<handle_t>& hdl)
: rpc_cmd(state)
@@ -475,10 +549,6 @@ stats_enable_cmd::to_string() const
return (s.str());
}
-dump_cmd::dump_cmd()
-{
-}
-
stats_disable_cmd::stats_disable_cmd(const handle_t& handle)
: rpc_cmd(m_res)
, m_swifindex(handle)
@@ -521,6 +591,10 @@ stats_disable_cmd::to_string() const
return (s.str());
}
+dump_cmd::dump_cmd()
+{
+}
+
bool
dump_cmd::operator==(const dump_cmd& other) const
{
@@ -548,6 +622,34 @@ dump_cmd::to_string() const
return ("itf-dump");
}
+vhost_dump_cmd::vhost_dump_cmd()
+{
+}
+
+bool
+vhost_dump_cmd::operator==(const vhost_dump_cmd& other) const
+{
+ return (true);
+}
+
+rc_t
+vhost_dump_cmd::issue(connection& con)
+{
+ m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
+
+ VAPI_CALL(m_dump->execute());
+
+ wait();
+
+ return rc_t::OK;
+}
+
+std::string
+vhost_dump_cmd::to_string() const
+{
+ return ("vhost-itf-dump");
+}
+
set_tag::set_tag(HW::item<handle_t>& item, const std::string& name)
: rpc_cmd(item)
, m_name(name)