25 singular_db<ip_punt_redirect::key_t, ip_punt_redirect> ip_punt_redirect::m_db;
32 : m_rx_itf(rx_itf.singular())
33 , m_tx_itf(tx_itf.singular())
47 : m_rx_itf(o.m_rx_itf)
48 , m_tx_itf(o.m_tx_itf)
50 , m_config(o.m_config)
59 m_db.release(
key(),
this);
66 return m_rx_itf->key();
72 ip_punt_redirect::sweep()
77 m_tx_itf->handle(), m_addr));
89 ip_punt_redirect::replay()
94 m_tx_itf->handle(), m_addr));
101 std::ostringstream s;
102 s <<
"IP-punt-redirect:" 103 <<
" rx-itf:" <<
key() <<
" tx-itf:" << m_tx_itf->to_string()
104 <<
" next-hop:" << m_addr;
115 m_tx_itf->handle(), m_addr));
119 std::shared_ptr<ip_punt_redirect>
122 return (m_db.find_or_add(temp.
key(), temp));
125 std::shared_ptr<ip_punt_redirect>
128 return find_or_add(*
this);
135 "IP punt redirect configurations",
this);
139 ip_punt_redirect::event_handler::handle_replay()
147 std::shared_ptr<ip_punt_redirect_cmds::dump_cmd>
cmd =
148 std::make_shared<ip_punt_redirect_cmds::dump_cmd>();
153 for (
auto& record : *cmd) {
154 auto& payload = record.get_payload();
156 std::shared_ptr<interface> tx_itf =
158 std::shared_ptr<interface> rx_itf =
163 <<
", " << payload.punt.rx_sw_if_index <<
", " 166 if (rx_itf && tx_itf) {
179 ip_punt_redirect::event_handler::order()
const
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.
A command class that configures the IP punt_redirect.
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.
std::string to_string() const
convert to string format for debug purposes
static const log_level_t DEBUG
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
A cmd class that Unconfigs Ip punt redirect.
static void dump(std::ostream &os)
Dump all ip_punt_redirects into the stream provided.
~ip_punt_redirect()
Destructor.
interface::key_t key_t
The key type for ip_punt_redirects.
A representation of an interface 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 void enqueue(cmd *f)
Enqueue A command for execution.
const key_t key() const
return the object's key
std::shared_ptr< ip_punt_redirect > singular() const
Return the 'singular instance' of the ip_punt_redirect that matches this object.
ip_punt_redirect(const interface &rx_itf, const interface &tx_itf, const boost::asio::ip::address &addr)
Construct a new object matching the desried state.
Then L2/objects that bind to interfaces, BD, ACLS, etc.
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.
A representation of IP punt_redirect configuration on an interface.
static bool register_listener(listener *listener)
Register a listener of events.