aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vom/vom/interface_cmds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'extras/vom/vom/interface_cmds.cpp')
-rw-r--r--extras/vom/vom/interface_cmds.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/extras/vom/vom/interface_cmds.cpp b/extras/vom/vom/interface_cmds.cpp
index 3a7fb50f64b..b72c2ad69e5 100644
--- a/extras/vom/vom/interface_cmds.cpp
+++ b/extras/vom/vom/interface_cmds.cpp
@@ -23,6 +23,41 @@ DEFINE_VAPI_MSG_IDS_VHOST_USER_API_JSON;
namespace VOM {
namespace interface_cmds {
+
+bvi_create_cmd::bvi_create_cmd(HW::item<handle_t>& item,
+ const std::string& name)
+ : create_cmd(item, name)
+{
+}
+
+rc_t
+bvi_create_cmd::issue(connection& con)
+{
+ msg_t req(con.ctx(), std::ref(*this));
+
+ auto& payload = req.get_request().get_payload();
+
+ payload.user_instance = ~0;
+
+ VAPI_CALL(req.execute());
+
+ wait();
+
+ if (m_hw_item.rc() == rc_t::OK) {
+ insert_interface();
+ }
+
+ return rc_t::OK;
+}
+std::string
+bvi_create_cmd::to_string() const
+{
+ std::ostringstream s;
+ s << "bvi-itf-create: " << m_hw_item.to_string() << " name:" << m_name;
+
+ return (s.str());
+}
+
loopback_create_cmd::loopback_create_cmd(HW::item<handle_t>& item,
const std::string& name)
: create_cmd(item, name)
@@ -138,6 +173,37 @@ vhost_create_cmd::to_string() const
return (s.str());
}
+bvi_delete_cmd::bvi_delete_cmd(HW::item<handle_t>& item)
+ : delete_cmd(item)
+{
+}
+
+rc_t
+bvi_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();
+ m_hw_item.set(rc_t::NOOP);
+
+ remove_interface();
+ return rc_t::OK;
+}
+
+std::string
+bvi_delete_cmd::to_string() const
+{
+ std::ostringstream s;
+ s << "bvi-itf-delete: " << m_hw_item.to_string();
+
+ return (s.str());
+}
+
loopback_delete_cmd::loopback_delete_cmd(HW::item<handle_t>& item)
: delete_cmd(item)
{