23 singular_db<gbp_endpoint::key_t, gbp_endpoint> gbp_endpoint::m_db;
33 gbp_endpoint::flags_t::flags_t(
int v,
const std::string& s)
40 const std::vector<boost::asio::ip::address>& ip_addrs,
45 , m_itf(itf.singular())
48 , m_epg(epg.singular())
59 , m_flags(gbpe.m_flags)
66 m_db.release(
key(),
this);
72 return (std::make_pair(m_itf->key(), m_mac));
78 return ((
key() == gbpe.
key()) && (m_epg == gbpe.m_epg) &&
79 (m_flags == gbpe.m_flags));
96 m_hdl, m_itf->handle(), m_ips, m_mac, m_epg->sclass(), m_flags));
103 std::ostringstream s;
104 s <<
"gbp-endpoint:[" << m_itf->to_string() <<
", ips:[";
106 for (
auto ip : m_ips)
109 s <<
"], " << m_mac.
to_string() <<
", epg:" << m_epg->to_string() <<
"]";
119 m_hdl, m_itf->handle(), m_ips, m_mac, m_epg->sclass(), m_flags));
123 std::shared_ptr<gbp_endpoint>
126 return (m_db.find_or_add(temp.
key(), temp));
129 std::shared_ptr<gbp_endpoint>
132 return (m_db.find(k));
135 std::shared_ptr<gbp_endpoint>
138 return find_or_add(*
this);
154 gbp_endpoint::event_handler::handle_replay()
162 std::shared_ptr<gbp_endpoint_cmds::dump_cmd>
cmd =
163 std::make_shared<gbp_endpoint_cmds::dump_cmd>();
168 for (
auto& record : *cmd) {
169 auto& payload = record.get_payload();
171 std::vector<boost::asio::ip::address> addresses;
173 for (uint8_t n = 0; n < payload.endpoint.n_ips; n++)
174 addresses.push_back(
from_api(payload.endpoint.ips[n]));
175 std::shared_ptr<interface> itf =
177 std::shared_ptr<gbp_endpoint_group> epg =
190 <<
"no interface:" << payload.endpoint.sw_if_index
191 <<
"or sclass:" << payload.endpoint.sclass;
197 gbp_endpoint::event_handler::order()
const 211 os << key.first <<
"," << key.second;
static const flags_t LEARNT
static const flags_t BOUNCE
std::shared_ptr< gbp_endpoint > singular() const
Return the matching 'singular instance'.
static const flags_t NONE
vl_api_wireguard_peer_flags_t flags
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.
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
std::pair< interface::key_t, mac_address_t > key_t
The key for a GBP endpoint; interface and IP.
~gbp_endpoint()
Destructor.
A cmd class that deletes a GBP endpoint.
gbp_endpoint(const interface &itf, const std::vector< boost::asio::ip::address > &ip_addr, const mac_address_t &mac, const gbp_endpoint_group &epg, const flags_t &flags=flags_t::NONE)
Construct a GBP endpoint.
const key_t key() const
Return the object's key.
static const flags_t REMOTE
A command class that creates or updates the GBP endpoint.
static const flags_t EXTERNAL
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
std::string to_string() const
Convert to string for debugging.
bool operator==(const gbp_endpoint &bdae) const
comparison operator
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
static const log_level_t ERROR
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
std::string to_string() const
String conversion.
The VPP Object Model (VOM) library.
const neighbour::flags_t from_api(vapi_enum_ip_neighbor_flags f)
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.
Type def of a Ethernet address.
static bool register_listener(listener *listener)
Register a listener of events.