Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'
[vpp.git] / src / vpp-api / vom / bridge_domain_entry.cpp
index de1c4b7..241de95 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "vom/bridge_domain_entry.hpp"
 #include "vom/bridge_domain_entry_cmds.hpp"
+#include "vom/singular_db_funcs.hpp"
 
 namespace VOM {
 singular_db<bridge_domain_entry::key_t, bridge_domain_entry>
@@ -79,8 +80,8 @@ void
 bridge_domain_entry::sweep()
 {
   if (m_hw) {
-    HW::enqueue(
-      new bridge_domain_entry_cmds::delete_cmd(m_hw, m_mac, m_bd->id()));
+    HW::enqueue(new bridge_domain_entry_cmds::delete_cmd(
+      m_hw, m_mac, m_bd->id(), interface::type_t::BVI == m_tx_itf->type()));
   }
   HW::write();
 }
@@ -90,7 +91,8 @@ bridge_domain_entry::replay()
 {
   if (m_hw) {
     HW::enqueue(new bridge_domain_entry_cmds::create_cmd(
-      m_hw, m_mac, m_bd->id(), m_tx_itf->handle()));
+      m_hw, m_mac, m_bd->id(), m_tx_itf->handle(),
+      interface::type_t::BVI == m_tx_itf->type()));
   }
 }
 std::string
@@ -111,7 +113,8 @@ bridge_domain_entry::update(const bridge_domain_entry& r)
    */
   if (rc_t::OK != m_hw.rc()) {
     HW::enqueue(new bridge_domain_entry_cmds::create_cmd(
-      m_hw, m_mac, m_bd->id(), m_tx_itf->handle()));
+      m_hw, m_mac, m_bd->id(), m_tx_itf->handle(),
+      interface::type_t::BVI == m_tx_itf->type()));
   }
 }
 
@@ -136,7 +139,7 @@ bridge_domain_entry::singular() const
 void
 bridge_domain_entry::dump(std::ostream& os)
 {
-  m_db.dump(os);
+  db_dump(m_db, os);
 }
 
 bridge_domain_entry::event_handler::event_handler()
@@ -166,11 +169,21 @@ bridge_domain_entry::event_handler::handle_populate(const client_db::key_t& key)
 
     std::shared_ptr<interface> itf = interface::find(payload.sw_if_index);
     std::shared_ptr<bridge_domain> bd = bridge_domain::find(payload.bd_id);
+
+    if (!bd || !itf) {
+      VOM_LOG(log_level_t::ERROR) << "bridge-domain-entry dump:"
+                                  << " itf:" << payload.sw_if_index
+                                  << " bd:" << payload.bd_id;
+      continue;
+    }
+
     mac_address_t mac(payload.mac);
     bridge_domain_entry bd_e(*bd, mac, *itf);
 
-    VOM_LOG(log_level_t::DEBUG) << "bd-entry-dump: " << bd->to_string()
-                                << mac.to_string() << itf->to_string();
+    VOM_LOG(log_level_t::DEBUG) << "bridge-domain-entry dump:"
+                                << " " << bd->to_string() << " "
+                                << itf->to_string() << " mac:["
+                                << mac.to_string() << "]";
 
     /*
      * Write each of the discovered interfaces into the OM,
@@ -190,7 +203,7 @@ bridge_domain_entry::event_handler::order() const
 void
 bridge_domain_entry::event_handler::show(std::ostream& os)
 {
-  m_db.dump(os);
+  db_dump(m_db, os);
 }
 
 std::ostream&