22 singular_db<gbp_contract::key_t, gbp_contract> gbp_contract::m_db;
24 gbp_contract::event_handler gbp_contract::m_evh;
30 , m_src_epg_id(src_epg_id)
31 , m_dst_epg_id(dst_epg_id)
32 , m_acl(acl.singular())
38 , m_src_epg_id(gbpc.m_src_epg_id)
39 , m_dst_epg_id(gbpc.m_dst_epg_id)
49 m_db.release(
key(),
this);
55 return (std::make_pair(m_src_epg_id, m_dst_epg_id));
61 return ((
key() == gbpc.
key()) && (m_acl->handle() == gbpc.m_acl->handle()));
79 m_hw, m_src_epg_id, m_dst_epg_id, m_acl->handle()));
87 s <<
"gbp-contract:[{" << m_src_epg_id <<
", " << m_dst_epg_id <<
"}, " 88 << m_acl->to_string() <<
"]";
101 m_hw, m_src_epg_id, m_dst_epg_id, m_acl->handle()));
105 std::shared_ptr<gbp_contract>
108 return (m_db.find_or_add(temp.
key(), temp));
111 std::shared_ptr<gbp_contract>
114 return (m_db.find(k));
117 std::shared_ptr<gbp_contract>
120 return find_or_add(*
this);
129 gbp_contract::event_handler::event_handler()
136 gbp_contract::event_handler::handle_replay()
144 std::shared_ptr<gbp_contract_cmds::dump_cmd>
cmd =
145 std::make_shared<gbp_contract_cmds::dump_cmd>();
150 for (
auto& record : *cmd) {
151 auto& payload = record.get_payload();
153 std::shared_ptr<ACL::l3_list> acl =
157 gbp_contract gbpc(payload.contract.src_epg, payload.contract.dst_epg,
167 gbp_contract::event_handler::order()
const 181 os <<
"{ " << key.first <<
"," << key.second <<
"}";
const key_t key() const
Return the object's key.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
An ACL list comprises a set of match actions rules to be applied to packets.
uint32_t epg_id_t
EPG IDs are 32 bit integers.
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
static std::shared_ptr< list > find(const handle_t &handle)
gbp_contract(epg_id_t src_epg_id, epg_id_t dst_epg_id, const ACL::l3_list &acl)
Construct a GBP contract.
std::shared_ptr< gbp_contract > singular() const
Return the matching 'singular instance'.
rc_t rc() const
Get the HW return code.
bool operator==(const gbp_contract &bdae) const
comparison operator
void replay(void)
replay the object to create it in hardware
A entry in the ARP termination table of a Bridge Domain.
~gbp_contract()
Destructor.
std::pair< epg_id_t, epg_id_t > key_t
The key for a contract is the pari of EPG-IDs.
std::string to_string() const
Convert to string for debugging.
A command class that creates or updates the GBP contract.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
static const rc_t OK
The HW write was successfull.
static void enqueue(cmd *f)
Enqueue A command for execution.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
static std::shared_ptr< gbp_contract > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
A cmd class that deletes a GBP contract.
static bool register_listener(listener *listener)
Register a listener of events.