20 singular_db<neighbour::key_t, neighbour> neighbour::m_db;
21 neighbour::event_handler neighbour::m_evh;
24 const boost::asio::ip::address& ip_addr,
27 , m_itf(itf.singular())
36 , m_ip_addr(bde.m_ip_addr)
46 m_db.release(
key(),
this);
52 return ((
key() == n.
key()) && (m_mac == n.m_mac));
58 return (std::make_pair(m_itf->key(), m_ip_addr));
84 s <<
"neighbour:[" << m_itf->to_string() <<
", " << m_mac.
to_string() <<
", " 85 << m_ip_addr.to_string() <<
"]";
102 std::shared_ptr<neighbour>
103 neighbour::find_or_add(
const neighbour& temp)
105 return (m_db.find_or_add(temp.
key(), temp));
108 std::shared_ptr<neighbour>
111 return (m_db.find(k));
114 std::shared_ptr<neighbour>
117 return find_or_add(*
this);
129 os <<
"[" << key.first <<
", " << key.second <<
"]";
134 neighbour::event_handler::event_handler()
141 neighbour::event_handler::handle_replay()
148 std::shared_ptr<interface> itf,
154 std::shared_ptr<neighbour_cmds::dump_cmd>
cmd =
155 std::make_shared<neighbour_cmds::dump_cmd>(
161 for (
auto& record : *cmd) {
165 auto& payload = record.get_payload();
168 boost::asio::ip::address ip_addr =
169 from_bytes(payload.is_ipv6, payload.ip_address);
173 << mac.
to_string() << ip_addr.to_string();
198 neighbour::event_handler::order()
const
A cmd class that deletes a bridge domain ARP entry.
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
Types belonging to Routing.
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 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.