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;
58 , m_bvi(bvi.singular())
80 const std::shared_ptr<interface> bvi,
81 const std::shared_ptr<interface> uu_fwd,
82 const std::shared_ptr<interface> bm_flood,
88 , m_bm_flood(bm_flood)
92 m_bvi = m_bvi->singular();
94 m_uu_fwd = m_uu_fwd->singular();
96 m_bm_flood = m_bm_flood->singular();
101 const std::shared_ptr<interface> uu_fwd,
102 const std::shared_ptr<interface> bm_flood,
108 , m_bm_flood(bm_flood)
112 m_uu_fwd = m_uu_fwd->singular();
114 m_bm_flood = m_bm_flood->singular();
121 , m_uu_fwd(bd.m_uu_fwd)
122 , m_bm_flood(bd.m_bm_flood)
123 , m_flags(bd.m_flags)
130 return (m_bd->key());
139 const std::shared_ptr<bridge_domain>
145 const std::shared_ptr<interface>
156 if (m_bvi && b.m_bvi)
157 equal &= (m_bvi->key() == b.m_bvi->key());
158 else if (!m_bvi && !b.m_bvi)
163 if (m_uu_fwd && b.m_uu_fwd)
164 equal &= (m_uu_fwd->key() == b.m_uu_fwd->key());
165 else if (!m_uu_fwd && !b.m_uu_fwd)
170 if (m_bm_flood && b.m_bm_flood)
171 equal &= (m_bm_flood->key() == b.m_bm_flood->key());
172 else if (!m_bm_flood && !b.m_bm_flood)
177 return ((m_bd->key() == b.m_bd->key()) && equal);
181 gbp_bridge_domain::sweep()
205 m_db.release(m_id.
data(),
this);
211 std::ostringstream s;
212 s <<
"gbp-bridge-domain:[" << m_bd->to_string()
216 s <<
" bvi:" << m_bvi->to_string();
218 s <<
" uu-fwd:" << m_uu_fwd->to_string();
225 std::shared_ptr<gbp_bridge_domain>
228 return (m_db.find(key));
245 std::shared_ptr<gbp_bridge_domain>
248 return (m_db.find_or_add(temp.m_id.
data(), temp));
251 std::shared_ptr<gbp_bridge_domain>
254 return find_or_add(*
this);
269 std::shared_ptr<gbp_bridge_domain_cmds::dump_cmd>
cmd =
270 std::make_shared<gbp_bridge_domain_cmds::dump_cmd>();
275 for (
auto& record : *cmd) {
276 auto& payload = record.get_payload();
278 std::shared_ptr<interface> uu_fwd =
280 std::shared_ptr<interface> bm_flood =
282 std::shared_ptr<interface> bvi =
295 if (uu_fwd && bm_flood && bvi) {
305 <<
"no BVI:" << payload.bd.bvi_sw_if_index
306 <<
" nor uu-fwd:" << payload.bd.uu_fwd_sw_if_index;
318 gbp_bridge_domain::event_handler::handle_replay()
324 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.
const std::shared_ptr< bridge_domain > get_bridge_domain() const
static rc_t write()
Write/Execute all commands hitherto enqueued.
rc_t rc() const
Get the HW return code.
static const log_level_t DEBUG
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
gbp_bridge_domain(const bridge_domain &bd, const interface &bvi, const flags_t &flags=flags_t::NONE)
Construct a GBP bridge_domain.
static const flags_t NONE
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
virtual tables - tables with a dependency on another table
T & data()
Return the data read/written.
static const flags_t MCAST_DROP
static const flags_t UCAST_ARP
std::shared_ptr< gbp_bridge_domain > singular() const
Return the matching 'singular instance'.
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< interface > get_bvi() const
bool operator==(const gbp_bridge_domain &bdae) const
comparison operator
A command class that creates an Bridge-Domain.
A entry in the ARP termination table of a Bridge Domain.
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.
const std::string & to_string() const
convert to string format for debug purposes
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
std::string to_string() const
Convert to string for debugging.
const key_t key() const
Return the object's key.
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
~gbp_bridge_domain()
Destructor.
typedef gbp_bridge_domain
static bool register_listener(listener *listener)
Register a listener of events.
uint32_t id() const
Return the bridge domain's VPP ID.