22 singular_db<gbp_endpoint::key_t, gbp_endpoint> gbp_endpoint::m_db;
31 , m_itf(itf.singular())
34 , m_epg(epg.singular())
50 m_db.release(
key(),
this);
56 return (std::make_pair(m_itf->key(), m_ip));
62 return ((
key() == gbpe.
key()) && (m_epg == gbpe.m_epg));
87 s <<
"gbp-endpoint:[" << m_itf->to_string() <<
", " << m_ip.to_string()
88 <<
", " << m_mac.
to_string() <<
", epg:" << m_epg->to_string() <<
"]";
102 std::shared_ptr<gbp_endpoint>
105 return (m_db.find_or_add(temp.
key(), temp));
108 std::shared_ptr<gbp_endpoint>
111 return (m_db.find(k));
114 std::shared_ptr<gbp_endpoint>
117 return find_or_add(*
this);
133 gbp_endpoint::event_handler::handle_replay()
141 std::shared_ptr<gbp_endpoint_cmds::dump_cmd>
cmd =
142 std::make_shared<gbp_endpoint_cmds::dump_cmd>();
147 for (
auto& record : *cmd) {
148 auto& payload = record.get_payload();
151 from_bytes(payload.endpoint.is_ip6, payload.endpoint.address);
152 std::shared_ptr<interface> itf =
154 std::shared_ptr<gbp_endpoint_group> epg =
170 gbp_endpoint::event_handler::order()
const std::pair< interface::key_t, boost::asio::ip::address > key_t
The key for a GBP endpoint; interface and IP.
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.
static std::shared_ptr< interface > find(const handle_t &h)
The the singular instance of the interface in the DB by handle.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
std::shared_ptr< gbp_endpoint > singular() const
Return the matching 'singular instance'.
std::string to_string() const
String conversion.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
~gbp_endpoint()
Destructor.
A cmd class that deletes a GBP endpoint.
gbp_endpoint(const interface &itf, const boost::asio::ip::address &ip_addr, const mac_address_t &mac, const gbp_endpoint_group &epg)
Construct a GBP endpoint.
rc_t rc() const
Get the HW return code.
A command class that creates or updates the GBP endpoint.
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
A representation of an interface in VPP.
A entry in the ARP termination table of a Bridge Domain.
boost::asio::ip::address from_bytes(uint8_t is_ip6, uint8_t *bytes)
Convert a VPP byte stinrg into a boost addresss.
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.
void replay(void)
replay the object to create it in hardware
std::string to_string() const
Convert to string for debugging.
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
static std::shared_ptr< gbp_endpoint > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
static std::shared_ptr< gbp_endpoint_group > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
bool operator==(const gbp_endpoint &bdae) const
comparison operator
Type def of a Ethernet address.
static bool register_listener(listener *listener)
Register a listener of events.