VOM: Additions to allow uses to UT applications that use VOM
[vpp.git] / src / vpp-api / vom / bridge_domain_arp_entry.hpp
index 181afe6..b4af6a0 100644 (file)
@@ -21,8 +21,6 @@
 #include "vom/singular_db.hpp"
 #include "vom/types.hpp"
 
-#include <vapi/l2.api.vapi.hpp>
-
 namespace VOM {
 /**
  * A entry in the ARP termination table of a Bridge Domain
@@ -34,20 +32,20 @@ public:
    * The key for a bridge_domain ARP entry;
    *  the BD, IP address and MAC address
    */
-  typedef std::tuple<uint32_t, mac_address_t, boost::asio::ip::address> key_t;
+  typedef std::pair<bridge_domain::key_t, boost::asio::ip::address> key_t;
 
   /**
-   * Construct a bridge_domain in the given bridge domain
+   * Construct a bridge domain ARP Entry in the given bridge domain
    */
   bridge_domain_arp_entry(const bridge_domain& bd,
-                          const mac_address_t& mac,
-                          const boost::asio::ip::address& ip_addr);
+                          const boost::asio::ip::address& ip_addr,
+                          const mac_address_t& mac);
 
   /**
-   * Construct a bridge_domain in the default table
+   * Construct a bridge domain ARP entry in the default table
    */
-  bridge_domain_arp_entry(const mac_address_t& mac,
-                          const boost::asio::ip::address& ip_addr);
+  bridge_domain_arp_entry(const boost::asio::ip::address& ip_addr,
+                          const mac_address_t& mac);
 
   /**
    * Copy Construct
@@ -59,6 +57,16 @@ public:
    */
   ~bridge_domain_arp_entry();
 
+  /**
+   * Return the object's key
+   */
+  const key_t key() const;
+
+  /**
+   * comparison operator
+   */
+  bool operator==(const bridge_domain_arp_entry& bdae) const;
+
   /**
    * Return the matching 'singular instance'
    */
@@ -67,8 +75,7 @@ public:
   /**
    * Find the instnace of the bridge_domain domain in the OM
    */
-  static std::shared_ptr<bridge_domain_arp_entry> find(
-    const bridge_domain_arp_entry& temp);
+  static std::shared_ptr<bridge_domain_arp_entry> find(const key_t& k);
 
   /**
    * Dump all bridge_domain-doamin into the stream provided
@@ -85,78 +92,6 @@ public:
    */
   std::string to_string() const;
 
-  /**
-   * A command class that creates or updates the bridge domain ARP Entry
-   */
-  class create_cmd
-    : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
-  {
-  public:
-    /**
-     * Constructor
-     */
-    create_cmd(HW::item<bool>& item,
-               uint32_t id,
-               const mac_address_t& mac,
-               const boost::asio::ip::address& ip_addr);
-
-    /**
-     * Issue the command to VPP/HW
-     */
-    rc_t issue(connection& con);
-
-    /**
-     * convert to string format for debug purposes
-     */
-    std::string to_string() const;
-
-    /**
-     * Comparison operator - only used for UT
-     */
-    bool operator==(const create_cmd& i) const;
-
-  private:
-    uint32_t m_bd;
-    mac_address_t m_mac;
-    boost::asio::ip::address m_ip_addr;
-  };
-
-  /**
-   * A cmd class that deletes a bridge domain ARP entry
-   */
-  class delete_cmd
-    : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
-  {
-  public:
-    /**
-     * Constructor
-     */
-    delete_cmd(HW::item<bool>& item,
-               uint32_t id,
-               const mac_address_t& mac,
-               const boost::asio::ip::address& ip_addr);
-
-    /**
-     * Issue the command to VPP/HW
-     */
-    rc_t issue(connection& con);
-
-    /**
-     * convert to string format for debug purposes
-     */
-    std::string to_string() const;
-
-    /**
-     * Comparison operator - only used for UT
-     */
-    bool operator==(const delete_cmd& i) const;
-
-  private:
-    uint32_t m_bd;
-    mac_address_t m_mac;
-    boost::asio::ip::address m_ip_addr;
-  };
-
 private:
   /**
    * Class definition for listeners to OM events
@@ -230,14 +165,14 @@ private:
   std::shared_ptr<bridge_domain> m_bd;
 
   /**
-   * 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 return
    */
-  boost::asio::ip::address m_ip_addr;
+  mac_address_t m_mac;
 
   /**
    * A map of all bridge_domains
@@ -247,7 +182,7 @@ private:
 
 std::ostream& operator<<(std::ostream& os,
                          const bridge_domain_arp_entry::key_t& key);
-};
+}; // namespace
 
 /*
  * fd.io coding-style-patch-verification: ON