22 singular_db<gbp_endpoint_group::key_t, gbp_endpoint_group>
23 gbp_endpoint_group::m_db;
33 , m_itf(itf.singular())
52 , m_epg_id(epg.m_epg_id)
62 m_db.release(
key(),
this);
80 return (
key() == gg.
key() && (m_itf == gg.m_itf) && (m_rd == gg.m_rd) &&
85 gbp_endpoint_group::sweep()
98 m_hw, m_epg_id, m_bd->id(), m_rd->id(),
106 std::ostringstream s;
107 s <<
"gbp-endpoint-group:[" 108 <<
"epg:" << m_epg_id <<
", " << (m_itf ? m_itf->to_string() :
"NULL")
109 <<
", " << m_bd->to_string() <<
", " << m_rd->to_string() <<
"]";
119 m_hw, m_epg_id, m_bd->id(), m_rd->id(),
124 std::shared_ptr<gbp_endpoint_group>
127 return (m_db.find_or_add(temp.
key(), temp));
130 std::shared_ptr<gbp_endpoint_group>
133 return (m_db.find(k));
136 std::shared_ptr<gbp_endpoint_group>
139 return find_or_add(*
this);
148 const std::shared_ptr<gbp_route_domain>
154 const std::shared_ptr<gbp_bridge_domain>
168 gbp_endpoint_group::event_handler::handle_replay()
176 std::shared_ptr<gbp_endpoint_group_cmds::dump_cmd>
cmd =
177 std::make_shared<gbp_endpoint_group_cmds::dump_cmd>();
182 for (
auto& record : *cmd) {
183 auto& payload = record.get_payload();
185 std::shared_ptr<interface> itf =
187 std::shared_ptr<gbp_route_domain> rd =
189 std::shared_ptr<gbp_bridge_domain> bd =
193 <<
", " << payload.epg.rd_id <<
", " 194 << payload.epg.bd_id <<
"]";
196 if (itf && bd && rd) {
201 }
else if (bd && rd) {
208 <<
" or BD:" << payload.epg.bd_id
209 <<
" or RD:" << payload.epg.rd_id;
215 gbp_endpoint_group::event_handler::order()
const const std::shared_ptr< gbp_bridge_domain > get_bridge_domain()
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.
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
uint32_t epg_id_t
EPG IDs are 32 bit integers.
std::string to_string() const
Convert to string for debugging.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
A cmd class that deletes a GBP endpoint_group.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
const key_t key() const
Return the object's key.
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
epg_id_t id() const
Get the ID of the EPG.
static std::shared_ptr< gbp_bridge_domain > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
const std::shared_ptr< gbp_route_domain > get_route_domain()
rc_t rc() const
Get the HW return code.
A entry in the ARP termination table of a Bridge Domain.
bool operator==(const gbp_endpoint_group &bdae) const
comparison operator
std::shared_ptr< gbp_endpoint_group > singular() const
Return the matching 'singular instance'.
gbp_endpoint_group(epg_id_t epg_id, const interface &itf, const gbp_route_domain &rd, const gbp_bridge_domain &bd)
Construct a GBP endpoint_group.
void replay(void)
replay the object to create it in hardware
A representation of an interface in VPP.
A entry in the ARP termination table of a Bridge Domain.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
void event_handler(void *tls_async)
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.
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
epg_id_t key_t
The key for a GBP endpoint group is its ID.
static const log_level_t ERROR
A entry in the ARP termination table of a Route Domain.
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
static std::shared_ptr< gbp_route_domain > find(const key_t &k)
Find the instnace of the route_domain domain in the OM.
~gbp_endpoint_group()
Destructor.
static std::shared_ptr< gbp_endpoint_group > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
static bool register_listener(listener *listener)
Register a listener of events.
A command class that creates or updates the GBP endpoint_group.