gbp_route_domain::gbp_route_domain(const gbp_route_domain& rd)
: m_id(rd.id())
, m_rd(rd.m_rd)
+ , m_scope(rd.m_scope)
, m_ip4_uu_fwd(rd.m_ip4_uu_fwd)
, m_ip6_uu_fwd(rd.m_ip6_uu_fwd)
{
}
gbp_route_domain::gbp_route_domain(const route_domain& rd,
+ scope_t scope,
const interface& ip4_uu_fwd,
const interface& ip6_uu_fwd)
: m_id(rd.table_id())
, m_rd(rd.singular())
+ , m_scope(scope)
, m_ip4_uu_fwd(ip4_uu_fwd.singular())
, m_ip6_uu_fwd(ip6_uu_fwd.singular())
{
}
+
gbp_route_domain::gbp_route_domain(const route_domain& rd,
+ scope_t scope,
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_scope(scope)
+ , 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)
+gbp_route_domain::gbp_route_domain(const route_domain& rd, scope_t scope)
: m_id(rd.table_id())
, m_rd(rd.singular())
+ , m_scope(scope)
+ , m_ip4_uu_fwd()
+ , m_ip6_uu_fwd()
{
}
return (m_rd->key());
}
-uint32_t
+route::table_id_t
gbp_route_domain::id() const
{
return (m_rd->table_id());
}
const std::shared_ptr<route_domain>
-gbp_route_domain::get_route_domain()
+gbp_route_domain::get_route_domain() const
{
return m_rd;
}
+const std::shared_ptr<interface>
+gbp_route_domain::get_ip4_uu_fwd() const
+{
+ return m_ip4_uu_fwd;
+}
+
+const std::shared_ptr<interface>
+gbp_route_domain::get_ip6_uu_fwd() const
+{
+ return m_ip6_uu_fwd;
+}
+
bool
gbp_route_domain::operator==(const gbp_route_domain& b) const
{
else
equal = false;
- return ((m_rd->key() == b.m_rd->key()) && equal);
+ return ((m_rd->key() == b.m_rd->key()) && m_scope == b.m_scope && equal);
}
void
if (rc_t::OK == m_id.rc()) {
if (m_ip4_uu_fwd && m_ip6_uu_fwd)
HW::enqueue(new gbp_route_domain_cmds::create_cmd(
- m_id, m_ip4_uu_fwd->handle(), m_ip6_uu_fwd->handle()));
+ m_id, m_scope, m_ip4_uu_fwd->handle(), m_ip6_uu_fwd->handle()));
else
- HW::enqueue(new gbp_route_domain_cmds::create_cmd(m_id, handle_t::INVALID,
- handle_t::INVALID));
+ HW::enqueue(new gbp_route_domain_cmds::create_cmd(
+ m_id, m_scope, handle_t::INVALID, handle_t::INVALID));
}
}
gbp_route_domain::to_string() const
{
std::ostringstream s;
- s << "gbp-route-domain:[" << m_rd->to_string();
+ s << "gbp-route-domain:[" << m_rd->to_string() << "scope:" << m_scope;
if (m_ip4_uu_fwd)
s << " v4-uu:[" << m_ip4_uu_fwd->to_string() << "]";
void
gbp_route_domain::update(const gbp_route_domain& desired)
{
- /*
- * the desired state is always that the interface should be created
- */
if (rc_t::OK != m_id.rc()) {
if (m_ip4_uu_fwd && m_ip6_uu_fwd)
HW::enqueue(new gbp_route_domain_cmds::create_cmd(
- m_id, m_ip4_uu_fwd->handle(), m_ip6_uu_fwd->handle()));
+ m_id, m_scope, m_ip4_uu_fwd->handle(), m_ip6_uu_fwd->handle()));
else
- HW::enqueue(new gbp_route_domain_cmds::create_cmd(m_id, handle_t::INVALID,
- handle_t::INVALID));
+ HW::enqueue(new gbp_route_domain_cmds::create_cmd(
+ m_id, m_scope, handle_t::INVALID, handle_t::INVALID));
}
}
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>
interface::find(payload.rd.ip4_uu_sw_if_index);
if (ip6_uu_fwd && ip4_uu_fwd) {
- gbp_route_domain rd(payload.rd.rd_id, *ip4_uu_fwd, *ip6_uu_fwd);
+ gbp_route_domain rd(payload.rd.rd_id, payload.rd.scope, *ip4_uu_fwd,
+ *ip6_uu_fwd);
OM::commit(key, rd);
VOM_LOG(log_level_t::DEBUG) << "dump: " << rd.to_string();
} else {
- gbp_route_domain rd(payload.rd.rd_id);
+ gbp_route_domain rd(payload.rd.rd_id, payload.rd.scope);
OM::commit(key, rd);
VOM_LOG(log_level_t::DEBUG) << "dump: " << rd.to_string();
}
dependency_t
gbp_route_domain::event_handler::order() const
{
- return (dependency_t::TABLE);
+ return (dependency_t::VIRTUAL_TABLE);
}
void