aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vom
diff options
context:
space:
mode:
Diffstat (limited to 'extras/vom')
-rw-r--r--extras/vom/vom/bridge_domain_arp_entry.cpp26
-rw-r--r--extras/vom/vom/bridge_domain_arp_entry_cmds.cpp37
-rw-r--r--extras/vom/vom/bridge_domain_arp_entry_cmds.hpp39
3 files changed, 102 insertions, 0 deletions
diff --git a/extras/vom/vom/bridge_domain_arp_entry.cpp b/extras/vom/vom/bridge_domain_arp_entry.cpp
index a203a76744e..7221c3f2578 100644
--- a/extras/vom/vom/bridge_domain_arp_entry.cpp
+++ b/extras/vom/vom/bridge_domain_arp_entry.cpp
@@ -162,6 +162,32 @@ void
bridge_domain_arp_entry::event_handler::handle_populate(
const client_db::key_t& key)
{
+ /*
+ * dump VPP Bridge domains
+ */
+ std::shared_ptr<bridge_domain_arp_entry_cmds::dump_cmd> cmd =
+ std::make_shared<bridge_domain_arp_entry_cmds::dump_cmd>(~0);
+
+ HW::enqueue(cmd);
+ HW::write();
+
+ for (auto& record : *cmd) {
+ auto& payload = record.get_payload();
+
+ std::shared_ptr<bridge_domain> bd = bridge_domain::find(payload.bd_id);
+ bridge_domain_arp_entry bd_ae(
+ *bd, from_bytes(payload.is_ipv6, payload.ip_address),
+ mac_address_t(payload.mac_address));
+
+ VOM_LOG(log_level_t::DEBUG) << "dump: " << bd_ae.to_string();
+
+ /*
+ * Write each of the discovered bridge-domain arp entry into the OM,
+ * but disable the HW Command q whilst we do, so that no
+ * commands are sent to VPP
+ */
+ OM::commit(key, bd_ae);
+ }
}
dependency_t
diff --git a/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp b/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp
index d404d5d72d8..188d7738a6c 100644
--- a/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp
+++ b/extras/vom/vom/bridge_domain_arp_entry_cmds.cpp
@@ -111,6 +111,43 @@ delete_cmd::to_string() const
return (s.str());
}
+dump_cmd::dump_cmd(uint32_t bd_id)
+ : m_bd(bd_id)
+{
+}
+
+dump_cmd::dump_cmd(const dump_cmd& d)
+ : m_bd(d.m_bd)
+{
+}
+
+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)));
+
+ auto& payload = m_dump->get_request().get_payload();
+ payload.bd_id = m_bd;
+
+ VAPI_CALL(m_dump->execute());
+
+ wait();
+
+ return rc_t::OK;
+}
+
+std::string
+dump_cmd::to_string() const
+{
+ return ("bridge-domain-arp-entry-dump");
+}
+
}; // namespace bridge_domain_arp_entry
}; // namespace VOM
diff --git a/extras/vom/vom/bridge_domain_arp_entry_cmds.hpp b/extras/vom/vom/bridge_domain_arp_entry_cmds.hpp
index 9637e37a845..490fc4ba738 100644
--- a/extras/vom/vom/bridge_domain_arp_entry_cmds.hpp
+++ b/extras/vom/vom/bridge_domain_arp_entry_cmds.hpp
@@ -17,6 +17,7 @@
#define __VOM_BRIDGE_DOMAIN_ARP_ENTRY_CMDS_H__
#include "vom/bridge_domain_arp_entry.hpp"
+#include "vom/dump_cmd.hpp"
#include <vapi/l2.api.vapi.hpp>
#include <vapi/vpe.api.vapi.hpp>
@@ -93,6 +94,44 @@ private:
mac_address_t m_mac;
boost::asio::ip::address m_ip_addr;
};
+
+/**
+ * A cmd class that Dumps all arp termination tables
+ */
+class dump_cmd : public VOM::dump_cmd<vapi::Bd_ip_mac_dump>
+{
+public:
+ /**
+ * Constructor
+ */
+ dump_cmd(uint32_t bd_id);
+ 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 bd_id to get the arp termination table for
+ */
+ uint32_t m_bd;
+};
};
};