23 gbp_subnet::type_t::type_t(
int v,
const std::string s)
24 : enum_base<gbp_subnet::type_t>(v, s)
28 const gbp_subnet::type_t gbp_subnet::type_t::INTERNAL(0,
"internal");
29 const gbp_subnet::type_t gbp_subnet::type_t::EXTERNAL(1,
"external");
31 singular_db<gbp_subnet::key_t, gbp_subnet> gbp_subnet::m_db;
39 , m_type(type_t::INTERNAL)
52 , m_type(type_t::EXTERNAL)
61 , m_prefix(o.m_prefix)
63 , m_recirc(o.m_recirc)
71 m_db.release(
key(),
this);
77 return (std::make_pair(m_rd->key(), m_prefix));
83 return ((
key() == gs.
key()) && (m_type == gs.m_type) &&
84 (m_recirc == gs.m_recirc) && (m_epg == gs.m_epg));
102 m_hw, m_rd->table_id(), m_prefix, (m_type == type_t::INTERNAL),
104 (m_epg ? m_epg->id() : ~0)));
111 std::ostringstream s;
112 s <<
"gbp-subnet:[" << m_type.to_string() <<
", " << m_rd->to_string() <<
":" 115 s <<
", " << m_recirc->to_string();
117 s <<
", " << m_epg->to_string();
129 m_hw, m_rd->table_id(), m_prefix, (m_type == type_t::INTERNAL),
131 (m_epg ? m_epg->id() : ~0)));
133 if (m_type != r.m_type) {
135 m_recirc = r.m_recirc;
139 m_hw, m_rd->table_id(), m_prefix, (m_type == type_t::INTERNAL),
141 (m_epg ? m_epg->id() : ~0)));
146 std::shared_ptr<gbp_subnet>
147 gbp_subnet::find_or_add(
const gbp_subnet& temp)
149 return (m_db.find_or_add(temp.
key(), temp));
152 std::shared_ptr<gbp_subnet>
155 return (m_db.find(k));
158 std::shared_ptr<gbp_subnet>
161 return find_or_add(*
this);
177 gbp_subnet::event_handler::handle_replay()
185 std::shared_ptr<gbp_subnet_cmds::dump_cmd>
cmd =
186 std::make_shared<gbp_subnet_cmds::dump_cmd>();
191 for (
auto& record : *cmd) {
192 auto& payload = record.get_payload();
195 std::shared_ptr<route_domain> rd =
199 if (payload.subnet.is_internal) {
204 std::shared_ptr<interface> itf =
206 std::shared_ptr<gbp_endpoint_group> epg =
224 gbp_subnet::event_handler::order()
const static std::shared_ptr< route_domain > find(const key_t &temp)
Find the instnace of the route domain in the OM.
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.
std::shared_ptr< gbp_subnet > singular() const
Return the matching 'singular instance'.
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.
static const log_level_t DEBUG
ip_address_t from_api(const vapi_type_address &v)
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
std::string to_string() const
Convert to string for debugging.
rc_t rc() const
Get the HW return code.
void replay(void)
replay the object to create it in hardware
std::string to_string() const
convert to string format for debug purposes
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
static std::shared_ptr< gbp_subnet > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
A recirculation interface for GBP use pre/post NAT.
bool operator==(const gbp_subnet &bdae) const
comparison operator
gbp_subnet(const route_domain &rd, const route::prefix_t &prefix)
Construct an internal GBP subnet.
const key_t key() const
Return the object's key.
A cmd class that deletes a GBP subnet.
A entry in the ARP termination table of a Bridge Domain.
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.
A command class that creates or updates the GBP subnet.
static std::shared_ptr< gbp_recirc > find(const key_t &k)
Find the instnace of the recirc interface in the OM.
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
std::pair< route_domain::key_t, route::prefix_t > key_t
The key for a GBP subnet; table and prefix.
static std::shared_ptr< gbp_endpoint_group > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
static bool register_listener(listener *listener)
Register a listener of events.