From: Mohsin Kazmi Date: Thu, 23 Aug 2018 13:25:47 +0000 (+0200) Subject: VOM: Add support bridge domain arp entry dump X-Git-Tag: v18.10-rc1~346 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=ef89e4d6800e44a068ea4926bc24c4429eeacdb4;p=vpp.git VOM: Add support bridge domain arp entry dump Change-Id: I5d563e1ebc3bd0a40e9347eaf0d00cad1f86a382 Signed-off-by: Mohsin Kazmi --- 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 cmd = + std::make_shared(~0); + + HW::enqueue(cmd); + HW::write(); + + for (auto& record : *cmd) { + auto& payload = record.get_payload(); + + std::shared_ptr 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 #include @@ -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 +{ +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 item; + + /** + * The bd_id to get the arp termination table for + */ + uint32_t m_bd; +}; }; };