l2: BD ARP termination entry API update
[vpp.git] / extras / vom / vom / bridge_domain_arp_entry.cpp
index a203a76..f468e0f 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include "vom/bridge_domain_arp_entry.hpp"
+#include "vom/api_types.hpp"
 #include "vom/bridge_domain_arp_entry_cmds.hpp"
 #include "vom/singular_db_funcs.hpp"
 
@@ -162,6 +163,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.entry.bd_id);
+    bridge_domain_arp_entry bd_ae(*bd, from_api(payload.entry.ip),
+                                  from_api(payload.entry.mac));
+
+    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