ip: Protocol Independent IP Neighbors
[vpp.git] / extras / vom / vom / arp_proxy_config_cmds.cpp
index cf7fad5..a203830 100644 (file)
@@ -14,6 +14,9 @@
  */
 
 #include "vom/arp_proxy_config_cmds.hpp"
+#include "vom/api_types.hpp"
+
+DEFINE_VAPI_MSG_IDS_ARP_API_JSON;
 
 namespace VOM {
 namespace arp_proxy_config_cmds {
@@ -24,8 +27,7 @@ config_cmd::config_cmd(HW::item<bool>& item,
   : rpc_cmd(item)
   , m_low(low)
   , m_high(high)
-{
-}
+{}
 
 bool
 config_cmd::operator==(const config_cmd& o) const
@@ -41,14 +43,12 @@ config_cmd::issue(connection& con)
   auto& payload = req.get_request().get_payload();
   payload.is_add = 1;
 
-  std::copy_n(std::begin(m_low.to_bytes()), m_low.to_bytes().size(),
-              payload.low_address);
-  std::copy_n(std::begin(m_high.to_bytes()), m_high.to_bytes().size(),
-              payload.hi_address);
+  to_api(m_low, payload.proxy.low);
+  to_api(m_high, payload.proxy.hi);
 
   VAPI_CALL(req.execute());
 
-  m_hw_item.set(wait());
+  wait();
 
   return (rc_t::OK);
 }
@@ -69,8 +69,7 @@ unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
   : rpc_cmd(item)
   , m_low(low)
   , m_high(high)
-{
-}
+{}
 
 bool
 unconfig_cmd::operator==(const unconfig_cmd& o) const
@@ -86,10 +85,8 @@ unconfig_cmd::issue(connection& con)
   auto& payload = req.get_request().get_payload();
   payload.is_add = 0;
 
-  std::copy_n(std::begin(m_low.to_bytes()), m_low.to_bytes().size(),
-              payload.low_address);
-  std::copy_n(std::begin(m_high.to_bytes()), m_high.to_bytes().size(),
-              payload.hi_address);
+  to_api(m_low, payload.proxy.low);
+  to_api(m_high, payload.proxy.hi);
 
   VAPI_CALL(req.execute());
 
@@ -108,9 +105,34 @@ unconfig_cmd::to_string() const
 
   return (s.str());
 }
+
+bool
+dump_cmd::operator==(const dump_cmd& other) const
+{
+  return (true);
 }
+
+rc_t
+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
+dump_cmd::to_string() const
+{
+  return ("ARP-proxy-dump");
+}
+
+}; // namesapce cmds
+}; // namespace VOM
+
 /*
  * fd.io coding-style-patch-verification: ON
  *