Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
vxlan: vxlan/vxlan.api API cleanup
[vpp.git]
/
extras
/
vom
/
vom
/
gbp_contract.cpp
diff --git
a/extras/vom/vom/gbp_contract.cpp
b/extras/vom/vom/gbp_contract.cpp
index
f372acf
..
8fcef02
100644
(file)
--- a/
extras/vom/vom/gbp_contract.cpp
+++ b/
extras/vom/vom/gbp_contract.cpp
@@
-24,14
+24,16
@@
singular_db<gbp_contract::key_t, gbp_contract> gbp_contract::m_db;
gbp_contract::event_handler gbp_contract::m_evh;
gbp_contract::event_handler gbp_contract::m_evh;
-gbp_contract::gbp_contract(epg_id_t src_epg_id,
- epg_id_t dst_epg_id,
+gbp_contract::gbp_contract(scope_t scope,
+ sclass_t sclass,
+ sclass_t dclass,
const ACL::l3_list& acl,
const gbp_rules_t& rules,
const ethertype_set_t& allowed_ethertypes)
: m_hw(false)
const ACL::l3_list& acl,
const gbp_rules_t& rules,
const ethertype_set_t& allowed_ethertypes)
: m_hw(false)
- , m_src_epg_id(src_epg_id)
- , m_dst_epg_id(dst_epg_id)
+ , m_scope(scope)
+ , m_sclass(sclass)
+ , m_dclass(dclass)
, m_acl(acl.singular())
, m_gbp_rules(rules)
, m_allowed_ethertypes(allowed_ethertypes)
, m_acl(acl.singular())
, m_gbp_rules(rules)
, m_allowed_ethertypes(allowed_ethertypes)
@@
-40,8
+42,9
@@
gbp_contract::gbp_contract(epg_id_t src_epg_id,
gbp_contract::gbp_contract(const gbp_contract& gbpc)
: m_hw(gbpc.m_hw)
gbp_contract::gbp_contract(const gbp_contract& gbpc)
: m_hw(gbpc.m_hw)
- , m_src_epg_id(gbpc.m_src_epg_id)
- , m_dst_epg_id(gbpc.m_dst_epg_id)
+ , m_scope(gbpc.m_scope)
+ , m_sclass(gbpc.m_sclass)
+ , m_dclass(gbpc.m_dclass)
, m_acl(gbpc.m_acl)
, m_gbp_rules(gbpc.m_gbp_rules)
, m_allowed_ethertypes(gbpc.m_allowed_ethertypes)
, m_acl(gbpc.m_acl)
, m_gbp_rules(gbpc.m_gbp_rules)
, m_allowed_ethertypes(gbpc.m_allowed_ethertypes)
@@
-59,7
+62,7
@@
gbp_contract::~gbp_contract()
const gbp_contract::key_t
gbp_contract::key() const
{
const gbp_contract::key_t
gbp_contract::key() const
{
- return (std::make_
pair(m_src_epg_id, m_dst_epg_id
));
+ return (std::make_
tuple(m_scope, m_sclass, m_dclass
));
}
bool
}
bool
@@
-73,7
+76,7
@@
gbp_contract::sweep()
{
if (m_hw) {
HW::enqueue(
{
if (m_hw) {
HW::enqueue(
- new gbp_contract_cmds::delete_cmd(m_hw, m_s
rc_epg_id, m_dst_epg_id
));
+ new gbp_contract_cmds::delete_cmd(m_hw, m_s
cope, m_sclass, m_dclass
));
}
HW::write();
}
}
HW::write();
}
@@
-83,7
+86,7
@@
gbp_contract::replay()
{
if (m_hw) {
HW::enqueue(new gbp_contract_cmds::create_cmd(
{
if (m_hw) {
HW::enqueue(new gbp_contract_cmds::create_cmd(
- m_hw, m_s
rc_epg_id, m_dst_epg_id
, m_acl->handle(), m_gbp_rules,
+ m_hw, m_s
cope, m_sclass, m_dclass
, m_acl->handle(), m_gbp_rules,
m_allowed_ethertypes));
}
}
m_allowed_ethertypes));
}
}
@@
-92,8
+95,8
@@
std::string
gbp_contract::to_string() const
{
std::ostringstream s;
gbp_contract::to_string() const
{
std::ostringstream s;
- s << "gbp-contract:[{" << m_s
rc_epg_id << ", " << m_dst_epg_id << "}, "
- << m_acl->to_string();
+ s << "gbp-contract:[{" << m_s
cope << ", " << m_sclass << ", " << m_dclass
+ <<
"}, " <<
m_acl->to_string();
if (m_gbp_rules.size()) {
auto it = m_gbp_rules.cbegin();
while (it != m_gbp_rules.cend()) {
if (m_gbp_rules.size()) {
auto it = m_gbp_rules.cbegin();
while (it != m_gbp_rules.cend()) {
@@
-101,7
+104,10
@@
gbp_contract::to_string() const
++it;
}
}
++it;
}
}
- s << "]";
+ s << "[ethertype:";
+ for (auto e : m_allowed_ethertypes)
+ s << " " << e;
+ s << "]]";
return (s.str());
}
return (s.str());
}
@@
-114,7
+120,7
@@
gbp_contract::update(const gbp_contract& r)
*/
if (rc_t::OK != m_hw.rc()) {
HW::enqueue(new gbp_contract_cmds::create_cmd(
*/
if (rc_t::OK != m_hw.rc()) {
HW::enqueue(new gbp_contract_cmds::create_cmd(
- m_hw, m_s
rc_epg_id, m_dst_epg_id
, m_acl->handle(), m_gbp_rules,
+ m_hw, m_s
cope, m_sclass, m_dclass
, m_acl->handle(), m_gbp_rules,
m_allowed_ethertypes));
}
}
m_allowed_ethertypes));
}
}
@@
-205,10
+211,10
@@
gbp_contract::event_handler::handle_populate(const client_db::key_t& key)
allowed_ethertypes.insert(ethertype_t::from_numeric_val(et[i]));
}
allowed_ethertypes.insert(ethertype_t::from_numeric_val(et[i]));
}
- gbp_contract gbpc(payload.contract.src_epg, payload.contract.dst_epg,
- *acl, rules, allowed_ethertypes);
+ gbp_contract gbpc(payload.contract.scope, payload.contract.sclass,
+ payload.contract.dclass, *acl, rules,
+ allowed_ethertypes);
OM::commit(key, gbpc);
OM::commit(key, gbpc);
-
VOM_LOG(log_level_t::DEBUG) << "read: " << gbpc.to_string();
} else {
VOM_LOG(log_level_t::ERROR) << " no ACL:" << payload.contract.acl_index;
VOM_LOG(log_level_t::DEBUG) << "read: " << gbpc.to_string();
} else {
VOM_LOG(log_level_t::ERROR) << " no ACL:" << payload.contract.acl_index;
@@
-231,7
+237,8
@@
gbp_contract::event_handler::show(std::ostream& os)
std::ostream&
operator<<(std::ostream& os, const gbp_contract::key_t& key)
{
std::ostream&
operator<<(std::ostream& os, const gbp_contract::key_t& key)
{
- os << "{ " << key.first << "," << key.second << "}";
+ os << "{ " << std::get<0>(key) << "," << std::get<1>(key) << ", "
+ << std::get<2>(key) << "}";
return (os);
}
return (os);
}