22 singular_db<gbp_endpoint::key_t, gbp_endpoint> gbp_endpoint::m_db;
24 gbp_endpoint::event_handler gbp_endpoint::m_evh;
27 const boost::asio::ip::address& ip_addr,
30 , m_itf(itf.singular())
39 , m_ip_addr(gbpe.m_ip_addr)
40 , m_epg_id(gbpe.m_epg_id)
49 m_db.release(
key(),
this);
55 return (std::make_pair(m_itf->key(), m_ip_addr));
61 return ((
key() == gbpe.
key()) && (m_epg_id == gbpe.m_epg_id));
79 m_ip_addr, m_epg_id));
87 s <<
"gbp-endpoint:[" << m_itf->to_string() <<
", " << m_ip_addr.to_string()
88 <<
", epg-id:" << m_epg_id <<
"]";
101 m_ip_addr, m_epg_id));
105 std::shared_ptr<gbp_endpoint>
108 return (m_db.find_or_add(temp.
key(), temp));
111 std::shared_ptr<gbp_endpoint>
114 return (m_db.find(k));
117 std::shared_ptr<gbp_endpoint>
120 return find_or_add(*
this);
129 gbp_endpoint::event_handler::event_handler()
136 gbp_endpoint::event_handler::handle_replay()
144 std::shared_ptr<gbp_endpoint_cmds::dump_cmd>
cmd =
145 std::make_shared<gbp_endpoint_cmds::dump_cmd>();
150 for (
auto& record : *cmd) {
151 auto& payload = record.get_payload();
153 boost::asio::ip::address address =
154 from_bytes(payload.endpoint.is_ip6, payload.endpoint.address);
155 std::shared_ptr<interface> itf =
161 gbp_endpoint gbpe(*itf, address, payload.endpoint.epg_id);
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.
uint32_t epg_id_t
EPG IDs are 32 bit integers.
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'.
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.
rc_t rc() const
Get the HW return code.
A entry in the ARP termination table of a Bridge Domain.
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.
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.
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
gbp_endpoint(const interface &itf, const boost::asio::ip::address &ip_addr, epg_id_t epg_id)
Construct a GBP endpoint.
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.
bool operator==(const gbp_endpoint &bdae) const
comparison operator
static bool register_listener(listener *listener)
Register a listener of events.