|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
23 singular_db<gbp_contract::key_t, gbp_contract> gbp_contract::m_db;
37 , m_acl(acl.singular())
45 , m_scope(gbpc.m_scope)
46 , m_sclass(gbpc.m_sclass)
47 , m_dclass(gbpc.m_dclass)
49 , m_gbp_rules(gbpc.m_gbp_rules)
50 , m_allowed_ethertypes(gbpc.m_allowed_ethertypes)
59 m_db.release(
key(),
this);
65 return (std::make_tuple(m_scope, m_sclass, m_dclass));
71 return ((
key() == gbpc.
key()) && (m_acl->handle() == gbpc.m_acl->handle()));
89 m_hw, m_scope, m_sclass, m_dclass, m_acl->handle(), m_gbp_rules,
90 m_allowed_ethertypes));
98 s <<
"gbp-contract:[{" << m_scope <<
", " << m_sclass <<
", " << m_dclass
99 <<
"}, " << m_acl->to_string();
100 if (m_gbp_rules.size()) {
101 auto it = m_gbp_rules.cbegin();
102 while (
it != m_gbp_rules.cend()) {
103 s <<
it->to_string();
108 for (
auto e : m_allowed_ethertypes)
123 m_hw, m_scope, m_sclass, m_dclass, m_acl->handle(), m_gbp_rules,
124 m_allowed_ethertypes));
128 std::shared_ptr<gbp_contract>
131 return (m_db.find_or_add(temp.key(), temp));
134 std::shared_ptr<gbp_contract>
137 return (m_db.find(k));
140 std::shared_ptr<gbp_contract>
143 return find_or_add(*
this);
159 gbp_contract::event_handler::handle_replay()
167 std::shared_ptr<gbp_contract_cmds::dump_cmd> cmd =
168 std::make_shared<gbp_contract_cmds::dump_cmd>();
173 for (
auto& record : *cmd) {
174 auto& payload = record.get_payload();
176 std::shared_ptr<ACL::l3_list> acl =
182 for (uint8_t
i = 0;
i < payload.contract.n_rules;
i++) {
183 const gbp_rule::action_t
action =
186 payload.contract.rules[
i].nh_set.hash_mode);
188 for (
u8 j = 0; j < payload.contract.rules[
i].nh_set.n_nhs; j++) {
189 gbp_rule::next_hop_t
nh(
190 from_api(payload.contract.rules[
i].nh_set.nhs[j].ip),
191 from_api(payload.contract.rules[
i].nh_set.nhs[j].mac),
192 payload.contract.rules[
i].nh_set.nhs[j].bd_id,
193 payload.contract.rules[
i].nh_set.nhs[j].rd_id);
196 gbp_rule::next_hop_set_t next_hop_set(hm,
nhs);
205 data = (((
u8*)&payload.contract.n_ether_types) +
206 (
sizeof(payload.contract.rules[0]) * payload.contract.n_rules));
210 for (uint8_t
i = 0;
i < n_et;
i++) {
214 gbp_contract gbpc(payload.contract.scope, payload.contract.sclass,
215 payload.contract.dclass, *acl,
rules,
226 gbp_contract::event_handler::order()
const
240 os <<
"{ " << std::get<0>(
key) <<
"," << std::get<1>(
key) <<
", "
241 << std::get<2>(
key) <<
"}";
static rc_t write()
Write/Execute all commands hitherto enqueued.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
The VPP Object Model (VOM) library.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
const static rc_t OK
The HW write was successfull.
bool operator==(const gbp_contract &bdae) const
comparison operator
const key_t key() const
Return the object's key.
std::set< next_hop_t > next_hops_t
unordered set of next hops
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
A command class that creates or updates the GBP contract.
vl_api_gbp_next_hop_t nhs[8]
@ ENTRY
Entries in Tables.
vnet_hw_if_output_node_runtime_t * r
u16 allowed_ethertypes[16]
std::string to_string() const
Convert to string for debugging.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
std::set< ethertype_t > ethertype_set_t
A set of allowed ethertypes.
static std::shared_ptr< l3_list > find(const handle_t &handle)
static bool register_listener(listener *listener)
Register a listener of events.
static const ethertype_t & from_numeric_val(uint16_t numeric)
Get the ethertype from the numeric value.
void replay(void)
replay the object to create it in hardware
A cmd class that deletes a GBP contract.
std::tuple< scope_t, sclass_t, sclass_t > key_t
The key for a contract is the pair of EPG-IDs.
const typedef std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
sll srl srl sll sra u16x4 i
static void enqueue(cmd *f)
Enqueue A command for execution.
save_rewrite_length must be aligned so that reass doesn t overwrite it
~gbp_contract()
Destructor.
const static log_level_t DEBUG
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
An L3 ACL list comprises a set of match actions rules to be applied to packets.
static const action_t & from_int(vapi_enum_gbp_rule_action i)
create the action from int value
rc_t rc() const
Get the HW return code.
std::set< gbp_rule > gbp_rules_t
set of gbp rules
vl_api_gbp_rule_t rules[n_rules]
gbp_contract(scope_t scope, sclass_t sclass, sclass_t dclass, const ACL::l3_list &acl, const gbp_rules_t &gpb_rules, const ethertype_set_t &allowed_ethertypes)
Construct a GBP contract.
static const hash_mode_t & from_int(vapi_enum_gbp_hash_mode i)
create the hash mode from int value
void event_handler(void *tls_async)
std::shared_ptr< gbp_contract > singular() const
Return the matching 'singular instance'.
static std::shared_ptr< gbp_contract > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
vl_api_mac_event_action_t action
A entry in the ARP termination table of a Bridge Domain.
const static log_level_t ERROR
const neighbour::flags_t from_api(vapi_enum_ip_neighbor_flags f)