22 singular_db<neighbour::key_t, neighbour> neighbour::m_db;
49 , m_ip_addr(n.m_ip_addr)
60 m_db.release(
key(),
this);
66 return ((
key() == n.
key()) && (m_mac == n.m_mac));
72 return (std::make_pair(m_itf->key(), m_ip_addr));
98 s <<
"neighbour:[" << m_itf->to_string() <<
", " << m_mac.
to_string() <<
", " 99 << m_ip_addr.to_string() <<
" " << m_flags.
to_string() <<
"]";
112 m_ip_addr, m_flags));
116 std::shared_ptr<neighbour>
117 neighbour::find_or_add(
const neighbour& temp)
119 return (m_db.find_or_add(temp.
key(), temp));
122 std::shared_ptr<neighbour>
125 return (m_db.find(k));
128 std::shared_ptr<neighbour>
131 return find_or_add(*
this);
143 os <<
"[" << key.first <<
", " << key.second <<
"]";
155 neighbour::event_handler::handle_replay()
162 std::shared_ptr<interface> itf,
168 std::shared_ptr<neighbour_cmds::dump_cmd>
cmd =
169 std::make_shared<neighbour_cmds::dump_cmd>(
175 for (
auto& record : *cmd) {
179 auto& payload = record.get_payload();
188 << mac.
to_string() <<
" " << ip_addr.to_string()
214 neighbour::event_handler::order()
const
const key_t key() const
Return the object's key.
A cmd class that deletes a bridge domain ARP entry.
std::shared_ptr< neighbour > singular() const
Return the matching 'singular instance'.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
A template base class for all enum types.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static void register_handler(const std::vector< std::string > &cmds, const std::string &help, command_handler *ch)
Register a command handler for inspection.
std::string to_string() const
Convert to string for debugging.
static rc_t write()
Write/Execute all commands hitherto enqueued.
rc_t rc() const
Get the HW return code.
static const flags_t STATIC
static const log_level_t DEBUG
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route...
neighbour(const interface &itf, const boost::asio::ip::address &ip_addr, const mac_address_t &mac, const flags_t flags=flags_t::STATIC)
Construct an ARP entry.
bool operator==(const neighbour &n) const
Comparison operator.
static const_iterator_t cbegin()
static const flags_t NONE
static const l3_proto_t IPV4
static const l3_proto_t IPV6
A entry in the neighbour entry (ARP or IPv6 ND)
flags_t(int v, const std::string s)
Constructor.
A representation of an interface in VPP.
static const flags_t NO_FIB_ENTRY
const std::string & to_string() const
convert to string format for debug purposes
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)
void replay(void)
replay the object to create it in hardware
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 cmd class that Dumps all the neighbours.
static void dump(std::ostream &os)
Dump all neighbours into the stream provided.
std::ostream & operator<<(std::ostream &os, const std::pair< direction_t, interface::key_t > &key)
static std::shared_ptr< neighbour > find(const key_t &k)
Find the neighbour fromits key.
std::string to_string() const
String conversion.
The VPP Object Model (VOM) library.
A command class that creates or updates the bridge domain ARP Entry.
const neighbour::flags_t from_api(vapi_enum_ip_neighbor_flags f)
A representation of a method call to VPP.
static const_iterator_t cend()
std::pair< interface::key_t, boost::asio::ip::address > key_t
The key for a neighbour entry; the interface and IP address.
Type def of a Ethernet address.
static bool register_listener(listener *listener)
Register a listener of events.