X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Fgbp_subnet.cpp;h=bc897f125dbba75d9e62e6f61f281efd395ed107;hb=3c0d84c98;hp=304da3ef4968e3eafedc339978eae05deb3c5809;hpb=4ba67723d716660c56326ce498b99a060a9471b1;p=vpp.git diff --git a/extras/vom/vom/gbp_subnet.cpp b/extras/vom/vom/gbp_subnet.cpp index 304da3ef496..bc897f125db 100644 --- a/extras/vom/vom/gbp_subnet.cpp +++ b/extras/vom/vom/gbp_subnet.cpp @@ -33,6 +33,7 @@ const gbp_subnet::type_t gbp_subnet::type_t::STITCHED_EXTERNAL( "stitched-external"); 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"); +const gbp_subnet::type_t gbp_subnet::type_t::ANON_L3_OUT(4, "anon-l3-out"); singular_db gbp_subnet::m_db; @@ -47,6 +48,7 @@ gbp_subnet::gbp_subnet(const gbp_route_domain& rd, , m_type(type) , m_recirc(nullptr) , m_epg(nullptr) + , m_sclass(~0) { } @@ -60,18 +62,21 @@ gbp_subnet::gbp_subnet(const gbp_route_domain& rd, , m_type(type_t::STITCHED_EXTERNAL) , m_recirc(recirc.singular()) , m_epg(epg.singular()) + , m_sclass(~0) { } gbp_subnet::gbp_subnet(const gbp_route_domain& rd, const route::prefix_t& prefix, - const gbp_endpoint_group& epg) + sclass_t sclass, + const type_t& type) : m_hw(false) , m_rd(rd.singular()) , m_prefix(prefix) - , m_type(type_t::L3_OUT) + , m_type(type) , m_recirc(nullptr) - , m_epg(epg.singular()) + , m_epg() + , m_sclass(sclass) { } @@ -82,6 +87,7 @@ gbp_subnet::gbp_subnet(const gbp_subnet& o) , m_type(o.m_type) , m_recirc(o.m_recirc) , m_epg(o.m_epg) + , m_sclass(o.m_sclass) { } @@ -101,7 +107,8 @@ bool gbp_subnet::operator==(const gbp_subnet& gs) const { return ((key() == gs.key()) && (m_type == gs.m_type) && - (m_recirc == gs.m_recirc) && (m_epg == gs.m_epg)); + (m_recirc == gs.m_recirc) && (m_epg == gs.m_epg) && + (m_sclass == gs.m_sclass)); } void @@ -120,7 +127,7 @@ gbp_subnet::replay() HW::enqueue(new gbp_subnet_cmds::create_cmd( m_hw, m_rd->id(), m_prefix, m_type, (m_recirc ? m_recirc->handle() : handle_t::INVALID), - (m_epg ? m_epg->sclass() : ~0))); + (m_epg ? m_epg->sclass() : m_sclass))); } } @@ -147,7 +154,7 @@ gbp_subnet::update(const gbp_subnet& r) HW::enqueue(new gbp_subnet_cmds::create_cmd( m_hw, m_rd->id(), m_prefix, m_type, (m_recirc ? m_recirc->handle() : handle_t::INVALID), - (m_epg ? m_epg->sclass() : ~0))); + (m_epg ? m_epg->sclass() : m_sclass))); } else { if (m_type != r.m_type) { m_epg = r.m_epg; @@ -157,7 +164,7 @@ gbp_subnet::update(const gbp_subnet& r) HW::enqueue(new gbp_subnet_cmds::create_cmd( m_hw, m_rd->id(), m_prefix, m_type, (m_recirc ? m_recirc->handle() : handle_t::INVALID), - (m_epg ? m_epg->sclass() : ~0))); + (m_epg ? m_epg->sclass() : m_sclass))); } } } @@ -229,10 +236,13 @@ gbp_subnet::event_handler::handle_populate(const client_db::key_t& key) break; } case GBP_API_SUBNET_L3_OUT: { - std::shared_ptr epg = - gbp_endpoint_group::find(payload.subnet.sclass); - - gbp_subnet gs(*rd, pfx, *epg); + gbp_subnet gs(*rd, pfx, payload.subnet.sclass); + OM::commit(key, gs); + VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string(); + break; + } + case GBP_API_SUBNET_ANON_L3_OUT: { + gbp_subnet gs(*rd, pfx, payload.subnet.sclass, type_t::ANON_L3_OUT); OM::commit(key, gs); VOM_LOG(log_level_t::DEBUG) << "read: " << gs.to_string(); break;