38 gbp_bridge_domain::flags_t::flags_t(
int v,
const std::string& s)
46 singular_db<uint32_t, gbp_bridge_domain> gbp_bridge_domain::m_db;
60 , m_bvi(bvi.singular())
85 const std::shared_ptr<interface> bvi,
86 const std::shared_ptr<interface> uu_fwd,
87 const std::shared_ptr<interface> bm_flood,
94 , m_bm_flood(bm_flood)
98 m_bvi = m_bvi->singular();
100 m_uu_fwd = m_uu_fwd->singular();
102 m_bm_flood = m_bm_flood->singular();
108 const std::shared_ptr<interface> uu_fwd,
109 const std::shared_ptr<interface> bm_flood,
116 , m_bm_flood(bm_flood)
120 m_uu_fwd = m_uu_fwd->singular();
122 m_bm_flood = m_bm_flood->singular();
130 , m_uu_fwd(bd.m_uu_fwd)
131 , m_bm_flood(bd.m_bm_flood)
132 , m_flags(bd.m_flags)
139 return (m_bd->key());
148 const std::shared_ptr<bridge_domain>
154 const std::shared_ptr<interface>
165 if (m_bvi && b.m_bvi)
166 equal &= (m_bvi->key() == b.m_bvi->key());
167 else if (!m_bvi && !b.m_bvi)
172 if (m_uu_fwd && b.m_uu_fwd)
173 equal &= (m_uu_fwd->key() == b.m_uu_fwd->key());
174 else if (!m_uu_fwd && !b.m_uu_fwd)
179 if (m_bm_flood && b.m_bm_flood)
180 equal &= (m_bm_flood->key() == b.m_bm_flood->key());
181 else if (!m_bm_flood && !b.m_bm_flood)
186 return ((m_bd->key() == b.m_bd->key()) && equal);
190 gbp_bridge_domain::sweep()
214 m_db.release(m_id.
data(),
this);
220 std::ostringstream s;
221 s <<
"gbp-bridge-domain:[" << m_bd->to_string()
225 s <<
" bvi:" << m_bvi->to_string();
227 s <<
" uu-fwd:" << m_uu_fwd->to_string();
234 std::shared_ptr<gbp_bridge_domain>
237 return (m_db.find(key));
254 std::shared_ptr<gbp_bridge_domain>
257 return (m_db.find_or_add(temp.m_id.
data(), temp));
260 std::shared_ptr<gbp_bridge_domain>
263 return find_or_add(*
this);
278 std::shared_ptr<gbp_bridge_domain_cmds::dump_cmd>
cmd =
279 std::make_shared<gbp_bridge_domain_cmds::dump_cmd>();
284 for (
auto& record : *cmd) {
285 auto& payload = record.get_payload();
287 std::shared_ptr<interface> uu_fwd =
289 std::shared_ptr<interface> bm_flood =
291 std::shared_ptr<interface> bvi =
293 std::shared_ptr<gbp_route_domain> grd =
306 if (uu_fwd && bm_flood && bvi && grd) {
317 <<
"no BVI:" << payload.bd.bvi_sw_if_index
318 <<
" nor uu-fwd:" << payload.bd.uu_fwd_sw_if_index;
330 gbp_bridge_domain::event_handler::handle_replay()
336 gbp_bridge_domain::event_handler::order()
const
static const flags_t DO_NOT_LEARN
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
static const flags_t UU_FWD_DROP
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.
A cmd class that Delete an Bridge-Domain.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
uint32_t id() const
Return the bridge domain's VPP ID.
bool operator==(const gbp_bridge_domain &bdae) const
comparison operator
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
static const flags_t NONE
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
std::shared_ptr< gbp_bridge_domain > singular() const
Return the matching 'singular instance'.
const std::shared_ptr< interface > get_bvi() const
T & data()
Return the data read/written.
static const flags_t MCAST_DROP
static const flags_t UCAST_ARP
void replay(void)
replay the object to create it in hardware
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< bridge_domain > get_bridge_domain() const
A command class that creates an Bridge-Domain.
rc_t rc() const
Get the HW return code.
A entry in the ARP termination table of a Bridge Domain.
const key_t key() const
Return the object's key.
bridge_domain::key_t key_t
The key for a bridge_domain is the pair of EPG-IDs.
A representation of an interface in VPP.
A base class for all object_base in the VPP object_base-Model.
gbp_bridge_domain(const bridge_domain &bd, const gbp_route_domain &rd, const interface &bvi, const flags_t &flags=flags_t::NONE)
Construct a GBP 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 const log_level_t ERROR
A entry in the ARP termination table of a Route Domain.
The VPP Object Model (VOM) library.
std::string to_string() const
Convert to string for debugging.
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_bridge_domain()
Destructor.
const std::string & to_string() const
convert to string format for debug purposes
typedef gbp_bridge_domain
static bool register_listener(listener *listener)
Register a listener of events.