21 singular_db<neighbour::key_t, neighbour> neighbour::m_db;
28 , m_itf(itf.singular())
37 , m_ip_addr(bde.m_ip_addr)
47 m_db.release(
key(),
this);
53 return ((
key() == n.
key()) && (m_mac == n.m_mac));
59 return (std::make_pair(m_itf->key(), m_ip_addr));
85 s <<
"neighbour:[" << m_itf->to_string() <<
", " << m_mac.
to_string() <<
", " 86 << m_ip_addr.to_string() <<
"]";
103 std::shared_ptr<neighbour>
104 neighbour::find_or_add(
const neighbour& temp)
106 return (m_db.find_or_add(temp.
key(), temp));
109 std::shared_ptr<neighbour>
112 return (m_db.find(k));
115 std::shared_ptr<neighbour>
118 return find_or_add(*
this);
130 os <<
"[" << key.first <<
", " << key.second <<
"]";
142 neighbour::event_handler::handle_replay()
149 std::shared_ptr<interface> itf,
155 std::shared_ptr<neighbour_cmds::dump_cmd>
cmd =
156 std::make_shared<neighbour_cmds::dump_cmd>(
162 for (
auto& record : *cmd) {
166 auto& payload = record.get_payload();
170 from_bytes(payload.is_ipv6, payload.ip_address);
174 << mac.
to_string() << ip_addr.to_string();
199 neighbour::event_handler::order()
const
A cmd class that deletes a bridge domain ARP entry.
void db_dump(const DB &db, std::ostream &os)
Print each of the objects in the DB into the stream provided.
const key_t key() const
Return the object's key.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
std::shared_ptr< neighbour > 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.
std::string to_string() const
String conversion.
static rc_t write()
Write/Execute all commands hitherto enqueued.
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...
std::string to_string() const
Convert to string for debugging.
static const_iterator_t cbegin()
rc_t rc() const
Get the HW return code.
static const l3_proto_t IPV4
static const l3_proto_t IPV6
bool operator==(const neighbour &n) const
Comparison operator.
A entry in the neighbour entry (ARP or IPv6 ND)
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.
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.
The VPP Object Model (VOM) library.
A command class that creates or updates the bridge domain ARP Entry.
A representation of a method call to VPP.
neighbour(const interface &itf, const boost::asio::ip::address &ip_addr, const mac_address_t &mac)
Construct an ARP entry.
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.