API: Change ip4_address and ip6_address to use type alias.
[vpp.git] / extras / vom / vom / gbp_subnet.cpp
index 2221c61..a6bb550 100644 (file)
@@ -31,7 +31,8 @@ const gbp_subnet::type_t gbp_subnet::type_t::STITCHED_INTERNAL(
 const gbp_subnet::type_t gbp_subnet::type_t::STITCHED_EXTERNAL(
   1,
   "stitched-external");
-const gbp_subnet::type_t gbp_subnet::type_t::TRANSPORT(1, "transport");
+const gbp_subnet::type_t gbp_subnet::type_t::TRANSPORT(2, "transport");
+const gbp_subnet::type_t gbp_subnet::type_t::L3_OUT(3, "l3-out");
 
 singular_db<gbp_subnet::key_t, gbp_subnet> gbp_subnet::m_db;
 
@@ -62,6 +63,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 +228,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);