summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/vom/vom/gbp_contract.cpp35
-rw-r--r--extras/vom/vom/gbp_contract.hpp10
-rw-r--r--extras/vom/vom/gbp_contract_cmds.cpp37
-rw-r--r--extras/vom/vom/gbp_contract_cmds.hpp14
-rw-r--r--extras/vom/vom/gbp_endpoint.cpp8
-rw-r--r--extras/vom/vom/gbp_endpoint_cmds.cpp10
-rw-r--r--extras/vom/vom/gbp_endpoint_cmds.hpp8
-rw-r--r--extras/vom/vom/gbp_endpoint_group.cpp64
-rw-r--r--extras/vom/vom/gbp_endpoint_group.hpp24
-rw-r--r--extras/vom/vom/gbp_endpoint_group_cmds.cpp20
-rw-r--r--extras/vom/vom/gbp_endpoint_group_cmds.hpp8
-rw-r--r--extras/vom/vom/gbp_recirc.cpp8
-rw-r--r--extras/vom/vom/gbp_recirc_cmds.cpp12
-rw-r--r--extras/vom/vom/gbp_recirc_cmds.hpp4
-rw-r--r--extras/vom/vom/gbp_subnet.cpp10
-rw-r--r--extras/vom/vom/gbp_subnet_cmds.cpp10
-rw-r--r--extras/vom/vom/gbp_subnet_cmds.hpp8
-rw-r--r--src/plugins/gbp/CMakeLists.txt3
-rw-r--r--src/plugins/gbp/gbp.api14
-rw-r--r--src/plugins/gbp/gbp_api.c36
-rw-r--r--src/plugins/gbp/gbp_bridge_domain.c5
-rw-r--r--src/plugins/gbp/gbp_classify_node.c31
-rw-r--r--src/plugins/gbp/gbp_contract.c32
-rw-r--r--src/plugins/gbp/gbp_contract.h10
-rw-r--r--src/plugins/gbp/gbp_endpoint.c21
-rw-r--r--src/plugins/gbp/gbp_endpoint.h6
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.c35
-rw-r--r--src/plugins/gbp/gbp_endpoint_group.h44
-rw-r--r--src/plugins/gbp/gbp_fwd.c2
-rw-r--r--src/plugins/gbp/gbp_fwd_dpo.c12
-rw-r--r--src/plugins/gbp/gbp_fwd_node.c13
-rw-r--r--src/plugins/gbp/gbp_learn_node.c70
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.c16
-rw-r--r--src/plugins/gbp/gbp_policy_dpo.h6
-rw-r--r--src/plugins/gbp/gbp_policy_node.c14
-rw-r--r--src/plugins/gbp/gbp_recirc.c12
-rw-r--r--src/plugins/gbp/gbp_recirc.h4
-rw-r--r--src/plugins/gbp/gbp_route_domain.c5
-rw-r--r--src/plugins/gbp/gbp_sclass.c94
-rw-r--r--src/plugins/gbp/gbp_sclass.h48
-rw-r--r--src/plugins/gbp/gbp_sclass_node.c296
-rw-r--r--src/plugins/gbp/gbp_subnet.c36
-rw-r--r--src/plugins/gbp/gbp_subnet.h4
-rw-r--r--src/plugins/gbp/gbp_types.h6
-rw-r--r--src/plugins/gbp/gbp_vxlan.c12
-rw-r--r--src/plugins/gbp/gbp_vxlan_node.c1
-rw-r--r--src/vnet/buffer.h6
-rw-r--r--src/vnet/interface_format.c4
-rw-r--r--src/vnet/l2/l2_input.h1
-rw-r--r--src/vnet/l2/l2_output.h1
-rw-r--r--test/test_gbp.py130
-rw-r--r--test/vpp_papi_provider.py26
52 files changed, 417 insertions, 929 deletions
diff --git a/extras/vom/vom/gbp_contract.cpp b/extras/vom/vom/gbp_contract.cpp
index 0ef50ad5535..c95c2e8008e 100644
--- a/extras/vom/vom/gbp_contract.cpp
+++ b/extras/vom/vom/gbp_contract.cpp
@@ -24,14 +24,14 @@ singular_db<gbp_contract::key_t, gbp_contract> gbp_contract::m_db;
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(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)
- , m_src_epg_id(src_epg_id)
- , m_dst_epg_id(dst_epg_id)
+ , m_sclass(sclass)
+ , m_dclass(dclass)
, m_acl(acl.singular())
, m_gbp_rules(rules)
, m_allowed_ethertypes(allowed_ethertypes)
@@ -40,8 +40,8 @@ gbp_contract::gbp_contract(epg_id_t src_epg_id,
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_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)
@@ -59,7 +59,7 @@ gbp_contract::~gbp_contract()
const gbp_contract::key_t
gbp_contract::key() const
{
- return (std::make_pair(m_src_epg_id, m_dst_epg_id));
+ return (std::make_pair(m_sclass, m_dclass));
}
bool
@@ -72,8 +72,7 @@ void
gbp_contract::sweep()
{
if (m_hw) {
- HW::enqueue(
- new gbp_contract_cmds::delete_cmd(m_hw, m_src_epg_id, m_dst_epg_id));
+ HW::enqueue(new gbp_contract_cmds::delete_cmd(m_hw, m_sclass, m_dclass));
}
HW::write();
}
@@ -82,9 +81,9 @@ void
gbp_contract::replay()
{
if (m_hw) {
- HW::enqueue(new gbp_contract_cmds::create_cmd(
- m_hw, m_src_epg_id, m_dst_epg_id, m_acl->handle(), m_gbp_rules,
- m_allowed_ethertypes));
+ HW::enqueue(new gbp_contract_cmds::create_cmd(m_hw, m_sclass, m_dclass,
+ m_acl->handle(), m_gbp_rules,
+ m_allowed_ethertypes));
}
}
@@ -92,7 +91,7 @@ std::string
gbp_contract::to_string() const
{
std::ostringstream s;
- s << "gbp-contract:[{" << m_src_epg_id << ", " << m_dst_epg_id << "}, "
+ s << "gbp-contract:[{" << m_sclass << ", " << m_dclass << "}, "
<< m_acl->to_string();
if (m_gbp_rules.size()) {
auto it = m_gbp_rules.cbegin();
@@ -116,9 +115,9 @@ gbp_contract::update(const gbp_contract& r)
* create the table if it is not yet created
*/
if (rc_t::OK != m_hw.rc()) {
- HW::enqueue(new gbp_contract_cmds::create_cmd(
- m_hw, m_src_epg_id, m_dst_epg_id, m_acl->handle(), m_gbp_rules,
- m_allowed_ethertypes));
+ HW::enqueue(new gbp_contract_cmds::create_cmd(m_hw, m_sclass, m_dclass,
+ m_acl->handle(), m_gbp_rules,
+ m_allowed_ethertypes));
}
}
@@ -208,8 +207,8 @@ gbp_contract::event_handler::handle_populate(const client_db::key_t& key)
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.sclass, payload.contract.dclass, *acl,
+ rules, allowed_ethertypes);
OM::commit(key, gbpc);
VOM_LOG(log_level_t::DEBUG) << "read: " << gbpc.to_string();
diff --git a/extras/vom/vom/gbp_contract.hpp b/extras/vom/vom/gbp_contract.hpp
index 2f1c3c5a950..7775638bb9f 100644
--- a/extras/vom/vom/gbp_contract.hpp
+++ b/extras/vom/vom/gbp_contract.hpp
@@ -39,7 +39,7 @@ public:
/**
* The key for a contract is the pari of EPG-IDs
*/
- typedef std::pair<epg_id_t, epg_id_t> key_t;
+ typedef std::pair<sclass_t, sclass_t> key_t;
/**
* A set of allowed ethertypes
@@ -49,8 +49,8 @@ public:
/**
* Construct a GBP contract
*/
- gbp_contract(epg_id_t src_epg_id,
- epg_id_t dst_epg_id,
+ gbp_contract(sclass_t sclass,
+ sclass_t dclass,
const ACL::l3_list& acl,
const gbp_rules_t& gpb_rules,
const ethertype_set_t& allowed_ethertypes);
@@ -169,12 +169,12 @@ private:
/**
* The source EPG ID
*/
- epg_id_t m_src_epg_id;
+ sclass_t m_sclass;
/**
* The destination EPG ID
*/
- epg_id_t m_dst_epg_id;
+ sclass_t m_dclass;
/**
* The ACL applied to traffic between the gourps
diff --git a/extras/vom/vom/gbp_contract_cmds.cpp b/extras/vom/vom/gbp_contract_cmds.cpp
index 5cdd885f304..9e8a177422b 100644
--- a/extras/vom/vom/gbp_contract_cmds.cpp
+++ b/extras/vom/vom/gbp_contract_cmds.cpp
@@ -20,14 +20,14 @@ namespace VOM {
namespace gbp_contract_cmds {
create_cmd::create_cmd(HW::item<bool>& item,
- epg_id_t src_epg_id,
- epg_id_t dst_epg_id,
+ sclass_t sclass,
+ sclass_t dclass,
const handle_t& acl,
const gbp_contract::gbp_rules_t& gbp_rules,
const gbp_contract::ethertype_set_t& allowed_ethertypes)
: rpc_cmd(item)
- , m_src_epg_id(src_epg_id)
- , m_dst_epg_id(dst_epg_id)
+ , m_sclass(sclass)
+ , m_dclass(dclass)
, m_acl(acl)
, m_gbp_rules(gbp_rules)
, m_allowed_ethertypes(allowed_ethertypes)
@@ -37,9 +37,8 @@ create_cmd::create_cmd(HW::item<bool>& item,
bool
create_cmd::operator==(const create_cmd& other) const
{
- return ((m_acl == other.m_acl) && (m_src_epg_id == other.m_src_epg_id) &&
- (m_dst_epg_id == other.m_dst_epg_id) &&
- (m_gbp_rules == other.m_gbp_rules) &&
+ return ((m_acl == other.m_acl) && (m_sclass == other.m_sclass) &&
+ (m_dclass == other.m_dclass) && (m_gbp_rules == other.m_gbp_rules) &&
(m_allowed_ethertypes == other.m_allowed_ethertypes));
}
@@ -54,8 +53,8 @@ create_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.is_add = 1;
payload.contract.acl_index = m_acl.value();
- payload.contract.src_epg = m_src_epg_id;
- payload.contract.dst_epg = m_dst_epg_id;
+ payload.contract.sclass = m_sclass;
+ payload.contract.dclass = m_dclass;
uint32_t ii = 0;
payload.contract.n_rules = n_rules;
@@ -112,8 +111,7 @@ create_cmd::to_string() const
{
std::ostringstream s;
s << "gbp-contract-create: " << m_hw_item.to_string()
- << " src-epg-id:" << m_src_epg_id << " dst-epg-id:" << m_dst_epg_id
- << " acl:" << m_acl;
+ << " sclass:" << m_sclass << " dclass:" << m_dclass << " acl:" << m_acl;
s << "[ethertype:";
for (auto e : m_allowed_ethertypes)
s << " " << e;
@@ -122,20 +120,17 @@ create_cmd::to_string() const
return (s.str());
}
-delete_cmd::delete_cmd(HW::item<bool>& item,
- epg_id_t src_epg_id,
- epg_id_t dst_epg_id)
+delete_cmd::delete_cmd(HW::item<bool>& item, sclass_t sclass, sclass_t dclass)
: rpc_cmd(item)
- , m_src_epg_id(src_epg_id)
- , m_dst_epg_id(dst_epg_id)
+ , m_sclass(sclass)
+ , m_dclass(dclass)
{
}
bool
delete_cmd::operator==(const delete_cmd& other) const
{
- return ((m_src_epg_id == other.m_src_epg_id) &&
- (m_dst_epg_id == other.m_dst_epg_id));
+ return ((m_sclass == other.m_sclass) && (m_dclass == other.m_dclass));
}
rc_t
@@ -146,8 +141,8 @@ delete_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.is_add = 0;
payload.contract.acl_index = ~0;
- payload.contract.src_epg = m_src_epg_id;
- payload.contract.dst_epg = m_dst_epg_id;
+ payload.contract.sclass = m_sclass;
+ payload.contract.dclass = m_dclass;
VAPI_CALL(req.execute());
@@ -159,7 +154,7 @@ delete_cmd::to_string() const
{
std::ostringstream s;
s << "gbp-contract-delete: " << m_hw_item.to_string()
- << " src-epg-id:" << m_src_epg_id << " dst-epg-id:" << m_dst_epg_id;
+ << " src-epg-id:" << m_sclass << " dst-epg-id:" << m_dclass;
return (s.str());
}
diff --git a/extras/vom/vom/gbp_contract_cmds.hpp b/extras/vom/vom/gbp_contract_cmds.hpp
index 476a594ae3e..7108c53f77b 100644
--- a/extras/vom/vom/gbp_contract_cmds.hpp
+++ b/extras/vom/vom/gbp_contract_cmds.hpp
@@ -34,8 +34,8 @@ public:
* Constructor
*/
create_cmd(HW::item<bool>& item,
- epg_id_t src_epg_id,
- epg_id_t dst_epg_id,
+ sclass_t sclass,
+ sclass_t dclass,
const handle_t& acl,
const gbp_contract::gbp_rules_t& gbp_rules,
const gbp_contract::ethertype_set_t& allowed_ethertypes);
@@ -56,8 +56,8 @@ public:
bool operator==(const create_cmd& i) const;
private:
- const epg_id_t m_src_epg_id;
- const epg_id_t m_dst_epg_id;
+ const sclass_t m_sclass;
+ const sclass_t m_dclass;
const handle_t m_acl;
const gbp_contract::gbp_rules_t& m_gbp_rules;
const gbp_contract::ethertype_set_t& m_allowed_ethertypes;
@@ -72,7 +72,7 @@ public:
/**
* Constructor
*/
- delete_cmd(HW::item<bool>& item, epg_id_t src_epg_id, epg_id_t dst_epg_id);
+ delete_cmd(HW::item<bool>& item, sclass_t sclass, sclass_t dclass);
/**
* Issue the command to VPP/HW
@@ -90,8 +90,8 @@ public:
bool operator==(const delete_cmd& i) const;
private:
- const epg_id_t m_src_epg_id;
- const epg_id_t m_dst_epg_id;
+ const sclass_t m_sclass;
+ const sclass_t m_dclass;
};
/**
diff --git a/extras/vom/vom/gbp_endpoint.cpp b/extras/vom/vom/gbp_endpoint.cpp
index b39e9f934e6..20f966cfb20 100644
--- a/extras/vom/vom/gbp_endpoint.cpp
+++ b/extras/vom/vom/gbp_endpoint.cpp
@@ -78,7 +78,7 @@ gbp_endpoint::replay()
{
if (m_hdl) {
HW::enqueue(new gbp_endpoint_cmds::create_cmd(m_hdl, m_itf->handle(), m_ips,
- m_mac, m_epg->id()));
+ m_mac, m_epg->sclass()));
}
}
@@ -101,7 +101,7 @@ gbp_endpoint::update(const gbp_endpoint& r)
{
if (rc_t::OK != m_hdl.rc()) {
HW::enqueue(new gbp_endpoint_cmds::create_cmd(m_hdl, m_itf->handle(), m_ips,
- m_mac, m_epg->id()));
+ m_mac, m_epg->sclass()));
}
}
@@ -160,7 +160,7 @@ gbp_endpoint::event_handler::handle_populate(const client_db::key_t& key)
std::shared_ptr<interface> itf =
interface::find(payload.endpoint.sw_if_index);
std::shared_ptr<gbp_endpoint_group> epg =
- gbp_endpoint_group::find(payload.endpoint.epg_id);
+ gbp_endpoint_group::find(payload.endpoint.sclass);
mac_address_t mac = from_api(payload.endpoint.mac);
VOM_LOG(log_level_t::DEBUG) << "data: " << payload.endpoint.sw_if_index;
@@ -173,7 +173,7 @@ gbp_endpoint::event_handler::handle_populate(const client_db::key_t& key)
} else {
VOM_LOG(log_level_t::ERROR)
<< "no interface:" << payload.endpoint.sw_if_index
- << "or epg:" << payload.endpoint.epg_id;
+ << "or sclass:" << payload.endpoint.sclass;
}
}
}
diff --git a/extras/vom/vom/gbp_endpoint_cmds.cpp b/extras/vom/vom/gbp_endpoint_cmds.cpp
index 2732d1cc297..77c75488099 100644
--- a/extras/vom/vom/gbp_endpoint_cmds.cpp
+++ b/extras/vom/vom/gbp_endpoint_cmds.cpp
@@ -25,12 +25,12 @@ create_cmd::create_cmd(HW::item<handle_t>& item,
const handle_t& itf,
const std::vector<boost::asio::ip::address>& ip_addrs,
const mac_address_t& mac,
- epg_id_t epg_id)
+ sclass_t sclass)
: rpc_cmd(item)
, m_itf(itf)
, m_ip_addrs(ip_addrs)
, m_mac(mac)
- , m_epg_id(epg_id)
+ , m_sclass(sclass)
{
}
@@ -38,7 +38,7 @@ bool
create_cmd::operator==(const create_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_ip_addrs == other.m_ip_addrs) &&
- (m_mac == other.m_mac) && (m_epg_id == other.m_epg_id));
+ (m_mac == other.m_mac) && (m_sclass == other.m_sclass));
}
rc_t
@@ -50,7 +50,7 @@ create_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.endpoint.sw_if_index = m_itf.value();
- payload.endpoint.epg_id = m_epg_id;
+ payload.endpoint.sclass = m_sclass;
payload.endpoint.n_ips = m_ip_addrs.size();
for (n = 0; n < payload.endpoint.n_ips; n++) {
@@ -93,7 +93,7 @@ create_cmd::to_string() const
s << ip.to_string();
s << "] mac:" << m_mac;
- s << " epg-id:" << m_epg_id;
+ s << " slcass:" << m_sclass;
return (s.str());
}
diff --git a/extras/vom/vom/gbp_endpoint_cmds.hpp b/extras/vom/vom/gbp_endpoint_cmds.hpp
index e90fb66f04a..2aa56f8312e 100644
--- a/extras/vom/vom/gbp_endpoint_cmds.hpp
+++ b/extras/vom/vom/gbp_endpoint_cmds.hpp
@@ -25,8 +25,8 @@ namespace VOM {
namespace gbp_endpoint_cmds {
/**
-* A command class that creates or updates the GBP endpoint
-*/
+ * A command class that creates or updates the GBP endpoint
+ */
class create_cmd : public rpc_cmd<HW::item<handle_t>, vapi::Gbp_endpoint_add>
{
public:
@@ -37,7 +37,7 @@ public:
const handle_t& itf,
const std::vector<boost::asio::ip::address>& ip_addrs,
const mac_address_t& mac,
- epg_id_t epg_id);
+ sclass_t sclass);
/**
* Issue the command to VPP/HW
@@ -60,7 +60,7 @@ private:
const handle_t m_itf;
const std::vector<boost::asio::ip::address> m_ip_addrs;
const mac_address_t m_mac;
- const epg_id_t m_epg_id;
+ const sclass_t m_sclass;
};
/**
diff --git a/extras/vom/vom/gbp_endpoint_group.cpp b/extras/vom/vom/gbp_endpoint_group.cpp
index d549a067e67..abec585c744 100644
--- a/extras/vom/vom/gbp_endpoint_group.cpp
+++ b/extras/vom/vom/gbp_endpoint_group.cpp
@@ -45,13 +45,14 @@ gbp_endpoint_group::retention_t::to_string() const
return std::to_string(remote_ep_timeout);
}
-gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id,
+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_sclass(0xffff)
+ , m_vnid(vnid)
+ , m_sclass(sclass)
, m_itf(itf.singular())
, m_rd(rd.singular())
, m_bd(bd.singular())
@@ -59,40 +60,25 @@ gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id,
{
}
-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_sclass(0xffff)
- , m_itf()
- , m_rd(rd.singular())
- , m_bd(bd.singular())
- , m_retention()
-{
-}
-
-gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id,
- uint16_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_itf()
, m_rd(rd.singular())
, m_bd(bd.singular())
, m_retention()
{
}
-gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id,
- uint16_t sclass,
+gbp_endpoint_group::gbp_endpoint_group(sclass_t sclass,
const gbp_route_domain& rd,
const gbp_bridge_domain& bd)
: m_hw(false)
- , m_epg_id(epg_id)
+ , m_vnid(~0)
, m_sclass(sclass)
, m_itf()
, m_rd(rd.singular())
@@ -103,7 +89,7 @@ gbp_endpoint_group::gbp_endpoint_group(epg_id_t epg_id,
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)
@@ -121,13 +107,13 @@ gbp_endpoint_group::~gbp_endpoint_group()
const gbp_endpoint_group::key_t
gbp_endpoint_group::key() const
{
- return (m_epg_id);
+ return (m_sclass);
}
-epg_id_t
-gbp_endpoint_group::id() const
+vnid_t
+gbp_endpoint_group::vnid() const
{
- return (m_epg_id);
+ return (m_vnid);
}
void
@@ -136,10 +122,16 @@ gbp_endpoint_group::set(const retention_t& retention)
m_retention = retention;
}
+sclass_t
+gbp_endpoint_group::sclass() const
+{
+ return (m_sclass);
+}
+
bool
gbp_endpoint_group::operator==(const gbp_endpoint_group& gg) const
{
- return (key() == gg.key() && (m_sclass == gg.m_sclass) &&
+ 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));
}
@@ -148,7 +140,7 @@ 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();
}
@@ -158,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_sclass, m_bd->id(), m_rd->id(), m_retention,
+ m_hw, m_vnid, m_sclass, m_bd->id(), m_rd->id(), m_retention,
(m_itf ? m_itf->handle() : handle_t::INVALID)));
}
}
@@ -168,7 +160,7 @@ gbp_endpoint_group::to_string() const
{
std::ostringstream s;
s << "gbp-endpoint-group:["
- << "epg:" << m_epg_id << ", sclass:" << m_sclass << ", "
+ << "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() << "]";
@@ -181,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_sclass, m_bd->id(), m_rd->id(), m_retention,
+ m_hw, m_vnid, m_sclass, m_bd->id(), m_rd->id(), m_retention,
(m_itf ? m_itf->handle() : handle_t::INVALID)));
}
}
@@ -259,13 +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, payload.epg.sclass, *itf, *rd,
+ 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, payload.epg.sclass, *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();
diff --git a/extras/vom/vom/gbp_endpoint_group.hpp b/extras/vom/vom/gbp_endpoint_group.hpp
index d6af570b7a9..5c061a900b3 100644
--- a/extras/vom/vom/gbp_endpoint_group.hpp
+++ b/extras/vom/vom/gbp_endpoint_group.hpp
@@ -28,7 +28,8 @@ namespace VOM {
/**
* EPG IDs are 32 bit integers
*/
-typedef uint32_t epg_id_t;
+typedef uint32_t vnid_t;
+typedef uint16_t sclass_t;
/**
* A entry in the ARP termination table of a Bridge Domain
@@ -59,25 +60,21 @@ public:
/**
* The key for a GBP endpoint group is its ID
*/
- typedef epg_id_t key_t;
+ typedef sclass_t key_t;
/**
* Construct a GBP endpoint_group
*/
- gbp_endpoint_group(epg_id_t epg_id,
+ gbp_endpoint_group(vnid_t vnid,
+ sclass_t sclass,
const interface& itf,
const gbp_route_domain& rd,
const gbp_bridge_domain& bd);
- gbp_endpoint_group(epg_id_t epg_id,
+ gbp_endpoint_group(vnid_t vnid,
+ sclass_t sclass,
const gbp_route_domain& rd,
const gbp_bridge_domain& bd);
- gbp_endpoint_group(epg_id_t epg_id,
- uint16_t sclass,
- const interface& itf,
- const gbp_route_domain& rd,
- const gbp_bridge_domain& bd);
- gbp_endpoint_group(epg_id_t epg_id,
- uint16_t sclass,
+ gbp_endpoint_group(sclass_t sclass,
const gbp_route_domain& rd,
const gbp_bridge_domain& bd);
@@ -129,7 +126,8 @@ public:
/**
* Get the ID of the EPG
*/
- epg_id_t id() const;
+ vnid_t vnid() const;
+ sclass_t sclass() const;
const std::shared_ptr<gbp_route_domain> get_route_domain() const;
const std::shared_ptr<gbp_bridge_domain> get_bridge_domain() const;
@@ -206,7 +204,7 @@ private:
/**
* The EPG ID
*/
- epg_id_t m_epg_id;
+ vnid_t m_vnid;
/**
* The SClass on the wire
diff --git a/extras/vom/vom/gbp_endpoint_group_cmds.cpp b/extras/vom/vom/gbp_endpoint_group_cmds.cpp
index a4f86603cb8..c5618602550 100644
--- a/extras/vom/vom/gbp_endpoint_group_cmds.cpp
+++ b/extras/vom/vom/gbp_endpoint_group_cmds.cpp
@@ -19,14 +19,14 @@ namespace VOM {
namespace gbp_endpoint_group_cmds {
create_cmd::create_cmd(HW::item<bool>& item,
- epg_id_t epg_id,
+ vnid_t vnid,
uint16_t sclass,
uint32_t bd_id,
route::table_id_t rd_id,
const gbp_endpoint_group::retention_t& retention,
const handle_t& itf)
: rpc_cmd(item)
- , m_epg_id(epg_id)
+ , m_vnid(vnid)
, m_sclass(sclass)
, m_bd_id(bd_id)
, m_rd_id(rd_id)
@@ -39,7 +39,7 @@ bool
create_cmd::operator==(const create_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_bd_id == other.m_bd_id) &&
- (m_rd_id == other.m_rd_id) && (m_epg_id == other.m_epg_id) &&
+ (m_rd_id == other.m_rd_id) && (m_vnid == other.m_vnid) &&
(m_retention == other.m_retention));
}
@@ -50,7 +50,7 @@ create_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.epg.uplink_sw_if_index = m_itf.value();
- payload.epg.epg_id = m_epg_id;
+ payload.epg.vnid = m_vnid;
payload.epg.sclass = m_sclass;
payload.epg.bd_id = m_bd_id;
payload.epg.rd_id = m_rd_id;
@@ -66,22 +66,22 @@ create_cmd::to_string() const
{
std::ostringstream s;
s << "gbp-endpoint-group-create: " << m_hw_item.to_string()
- << " epg-id:" << m_epg_id << " bd-id:" << m_bd_id << " rd-id:" << m_rd_id
+ << " vnid:" << m_vnid << " bd-id:" << m_bd_id << " rd-id:" << m_rd_id
<< " itf:" << m_itf;
return (s.str());
}
-delete_cmd::delete_cmd(HW::item<bool>& item, epg_id_t epg_id)
+delete_cmd::delete_cmd(HW::item<bool>& item, sclass_t sclass)
: rpc_cmd(item)
- , m_epg_id(epg_id)
+ , m_sclass(sclass)
{
}
bool
delete_cmd::operator==(const delete_cmd& other) const
{
- return (m_epg_id == other.m_epg_id);
+ return (m_sclass == other.m_sclass);
}
rc_t
@@ -90,7 +90,7 @@ delete_cmd::issue(connection& con)
msg_t req(con.ctx(), std::ref(*this));
auto& payload = req.get_request().get_payload();
- payload.epg_id = m_epg_id;
+ payload.sclass = m_sclass;
VAPI_CALL(req.execute());
@@ -102,7 +102,7 @@ delete_cmd::to_string() const
{
std::ostringstream s;
s << "gbp-endpoint-group-delete: " << m_hw_item.to_string()
- << " epg:" << m_epg_id;
+ << " sclass:" << m_sclass;
return (s.str());
}
diff --git a/extras/vom/vom/gbp_endpoint_group_cmds.hpp b/extras/vom/vom/gbp_endpoint_group_cmds.hpp
index b735b5c132d..fa892726bf3 100644
--- a/extras/vom/vom/gbp_endpoint_group_cmds.hpp
+++ b/extras/vom/vom/gbp_endpoint_group_cmds.hpp
@@ -34,7 +34,7 @@ public:
* Constructor
*/
create_cmd(HW::item<bool>& item,
- epg_id_t epg_id,
+ vnid_t vnid,
uint16_t sclass,
uint32_t bd_id,
route::table_id_t rd_id,
@@ -57,7 +57,7 @@ public:
bool operator==(const create_cmd& i) const;
private:
- const epg_id_t m_epg_id;
+ const vnid_t m_vnid;
const uint16_t m_sclass;
const uint32_t m_bd_id;
const route::table_id_t m_rd_id;
@@ -74,7 +74,7 @@ public:
/**
* Constructor
*/
- delete_cmd(HW::item<bool>& item, epg_id_t epg_id);
+ delete_cmd(HW::item<bool>& item, sclass_t sclass);
/**
* Issue the command to VPP/HW
@@ -92,7 +92,7 @@ public:
bool operator==(const delete_cmd& i) const;
private:
- const epg_id_t m_epg_id;
+ const sclass_t m_sclass;
};
/**
diff --git a/extras/vom/vom/gbp_recirc.cpp b/extras/vom/vom/gbp_recirc.cpp
index 250e3048f8a..19cb2da60e2 100644
--- a/extras/vom/vom/gbp_recirc.cpp
+++ b/extras/vom/vom/gbp_recirc.cpp
@@ -88,7 +88,7 @@ gbp_recirc::replay()
{
if (m_hw) {
HW::enqueue(new gbp_recirc_cmds::create_cmd(
- m_hw, m_itf->handle(), (m_type == type_t::EXTERNAL), m_epg->id()));
+ m_hw, m_itf->handle(), (m_type == type_t::EXTERNAL), m_epg->sclass()));
}
}
@@ -107,7 +107,7 @@ gbp_recirc::update(const gbp_recirc& r)
{
if (rc_t::OK != m_hw.rc()) {
HW::enqueue(new gbp_recirc_cmds::create_cmd(
- m_hw, m_itf->handle(), (m_type == type_t::EXTERNAL), m_epg->id()));
+ m_hw, m_itf->handle(), (m_type == type_t::EXTERNAL), m_epg->sclass()));
}
}
@@ -162,10 +162,10 @@ gbp_recirc::event_handler::handle_populate(const client_db::key_t& key)
std::shared_ptr<interface> itf =
interface::find(payload.recirc.sw_if_index);
std::shared_ptr<gbp_endpoint_group> epg =
- gbp_endpoint_group::find(payload.recirc.epg_id);
+ gbp_endpoint_group::find(payload.recirc.sclass);
VOM_LOG(log_level_t::DEBUG) << "data: [" << payload.recirc.sw_if_index
- << ", " << payload.recirc.epg_id << "]";
+ << ", " << payload.recirc.sclass << "]";
if (itf && epg) {
gbp_recirc recirc(
diff --git a/extras/vom/vom/gbp_recirc_cmds.cpp b/extras/vom/vom/gbp_recirc_cmds.cpp
index b14697c9f6f..90b931c0ced 100644
--- a/extras/vom/vom/gbp_recirc_cmds.cpp
+++ b/extras/vom/vom/gbp_recirc_cmds.cpp
@@ -21,11 +21,11 @@ namespace gbp_recirc_cmds {
create_cmd::create_cmd(HW::item<bool>& item,
const handle_t& itf,
bool is_ext,
- epg_id_t epg_id)
+ sclass_t sclass)
: rpc_cmd(item)
, m_itf(itf)
, m_is_ext(is_ext)
- , m_epg_id(epg_id)
+ , m_sclass(sclass)
{
}
@@ -33,7 +33,7 @@ bool
create_cmd::operator==(const create_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_is_ext == other.m_is_ext) &&
- (m_epg_id == other.m_epg_id));
+ (m_sclass == other.m_sclass));
}
rc_t
@@ -44,7 +44,7 @@ create_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.is_add = 1;
payload.recirc.sw_if_index = m_itf.value();
- payload.recirc.epg_id = m_epg_id;
+ payload.recirc.sclass = m_sclass;
payload.recirc.is_ext = m_is_ext;
VAPI_CALL(req.execute());
@@ -57,7 +57,7 @@ create_cmd::to_string() const
{
std::ostringstream s;
s << "gbp-recirc-create: " << m_hw_item.to_string() << " itf:" << m_itf
- << " ext:" << m_is_ext << " epg-id:" << m_epg_id;
+ << " ext:" << m_is_ext << " sclass:" << m_sclass;
return (s.str());
}
@@ -82,7 +82,7 @@ delete_cmd::issue(connection& con)
auto& payload = req.get_request().get_payload();
payload.is_add = 0;
payload.recirc.sw_if_index = m_itf.value();
- payload.recirc.epg_id = ~0;
+ payload.recirc.sclass = ~0;
VAPI_CALL(req.execute());
diff --git a/extras/vom/vom/gbp_recirc_cmds.hpp b/extras/vom/vom/gbp_recirc_cmds.hpp
index 3c25d4495ca..9d95bf16195 100644
--- a/extras/vom/vom/gbp_recirc_cmds.hpp
+++ b/extras/vom/vom/gbp_recirc_cmds.hpp
@@ -36,7 +36,7 @@ public:
create_cmd(HW::item<bool>& item,
const handle_t& itf,
bool is_ext,
- epg_id_t epg_id);
+ sclass_t sclass);
/**
* Issue the command to VPP/HW
@@ -56,7 +56,7 @@ public:
private:
const handle_t m_itf;
bool m_is_ext;
- const epg_id_t m_epg_id;
+ const sclass_t m_sclass;
};
/**
diff --git a/extras/vom/vom/gbp_subnet.cpp b/extras/vom/vom/gbp_subnet.cpp
index a6bb55071e9..304da3ef496 100644
--- a/extras/vom/vom/gbp_subnet.cpp
+++ b/extras/vom/vom/gbp_subnet.cpp
@@ -120,7 +120,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->id() : ~0)));
+ (m_epg ? m_epg->sclass() : ~0)));
}
}
@@ -147,7 +147,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->id() : ~0)));
+ (m_epg ? m_epg->sclass() : ~0)));
} else {
if (m_type != r.m_type) {
m_epg = r.m_epg;
@@ -157,7 +157,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->id() : ~0)));
+ (m_epg ? m_epg->sclass() : ~0)));
}
}
}
@@ -230,7 +230,7 @@ gbp_subnet::event_handler::handle_populate(const client_db::key_t& key)
}
case GBP_API_SUBNET_L3_OUT: {
std::shared_ptr<gbp_endpoint_group> epg =
- gbp_endpoint_group::find(payload.subnet.epg_id);
+ gbp_endpoint_group::find(payload.subnet.sclass);
gbp_subnet gs(*rd, pfx, *epg);
OM::commit(key, gs);
@@ -241,7 +241,7 @@ gbp_subnet::event_handler::handle_populate(const client_db::key_t& key)
std::shared_ptr<interface> itf =
interface::find(payload.subnet.sw_if_index);
std::shared_ptr<gbp_endpoint_group> epg =
- gbp_endpoint_group::find(payload.subnet.epg_id);
+ gbp_endpoint_group::find(payload.subnet.sclass);
if (itf && epg) {
std::shared_ptr<gbp_recirc> recirc = gbp_recirc::find(itf->key());
diff --git a/extras/vom/vom/gbp_subnet_cmds.cpp b/extras/vom/vom/gbp_subnet_cmds.cpp
index 3dcd652dd19..cf2801c8d63 100644
--- a/extras/vom/vom/gbp_subnet_cmds.cpp
+++ b/extras/vom/vom/gbp_subnet_cmds.cpp
@@ -24,13 +24,13 @@ create_cmd::create_cmd(HW::item<bool>& item,
const route::prefix_t& prefix,
const gbp_subnet::type_t& type,
const handle_t& itf,
- epg_id_t epg_id)
+ sclass_t sclass)
: rpc_cmd(item)
, m_rd(rd)
, m_prefix(prefix)
, m_type(type)
, m_itf(itf)
- , m_epg_id(epg_id)
+ , m_sclass(sclass)
{
}
@@ -39,7 +39,7 @@ create_cmd::operator==(const create_cmd& other) const
{
return ((m_itf == other.m_itf) && (m_rd == other.m_rd) &&
(m_prefix == other.m_prefix) && (m_type == other.m_type) &&
- (m_itf == other.m_itf) && (m_epg_id == other.m_epg_id));
+ (m_itf == other.m_itf) && (m_sclass == other.m_sclass));
}
static vapi_enum_gbp_subnet_type
@@ -65,7 +65,7 @@ create_cmd::issue(connection& con)
payload.subnet.type = gbp_subnet_type_to_api(m_type);
payload.subnet.rd_id = m_rd;
payload.subnet.sw_if_index = m_itf.value();
- payload.subnet.epg_id = m_epg_id;
+ payload.subnet.sclass = m_sclass;
payload.subnet.prefix = to_api(m_prefix);
VAPI_CALL(req.execute());
@@ -79,7 +79,7 @@ create_cmd::to_string() const
std::ostringstream s;
s << "gbp-subnet-create: " << m_hw_item.to_string() << "type:" << m_type
<< ", " << m_rd << ":" << m_prefix.to_string() << " itf:" << m_itf
- << " epg-id:" << m_epg_id;
+ << " sclass:" << m_sclass;
return (s.str());
}
diff --git a/extras/vom/vom/gbp_subnet_cmds.hpp b/extras/vom/vom/gbp_subnet_cmds.hpp
index da2a4c509d1..b78699e5bf5 100644
--- a/extras/vom/vom/gbp_subnet_cmds.hpp
+++ b/extras/vom/vom/gbp_subnet_cmds.hpp
@@ -25,8 +25,8 @@ namespace VOM {
namespace gbp_subnet_cmds {
/**
-* A command class that creates or updates the GBP subnet
-*/
+ * A command class that creates or updates the GBP subnet
+ */
class create_cmd : public rpc_cmd<HW::item<bool>, vapi::Gbp_subnet_add_del>
{
public:
@@ -38,7 +38,7 @@ public:
const route::prefix_t& prefix,
const gbp_subnet::type_t& type,
const handle_t& itf,
- epg_id_t epg_id);
+ sclass_t sclass);
/**
* Issue the command to VPP/HW
@@ -60,7 +60,7 @@ private:
const route::prefix_t m_prefix;
const gbp_subnet::type_t& m_type;
const handle_t m_itf;
- const epg_id_t m_epg_id;
+ const sclass_t m_sclass;
};
/**
diff --git a/src/plugins/gbp/CMakeLists.txt b/src/plugins/gbp/CMakeLists.txt
index 02c4c17beb2..6789a9c1ade 100644
--- a/src/plugins/gbp/CMakeLists.txt
+++ b/src/plugins/gbp/CMakeLists.txt
@@ -33,8 +33,6 @@ add_vpp_plugin(gbp
gbp_recirc.c
gbp_route_domain.c
gbp_scanner.c
- gbp_sclass.c
- gbp_sclass_node.c
gbp_subnet.c
gbp_vxlan.c
gbp_vxlan_node.c
@@ -47,7 +45,6 @@ add_vpp_plugin(gbp
gbp_policy_dpo.c
gbp_policy_node.c
gbp_vxlan_node.c
- gbp_sclass_node.c
API_FILES
gbp.api
diff --git a/src/plugins/gbp/gbp.api b/src/plugins/gbp/gbp.api
index 8343e228f19..342c98bb6b3 100644
--- a/src/plugins/gbp/gbp.api
+++ b/src/plugins/gbp/gbp.api
@@ -114,7 +114,7 @@ typedef gbp_endpoint_tun
typedef gbp_endpoint
{
u32 sw_if_index;
- u16 epg_id;
+ u16 sclass;
vl_api_gbp_endpoint_flags_t flags;
vl_api_mac_address_t mac;
vl_api_gbp_endpoint_tun_t tun;
@@ -164,7 +164,7 @@ typedef gbp_endpoint_retention
typeonly define gbp_endpoint_group
{
- u16 epg_id;
+ u32 vnid;
u16 sclass;
u32 bd_id;
u32 rd_id;
@@ -182,7 +182,7 @@ autoreply define gbp_endpoint_group_del
{
u32 client_index;
u32 context;
- u16 epg_id;
+ u16 sclass;
};
define gbp_endpoint_group_dump
@@ -200,7 +200,7 @@ define gbp_endpoint_group_details
typeonly define gbp_recirc
{
u32 sw_if_index;
- u16 epg_id;
+ u16 sclass;
u8 is_ext;
};
@@ -236,7 +236,7 @@ typeonly define gbp_subnet
{
u32 rd_id;
u32 sw_if_index;
- u16 epg_id;
+ u16 sclass;
vl_api_gbp_subnet_type_t type;
vl_api_prefix_t prefix;
};
@@ -298,8 +298,8 @@ typedef gbp_rule
typedef gbp_contract
{
- u16 src_epg;
- u16 dst_epg;
+ u16 sclass;
+ u16 dclass;
u32 acl_index;
u8 n_rules;
vl_api_gbp_rule_t rules[n_rules];
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index ffdae2869bf..3f35555efd1 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -165,7 +165,7 @@ vl_api_gbp_endpoint_add_t_handler (vl_api_gbp_endpoint_add_t * mp)
rv = gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
sw_if_index, ips, &mac,
INDEX_INVALID, INDEX_INVALID,
- ntohs (mp->endpoint.epg_id),
+ ntohs (mp->endpoint.sclass),
gef, &tun_src, &tun_dst, &handle);
}
else
@@ -173,7 +173,7 @@ vl_api_gbp_endpoint_add_t_handler (vl_api_gbp_endpoint_add_t * mp)
rv = gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
sw_if_index, ips, &mac,
INDEX_INVALID, INDEX_INVALID,
- ntohs (mp->endpoint.epg_id),
+ ntohs (mp->endpoint.sclass),
gef, NULL, NULL, &handle);
}
vec_free (ips);
@@ -241,7 +241,7 @@ gbp_endpoint_send_details (index_t gei, void *args)
{
mp->endpoint.sw_if_index = ntohl (gef->gef_itf);
}
- mp->endpoint.epg_id = ntohs (ge->ge_fwd.gef_epg_id);
+ mp->endpoint.sclass = ntohs (ge->ge_fwd.gef_sclass);
mp->endpoint.n_ips = n_ips;
mp->endpoint.flags = gbp_endpoint_flags_encode (gef->gef_flags);
mp->handle = htonl (gei);
@@ -293,7 +293,7 @@ static void
gbp_retention_decode (&mp->epg.retention, &retention);
- rv = gbp_endpoint_group_add_and_lock (ntohs (mp->epg.epg_id),
+ rv = gbp_endpoint_group_add_and_lock (ntohl (mp->epg.vnid),
ntohs (mp->epg.sclass),
ntohl (mp->epg.bd_id),
ntohl (mp->epg.rd_id),
@@ -310,7 +310,7 @@ static void
vl_api_gbp_endpoint_group_del_reply_t *rmp;
int rv = 0;
- rv = gbp_endpoint_group_delete (ntohs (mp->epg_id));
+ rv = gbp_endpoint_group_delete (ntohs (mp->sclass));
REPLY_MACRO (VL_API_GBP_ENDPOINT_GROUP_DEL_REPLY + GBP_MSG_BASE);
}
@@ -425,7 +425,7 @@ vl_api_gbp_subnet_add_del_t_handler (vl_api_gbp_subnet_add_del_t * mp)
rv = gbp_subnet_add (ntohl (mp->subnet.rd_id),
&pfx, type,
ntohl (mp->subnet.sw_if_index),
- ntohs (mp->subnet.epg_id));
+ ntohs (mp->subnet.sclass));
else
rv = gbp_subnet_del (ntohl (mp->subnet.rd_id), &pfx);
@@ -463,7 +463,7 @@ static walk_rc_t
gbp_subnet_send_details (u32 rd_id,
const fib_prefix_t * pfx,
gbp_subnet_type_t type,
- u32 sw_if_index, epg_id_t epg, void *args)
+ u32 sw_if_index, sclass_t sclass, void *args)
{
vl_api_gbp_subnet_details_t *mp;
gbp_walk_ctx_t *ctx;
@@ -479,7 +479,7 @@ gbp_subnet_send_details (u32 rd_id,
mp->subnet.type = gub_subnet_type_to_api (type);
mp->subnet.sw_if_index = ntohl (sw_if_index);
- mp->subnet.epg_id = ntohs (epg);
+ mp->subnet.sclass = ntohs (sclass);
mp->subnet.rd_id = ntohl (rd_id);
ip_prefix_encode (pfx, &mp->subnet.prefix);
@@ -521,7 +521,7 @@ gbp_endpoint_group_send_details (gbp_endpoint_group_t * gg, void *args)
mp->context = ctx->context;
mp->epg.uplink_sw_if_index = ntohl (gg->gg_uplink_sw_if_index);
- mp->epg.epg_id = ntohs (gg->gg_id);
+ mp->epg.vnid = ntohl (gg->gg_vnid);
mp->epg.sclass = ntohs (gg->gg_sclass);
mp->epg.bd_id = ntohl (gbp_endpoint_group_get_bd_id (gg));
mp->epg.rd_id = ntohl (gbp_route_domain_get_rd_id (gg->gg_rd));
@@ -647,7 +647,7 @@ vl_api_gbp_recirc_add_del_t_handler (vl_api_gbp_recirc_add_del_t * mp)
if (mp->is_add)
rv = gbp_recirc_add (sw_if_index,
- ntohs (mp->recirc.epg_id), mp->recirc.is_ext);
+ ntohs (mp->recirc.sclass), mp->recirc.is_ext);
else
rv = gbp_recirc_delete (sw_if_index);
@@ -671,7 +671,7 @@ gbp_recirc_send_details (gbp_recirc_t * gr, void *args)
mp->_vl_msg_id = ntohs (VL_API_GBP_RECIRC_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
- mp->recirc.epg_id = ntohs (gr->gr_epg);
+ mp->recirc.sclass = ntohs (gr->gr_sclass);
mp->recirc.sw_if_index = ntohl (gr->gr_sw_if_index);
mp->recirc.is_ext = gr->gr_is_ext;
@@ -959,14 +959,14 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
allowed_ethertypes[ii] = et[ii];
}
- rv = gbp_contract_update (ntohs (mp->contract.src_epg),
- ntohs (mp->contract.dst_epg),
+ rv = gbp_contract_update (ntohs (mp->contract.sclass),
+ ntohs (mp->contract.dclass),
ntohl (mp->contract.acl_index),
rules, allowed_ethertypes);
}
else
- rv = gbp_contract_delete (ntohs (mp->contract.src_epg),
- ntohs (mp->contract.dst_epg));
+ rv = gbp_contract_delete (ntohs (mp->contract.sclass),
+ ntohs (mp->contract.dclass));
out:
REPLY_MACRO (VL_API_GBP_CONTRACT_ADD_DEL_REPLY + GBP_MSG_BASE);
@@ -987,9 +987,9 @@ gbp_contract_send_details (gbp_contract_t * gbpc, void *args)
mp->_vl_msg_id = ntohs (VL_API_GBP_CONTRACT_DETAILS + GBP_MSG_BASE);
mp->context = ctx->context;
- mp->contract.src_epg = ntohs (gbpc->gc_key.gck_src);
- mp->contract.dst_epg = ntohs (gbpc->gc_key.gck_dst);
- // mp->contract.acl_index = ntohl (gbpc->gc_value.gc_acl_index);
+ mp->contract.sclass = ntohs (gbpc->gc_key.gck_src);
+ mp->contract.dclass = ntohs (gbpc->gc_key.gck_dst);
+ mp->contract.acl_index = ntohl (gbpc->gc_acl_index);
vl_api_send_msg (ctx->reg, (u8 *) mp);
diff --git a/src/plugins/gbp/gbp_bridge_domain.c b/src/plugins/gbp/gbp_bridge_domain.c
index 24bfb254ad4..02ed97d7452 100644
--- a/src/plugins/gbp/gbp_bridge_domain.c
+++ b/src/plugins/gbp/gbp_bridge_domain.c
@@ -15,7 +15,6 @@
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_endpoint.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <plugins/gbp/gbp_learn.h>
#include <vnet/dpo/dvr_dpo.h>
@@ -211,14 +210,12 @@ gbp_bridge_domain_add_and_lock (u32 bd_id,
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L2_BRIDGE, gb->gb_uu_fwd_sw_if_index,
bd_index, L2_BD_PORT_TYPE_UU_FWD, 0, 0);
- gbp_sclass_enable_l2 (gb->gb_uu_fwd_sw_if_index);
}
if (~0 != gb->gb_bm_flood_sw_if_index)
{
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L2_BRIDGE, gb->gb_bm_flood_sw_if_index,
bd_index, L2_BD_PORT_TYPE_NORMAL, 0, 0);
- gbp_sclass_enable_l2 (gb->gb_bm_flood_sw_if_index);
gbp_learn_enable (gb->gb_bm_flood_sw_if_index, GBP_LEARN_MODE_L2);
}
@@ -269,14 +266,12 @@ gbp_bridge_domain_unlock (index_t index)
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L3, gb->gb_uu_fwd_sw_if_index,
gb->gb_bd_index, L2_BD_PORT_TYPE_UU_FWD, 0, 0);
- gbp_sclass_disable_l2 (gb->gb_uu_fwd_sw_if_index);
}
if (~0 != gb->gb_bm_flood_sw_if_index)
{
set_int_l2_mode (vlib_get_main (), vnet_get_main (),
MODE_L3, gb->gb_bm_flood_sw_if_index,
gb->gb_bd_index, L2_BD_PORT_TYPE_NORMAL, 0, 0);
- gbp_sclass_disable_l2 (gb->gb_bm_flood_sw_if_index);
gbp_learn_enable (gb->gb_bm_flood_sw_if_index, GBP_LEARN_MODE_L2);
}
diff --git a/src/plugins/gbp/gbp_classify_node.c b/src/plugins/gbp/gbp_classify_node.c
index 43fea769cce..1b2cb0a2bc7 100644
--- a/src/plugins/gbp/gbp_classify_node.c
+++ b/src/plugins/gbp/gbp_classify_node.c
@@ -33,7 +33,7 @@
typedef struct gbp_classify_trace_t_
{
/* per-pkt trace data */
- epg_id_t src_epg;
+ sclass_t sclass;
} gbp_classify_trace_t;
/*
@@ -61,9 +61,10 @@ gbp_classify_inline (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
- u32 next0, bi0, src_epg, sw_if_index0;
+ u32 next0, bi0, sw_if_index0;
const gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
bi0 = from[0];
to_next[0] = bi0;
@@ -79,7 +80,7 @@ gbp_classify_inline (vlib_main_t * vm,
if (GBP_SRC_CLASSIFY_NULL == type)
{
- src_epg = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
next0 =
vnet_l2_feature_next (b0, gscm->l2_input_feat_next[type],
L2INPUT_FEAT_GBP_NULL_CLASSIFY);
@@ -139,18 +140,18 @@ gbp_classify_inline (vlib_main_t * vm,
}
if (PREDICT_TRUE (NULL != ge0))
- src_epg = ge0->ge_fwd.gef_epg_id;
+ sclass0 = ge0->ge_fwd.gef_sclass;
else
- src_epg = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
}
- vnet_buffer2 (b0)->gbp.src_epg = src_epg;
+ vnet_buffer2 (b0)->gbp.sclass = sclass0;
if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
{
gbp_classify_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = src_epg;
+ t->sclass = sclass0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
@@ -205,7 +206,7 @@ format_gbp_classify_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_classify_trace_t *t = va_arg (*args, gbp_classify_trace_t *);
- s = format (s, "src-epg:%d", t->src_epg);
+ s = format (s, "sclass:%d", t->sclass);
return s;
}
@@ -342,7 +343,7 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
ip4_header_t *ip4_0;
ip6_header_t *ip6_0;
vlib_buffer_t *b0;
- epg_id_t src_epg0;
+ sclass_t sclass0;
bi0 = from[0];
to_next[0] = bi0;
@@ -383,7 +384,7 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
break;
default:
/* not IP so no LPM classify possible */
- src_epg0 = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
goto trace;
}
}
@@ -418,7 +419,7 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
else
{
/* not IP so no LPM classify possible */
- src_epg0 = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
goto trace;
}
lb0 = load_balance_get (lbi0);
@@ -427,23 +428,23 @@ gbp_lpm_classify_inline (vlib_main_t * vm,
if (gbp_policy_dpo_type == dpo0->dpoi_type)
{
gpd0 = gbp_policy_dpo_get (dpo0->dpoi_index);
- src_epg0 = gpd0->gpd_epg;
+ sclass0 = gpd0->gpd_sclass;
}
else
{
/* could not classify => drop */
- src_epg0 = EPG_INVALID;
+ sclass0 = SCLASS_INVALID;
next0 = GPB_LPM_CLASSIFY_DROP;
}
trace:
- vnet_buffer2 (b0)->gbp.src_epg = src_epg0;
+ vnet_buffer2 (b0)->gbp.sclass = sclass0;
if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
{
gbp_classify_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = src_epg0;
+ t->sclass = sclass0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
diff --git a/src/plugins/gbp/gbp_contract.c b/src/plugins/gbp/gbp_contract.c
index f7b8b6474c5..805e9b23d09 100644
--- a/src/plugins/gbp/gbp_contract.c
+++ b/src/plugins/gbp/gbp_contract.c
@@ -377,7 +377,7 @@ gbp_contract_next_hop_resolve (index_t gui, index_t gnhi)
gbd->gb_uu_fwd_sw_if_index,
ips,
&gnh->gnh_mac,
- gnh->gnh_bd, gnh->gnh_rd, EPG_INVALID,
+ gnh->gnh_bd, gnh->gnh_rd, SCLASS_INVALID,
GBP_ENDPOINT_FLAG_NONE, NULL, NULL,
&gnh->gnh_ge);
@@ -433,8 +433,8 @@ gbp_contract_mk_lbs (index_t * guis)
}
int
-gbp_contract_update (epg_id_t src_epg,
- epg_id_t dst_epg,
+gbp_contract_update (sclass_t sclass,
+ sclass_t dclass,
u32 acl_index, index_t * rules, u16 * allowed_ethertypes)
{
gbp_main_t *gm = &gbp_main;
@@ -444,8 +444,8 @@ gbp_contract_update (epg_id_t src_epg,
uword *p;
gbp_contract_key_t key = {
- .gck_src = src_epg,
- .gck_dst = dst_epg,
+ .gck_src = sclass,
+ .gck_dst = dclass,
};
if (~0 == gm->gbp_acl_user_id)
@@ -483,7 +483,7 @@ gbp_contract_update (epg_id_t src_epg,
gc->gc_acl_index = acl_index;
gc->gc_lc_index =
gm->acl_plugin.get_lookup_context_index (gm->gbp_acl_user_id,
- src_epg, dst_epg);
+ sclass, dclass);
vec_add1 (acl_vec, gc->gc_acl_index);
gm->acl_plugin.set_acl_vec_for_context (gc->gc_lc_index, acl_vec);
@@ -493,11 +493,11 @@ gbp_contract_update (epg_id_t src_epg,
}
int
-gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg)
+gbp_contract_delete (sclass_t sclass, sclass_t dclass)
{
gbp_contract_key_t key = {
- .gck_src = src_epg,
- .gck_dst = dst_epg,
+ .gck_src = sclass,
+ .gck_dst = dclass,
};
gbp_contract_t *gc;
uword *p;
@@ -538,7 +538,7 @@ static clib_error_t *
gbp_contract_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
- epg_id_t src_epg_id = EPG_INVALID, dst_epg_id = EPG_INVALID;
+ sclass_t sclass = SCLASS_INVALID, dclass = SCLASS_INVALID;
u32 acl_index = ~0;
u8 add = 1;
@@ -548,9 +548,9 @@ gbp_contract_cli (vlib_main_t * vm,
add = 1;
else if (unformat (input, "del"))
add = 0;
- else if (unformat (input, "src-epg %d", &src_epg_id))
+ else if (unformat (input, "src-epg %d", &sclass))
;
- else if (unformat (input, "dst-epg %d", &dst_epg_id))
+ else if (unformat (input, "dst-epg %d", &dclass))
;
else if (unformat (input, "acl-index %d", &acl_index))
;
@@ -558,18 +558,18 @@ gbp_contract_cli (vlib_main_t * vm,
break;
}
- if (EPG_INVALID == src_epg_id)
+ if (SCLASS_INVALID == sclass)
return clib_error_return (0, "Source EPG-ID must be specified");
- if (EPG_INVALID == dst_epg_id)
+ if (SCLASS_INVALID == dclass)
return clib_error_return (0, "Destination EPG-ID must be specified");
if (add)
{
- gbp_contract_update (src_epg_id, dst_epg_id, acl_index, NULL, NULL);
+ gbp_contract_update (sclass, dclass, acl_index, NULL, NULL);
}
else
{
- gbp_contract_delete (src_epg_id, dst_epg_id);
+ gbp_contract_delete (sclass, dclass);
}
return (NULL);
diff --git a/src/plugins/gbp/gbp_contract.h b/src/plugins/gbp/gbp_contract.h
index 876c10f3702..dff1b445061 100644
--- a/src/plugins/gbp/gbp_contract.h
+++ b/src/plugins/gbp/gbp_contract.h
@@ -30,8 +30,8 @@ typedef struct gbp_contract_key_t_
/**
* source and destination EPGs for which the ACL applies
*/
- epg_id_t gck_src;
- epg_id_t gck_dst;
+ sclass_t gck_src;
+ sclass_t gck_dst;
};
u32 as_u32;
};
@@ -138,11 +138,11 @@ typedef struct gbp_contract_db_t_
uword *gc_hash;
} gbp_contract_db_t;
-extern int gbp_contract_update (epg_id_t src_epg,
- epg_id_t dst_epg,
+extern int gbp_contract_update (sclass_t sclass,
+ sclass_t dclass,
u32 acl_index,
index_t * rules, u16 * allowed_ethertypes);
-extern int gbp_contract_delete (epg_id_t src_epg, epg_id_t dst_epg);
+extern int gbp_contract_delete (sclass_t sclass, sclass_t dclass);
extern index_t gbp_rule_alloc (gbp_rule_action_t action,
gbp_hash_mode_t hash_mode, index_t * nhs);
diff --git a/src/plugins/gbp/gbp_endpoint.c b/src/plugins/gbp/gbp_endpoint.c
index 4bd726fec31..36e0050c39d 100644
--- a/src/plugins/gbp/gbp_endpoint.c
+++ b/src/plugins/gbp/gbp_endpoint.c
@@ -636,7 +636,7 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
if (INDEX_INVALID != gel->gel_epg)
{
gg = gbp_endpoint_group_get (gel->gel_epg);
- gef->gef_epg_id = gg->gg_id;
+ gef->gef_sclass = gg->gg_sclass;
}
else
{
@@ -757,7 +757,7 @@ gbb_endpoint_fwd_recalc (gbp_endpoint_t * ge)
* is applied
*/
gbp_policy_dpo_add_or_lock (fib_proto_to_dpo (pfx->fp_proto),
- gg->gg_id, ~0, &policy_dpo);
+ gg->gg_sclass, ~0, &policy_dpo);
fib_table_entry_special_dpo_add (fib_index, pfx,
FIB_SOURCE_PLUGIN_HI,
@@ -818,7 +818,8 @@ gbp_endpoint_update_and_lock (gbp_endpoint_src_t src,
u32 sw_if_index,
const ip46_address_t * ips,
const mac_address_t * mac,
- index_t gbdi, index_t grdi, epg_id_t epg_id,
+ index_t gbdi, index_t grdi,
+ sclass_t sclass,
gbp_endpoint_flags_t flags,
const ip46_address_t * tun_src,
const ip46_address_t * tun_dst, u32 * handle)
@@ -842,9 +843,9 @@ gbp_endpoint_update_and_lock (gbp_endpoint_src_t src,
* we need to determine the bridge-domain, either from the EPG or
* the BD passed
*/
- if (EPG_INVALID != epg_id)
+ if (SCLASS_INVALID != sclass)
{
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID == ggi)
return (VNET_API_ERROR_NO_SUCH_ENTRY);
@@ -1074,7 +1075,7 @@ gbp_endpoint_cli (vlib_main_t * vm,
ip46_address_t ip = ip46_address_initializer, *ips = NULL;
mac_address_t mac = ZERO_MAC_ADDRESS;
vnet_main_t *vnm = vnet_get_main ();
- u32 epg_id = EPG_INVALID;
+ u32 sclass = SCLASS_INVALID;
u32 handle = INDEX_INVALID;
u32 sw_if_index = ~0;
u8 add = 1;
@@ -1091,7 +1092,7 @@ gbp_endpoint_cli (vlib_main_t * vm,
add = 1;
else if (unformat (input, "del"))
add = 0;
- else if (unformat (input, "epg %d", &epg_id))
+ else if (unformat (input, "sclass %d", &sclass))
;
else if (unformat (input, "handle %d", &handle))
;
@@ -1109,14 +1110,14 @@ gbp_endpoint_cli (vlib_main_t * vm,
{
if (~0 == sw_if_index)
return clib_error_return (0, "interface must be specified");
- if (EPG_INVALID == epg_id)
- return clib_error_return (0, "EPG-ID must be specified");
+ if (SCLASS_INVALID == sclass)
+ return clib_error_return (0, "SCLASS must be specified");
rv =
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
sw_if_index, ips, &mac,
INDEX_INVALID, INDEX_INVALID,
- epg_id,
+ sclass,
GBP_ENDPOINT_FLAG_NONE,
NULL, NULL, &handle);
diff --git a/src/plugins/gbp/gbp_endpoint.h b/src/plugins/gbp/gbp_endpoint.h
index e399ff4f671..aba1f9d498c 100644
--- a/src/plugins/gbp/gbp_endpoint.h
+++ b/src/plugins/gbp/gbp_endpoint.h
@@ -164,9 +164,9 @@ typedef struct gbp_endpoint_fwd_t_
index_t *gef_adjs;
/**
- * Endpoint Group's ID. cached for fast DP access.
+ * Endpoint Group's sclass. cached for fast DP access.
*/
- epg_id_t gef_epg_id;
+ sclass_t gef_sclass;
gbp_endpoint_flags_t gef_flags;
} gbp_endpoint_fwd_t;
@@ -222,7 +222,7 @@ extern int gbp_endpoint_update_and_lock (gbp_endpoint_src_t src,
const ip46_address_t * ip,
const mac_address_t * mac,
index_t gbd, index_t grd,
- epg_id_t epg_id,
+ sclass_t sclass,
gbp_endpoint_flags_t flags,
const ip46_address_t * tun_src,
const ip46_address_t * tun_dst,
diff --git a/src/plugins/gbp/gbp_endpoint_group.c b/src/plugins/gbp/gbp_endpoint_group.c
index 821adef0c18..d6e42e81ac5 100644
--- a/src/plugins/gbp/gbp_endpoint_group.c
+++ b/src/plugins/gbp/gbp_endpoint_group.c
@@ -60,11 +60,11 @@ gbp_endpoint_group_lock (index_t i)
}
index_t
-gbp_endpoint_group_find (epg_id_t epg_id)
+gbp_endpoint_group_find (sclass_t sclass)
{
uword *p;
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg_id);
+ p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
if (NULL != p)
return p[0];
@@ -73,7 +73,7 @@ gbp_endpoint_group_find (epg_id_t epg_id)
}
int
-gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
+gbp_endpoint_group_add_and_lock (vnid_t vnid,
u16 sclass,
u32 bd_id,
u32 rd_id,
@@ -83,7 +83,7 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
gbp_endpoint_group_t *gg;
index_t ggi;
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID == ggi)
{
@@ -108,7 +108,7 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
pool_get_zero (gbp_endpoint_group_pool, gg);
- gg->gg_id = epg_id;
+ gg->gg_vnid = vnid;
gg->gg_rd = grdi;
gg->gg_gbd = gbi;
gg->gg_bd_index = gb->gb_bd_index;
@@ -119,7 +119,7 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
gg->gg_retention = *retention;
if (SCLASS_INVALID != gg->gg_sclass)
- hash_set (gbp_epg_sclass_db, gg->gg_sclass, gg->gg_id);
+ hash_set (gbp_epg_sclass_db, gg->gg_sclass, gg->gg_vnid);
/*
* an egress DVR dpo for internal subnets to use when sending
@@ -145,9 +145,8 @@ gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
L2INPUT_FEAT_GBP_NULL_CLASSIFY, 1);
}
- hash_set (gbp_endpoint_group_db.gg_hash,
- gg->gg_id, gg - gbp_endpoint_group_pool);
-
+ hash_set (gbp_endpoint_group_db.gg_hash_sclass,
+ gg->gg_sclass, gg - gbp_endpoint_group_pool);
}
else
{
@@ -196,18 +195,18 @@ gbp_endpoint_group_unlock (index_t ggi)
if (SCLASS_INVALID != gg->gg_sclass)
hash_unset (gbp_epg_sclass_db, gg->gg_sclass);
- hash_unset (gbp_endpoint_group_db.gg_hash, gg->gg_id);
+ hash_unset (gbp_endpoint_group_db.gg_hash_sclass, gg->gg_sclass);
pool_put (gbp_endpoint_group_pool, gg);
}
}
int
-gbp_endpoint_group_delete (epg_id_t epg_id)
+gbp_endpoint_group_delete (sclass_t sclass)
{
index_t ggi;
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID != ggi)
{
@@ -261,7 +260,7 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
gbp_endpoint_retention_t retention = { 0 };
- epg_id_t epg_id = EPG_INVALID, sclass;
+ vnid_t vnid = VNID_INVALID, sclass;
vnet_main_t *vnm = vnet_get_main ();
u32 uplink_sw_if_index = ~0;
u32 bd_id = ~0;
@@ -277,7 +276,7 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
add = 1;
else if (unformat (input, "del"))
add = 0;
- else if (unformat (input, "epg %d", &epg_id))
+ else if (unformat (input, "epg %d", &vnid))
;
else if (unformat (input, "sclass %d", &sclass))
;
@@ -289,7 +288,7 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
break;
}
- if (EPG_INVALID == epg_id)
+ if (VNID_INVALID == vnid)
return clib_error_return (0, "EPG-ID must be specified");
if (add)
@@ -301,11 +300,11 @@ gbp_endpoint_group_cli (vlib_main_t * vm,
if (~0 == rd_id)
return clib_error_return (0, "route-domain must be specified");
- gbp_endpoint_group_add_and_lock (epg_id, sclass, bd_id, rd_id,
+ gbp_endpoint_group_add_and_lock (vnid, sclass, bd_id, rd_id,
uplink_sw_if_index, &retention);
}
else
- gbp_endpoint_group_delete (epg_id);
+ gbp_endpoint_group_delete (vnid);
return (NULL);
}
@@ -343,7 +342,7 @@ format_gbp_endpoint_group (u8 * s, va_list * args)
if (NULL != gg)
s = format (s, "[%d] %d, sclass:%d bd:[%d,%d] rd:[%d] uplink:%U retnetion:%U locks:%d",
gg - gbp_endpoint_group_pool,
- gg->gg_id,
+ gg->gg_vnid,
gg->gg_sclass,
gbp_endpoint_group_get_bd_id(gg), gg->gg_bd_index,
gg->gg_rd,
diff --git a/src/plugins/gbp/gbp_endpoint_group.h b/src/plugins/gbp/gbp_endpoint_group.h
index 08e3a5c874c..e0d54eaaf86 100644
--- a/src/plugins/gbp/gbp_endpoint_group.h
+++ b/src/plugins/gbp/gbp_endpoint_group.h
@@ -37,7 +37,7 @@ typedef struct gpb_endpoint_group_t_
/**
* ID
*/
- epg_id_t gg_id;
+ vnid_t gg_vnid;
/**
* Sclass. Could be unset => ~0
@@ -86,18 +86,18 @@ typedef struct gpb_endpoint_group_t_
*/
typedef struct gbp_endpoint_group_db_t_
{
- uword *gg_hash;
+ uword *gg_hash_sclass;
} gbp_endpoint_group_db_t;
-extern int gbp_endpoint_group_add_and_lock (epg_id_t epg_id,
+extern int gbp_endpoint_group_add_and_lock (vnid_t vnid,
u16 sclass,
u32 bd_id,
u32 rd_id,
u32 uplink_sw_if_index,
const gbp_endpoint_retention_t *
retention);
-extern index_t gbp_endpoint_group_find (epg_id_t epg_id);
-extern int gbp_endpoint_group_delete (epg_id_t epg_id);
+extern index_t gbp_endpoint_group_find (sclass_t sclass);
+extern int gbp_endpoint_group_delete (sclass_t sclass);
extern void gbp_endpoint_group_unlock (index_t index);
extern void gbp_endpoint_group_lock (index_t index);
extern u32 gbp_endpoint_group_get_bd_id (const gbp_endpoint_group_t *);
@@ -120,24 +120,12 @@ extern gbp_endpoint_group_db_t gbp_endpoint_group_db;
extern gbp_endpoint_group_t *gbp_endpoint_group_pool;
extern uword *gbp_epg_sclass_db;
-always_inline gbp_endpoint_group_t *
-gbp_epg_get (epg_id_t epg)
-{
- uword *p;
-
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg);
-
- if (NULL != p)
- return (pool_elt_at_index (gbp_endpoint_group_pool, p[0]));
- return (NULL);
-}
-
always_inline u32
-gbp_epg_itf_lookup (epg_id_t epg)
+gbp_epg_itf_lookup_sclass (sclass_t sclass)
{
uword *p;
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg);
+ p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
if (NULL != p)
{
@@ -149,26 +137,12 @@ gbp_epg_itf_lookup (epg_id_t epg)
return (~0);
}
-always_inline epg_id_t
-gbp_epg_sclass_2_id (u16 sclass)
-{
- uword *p;
-
- p = hash_get (gbp_epg_sclass_db, sclass);
-
- if (NULL != p)
- {
- return (p[0]);
- }
- return (EPG_INVALID);
-}
-
always_inline const dpo_id_t *
-gbp_epg_dpo_lookup (epg_id_t epg, fib_protocol_t fproto)
+gbp_epg_dpo_lookup (sclass_t sclass, fib_protocol_t fproto)
{
uword *p;
- p = hash_get (gbp_endpoint_group_db.gg_hash, epg);
+ p = hash_get (gbp_endpoint_group_db.gg_hash_sclass, sclass);
if (NULL != p)
{
diff --git a/src/plugins/gbp/gbp_fwd.c b/src/plugins/gbp/gbp_fwd.c
index dd393980038..4ecc4779b92 100644
--- a/src/plugins/gbp/gbp_fwd.c
+++ b/src/plugins/gbp/gbp_fwd.c
@@ -27,7 +27,7 @@ typedef struct gbp_fwd_main_t_
u32 l2_input_feat_next[32];
} gbp_fwd_main_t;
-static gbp_fwd_main_t gbp_fwd_main;
+gbp_fwd_main_t gbp_fwd_main;
static clib_error_t *
gbp_fwd_init (vlib_main_t * vm)
diff --git a/src/plugins/gbp/gbp_fwd_dpo.c b/src/plugins/gbp/gbp_fwd_dpo.c
index c0b19a9e398..b1023f5e78f 100644
--- a/src/plugins/gbp/gbp_fwd_dpo.c
+++ b/src/plugins/gbp/gbp_fwd_dpo.c
@@ -170,7 +170,7 @@ VLIB_INIT_FUNCTION (gbp_fwd_dpo_module_init);
typedef struct gbp_fwd_dpo_trace_t_
{
- u32 src_epg;
+ u32 sclass;
u32 dpo_index;
} gbp_fwd_dpo_trace_t;
@@ -203,7 +203,7 @@ gbp_fwd_dpo_inline (vlib_main_t * vm,
{
const dpo_id_t *next_dpo0;
vlib_buffer_t *b0;
- epg_id_t src_epg0;
+ sclass_t sclass0;
u32 bi0, next0;
bi0 = from[0];
@@ -215,8 +215,8 @@ gbp_fwd_dpo_inline (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
- src_epg0 = vnet_buffer2 (b0)->gbp.src_epg;
- next_dpo0 = gbp_epg_dpo_lookup (src_epg0, fproto);
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
+ next_dpo0 = gbp_epg_dpo_lookup (sclass0, fproto);
if (PREDICT_TRUE (NULL != next_dpo0))
{
@@ -233,7 +233,7 @@ gbp_fwd_dpo_inline (vlib_main_t * vm,
gbp_fwd_dpo_trace_t *tr;
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->src_epg = src_epg0;
+ tr->sclass = sclass0;
tr->dpo_index = (NULL != next_dpo0 ?
next_dpo0->dpoi_index : ~0);
}
@@ -253,7 +253,7 @@ format_gbp_fwd_dpo_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_fwd_dpo_trace_t *t = va_arg (*args, gbp_fwd_dpo_trace_t *);
- s = format (s, " epg:%d dpo:%d", t->src_epg, t->dpo_index);
+ s = format (s, " sclass:%d dpo:%d", t->sclass, t->dpo_index);
return s;
}
diff --git a/src/plugins/gbp/gbp_fwd_node.c b/src/plugins/gbp/gbp_fwd_node.c
index eff4aeb1880..6ea56fd8074 100644
--- a/src/plugins/gbp/gbp_fwd_node.c
+++ b/src/plugins/gbp/gbp_fwd_node.c
@@ -48,7 +48,7 @@ typedef enum
typedef struct gbp_fwd_trace_t_
{
/* per-pkt trace data */
- epg_id_t src_epg;
+ sclass_t sclass;
u32 sw_if_index;
} gbp_fwd_trace_t;
@@ -70,9 +70,10 @@ VLIB_NODE_FN (gbp_fwd_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
while (n_left_from > 0 && n_left_to_next > 0)
{
- u32 bi0, sw_if_index0, src_epg;
+ u32 bi0, sw_if_index0;
gbp_fwd_next_t next0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
next0 = GBP_FWD_NEXT_DROP;
bi0 = from[0];
@@ -87,9 +88,9 @@ VLIB_NODE_FN (gbp_fwd_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
/*
* lookup the uplink based on src EPG
*/
- src_epg = vnet_buffer2 (b0)->gbp.src_epg;
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
- sw_if_index0 = gbp_epg_itf_lookup (src_epg);
+ sw_if_index0 = gbp_epg_itf_lookup_sclass (sclass0);
if (~0 != sw_if_index0)
{
@@ -105,7 +106,7 @@ VLIB_NODE_FN (gbp_fwd_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
{
gbp_fwd_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = src_epg;
+ t->sclass = sclass0;
t->sw_if_index = sw_if_index0;
}
@@ -129,7 +130,7 @@ format_gbp_fwd_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_fwd_trace_t *t = va_arg (*args, gbp_fwd_trace_t *);
- s = format (s, "src-epg:%d", t->src_epg);
+ s = format (s, "sclass:%d", t->sclass);
return s;
}
diff --git a/src/plugins/gbp/gbp_learn_node.c b/src/plugins/gbp/gbp_learn_node.c
index 461d209e0a6..8c623e8bd3e 100644
--- a/src/plugins/gbp/gbp_learn_node.c
+++ b/src/plugins/gbp/gbp_learn_node.c
@@ -58,7 +58,7 @@ typedef struct gbp_learn_l2_t_
mac_address_t mac;
u32 sw_if_index;
u32 bd_index;
- epg_id_t epg;
+ sclass_t sclass;
ip46_address_t outer_src;
ip46_address_t outer_dst;
} gbp_learn_l2_t;
@@ -71,7 +71,7 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
GBP_LEARN_DBG ("L2 EP: %U %U, %d",
format_mac_address_t, &gl2->mac,
- format_ip46_address, &gl2->ip, IP46_TYPE_ANY, gl2->epg);
+ format_ip46_address, &gl2->ip, IP46_TYPE_ANY, gl2->sclass);
if (!ip46_address_is_zero (&gl2->ip))
vec_add1 (ips, gl2->ip);
@@ -83,7 +83,7 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_DP,
gl2->sw_if_index, ips,
&gl2->mac, INDEX_INVALID,
- INDEX_INVALID, gl2->epg,
+ INDEX_INVALID, gl2->sclass,
(GBP_ENDPOINT_FLAG_LEARNT |
GBP_ENDPOINT_FLAG_REMOTE),
&gl2->outer_dst, &gl2->outer_src, NULL);
@@ -92,14 +92,14 @@ gbp_learn_l2_cp (const gbp_learn_l2_t * gl2)
static void
gbp_learn_l2_ip4_dp (const u8 * mac, const ip4_address_t * ip,
- u32 bd_index, u32 sw_if_index, epg_id_t epg,
+ u32 bd_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
gbp_learn_l2_t gl2 = {
.sw_if_index = sw_if_index,
.bd_index = bd_index,
- .epg = epg,
+ .sclass = sclass,
.ip.ip4 = *ip,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
@@ -111,14 +111,14 @@ gbp_learn_l2_ip4_dp (const u8 * mac, const ip4_address_t * ip,
static void
gbp_learn_l2_ip6_dp (const u8 * mac, const ip6_address_t * ip,
- u32 bd_index, u32 sw_if_index, epg_id_t epg,
+ u32 bd_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
gbp_learn_l2_t gl2 = {
.sw_if_index = sw_if_index,
.bd_index = bd_index,
- .epg = epg,
+ .sclass = sclass,
.ip.ip6 = *ip,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
@@ -130,14 +130,14 @@ gbp_learn_l2_ip6_dp (const u8 * mac, const ip6_address_t * ip,
static void
gbp_learn_l2_dp (const u8 * mac, u32 bd_index, u32 sw_if_index,
- epg_id_t epg,
+ sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
gbp_learn_l2_t gl2 = {
.sw_if_index = sw_if_index,
.bd_index = bd_index,
- .epg = epg,
+ .sclass = sclass,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
};
@@ -156,7 +156,7 @@ typedef struct gbp_learn_l2_trace_t_
u32 sw_if_index;
u32 new;
u32 throttled;
- u32 epg;
+ u32 sclass;
u32 d_bit;
gbp_bridge_domain_flags_t gb_flags;
} gbp_learn_l2_trace_t;
@@ -205,12 +205,13 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
ip4_address_t outer_src, outer_dst;
- u32 bi0, sw_if_index0, t0, epg0;
const ethernet_header_t *eh0;
+ u32 bi0, sw_if_index0, t0;
gbp_bridge_domain_t *gb0;
gbp_learn_next_t next0;
gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
next0 = GBP_LEARN_NEXT_DROP;
bi0 = from[0];
@@ -224,7 +225,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
eh0 = vlib_buffer_get_current (b0);
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
next0 = vnet_l2_feature_next (b0, glm->gl_l2_input_feat_next,
L2INPUT_FEAT_GBP_LEARN);
@@ -273,7 +274,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_ip4_dp (eh0->src_address,
&ip0->src_address,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
@@ -287,7 +288,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_ip6_dp (eh0->src_address,
&ip0->src_address,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
@@ -301,14 +302,14 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_ip4_dp (eh0->src_address,
&arp0->ip4_over_ethernet[0].ip4,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
}
default:
gbp_learn_l2_dp (eh0->src_address,
vnet_buffer (b0)->l2.bd_index,
- sw_if_index0, epg0,
+ sw_if_index0, sclass0,
&outer_src, &outer_dst);
break;
}
@@ -332,7 +333,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
t->new = (NULL == ge0);
t->throttled = t0;
t->sw_if_index = sw_if_index0;
- t->epg = epg0;
+ t->sclass = sclass0;
t->gb_flags = gb0->gb_flags;
t->d_bit = ! !(vnet_buffer2 (b0)->gbp.flags &
VXLAN_GBP_GPFLAGS_D);
@@ -358,10 +359,10 @@ format_gbp_learn_l2_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_learn_l2_trace_t *t = va_arg (*args, gbp_learn_l2_trace_t *);
- s = format (s, "new:%d throttled:%d d-bit:%d mac:%U itf:%d epg:%d"
+ s = format (s, "new:%d throttled:%d d-bit:%d mac:%U itf:%d sclass:%d"
" gb-flags:%U",
t->new, t->throttled, t->d_bit,
- format_mac_address_t, &t->mac, t->sw_if_index, t->epg,
+ format_mac_address_t, &t->mac, t->sw_if_index, t->sclass,
format_gbp_bridge_domain_flags, t->gb_flags);
return s;
@@ -390,7 +391,7 @@ typedef struct gbp_learn_l3_t_
ip46_address_t ip;
u32 fib_index;
u32 sw_if_index;
- epg_id_t epg;
+ sclass_t sclass;
ip46_address_t outer_src;
ip46_address_t outer_dst;
} gbp_learn_l3_t;
@@ -401,13 +402,13 @@ gbp_learn_l3_cp (const gbp_learn_l3_t * gl3)
ip46_address_t *ips = NULL;
GBP_LEARN_DBG ("L3 EP: %U, %d", format_ip46_address, &gl3->ip,
- IP46_TYPE_ANY, gl3->epg);
+ IP46_TYPE_ANY, gl3->sclass);
vec_add1 (ips, gl3->ip);
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_DP,
gl3->sw_if_index, ips, NULL,
- INDEX_INVALID, INDEX_INVALID, gl3->epg,
+ INDEX_INVALID, INDEX_INVALID, gl3->sclass,
(GBP_ENDPOINT_FLAG_REMOTE |
GBP_ENDPOINT_FLAG_LEARNT),
&gl3->outer_dst, &gl3->outer_src, NULL);
@@ -416,7 +417,7 @@ gbp_learn_l3_cp (const gbp_learn_l3_t * gl3)
static void
gbp_learn_ip4_dp (const ip4_address_t * ip,
- u32 fib_index, u32 sw_if_index, epg_id_t epg,
+ u32 fib_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
@@ -427,7 +428,7 @@ gbp_learn_ip4_dp (const ip4_address_t * ip,
},
.sw_if_index = sw_if_index,
.fib_index = fib_index,
- .epg = epg,
+ .sclass = sclass,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
};
@@ -438,7 +439,7 @@ gbp_learn_ip4_dp (const ip4_address_t * ip,
static void
gbp_learn_ip6_dp (const ip6_address_t * ip,
- u32 fib_index, u32 sw_if_index, epg_id_t epg,
+ u32 fib_index, u32 sw_if_index, sclass_t sclass,
const ip4_address_t * outer_src,
const ip4_address_t * outer_dst)
{
@@ -449,7 +450,7 @@ gbp_learn_ip6_dp (const ip6_address_t * ip,
},
.sw_if_index = sw_if_index,
.fib_index = fib_index,
- .epg = epg,
+ .sclass = sclass,
.outer_src.ip4 = *outer_src,
.outer_dst.ip4 = *outer_dst,
};
@@ -468,7 +469,7 @@ typedef struct gbp_learn_l3_trace_t_
u32 sw_if_index;
u32 new;
u32 throttled;
- u32 epg;
+ u32 sclass;
} gbp_learn_l3_trace_t;
static uword
@@ -497,14 +498,15 @@ gbp_learn_l3 (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
- u32 bi0, sw_if_index0, t0, epg0, fib_index0;
CLIB_UNUSED (const ip4_header_t *) ip4_0;
CLIB_UNUSED (const ip6_header_t *) ip6_0;
+ u32 bi0, sw_if_index0, t0, fib_index0;
ip4_address_t outer_src, outer_dst;
ethernet_header_t *eth0;
gbp_learn_next_t next0;
gbp_endpoint_t *ge0;
vlib_buffer_t *b0;
+ sclass_t sclass0;
next0 = GBP_LEARN_NEXT_DROP;
bi0 = from[0];
@@ -516,7 +518,7 @@ gbp_learn_l3 (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
+ sclass0 = vnet_buffer2 (b0)->gbp.sclass;
ip6_0 = NULL;
ip4_0 = NULL;
@@ -551,7 +553,7 @@ gbp_learn_l3 (vlib_main_t * vm,
if (!t0)
{
gbp_learn_ip6_dp (&ip6_0->src_address,
- fib_index0, sw_if_index0, epg0,
+ fib_index0, sw_if_index0, sclass0,
&outer_src, &outer_dst);
}
}
@@ -582,7 +584,7 @@ gbp_learn_l3 (vlib_main_t * vm,
if (!t0)
{
gbp_learn_ip4_dp (&ip4_0->src_address,
- fib_index0, sw_if_index0, epg0,
+ fib_index0, sw_if_index0, sclass0,
&outer_src, &outer_dst);
}
}
@@ -610,7 +612,7 @@ gbp_learn_l3 (vlib_main_t * vm,
t->new = (NULL == ge0);
t->throttled = t0;
t->sw_if_index = sw_if_index0;
- t->epg = epg0;
+ t->sclass = sclass0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
@@ -632,10 +634,10 @@ format_gbp_learn_l3_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
gbp_learn_l3_trace_t *t = va_arg (*args, gbp_learn_l3_trace_t *);
- s = format (s, "new:%d throttled:%d ip:%U itf:%d epg:%d",
+ s = format (s, "new:%d throttled:%d ip:%U itf:%d sclass:%d",
t->new, t->throttled,
format_ip46_address, &t->ip, IP46_TYPE_ANY, t->sw_if_index,
- t->epg);
+ t->sclass);
return s;
}
diff --git a/src/plugins/gbp/gbp_policy_dpo.c b/src/plugins/gbp/gbp_policy_dpo.c
index ce628e5c975..c52dcc4dc48 100644
--- a/src/plugins/gbp/gbp_policy_dpo.c
+++ b/src/plugins/gbp/gbp_policy_dpo.c
@@ -92,7 +92,7 @@ gbp_policy_dpo_get_urpf (const dpo_id_t * dpo)
void
gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
- epg_id_t epg, u32 sw_if_index, dpo_id_t * dpo)
+ sclass_t sclass, u32 sw_if_index, dpo_id_t * dpo)
{
gbp_policy_dpo_t *gpd;
dpo_id_t parent = DPO_INVALID;
@@ -101,7 +101,7 @@ gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
gpd->gpd_proto = dproto;
gpd->gpd_sw_if_index = sw_if_index;
- gpd->gpd_epg = epg;
+ gpd->gpd_sclass = sclass;
if (~0 != sw_if_index)
{
@@ -127,9 +127,9 @@ format_gbp_policy_dpo (u8 * s, va_list * ap)
gbp_policy_dpo_t *gpd = gbp_policy_dpo_get (index);
vnet_main_t *vnm = vnet_get_main ();
- s = format (s, "gbp-policy-dpo: %U, epg:%d out:%U",
+ s = format (s, "gbp-policy-dpo: %U, sclass:%d out:%U",
format_dpo_proto, gpd->gpd_proto,
- gpd->gpd_epg,
+ (int) gpd->gpd_sclass,
format_vnet_sw_if_index_name, vnm, gpd->gpd_sw_if_index);
s = format (s, "\n%U", format_white_space, indent + 2);
s = format (s, "%U", format_dpo_id, &gpd->gpd_dpo, indent + 4);
@@ -150,7 +150,7 @@ gbp_policy_dpo_interpose (const dpo_id_t * original,
gpd = gbp_policy_dpo_get (original->dpoi_index);
gpd_clone->gpd_proto = gpd->gpd_proto;
- gpd_clone->gpd_epg = gpd->gpd_epg;
+ gpd_clone->gpd_sclass = gpd->gpd_sclass;
gpd_clone->gpd_sw_if_index = gpd->gpd_sw_if_index;
dpo_stack (gbp_policy_dpo_type,
@@ -290,10 +290,10 @@ gbp_policy_dpo_inline (vlib_main_t * vm,
goto trace;
}
- key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
- key0.gck_dst = gpd0->gpd_epg;
+ key0.gck_src = vnet_buffer2 (b0)->gbp.sclass;
+ key0.gck_dst = gpd0->gpd_sclass;
- if (EPG_INVALID != key0.gck_src)
+ if (SCLASS_INVALID != key0.gck_src)
{
if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
{
diff --git a/src/plugins/gbp/gbp_policy_dpo.h b/src/plugins/gbp/gbp_policy_dpo.h
index 097205b8255..3a4264d9194 100644
--- a/src/plugins/gbp/gbp_policy_dpo.h
+++ b/src/plugins/gbp/gbp_policy_dpo.h
@@ -33,9 +33,9 @@ typedef struct gbp_policy_dpo_t_
dpo_proto_t gpd_proto;
/**
- * EPG
+ * SClass
*/
- epg_id_t gpd_epg;
+ sclass_t gpd_sclass;
/**
* output sw_if_index
@@ -54,7 +54,7 @@ typedef struct gbp_policy_dpo_t_
} gbp_policy_dpo_t;
extern void gbp_policy_dpo_add_or_lock (dpo_proto_t dproto,
- epg_id_t epg,
+ sclass_t sclass,
u32 sw_if_index, dpo_id_t * dpo);
extern dpo_type_t gbp_policy_dpo_get_type (void);
diff --git a/src/plugins/gbp/gbp_policy_node.c b/src/plugins/gbp/gbp_policy_node.c
index aaf362d2c9a..ff21e7d0e2e 100644
--- a/src/plugins/gbp/gbp_policy_node.c
+++ b/src/plugins/gbp/gbp_policy_node.c
@@ -49,7 +49,7 @@ typedef enum
typedef struct gbp_policy_trace_t_
{
/* per-pkt trace data */
- u32 src_epg;
+ u32 sclass;
u32 dst_epg;
u32 acl_index;
u32 allowed;
@@ -175,14 +175,14 @@ gbp_policy_inline (vlib_main_t * vm,
vnet_buffer (b0)->l2.bd_index);
if (NULL != ge0)
- key0.gck_dst = ge0->ge_fwd.gef_epg_id;
+ key0.gck_dst = ge0->ge_fwd.gef_sclass;
else
/* If you cannot determine the destination EP then drop */
goto trace;
- key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
+ key0.gck_src = vnet_buffer2 (b0)->gbp.sclass;
- if (EPG_INVALID != key0.gck_src)
+ if (SCLASS_INVALID != key0.gck_src)
{
if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
{
@@ -305,7 +305,7 @@ gbp_policy_inline (vlib_main_t * vm,
{
gbp_policy_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->src_epg = key0.gck_src;
+ t->sclass = key0.gck_src;
t->dst_epg = key0.gck_dst;
t->acl_index = (gc0 ? gc0->gc_acl_index : ~0),
t->allowed = (next0 != GBP_POLICY_NEXT_DENY);
@@ -346,8 +346,8 @@ format_gbp_policy_trace (u8 * s, va_list * args)
gbp_policy_trace_t *t = va_arg (*args, gbp_policy_trace_t *);
s =
- format (s, "src:%d, dst:%d, acl:%d allowed:%d",
- t->src_epg, t->dst_epg, t->acl_index, t->allowed);
+ format (s, "sclass:%d, dst:%d, acl:%d allowed:%d",
+ t->sclass, t->dst_epg, t->acl_index, t->allowed);
return s;
}
diff --git a/src/plugins/gbp/gbp_recirc.c b/src/plugins/gbp/gbp_recirc.c
index cee63811bd8..87d0d0564ad 100644
--- a/src/plugins/gbp/gbp_recirc.c
+++ b/src/plugins/gbp/gbp_recirc.c
@@ -53,13 +53,13 @@ format_gbp_recirc (u8 * s, va_list * args)
gbp_recirc_t *gr = va_arg (*args, gbp_recirc_t *);
vnet_main_t *vnm = vnet_get_main ();
- return format (s, " %U, epg:%d, ext:%d",
+ return format (s, " %U, sclass:%d, ext:%d",
format_vnet_sw_if_index_name, vnm,
- gr->gr_sw_if_index, gr->gr_epg, gr->gr_is_ext);
+ gr->gr_sw_if_index, gr->gr_sclass, gr->gr_is_ext);
}
int
-gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
+gbp_recirc_add (u32 sw_if_index, sclass_t sclass, u8 is_ext)
{
gbp_recirc_t *gr;
index_t gri;
@@ -74,7 +74,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
fib_protocol_t fproto;
index_t ggi;
- ggi = gbp_endpoint_group_find (epg_id);
+ ggi = gbp_endpoint_group_find (sclass);
if (INDEX_INVALID == ggi)
return (VNET_API_ERROR_NO_SUCH_ENTRY);
@@ -83,7 +83,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
pool_get_zero (gbp_recirc_pool, gr);
gri = gr - gbp_recirc_pool;
- gr->gr_epg = epg_id;
+ gr->gr_sclass = sclass;
gr->gr_is_ext = is_ext;
gr->gr_sw_if_index = sw_if_index;
@@ -135,7 +135,7 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
gr->gr_sw_if_index,
NULL, &mac, INDEX_INVALID,
- INDEX_INVALID, gr->gr_epg,
+ INDEX_INVALID, gr->gr_sclass,
GBP_ENDPOINT_FLAG_NONE,
NULL, NULL, &gr->gr_ep);
vnet_feature_enable_disable ("ip4-unicast",
diff --git a/src/plugins/gbp/gbp_recirc.h b/src/plugins/gbp/gbp_recirc.h
index 86b857d74a9..3af77b42b4b 100644
--- a/src/plugins/gbp/gbp_recirc.h
+++ b/src/plugins/gbp/gbp_recirc.h
@@ -30,7 +30,7 @@ typedef struct gpb_recirc_t_
/**
* EPG ID that packets will classify to when they arrive on this recirc
*/
- epg_id_t gr_epg;
+ sclass_t gr_sclass;
/**
* The index of the EPG
@@ -59,7 +59,7 @@ typedef struct gpb_recirc_t_
index_t gr_ep;
} gbp_recirc_t;
-extern int gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext);
+extern int gbp_recirc_add (u32 sw_if_index, sclass_t sclass, u8 is_ext);
extern int gbp_recirc_delete (u32 sw_if_index);
typedef walk_rc_t (*gbp_recirc_cb_t) (gbp_recirc_t * gbpe, void *ctx);
diff --git a/src/plugins/gbp/gbp_route_domain.c b/src/plugins/gbp/gbp_route_domain.c
index 6a3f4fa7f1e..67b6915b463 100644
--- a/src/plugins/gbp/gbp_route_domain.c
+++ b/src/plugins/gbp/gbp_route_domain.c
@@ -15,7 +15,6 @@
#include <plugins/gbp/gbp_route_domain.h>
#include <plugins/gbp/gbp_endpoint.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <vnet/dpo/dvr_dpo.h>
#include <vnet/fib/fib_table.h>
@@ -183,8 +182,6 @@ gbp_route_domain_add_and_lock (u32 rd_id,
&ADJ_BCAST_ADDR,
grd->grd_uu_sw_if_index[fproto],
rewrite);
-
- gbp_sclass_enable_ip (grd->grd_uu_sw_if_index[fproto]);
}
else
{
@@ -226,8 +223,6 @@ gbp_route_domain_unlock (index_t index)
fproto, FIB_SOURCE_PLUGIN_HI);
if (INDEX_INVALID != grd->grd_adj[fproto])
adj_unlock (grd->grd_adj[fproto]);
- if (~0 != grd->grd_uu_sw_if_index[fproto])
- gbp_sclass_disable_ip (grd->grd_uu_sw_if_index[fproto]);
}
gbp_route_domain_db_remove (grd);
diff --git a/src/plugins/gbp/gbp_sclass.c b/src/plugins/gbp/gbp_sclass.c
deleted file mode 100644
index 481ee886976..00000000000
--- a/src/plugins/gbp/gbp_sclass.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <plugins/gbp/gbp_sclass.h>
-#include <vnet/l2/l2_input.h>
-#include <vnet/l2/l2_output.h>
-
-gbp_sclass_main_t gbp_sclass_main;
-
-void
-gbp_sclass_enable_l2 (u32 sw_if_index)
-{
- l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_GBP_SCLASS_2_ID, 1);
- l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_GBP_ID_2_SCLASS, 1);
-}
-
-void
-gbp_sclass_disable_l2 (u32 sw_if_index)
-{
- l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_GBP_SCLASS_2_ID, 0);
- l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_GBP_ID_2_SCLASS, 0);
-}
-
-void
-gbp_sclass_enable_ip (u32 sw_if_index)
-{
- vnet_feature_enable_disable ("ip4-unicast",
- "ip4-gbp-sclass-2-id", sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip6-unicast",
- "ip6-gbp-sclass-2-id", sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip4-output",
- "ip4-gbp-id-2-sclass", sw_if_index, 1, 0, 0);
- vnet_feature_enable_disable ("ip6-output",
- "ip6-gbp-id-2-sclass", sw_if_index, 1, 0, 0);
-}
-
-void
-gbp_sclass_disable_ip (u32 sw_if_index)
-{
- vnet_feature_enable_disable ("ip4-unicast",
- "ip4-gbp-sclass-2-id", sw_if_index, 0, 0, 0);
- vnet_feature_enable_disable ("ip6-unicast",
- "ip6-gbp-sclass-2-id", sw_if_index, 0, 0, 0);
- vnet_feature_enable_disable ("ip4-output",
- "ip4-gbp-id-2-sclass", sw_if_index, 0, 0, 0);
- vnet_feature_enable_disable ("ip6-output",
- "ip6-gbp-id-2-sclass", sw_if_index, 0, 0, 0);
-}
-
-static clib_error_t *
-gbp_sclass_init (vlib_main_t * vm)
-{
- gbp_sclass_main_t *glm = &gbp_sclass_main;
- vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "l2-gbp-sclass-2-id");
-
- /* Initialize the feature next-node indices */
- feat_bitmap_init_next_nodes (vm,
- node->index,
- L2INPUT_N_FEAT,
- l2input_get_feat_names (),
- glm->gel_l2_input_feat_next);
-
- node = vlib_get_node_by_name (vm, (u8 *) "l2-gbp-id-2-sclass");
- feat_bitmap_init_next_nodes (vm,
- node->index,
- L2OUTPUT_N_FEAT,
- l2output_get_feat_names (),
- glm->gel_l2_output_feat_next);
-
- return (NULL);
-}
-
-VLIB_INIT_FUNCTION (gbp_sclass_init);
-
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/gbp/gbp_sclass.h b/src/plugins/gbp/gbp_sclass.h
deleted file mode 100644
index 75e35c36bdf..00000000000
--- a/src/plugins/gbp/gbp_sclass.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __GBP_SCLASS_H__
-#define __GBP_SCLASS_H__
-
-#include <plugins/gbp/gbp.h>
-
-/**
- * Grouping of global data for the GBP source EPG classification feature
- */
-typedef struct gbp_sclass_main_t_
-{
- /**
- * Next nodes for L2 output features
- */
- u32 gel_l2_input_feat_next[32];
- u32 gel_l2_output_feat_next[32];
-} gbp_sclass_main_t;
-
-extern gbp_sclass_main_t gbp_sclass_main;
-
-extern void gbp_sclass_enable_l2 (u32 sw_if_index);
-extern void gbp_sclass_disable_l2 (u32 sw_if_index);
-extern void gbp_sclass_enable_ip (u32 sw_if_index);
-extern void gbp_sclass_disable_ip (u32 sw_if_index);
-
-#endif
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/gbp/gbp_sclass_node.c b/src/plugins/gbp/gbp_sclass_node.c
deleted file mode 100644
index 35b23844fd6..00000000000
--- a/src/plugins/gbp/gbp_sclass_node.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <plugins/gbp/gbp_sclass.h>
-#include <vnet/l2/l2_input.h>
-#include <vnet/l2/l2_output.h>
-
-#define foreach_gbp_sclass \
- _(DROP, "drop")
-
-typedef enum
-{
-#define _(sym,str) GBP_SCLASS_NEXT_##sym,
- foreach_gbp_sclass
-#undef _
- GBP_SCLASS_N_NEXT,
-} gbp_sclass_next_t;
-
-typedef struct gbp_sclass_trace_t_
-{
- /* per-pkt trace data */
- u32 epg;
- u32 sclass;
-} gbp_sclass_trace_t;
-
-static_always_inline uword
-gbp_sclass_inline (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame, int is_id_2_sclass, int is_l2)
-{
- u32 n_left_from, *from, *to_next, next_index;
- gbp_sclass_main_t *glm;
-
- glm = &gbp_sclass_main;
- next_index = 0;
- n_left_from = frame->n_vectors;
- from = vlib_frame_vector_args (frame);
-
- while (n_left_from > 0)
- {
- u32 n_left_to_next;
-
- vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-
- while (n_left_from > 0 && n_left_to_next > 0)
- {
- gbp_sclass_next_t next0;
- vlib_buffer_t *b0;
- epg_id_t epg0;
- u16 sclass0;
- u32 bi0;
-
- next0 = GBP_SCLASS_NEXT_DROP;
- bi0 = from[0];
- to_next[0] = bi0;
- from += 1;
- to_next += 1;
- n_left_from -= 1;
- n_left_to_next -= 1;
-
- b0 = vlib_get_buffer (vm, bi0);
-
- if (is_id_2_sclass)
- {
- // output direction - convert from the SRC-EPD to the sclass
- gbp_endpoint_group_t *gg;
-
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
- gg = gbp_epg_get (epg0);
-
- if (NULL != gg)
- {
- sclass0 = vnet_buffer2 (b0)->gbp.sclass = gg->gg_sclass;
- if (is_l2)
- next0 =
- vnet_l2_feature_next (b0, glm->gel_l2_output_feat_next,
- L2OUTPUT_FEAT_GBP_ID_2_SCLASS);
- else
- vnet_feature_next (&next0, b0);
- }
- else
- sclass0 = 0;
- }
- else
- {
- /* input direction - convert from the sclass to the SRC-EGD */
- sclass0 = vnet_buffer2 (b0)->gbp.sclass;
- vnet_buffer2 (b0)->gbp.src_epg =
- gbp_epg_sclass_2_id (vnet_buffer2 (b0)->gbp.sclass);
- epg0 = vnet_buffer2 (b0)->gbp.src_epg;
-
- if (EPG_INVALID != epg0)
- {
- if (is_l2)
- next0 =
- vnet_l2_feature_next (b0, glm->gel_l2_input_feat_next,
- L2INPUT_FEAT_GBP_SCLASS_2_ID);
- else
- vnet_feature_next (&next0, b0);
- }
- }
-
- if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
- {
- gbp_sclass_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- t->epg = epg0;
- t->sclass = sclass0;
- }
-
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
- }
-
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
- }
-
- return frame->n_vectors;
-}
-
-VLIB_NODE_FN (l2_gbp_id_2_sclass_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 1, 1));
-}
-
-VLIB_NODE_FN (l2_gbp_sclass_2_id_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 0, 1));
-}
-
-VLIB_NODE_FN (ip4_gbp_id_2_sclass_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 1, 0));
-}
-
-VLIB_NODE_FN (ip4_gbp_sclass_2_id_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 0, 0));
-}
-
-VLIB_NODE_FN (ip6_gbp_id_2_sclass_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 1, 0));
-}
-
-VLIB_NODE_FN (ip6_gbp_sclass_2_id_node) (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
-{
- return (gbp_sclass_inline (vm, node, frame, 0, 0));
-}
-
-/* packet trace format function */
-static u8 *
-format_gbp_sclass_trace (u8 * s, va_list * args)
-{
- CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
- CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
- gbp_sclass_trace_t *t = va_arg (*args, gbp_sclass_trace_t *);
-
- s = format (s, "epg:%d sclass:%d", t->epg, t->sclass);
-
- return s;
-}
-
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_gbp_id_2_sclass_node) = {
- .name = "l2-gbp-id-2-sclass",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-VLIB_REGISTER_NODE (l2_gbp_sclass_2_id_node) = {
- .name = "l2-gbp-sclass-2-id",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-
-VLIB_REGISTER_NODE (ip4_gbp_id_2_sclass_node) = {
- .name = "ip4-gbp-id-2-sclass",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-VLIB_REGISTER_NODE (ip4_gbp_sclass_2_id_node) = {
- .name = "ip4-gbp-sclass-2-id",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-
-VLIB_REGISTER_NODE (ip6_gbp_id_2_sclass_node) = {
- .name = "ip6-gbp-id-2-sclass",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-VLIB_REGISTER_NODE (ip6_gbp_sclass_2_id_node) = {
- .name = "ip6-gbp-sclass-2-id",
- .vector_size = sizeof (u32),
- .format_trace = format_gbp_sclass_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_next_nodes = GBP_SCLASS_N_NEXT,
-
- .next_nodes = {
- [GBP_SCLASS_NEXT_DROP] = "error-drop",
- },
-};
-
-
-VNET_FEATURE_INIT (ip4_gbp_sclass_2_id_feat, static) =
-{
- .arc_name = "ip4-unicast",
- .node_name = "ip4-gbp-sclass-2-id",
- .runs_before = VNET_FEATURES ("gbp-learn-ip4"),
-};
-VNET_FEATURE_INIT (ip6_gbp_sclass_2_id_feat, static) =
-{
- .arc_name = "ip6-unicast",
- .node_name = "ip6-gbp-sclass-2-id",
- .runs_before = VNET_FEATURES ("gbp-learn-ip6"),
-};
-VNET_FEATURE_INIT (ip4_gbp_id_2_sclass_feat, static) =
-{
- .arc_name = "ip4-output",
- .node_name = "ip4-gbp-id-2-sclass",
-};
-VNET_FEATURE_INIT (ip6_gbp_id_2_sclass_feat, static) =
-{
- .arc_name = "ip6-output",
- .node_name = "ip6-gbp-id-2-sclass",
-};
-/* *INDENT-ON* */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/plugins/gbp/gbp_subnet.c b/src/plugins/gbp/gbp_subnet.c
index 0c8d3aee0a7..5e56c8200b9 100644
--- a/src/plugins/gbp/gbp_subnet.c
+++ b/src/plugins/gbp/gbp_subnet.c
@@ -43,12 +43,12 @@ typedef struct gbp_subnet_t_
{
struct
{
- epg_id_t gs_epg;
+ sclass_t gs_sclass;
u32 gs_sw_if_index;
} gs_stitched_external;
struct
{
- epg_id_t gs_epg;
+ sclass_t gs_sclass;
} gs_l3_out;
};
@@ -155,15 +155,15 @@ gbp_subnet_internal_add (gbp_subnet_t * gs)
}
static int
-gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, epg_id_t epg)
+gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, sclass_t sclass)
{
dpo_id_t gpd = DPO_INVALID;
- gs->gs_stitched_external.gs_epg = epg;
+ gs->gs_stitched_external.gs_sclass = sclass;
gs->gs_stitched_external.gs_sw_if_index = sw_if_index;
gbp_policy_dpo_add_or_lock (fib_proto_to_dpo (gs->gs_key->gsk_pfx.fp_proto),
- gs->gs_stitched_external.gs_epg,
+ gs->gs_stitched_external.gs_sclass,
gs->gs_stitched_external.gs_sw_if_index, &gpd);
gs->gs_fei = fib_table_entry_special_dpo_update (gs->gs_key->gsk_fib_index,
@@ -179,14 +179,14 @@ gbp_subnet_external_add (gbp_subnet_t * gs, u32 sw_if_index, epg_id_t epg)
}
static int
-gbp_subnet_l3_out_add (gbp_subnet_t * gs, u32 sw_if_index, epg_id_t epg)
+gbp_subnet_l3_out_add (gbp_subnet_t * gs, u32 sw_if_index, sclass_t sclass)
{
dpo_id_t gpd = DPO_INVALID;
- gs->gs_l3_out.gs_epg = epg;
+ gs->gs_l3_out.gs_sclass = sclass;
gbp_policy_dpo_add_or_lock (fib_proto_to_dpo (gs->gs_key->gsk_pfx.fp_proto),
- gs->gs_l3_out.gs_epg, ~0, &gpd);
+ gs->gs_l3_out.gs_sclass, ~0, &gpd);
gs->gs_fei = fib_table_entry_special_dpo_add (gs->gs_key->gsk_fib_index,
&gs->gs_key->gsk_pfx,
@@ -238,7 +238,7 @@ gbp_subnet_del (u32 rd_id, const fib_prefix_t * pfx)
int
gbp_subnet_add (u32 rd_id,
const fib_prefix_t * pfx,
- gbp_subnet_type_t type, u32 sw_if_index, epg_id_t epg)
+ gbp_subnet_type_t type, u32 sw_if_index, sclass_t sclass)
{
gbp_route_domain_t *grd;
index_t grdi, gsi;
@@ -273,13 +273,13 @@ gbp_subnet_add (u32 rd_id,
rv = gbp_subnet_internal_add (gs);
break;
case GBP_SUBNET_STITCHED_EXTERNAL:
- rv = gbp_subnet_external_add (gs, sw_if_index, epg);
+ rv = gbp_subnet_external_add (gs, sw_if_index, sclass);
break;
case GBP_SUBNET_TRANSPORT:
rv = gbp_subnet_transport_add (gs);
break;
case GBP_SUBNET_L3_OUT:
- rv = gbp_subnet_l3_out_add (gs, sw_if_index, epg);
+ rv = gbp_subnet_l3_out_add (gs, sw_if_index, sclass);
break;
}
@@ -292,9 +292,9 @@ gbp_subnet_walk (gbp_subnet_cb_t cb, void *ctx)
gbp_route_domain_t *grd;
gbp_subnet_t *gs;
u32 sw_if_index;
- epg_id_t epg;
+ sclass_t sclass;
- epg = EPG_INVALID;
+ sclass = SCLASS_INVALID;
sw_if_index = ~0;
/* *INDENT-OFF* */
@@ -310,15 +310,15 @@ gbp_subnet_walk (gbp_subnet_cb_t cb, void *ctx)
break;
case GBP_SUBNET_STITCHED_EXTERNAL:
sw_if_index = gs->gs_stitched_external.gs_sw_if_index;
- epg = gs->gs_stitched_external.gs_epg;
+ sclass = gs->gs_stitched_external.gs_sclass;
break;
case GBP_SUBNET_L3_OUT:
- epg = gs->gs_l3_out.gs_epg;
+ sclass = gs->gs_l3_out.gs_sclass;
break;
}
if (WALK_STOP == cb (grd->grd_id, &gs->gs_key->gsk_pfx,
- gs->gs_type, sw_if_index, epg, ctx))
+ gs->gs_type, sw_if_index, sclass, ctx))
break;
}));
/* *INDENT-ON* */
@@ -373,12 +373,12 @@ format_gbp_subnet (u8 * s, va_list * args)
case GBP_SUBNET_TRANSPORT:
break;
case GBP_SUBNET_STITCHED_EXTERNAL:
- s = format (s, " {epg:%d %U}", gs->gs_stitched_external.gs_epg,
+ s = format (s, " {sclass:%d %U}", gs->gs_stitched_external.gs_sclass,
format_vnet_sw_if_index_name,
vnet_get_main (), gs->gs_stitched_external.gs_sw_if_index);
break;
case GBP_SUBNET_L3_OUT:
- s = format (s, " {epg:%d}", gs->gs_l3_out.gs_epg);
+ s = format (s, " {sclass:%d}", gs->gs_l3_out.gs_sclass);
break;
}
diff --git a/src/plugins/gbp/gbp_subnet.h b/src/plugins/gbp/gbp_subnet.h
index 5fbd4b23df0..b792a1bafcb 100644
--- a/src/plugins/gbp/gbp_subnet.h
+++ b/src/plugins/gbp/gbp_subnet.h
@@ -29,7 +29,7 @@ typedef enum gbp_subnet_type_t_
extern int gbp_subnet_add (u32 rd_id,
const fib_prefix_t * pfx,
gbp_subnet_type_t type,
- u32 sw_if_index, epg_id_t epg);
+ u32 sw_if_index, sclass_t sclass);
extern int gbp_subnet_del (u32 rd_id, const fib_prefix_t * pfx);
@@ -37,7 +37,7 @@ typedef walk_rc_t (*gbp_subnet_cb_t) (u32 rd_id,
const fib_prefix_t * pfx,
gbp_subnet_type_t type,
u32 sw_if_index,
- epg_id_t epg, void *ctx);
+ sclass_t sclass, void *ctx);
extern void gbp_subnet_walk (gbp_subnet_cb_t cb, void *ctx);
diff --git a/src/plugins/gbp/gbp_types.h b/src/plugins/gbp/gbp_types.h
index 0faa74b694e..5bd9735e08b 100644
--- a/src/plugins/gbp/gbp_types.h
+++ b/src/plugins/gbp/gbp_types.h
@@ -18,8 +18,10 @@
#include <vnet/vnet.h>
-typedef u16 epg_id_t;
-#define EPG_INVALID ((u16)~0)
+typedef u32 vnid_t;
+#define VNID_INVALID ((u16)~0)
+
+typedef u16 sclass_t;
#define SCLASS_INVALID ((u16)~0)
#endif
diff --git a/src/plugins/gbp/gbp_vxlan.c b/src/plugins/gbp/gbp_vxlan.c
index c0e88fdda8e..286345ed8fa 100644
--- a/src/plugins/gbp/gbp_vxlan.c
+++ b/src/plugins/gbp/gbp_vxlan.c
@@ -18,7 +18,6 @@
#include <plugins/gbp/gbp_learn.h>
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h>
#include <vlibmemory/api.h>
@@ -169,9 +168,8 @@ gdb_vxlan_dep_add (gbp_vxlan_tunnel_t * gt,
vxr->vxr_itf = gbp_itf_add_and_lock (vxr->vxr_sw_if_index,
gt->gt_bd_index);
- ofeat = (L2OUTPUT_FEAT_GBP_POLICY_MAC |
- L2OUTPUT_FEAT_GBP_ID_2_SCLASS);
- ifeat = L2INPUT_FEAT_GBP_SCLASS_2_ID;
+ ofeat = L2OUTPUT_FEAT_GBP_POLICY_MAC;
+ ifeat = L2INPUT_FEAT_NONE;
if (!(gbd->gb_flags & GBP_BD_FLAG_DO_NOT_LEARN))
ifeat |= L2INPUT_FEAT_GBP_LEARN;
@@ -193,7 +191,6 @@ gdb_vxlan_dep_add (gbp_vxlan_tunnel_t * gt,
grd->grd_table_id[fproto], 1);
gbp_learn_enable (vxr->vxr_sw_if_index, GBP_LEARN_MODE_L3);
- gbp_sclass_enable_ip (vxr->vxr_sw_if_index);
}
}
@@ -283,7 +280,6 @@ gdb_vxlan_dep_del (index_t vxri)
FOR_EACH_FIB_IP_PROTOCOL (fproto)
ip_table_bind (fproto, vxr->vxr_sw_if_index, 0, 0);
- gbp_sclass_disable_ip (vxr->vxr_sw_if_index);
gbp_learn_disable (vxr->vxr_sw_if_index, GBP_LEARN_MODE_L3);
}
@@ -541,7 +537,6 @@ gbp_vxlan_tunnel_add (u32 vni, gbp_vxlan_tunnel_layer_t layer,
gt->gt_itf = gbp_itf_add_and_lock (gt->gt_sw_if_index,
gt->gt_bd_index);
gbp_learn_enable (gt->gt_sw_if_index, GBP_LEARN_MODE_L2);
- gbp_sclass_enable_l2 (gt->gt_sw_if_index);
}
else
{
@@ -554,7 +549,6 @@ gbp_vxlan_tunnel_add (u32 vni, gbp_vxlan_tunnel_layer_t layer,
grd->grd_vni_sw_if_index = gt->gt_sw_if_index;
gbp_learn_enable (gt->gt_sw_if_index, GBP_LEARN_MODE_L3);
- gbp_sclass_enable_ip (gt->gt_sw_if_index);
ip4_sw_interface_enable_disable (gt->gt_sw_if_index, 1);
ip6_sw_interface_enable_disable (gt->gt_sw_if_index, 1);
@@ -620,7 +614,6 @@ gbp_vxlan_tunnel_del (u32 vni)
if (GBP_VXLAN_TUN_L2 == gt->gt_layer)
{
gbp_learn_disable (gt->gt_sw_if_index, GBP_LEARN_MODE_L2);
- gbp_sclass_disable_l2 (gt->gt_sw_if_index);
gbp_itf_unlock (gt->gt_itf);
gbp_bridge_domain_unlock (gt->gt_gbd);
}
@@ -635,7 +628,6 @@ gbp_vxlan_tunnel_del (u32 vni)
ip6_sw_interface_enable_disable (gt->gt_sw_if_index, 0);
gbp_learn_disable (gt->gt_sw_if_index, GBP_LEARN_MODE_L3);
- gbp_sclass_disable_ip (gt->gt_sw_if_index);
gbp_route_domain_unlock (gt->gt_grd);
}
diff --git a/src/plugins/gbp/gbp_vxlan_node.c b/src/plugins/gbp/gbp_vxlan_node.c
index c49f74af879..413a9f47e1b 100644
--- a/src/plugins/gbp/gbp_vxlan_node.c
+++ b/src/plugins/gbp/gbp_vxlan_node.c
@@ -17,7 +17,6 @@
#include <plugins/gbp/gbp_learn.h>
#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>
-#include <plugins/gbp/gbp_sclass.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h>
#include <vlibmemory/api.h>
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 7afd16bdfcd..c9b99c9a231 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -391,11 +391,7 @@ typedef struct
{
u8 __unused;
u8 flags;
- union
- {
- u16 src_epg;
- u16 sclass;
- };
+ u16 sclass;
} gbp;
/**
diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c
index 5b20866cce2..2cc10f9b057 100644
--- a/src/vnet/interface_format.c
+++ b/src/vnet/interface_format.c
@@ -578,8 +578,8 @@ format_vnet_buffer_opaque2 (u8 * s, va_list * args)
s = format (s, "loop_counter: %d", o->loop_counter);
vec_add1 (s, '\n');
- s = format (s, "gbp.flags: %x, gbp.src_epg: %d",
- (u32) (o->gbp.flags), (u32) (o->gbp.src_epg));
+ s = format (s, "gbp.flags: %x, gbp.sclass: %d",
+ (u32) (o->gbp.flags), (u32) (o->gbp.sclass));
vec_add1 (s, '\n');
s = format (s, "pg_replay_timestamp: %llu", (u32) (o->pg_replay_timestamp));
diff --git a/src/vnet/l2/l2_input.h b/src/vnet/l2/l2_input.h
index 12e7e54038c..93da1277e67 100644
--- a/src/vnet/l2/l2_input.h
+++ b/src/vnet/l2/l2_input.h
@@ -114,7 +114,6 @@ l2input_bd_config (u32 bd_index)
_(GBP_NULL_CLASSIFY, "gbp-null-classify") \
_(GBP_SRC_CLASSIFY, "gbp-src-classify") \
_(GBP_LPM_CLASSIFY, "l2-gbp-lpm-classify") \
- _(GBP_SCLASS_2_ID, "l2-gbp-sclass-2-id") \
_(VTR, "l2-input-vtr") \
_(L2_IP_QOS_RECORD, "l2-ip-qos-record") \
_(VPATH, "vpath-input-l2") \
diff --git a/src/vnet/l2/l2_output.h b/src/vnet/l2/l2_output.h
index fdb6167155f..74d2829839f 100644
--- a/src/vnet/l2/l2_output.h
+++ b/src/vnet/l2/l2_output.h
@@ -81,7 +81,6 @@ extern vlib_node_registration_t l2output_node;
#define foreach_l2output_feat \
_(OUTPUT, "interface-output") \
_(SPAN, "span-l2-output") \
- _(GBP_ID_2_SCLASS, "l2-gbp-id-2-sclass") \
_(GBP_POLICY_PORT, "gbp-policy-port") \
_(GBP_POLICY_MAC, "gbp-policy-mac") \
_(CFM, "feature-bitmap-drop") \
diff --git a/test/test_gbp.py b/test/test_gbp.py
index 1b23cfffbe9..43043033a45 100644
--- a/test/test_gbp.py
+++ b/test/test_gbp.py
@@ -124,7 +124,7 @@ class VppGbpEndpoint(VppObject):
self.itf.sw_if_index,
[self.ip4.encode(), self.ip6.encode()],
self.vmac.packed,
- self.epg.epg,
+ self.epg.sclass,
self.flags,
self.tun_src.encode(),
self.tun_dst.encode())
@@ -141,7 +141,7 @@ class VppGbpEndpoint(VppObject):
return "gbp-endpoint:[%d==%d:%s:%d]" % (self.handle,
self.itf.sw_if_index,
self.ip4.address,
- self.epg.epg)
+ self.epg.sclass)
def query_vpp_config(self):
return find_gbp_endpoint(self._test,
@@ -164,7 +164,7 @@ class VppGbpRecirc(VppObject):
self._test.vapi.gbp_recirc_add_del(
1,
self.recirc.sw_if_index,
- self.epg.epg,
+ self.epg.sclass,
self.is_ext)
self._test.registry.register(self, self._test.logger)
@@ -172,7 +172,7 @@ class VppGbpRecirc(VppObject):
self._test.vapi.gbp_recirc_add_del(
0,
self.recirc.sw_if_index,
- self.epg.epg,
+ self.epg.sclass,
self.is_ext)
def __str__(self):
@@ -249,7 +249,7 @@ class VppGbpSubnet(VppObject):
self.prefix.encode(),
self.type,
sw_if_index=self.sw_if_index if self.sw_if_index else 0xffffffff,
- epg_id=self.epg if self.epg else 0xffff)
+ sclass=self.epg.sclass if self.epg else 0xffff)
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
@@ -288,7 +288,7 @@ class VppGbpEndpointGroup(VppObject):
GBP Endpoint Group
"""
- def __init__(self, test, epg, sclass, rd, bd, uplink,
+ def __init__(self, test, vnid, sclass, rd, bd, uplink,
bvi, bvi_ip4, bvi_ip6=None,
retention=VppGbpEndpointRetention()):
self._test = test
@@ -296,7 +296,7 @@ class VppGbpEndpointGroup(VppObject):
self.bvi = bvi
self.bvi_ip4 = VppIpAddress(bvi_ip4)
self.bvi_ip6 = VppIpAddress(bvi_ip6)
- self.epg = epg
+ self.vnid = vnid
self.bd = bd
self.rd = rd
self.sclass = sclass
@@ -306,7 +306,7 @@ class VppGbpEndpointGroup(VppObject):
def add_vpp_config(self):
self._test.vapi.gbp_endpoint_group_add(
- self.epg,
+ self.vnid,
self.sclass,
self.bd.bd.bd_id,
self.rd.rd_id,
@@ -315,18 +315,18 @@ class VppGbpEndpointGroup(VppObject):
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
- self._test.vapi.gbp_endpoint_group_del(self.epg)
+ self._test.vapi.gbp_endpoint_group_del(self.sclass)
def __str__(self):
return self.object_id()
def object_id(self):
- return "gbp-endpoint-group:[%d]" % (self.epg)
+ return "gbp-endpoint-group:[%d]" % (self.vnid)
def query_vpp_config(self):
epgs = self._test.vapi.gbp_endpoint_group_dump()
for epg in epgs:
- if epg.epg.epg_id == self.epg:
+ if epg.epg.vnid == self.vnid:
return True
return False
@@ -468,8 +468,8 @@ class VppGbpContract(VppObject):
rules.append(r.encode())
self._test.vapi.gbp_contract_add_del(
1,
- self.src_epg,
- self.dst_epg,
+ self.src_epg.sclass,
+ self.dst_epg.sclass,
self.acl_index,
rules,
self.allowed_ethertypes)
@@ -478,8 +478,8 @@ class VppGbpContract(VppObject):
def remove_vpp_config(self):
self._test.vapi.gbp_contract_add_del(
0,
- self.src_epg,
- self.dst_epg,
+ self.src_epg.sclass,
+ self.dst_epg.sclass,
self.acl_index,
[], [])
@@ -487,15 +487,15 @@ class VppGbpContract(VppObject):
return self.object_id()
def object_id(self):
- return "gbp-contract:[%d:%s:%d]" % (self.src_epg,
- self.dst_epg,
+ return "gbp-contract:[%d:%s:%d]" % (self.src_epg.sclass,
+ self.dst_epg.sclass,
self.acl_index)
def query_vpp_config(self):
cs = self._test.vapi.gbp_contract_dump()
for c in cs:
- if c.contract.src_epg == self.src_epg \
- and c.contract.dst_epg == self.dst_epg:
+ if c.contract.sclass == self.src_epg.sclass \
+ and c.contract.dclass == self.dst_epg.sclass:
return True
return False
@@ -748,36 +748,26 @@ class TestGBP(VppTestCase):
# 3 EPGs, 2 of which share a BD.
# 2 NAT EPGs, one for floating-IP subnets, the other for internet
#
- epgs = [VppGbpEndpointGroup(self, 220, 0, rd0, gbd1, self.pg4,
- self.loop0,
- "10.0.0.128",
- "2001:10::128"),
- VppGbpEndpointGroup(self, 221, 0, rd0, gbd1, self.pg5,
- self.loop0,
- "10.0.1.128",
- "2001:10:1::128"),
- VppGbpEndpointGroup(self, 222, 0, rd0, gbd2, self.pg6,
- self.loop1,
- "10.0.2.128",
- "2001:10:2::128"),
- VppGbpEndpointGroup(self, 333, 0, rd20, gbd20, self.pg7,
- self.loop2,
- "11.0.0.128",
- "3001::128"),
- VppGbpEndpointGroup(self, 444, 0, rd20, gbd20, self.pg8,
- self.loop2,
- "11.0.0.129",
- "3001::129")]
- recircs = [VppGbpRecirc(self, epgs[0],
- self.loop3),
- VppGbpRecirc(self, epgs[1],
- self.loop4),
- VppGbpRecirc(self, epgs[2],
- self.loop5),
- VppGbpRecirc(self, epgs[3],
- self.loop6, is_ext=True),
- VppGbpRecirc(self, epgs[4],
- self.loop7, is_ext=True)]
+ epgs = [VppGbpEndpointGroup(self, 220, 1220, rd0, gbd1,
+ self.pg4, self.loop0,
+ "10.0.0.128", "2001:10::128"),
+ VppGbpEndpointGroup(self, 221, 1221, rd0, gbd1,
+ self.pg5, self.loop0,
+ "10.0.1.128", "2001:10:1::128"),
+ VppGbpEndpointGroup(self, 222, 1222, rd0, gbd2,
+ self.pg6, self.loop1,
+ "10.0.2.128", "2001:10:2::128"),
+ VppGbpEndpointGroup(self, 333, 1333, rd20, gbd20,
+ self.pg7, self.loop2,
+ "11.0.0.128", "3001::128"),
+ VppGbpEndpointGroup(self, 444, 1444, rd20, gbd20,
+ self.pg8, self.loop2,
+ "11.0.0.129", "3001::129")]
+ recircs = [VppGbpRecirc(self, epgs[0], self.loop3),
+ VppGbpRecirc(self, epgs[1], self.loop4),
+ VppGbpRecirc(self, epgs[2], self.loop5),
+ VppGbpRecirc(self, epgs[3], self.loop6, is_ext=True),
+ VppGbpRecirc(self, epgs[4], self.loop7, is_ext=True)]
epg_nat = epgs[3]
recirc_nat = recircs[3]
@@ -1154,7 +1144,7 @@ class TestGBP(VppTestCase):
rule2 = acl.create_rule(is_ipv6=1, permit_deny=1, proto=17)
acl_index = acl.add_vpp_config([rule, rule2])
c1 = VppGbpContract(
- self, 220, 221, acl_index,
+ self, epgs[0], epgs[1], acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -1174,7 +1164,7 @@ class TestGBP(VppTestCase):
# contract for the return direction
#
c2 = VppGbpContract(
- self, 221, 220, acl_index,
+ self, epgs[1], epgs[0], acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -1211,7 +1201,7 @@ class TestGBP(VppTestCase):
# A uni-directional contract from EPG 220 -> 222 'L3 routed'
#
c3 = VppGbpContract(
- self, 220, 222, acl_index,
+ self, epgs[0], epgs[2], acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -1253,33 +1243,33 @@ class TestGBP(VppTestCase):
self, rd0, "0.0.0.0", 0,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_STITCHED_EXTERNAL,
sw_if_index=recirc_nat.recirc.sw_if_index,
- epg=epg_nat.epg)
+ epg=epg_nat)
se2 = VppGbpSubnet(
self, rd0, "11.0.0.0", 8,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_STITCHED_EXTERNAL,
sw_if_index=recirc_nat.recirc.sw_if_index,
- epg=epg_nat.epg)
+ epg=epg_nat)
se16 = VppGbpSubnet(
self, rd0, "::", 0,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_STITCHED_EXTERNAL,
sw_if_index=recirc_nat.recirc.sw_if_index,
- epg=epg_nat.epg)
+ epg=epg_nat)
# in the NAT RD an external subnet via the NAT EPG's uplink
se3 = VppGbpSubnet(
self, rd20, "0.0.0.0", 0,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_STITCHED_EXTERNAL,
sw_if_index=epg_nat.uplink.sw_if_index,
- epg=epg_nat.epg)
+ epg=epg_nat)
se36 = VppGbpSubnet(
self, rd20, "::", 0,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_STITCHED_EXTERNAL,
sw_if_index=epg_nat.uplink.sw_if_index,
- epg=epg_nat.epg)
+ epg=epg_nat)
se4 = VppGbpSubnet(
self, rd20, "11.0.0.0", 8,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_STITCHED_EXTERNAL,
sw_if_index=epg_nat.uplink.sw_if_index,
- epg=epg_nat.epg)
+ epg=epg_nat)
se1.add_vpp_config()
se2.add_vpp_config()
se16.add_vpp_config()
@@ -1316,7 +1306,7 @@ class TestGBP(VppTestCase):
acl_index2 = acl2.add_vpp_config([rule, rule2])
c4 = VppGbpContract(
- self, 220, 333, acl_index2,
+ self, epgs[0], epgs[3], acl_index2,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -1357,7 +1347,7 @@ class TestGBP(VppTestCase):
pkt_inter_epg_220_from_global * 65)
c5 = VppGbpContract(
- self, 333, 220, acl_index2,
+ self, epgs[3], epgs[0], acl_index2,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -1860,7 +1850,7 @@ class TestGBP(VppTestCase):
rule2 = acl.create_rule(is_ipv6=1, permit_deny=1, proto=17)
acl_index = acl.add_vpp_config([rule, rule2])
c1 = VppGbpContract(
- self, 220, 330, acl_index,
+ self, epg_220, epg_330, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -2755,7 +2745,7 @@ class TestGBP(VppTestCase):
# test the src-ip hash mode
#
c1 = VppGbpContract(
- self, 220, 222, acl_index,
+ self, epg_220, epg_222, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SRC_IP,
@@ -2774,7 +2764,7 @@ class TestGBP(VppTestCase):
c1.add_vpp_config()
c2 = VppGbpContract(
- self, 222, 220, acl_index,
+ self, epg_222, epg_220, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SRC_IP,
@@ -2887,7 +2877,7 @@ class TestGBP(VppTestCase):
# test the symmetric hash mode
#
c1 = VppGbpContract(
- self, 220, 222, acl_index,
+ self, epg_220, epg_222, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SYMMETRIC,
@@ -2906,7 +2896,7 @@ class TestGBP(VppTestCase):
c1.add_vpp_config()
c2 = VppGbpContract(
- self, 222, 220, acl_index,
+ self, epg_222, epg_220, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SYMMETRIC,
@@ -2971,7 +2961,7 @@ class TestGBP(VppTestCase):
Raw('\xa5' * 100))]
c3 = VppGbpContract(
- self, 220, 221, acl_index,
+ self, epg_220, epg_221, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_SYMMETRIC,
@@ -3007,7 +2997,7 @@ class TestGBP(VppTestCase):
vx_tun_l3.add_vpp_config()
c4 = VppGbpContract(
- self, 221, 220, acl_index,
+ self, epg_221, epg_220, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_PERMIT,
[]),
@@ -3085,7 +3075,7 @@ class TestGBP(VppTestCase):
# test the dst-ip hash mode
#
c5 = VppGbpContract(
- self, 220, 221, acl_index,
+ self, epg_220, epg_221, acl_index,
[VppGbpContractRule(
VppEnum.vl_api_gbp_rule_action_t.GBP_API_RULE_REDIRECT,
VppEnum.vl_api_gbp_hash_mode_t.GBP_API_HASH_MODE_DST_IP,
@@ -3195,7 +3185,7 @@ class TestGBP(VppTestCase):
l3o_1 = VppGbpSubnet(
self, rd1, "10.0.0.0", 24,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT,
- epg=220)
+ epg=epg_220)
l3o_1.add_vpp_config()
#
@@ -3301,7 +3291,7 @@ class TestGBP(VppTestCase):
l3o_220 = VppGbpSubnet(
self, rd1, "10.220.0.0", 24,
VppEnum.vl_api_gbp_subnet_type_t.GBP_API_SUBNET_L3_OUT,
- epg=220)
+ epg=epg_220)
l3o_220.add_vpp_config()
p = (Ether(src=self.pg7.remote_mac,
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 9955518b2ef..5975b571899 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -3553,7 +3553,7 @@ class VppPapiProvider(object):
'enable_ip6': 1 if enable_ip6 else 0,
})
- def gbp_endpoint_add(self, sw_if_index, ips, mac, epg, flags,
+ def gbp_endpoint_add(self, sw_if_index, ips, mac, sclass, flags,
tun_src, tun_dst):
""" GBP endpoint Add """
return self.api(self.papi.gbp_endpoint_add,
@@ -3562,7 +3562,7 @@ class VppPapiProvider(object):
'ips': ips,
'n_ips': len(ips),
'mac': mac,
- 'epg_id': epg,
+ 'sclass': sclass,
'flags': flags,
'tun': {
'src': tun_src,
@@ -3579,7 +3579,7 @@ class VppPapiProvider(object):
return self.api(self.papi.gbp_endpoint_dump,
{'_no_type_conversion': True})
- def gbp_endpoint_group_add(self, epg, sclass, bd,
+ def gbp_endpoint_group_add(self, vnid, sclass, bd,
rd, uplink_sw_if_index,
retention):
""" GBP endpoint group Add """
@@ -3589,15 +3589,15 @@ class VppPapiProvider(object):
'uplink_sw_if_index': uplink_sw_if_index,
'bd_id': bd,
'rd_id': rd,
- 'epg_id': epg,
+ 'vnid': vnid,
'sclass': sclass,
'retention': retention
}})
- def gbp_endpoint_group_del(self, epg):
+ def gbp_endpoint_group_del(self, sclass):
""" GBP endpoint group Del """
return self.api(self.papi.gbp_endpoint_group_del,
- {'epg_id': epg})
+ {'sclass': sclass})
def gbp_endpoint_group_dump(self):
""" GBP endpoint group Dump """
@@ -3652,14 +3652,14 @@ class VppPapiProvider(object):
""" GBP Route Domain Dump """
return self.api(self.papi.gbp_route_domain_dump, {})
- def gbp_recirc_add_del(self, is_add, sw_if_index, epg, is_ext):
+ def gbp_recirc_add_del(self, is_add, sw_if_index, sclass, is_ext):
""" GBP recirc Add/Del """
return self.api(self.papi.gbp_recirc_add_del,
{'is_add': is_add,
'recirc': {
'is_ext': is_ext,
'sw_if_index': sw_if_index,
- 'epg_id': epg}})
+ 'sclass': sclass}})
def gbp_recirc_dump(self):
""" GBP recirc Dump """
@@ -3681,14 +3681,14 @@ class VppPapiProvider(object):
def gbp_subnet_add_del(self, is_add, rd_id,
prefix, type,
sw_if_index=0xffffffff,
- epg_id=0xffff):
+ sclass=0xffff):
""" GBP Subnet Add/Del """
return self.api(self.papi.gbp_subnet_add_del,
{'is_add': is_add,
'subnet': {
'type': type,
'sw_if_index': sw_if_index,
- 'epg_id': epg_id,
+ 'sclass': sclass,
'prefix': prefix,
'rd_id': rd_id}})
@@ -3697,15 +3697,15 @@ class VppPapiProvider(object):
return self.api(self.papi.gbp_subnet_dump,
{'_no_type_conversion': True})
- def gbp_contract_add_del(self, is_add, src_epg, dst_epg, acl_index,
+ def gbp_contract_add_del(self, is_add, sclass, dclass, acl_index,
rules, allowed_ethertypes):
""" GBP contract Add/Del """
return self.api(self.papi.gbp_contract_add_del,
{'is_add': is_add,
'contract': {
'acl_index': acl_index,
- 'src_epg': src_epg,
- 'dst_epg': dst_epg,
+ 'sclass': sclass,
+ 'dclass': dclass,
'n_rules': len(rules),
'rules': rules,
'n_ether_types': len(allowed_ethertypes),