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
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
#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>
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;
+};
};
};