VOM: GBP use singular instance if shared-ptr is set

Change-Id: I845e0aa0b657b7a4745c158c4c510f604f4502bb
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/extras/vom/vom/gbp_bridge_domain.cpp b/extras/vom/vom/gbp_bridge_domain.cpp
index e370a6a..78f7d8d 100644
--- a/extras/vom/vom/gbp_bridge_domain.cpp
+++ b/extras/vom/vom/gbp_bridge_domain.cpp
@@ -79,6 +79,12 @@
   , m_bm_flood(bm_flood)
   , m_flags(flags)
 {
+  if (m_bvi)
+    m_bvi = m_bvi->singular();
+  if (m_uu_fwd)
+    m_uu_fwd = m_uu_fwd->singular();
+  if (m_bm_flood)
+    m_bm_flood = m_bm_flood->singular();
 }
 
 gbp_bridge_domain::gbp_bridge_domain(const bridge_domain& bd,
@@ -93,6 +99,10 @@
   , m_bm_flood(bm_flood)
   , m_flags(flags)
 {
+  if (m_uu_fwd)
+    m_uu_fwd = m_uu_fwd->singular();
+  if (m_bm_flood)
+    m_bm_flood = m_bm_flood->singular();
 }
 
 gbp_bridge_domain::gbp_bridge_domain(const gbp_bridge_domain& bd)
diff --git a/extras/vom/vom/gbp_route_domain.cpp b/extras/vom/vom/gbp_route_domain.cpp
index 96216a6..1c72dc8 100644
--- a/extras/vom/vom/gbp_route_domain.cpp
+++ b/extras/vom/vom/gbp_route_domain.cpp
@@ -48,19 +48,26 @@
   , m_ip6_uu_fwd(ip6_uu_fwd.singular())
 {
 }
+
 gbp_route_domain::gbp_route_domain(const route_domain& rd,
                                    const std::shared_ptr<interface> ip4_uu_fwd,
                                    const std::shared_ptr<interface> ip6_uu_fwd)
   : m_id(rd.table_id())
   , m_rd(rd.singular())
-  , m_ip4_uu_fwd(ip4_uu_fwd->singular())
-  , m_ip6_uu_fwd(ip6_uu_fwd->singular())
+  , m_ip4_uu_fwd(ip4_uu_fwd)
+  , m_ip6_uu_fwd(ip6_uu_fwd)
 {
+  if (m_ip4_uu_fwd)
+    m_ip4_uu_fwd = m_ip4_uu_fwd->singular();
+  if (m_ip6_uu_fwd)
+    m_ip6_uu_fwd = m_ip6_uu_fwd->singular();
 }
 
 gbp_route_domain::gbp_route_domain(const route_domain& rd)
   : m_id(rd.table_id())
   , m_rd(rd.singular())
+  , m_ip4_uu_fwd()
+  , m_ip6_uu_fwd()
 {
 }
 
@@ -175,7 +182,7 @@
 std::shared_ptr<gbp_route_domain>
 gbp_route_domain::find_or_add(const gbp_route_domain& temp)
 {
-  return (m_db.find_or_add(temp.m_id.data(), temp));
+  return (m_db.find_or_add(temp.key(), temp));
 }
 
 std::shared_ptr<gbp_route_domain>