X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fvom%2Fvom%2Fgbp_endpoint_group.cpp;h=abec585c7444fb00f560a5b594fa5ec991f87b39;hb=7c0eb56f4;hp=e63b09f7c1bb9133f525c20c8d542e4b5ce7de4c;hpb=5e82b050a5c140e195ba960b73fdcdefd5d9f3a5;p=vpp.git diff --git a/extras/vom/vom/gbp_endpoint_group.cpp b/extras/vom/vom/gbp_endpoint_group.cpp index e63b09f7c1b..abec585c744 100644 --- a/extras/vom/vom/gbp_endpoint_group.cpp +++ b/extras/vom/vom/gbp_endpoint_group.cpp @@ -24,35 +24,77 @@ singular_db gbp_endpoint_group::event_handler gbp_endpoint_group::m_evh; -gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id, +gbp_endpoint_group::retention_t::retention_t() + : remote_ep_timeout(0xffffffff) +{ +} +gbp_endpoint_group::retention_t::retention_t(uint32_t remote_ep_timeout_) + : remote_ep_timeout(remote_ep_timeout_) +{ +} + +bool +gbp_endpoint_group::retention_t::operator==(const retention_t& o) const +{ + return (remote_ep_timeout == o.remote_ep_timeout); +} + +std::string +gbp_endpoint_group::retention_t::to_string() const +{ + return std::to_string(remote_ep_timeout); +} + +gbp_endpoint_group::gbp_endpoint_group(vnid_t vnid, + sclass_t sclass, const interface& itf, const gbp_route_domain& rd, const gbp_bridge_domain& bd) : m_hw(false) - , m_epg_id(epg_id) + , m_vnid(vnid) + , m_sclass(sclass) , m_itf(itf.singular()) , m_rd(rd.singular()) , m_bd(bd.singular()) + , m_retention() { } -gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id, +gbp_endpoint_group::gbp_endpoint_group(vnid_t vnid, + sclass_t sclass, const gbp_route_domain& rd, const gbp_bridge_domain& bd) : m_hw(false) - , m_epg_id(epg_id) + , m_vnid(vnid) + , m_sclass(sclass) , m_itf() , m_rd(rd.singular()) , m_bd(bd.singular()) + , m_retention() +{ +} + +gbp_endpoint_group::gbp_endpoint_group(sclass_t sclass, + const gbp_route_domain& rd, + const gbp_bridge_domain& bd) + : m_hw(false) + , m_vnid(~0) + , m_sclass(sclass) + , m_itf() + , m_rd(rd.singular()) + , m_bd(bd.singular()) + , m_retention() { } gbp_endpoint_group::gbp_endpoint_group(const gbp_endpoint_group& epg) : m_hw(epg.m_hw) - , m_epg_id(epg.m_epg_id) + , m_vnid(epg.m_vnid) + , m_sclass(epg.m_sclass) , m_itf(epg.m_itf) , m_rd(epg.m_rd) , m_bd(epg.m_bd) + , m_retention(epg.m_retention) { } @@ -65,27 +107,40 @@ gbp_endpoint_group::~gbp_endpoint_group() const gbp_endpoint_group::key_t gbp_endpoint_group::key() const { - return (m_epg_id); + return (m_sclass); +} + +vnid_t +gbp_endpoint_group::vnid() const +{ + return (m_vnid); +} + +void +gbp_endpoint_group::set(const retention_t& retention) +{ + m_retention = retention; } -epg_id_t -gbp_endpoint_group::id() const +sclass_t +gbp_endpoint_group::sclass() const { - return (m_epg_id); + return (m_sclass); } bool gbp_endpoint_group::operator==(const gbp_endpoint_group& gg) const { - return (key() == gg.key() && (m_itf == gg.m_itf) && (m_rd == gg.m_rd) && - (m_bd == gg.m_bd)); + return (key() == gg.key() && (m_vnid == gg.m_vnid) && + (m_retention == gg.m_retention) && (m_itf == gg.m_itf) && + (m_rd == gg.m_rd) && (m_bd == gg.m_bd)); } void gbp_endpoint_group::sweep() { if (m_hw) { - HW::enqueue(new gbp_endpoint_group_cmds::delete_cmd(m_hw, m_epg_id)); + HW::enqueue(new gbp_endpoint_group_cmds::delete_cmd(m_hw, m_vnid)); } HW::write(); } @@ -95,7 +150,7 @@ gbp_endpoint_group::replay() { if (m_hw) { HW::enqueue(new gbp_endpoint_group_cmds::create_cmd( - m_hw, m_epg_id, m_bd->id(), m_rd->id(), + m_hw, m_vnid, m_sclass, m_bd->id(), m_rd->id(), m_retention, (m_itf ? m_itf->handle() : handle_t::INVALID))); } } @@ -105,8 +160,10 @@ gbp_endpoint_group::to_string() const { std::ostringstream s; s << "gbp-endpoint-group:[" - << "epg:" << m_epg_id << ", " << (m_itf ? m_itf->to_string() : "NULL") - << ", " << m_bd->to_string() << ", " << m_rd->to_string() << "]"; + << "vnid:" << m_vnid << ", sclass:" << m_sclass << ", " + << "retention:[" << m_retention.to_string() << "], " + << (m_itf ? m_itf->to_string() : "NULL") << ", " << m_bd->to_string() + << ", " << m_rd->to_string() << "]"; return (s.str()); } @@ -116,7 +173,7 @@ gbp_endpoint_group::update(const gbp_endpoint_group& r) { if (rc_t::OK != m_hw.rc()) { HW::enqueue(new gbp_endpoint_group_cmds::create_cmd( - m_hw, m_epg_id, m_bd->id(), m_rd->id(), + m_hw, m_vnid, m_sclass, m_bd->id(), m_rd->id(), m_retention, (m_itf ? m_itf->handle() : handle_t::INVALID))); } } @@ -194,12 +251,13 @@ gbp_endpoint_group::event_handler::handle_populate(const client_db::key_t& key) << payload.epg.bd_id << "]"; if (itf && bd && rd) { - gbp_endpoint_group gbpe(payload.epg.epg_id, *itf, *rd, *bd); + gbp_endpoint_group gbpe(payload.epg.vnid, payload.epg.sclass, *itf, *rd, + *bd); OM::commit(key, gbpe); VOM_LOG(log_level_t::DEBUG) << "read: " << gbpe.to_string(); } else if (bd && rd) { - gbp_endpoint_group gbpe(payload.epg.epg_id, *rd, *bd); + gbp_endpoint_group gbpe(payload.epg.sclass, *rd, *bd); OM::commit(key, gbpe); VOM_LOG(log_level_t::DEBUG) << "read: " << gbpe.to_string();