|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
20 namespace gbp_contract_cmds {
34 , m_gbp_rules(gbp_rules)
42 return ((m_acl == other.m_acl) && (m_sclass == other.m_sclass) &&
43 (m_scope == other.m_scope) && (m_dclass == other.m_dclass) &&
44 (m_gbp_rules == other.m_gbp_rules) &&
45 (m_allowed_ethertypes == other.m_allowed_ethertypes));
48 #define ARRAY_LEN(x) (sizeof(x) / sizeof(x[0]))
53 size_t n_rules = m_gbp_rules.size();
58 auto& payload = req.get_request().get_payload();
60 payload.contract.acl_index = m_acl.
value();
61 payload.contract.scope = m_scope;
62 payload.contract.sclass = m_sclass;
63 payload.contract.dclass = m_dclass;
64 payload.contract.n_rules =
n_rules;
65 payload.contract.n_ether_types = m_allowed_ethertypes.size();
67 for (
auto tt : m_allowed_ethertypes) {
68 payload.contract.allowed_ethertypes[ii] = tt.value();
70 if (ii ==
ARRAY_LEN(payload.contract.allowed_ethertypes))
75 for (
auto rule : m_gbp_rules) {
91 uint8_t jj = 0, nh_size = (next_hops.size() > 8) ? 8 : next_hops.size();
93 payload.contract.rules[ii].nh_set.n_nhs = nh_size;
94 for (
auto nh : next_hops) {
95 to_api(
nh.getIp(), payload.contract.rules[ii].nh_set.nhs[jj].ip);
96 to_api(
nh.getMac(), payload.contract.rules[ii].nh_set.nhs[jj].mac);
97 payload.contract.rules[ii].nh_set.nhs[jj].bd_id =
nh.getBdId();
98 payload.contract.rules[ii].nh_set.nhs[jj].rd_id =
nh.getRdId();
112 std::ostringstream s;
114 <<
" sclass:" << m_sclass <<
" dclass:" << m_dclass <<
" acl:" << m_acl;
116 for (
auto e : m_allowed_ethertypes)
137 return ((m_sclass == other.m_sclass) && (m_dclass == other.m_dclass));
143 msg_t req(
con.ctx(), 0, std::ref(*
this));
145 auto& payload = req.get_request().get_payload();
147 payload.contract.acl_index = ~0;
148 payload.contract.scope = m_scope;
149 payload.contract.sclass = m_sclass;
150 payload.contract.dclass = m_dclass;
160 std::ostringstream s;
162 <<
" sclass:" << m_sclass <<
" dclass:" << m_dclass;
188 return (
"gbp-contract-dump");
vapi::Gbp_contract_dump msg_t
@ GBP_API_HASH_MODE_DST_IP
std::string to_string() const
convert to string format for debug purposes
delete_cmd(HW::item< uint32_t > &item, scope_t scope, sclass_t sclass, sclass_t dclass)
Constructor.
rc_t wait()
Wait on the commands promise.
@ GBP_API_HASH_MODE_SRC_IP
The VPP Object Model (VOM) library.
const static rc_t OK
The HW write was successfull.
std::set< next_hop_t > next_hops_t
unordered set of next hops
uint32_t value() const
get the value of the handle
A base class for all RPC commands to VPP.
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
A command class that creates or updates the GBP contract.
std::string to_string() const
convert to string format for debug purposes
u16 allowed_ethertypes[16]
std::string to_string() const
convert to string format for debug purposes
HW::item< uint32_t > & m_hw_item
A reference to an object's HW::item that the command will update.
std::unique_ptr< vapi::Gbp_contract_dump > m_dump
The VAPI event registration.
const static action_t PERMIT
Permit action.
const static action_t REDIRECT
Redirect action.
std::set< ethertype_t > ethertype_set_t
A set of allowed ethertypes.
const static hash_mode_t SYMMETRIC
Flow hash is calculated based on SRC IP, DST IP and Protocol.
@ GBP_API_HASH_MODE_SYMMETRIC
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
A cmd class that deletes a GBP contract.
create_cmd(HW::item< uint32_t > &item, scope_t scope, 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)
Constructor.
A representation of the connection to VPP.
rc_t wait()
Wait for the issue of the command to complete.
rc_t issue(connection &con)
Issue the command to VPP/HW.
A type declaration of an interface handle in VPP.
std::string to_string() const
convert to string format for debug purposes
vapi_enum_ip_neighbor_flags to_api(const neighbour::flags_t &f)
vapi::Gbp_contract_add_del msg_t
convenient typedef
A cmd class that Dumps all the GBP contracts.
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
std::set< gbp_rule > gbp_rules_t
set of gbp rules
Error codes that VPP will return during a HW write.
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
const static hash_mode_t SRC_IP
Flow Hash is calculated based on SRC IP in case of load balancing.
rc_t issue(connection &con)
Issue the command to VPP/HW.
rc_t issue(connection &con)
Issue the command to VPP/HW.