From fd920609819a5b10d3d7c8d34fe4fa4214c7da22 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 23 Nov 2017 12:15:00 -0800 Subject: VOM: Additions to allow uses to UT applications that use VOM - find object by key - compare objects Change-Id: I36ec8612be9482bcef7ceced2a59f7403f77b3e8 Signed-off-by: Neale Ranns --- src/vpp-api/vom/neighbour.hpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'src/vpp-api/vom/neighbour.hpp') diff --git a/src/vpp-api/vom/neighbour.hpp b/src/vpp-api/vom/neighbour.hpp index 85577f077a9..500f03d0a61 100644 --- a/src/vpp-api/vom/neighbour.hpp +++ b/src/vpp-api/vom/neighbour.hpp @@ -22,26 +22,23 @@ namespace VOM { /** - * A entry in the ARP termination table of a Bridge Domain + * A entry in the neighbour entry (ARP or IPv6 ND) */ class neighbour : public object_base { public: /** - * The key for a bridge_domain ARP entry; - * the BD, IP address and MAC address + * The key for a neighbour entry; + * the interface and IP address */ - typedef std::tuple - key_t; + typedef std::pair key_t; /** * Construct an ARP entry */ neighbour(const interface& itf, - const mac_address_t& mac, - const boost::asio::ip::address& ip_addr); + const boost::asio::ip::address& ip_addr, + const mac_address_t& mac); /** * Copy Construct @@ -53,18 +50,28 @@ public: */ ~neighbour(); + /** + * Return the object's key + */ + const key_t key() const; + + /** + * Comparison operator + */ + bool operator==(const neighbour& n) const; + /** * Return the matching 'singular instance' */ std::shared_ptr singular() const; /** - * Find the instnace of the bridge_domain domain in the OM + * Find the neighbour fromits key */ - static std::shared_ptr find(const neighbour& temp); + static std::shared_ptr find(const key_t& k); /** - * Dump all bridge_domain-doamin into the stream provided + * Dump all neighbours into the stream provided */ static void dump(std::ostream& os); @@ -127,7 +134,7 @@ private: const l3_proto_t& proto); /** - * Find or add the instnace of the bridge_domain domain in the OM + * Find or add the instnace of the neighbour in the OM */ static std::shared_ptr find_or_add(const neighbour& temp); @@ -157,14 +164,14 @@ private: std::shared_ptr m_itf; /** - * The mac to match + * The IP address */ - mac_address_t m_mac; + boost::asio::ip::address m_ip_addr; /** - * The IP address + * The mac to match */ - boost::asio::ip::address m_ip_addr; + mac_address_t m_mac; /** * A map of all bridge_domains -- cgit 1.2.3-korg