GBP: l3-out subnets
[vpp.git] / extras / vom / vom / gbp_subnet.cpp
index 2221c61..8404dcd 100644 (file)
@@ -62,6 +62,18 @@ gbp_subnet::gbp_subnet(const gbp_route_domain& rd,
 {
 }
 
+gbp_subnet::gbp_subnet(const gbp_route_domain& rd,
+                       const route::prefix_t& prefix,
+                       const gbp_endpoint_group& epg)
+  : m_hw(false)
+  , m_rd(rd.singular())
+  , m_prefix(prefix)
+  , m_type(type_t::L3_OUT)
+  , m_recirc(nullptr)
+  , m_epg(epg.singular())
+{
+}
+
 gbp_subnet::gbp_subnet(const gbp_subnet& o)
   : m_hw(o.m_hw)
   , m_rd(o.m_rd)
@@ -215,6 +227,15 @@ gbp_subnet::event_handler::handle_populate(const client_db::key_t& key)
           VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string();
           break;
         }
+        case GBP_API_SUBNET_L3_OUT: {
+          std::shared_ptr<gbp_endpoint_group> epg =
+            gbp_endpoint_group::find(payload.subnet.epg_id);
+
+          gbp_subnet gs(*rd, pfx, *epg);
+          OM::commit(key, gs);
+          VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string();
+          break;
+        }
         case GBP_API_SUBNET_STITCHED_EXTERNAL: {
           std::shared_ptr<interface> itf =
             interface::find(payload.subnet.sw_if_index);