23 singular_db<gbp_endpoint::key_t, gbp_endpoint> gbp_endpoint::m_db;
29 const std::vector<boost::asio::ip::address>& ip_addrs,
33 , m_itf(itf.singular())
36 , m_epg(epg.singular())
52 m_db.release(
key(),
this);
58 return (std::make_pair(m_itf->key(), m_mac));
64 return ((
key() == gbpe.
key()) && (m_epg == gbpe.m_epg));
89 s <<
"gbp-endpoint:[" << m_itf->to_string() <<
", ips:[";
94 s <<
"], " << m_mac.
to_string() <<
", epg:" << m_epg->to_string() <<
"]";
104 m_mac, m_epg->id()));
108 std::shared_ptr<gbp_endpoint>
111 return (m_db.find_or_add(temp.
key(), temp));
114 std::shared_ptr<gbp_endpoint>
117 return (m_db.find(k));
120 std::shared_ptr<gbp_endpoint>
123 return find_or_add(*
this);
139 gbp_endpoint::event_handler::handle_replay()
147 std::shared_ptr<gbp_endpoint_cmds::dump_cmd>
cmd =
148 std::make_shared<gbp_endpoint_cmds::dump_cmd>();
153 for (
auto& record : *cmd) {
154 auto& payload = record.get_payload();
156 std::vector<boost::asio::ip::address> addresses;
158 for (uint8_t n = 0; n < payload.endpoint.n_ips; n++)
159 addresses.push_back(
from_api(payload.endpoint.ips[n]));
160 std::shared_ptr<interface> itf =
162 std::shared_ptr<gbp_endpoint_group> epg =
178 gbp_endpoint::event_handler::order()
const 192 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.
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.
gbp_endpoint(const interface &itf, const std::vector< boost::asio::ip::address > &ip_addr, const mac_address_t &mac, const gbp_endpoint_group &epg)
Construct a GBP endpoint.
static rc_t write()
Write/Execute all commands hitherto enqueued.
static const log_level_t DEBUG
std::pair< interface::key_t, mac_address_t > key_t
The key for a GBP endpoint; interface and IP.
~gbp_endpoint()
Destructor.
ip_address_t from_api(const vapi_type_address &v)
A cmd class that deletes 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.
A type declaration of an interface handle in VPP.
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.
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_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.