GBP V2
[vpp.git] / src / vpp-api / vom / bridge_domain.hpp
index b42f53f..d345da2 100644 (file)
@@ -31,6 +31,71 @@ namespace VOM {
 class bridge_domain : public object_base
 {
 public:
+  /**
+   * Key Type for Bridge Domains in the sigular DB
+   */
+  typedef uint32_t key_t;
+
+  /**
+   * Bridge Domain Learning mode
+   */
+  struct learning_mode_t : enum_base<learning_mode_t>
+  {
+    const static learning_mode_t ON;
+    const static learning_mode_t OFF;
+
+  private:
+    /**
+     * Private constructor taking the value and the string name
+     */
+    learning_mode_t(int v, const std::string& s);
+  };
+
+  /**
+   * Bridge Domain ARP termination mode
+   */
+  struct arp_term_mode_t : enum_base<arp_term_mode_t>
+  {
+    const static arp_term_mode_t ON;
+    const static arp_term_mode_t OFF;
+
+  private:
+    /**
+     * Private constructor taking the value and the string name
+     */
+    arp_term_mode_t(int v, const std::string& s);
+  };
+
+  /**
+   * Bridge Domain MAC aging mode
+   */
+  struct mac_age_mode_t : enum_base<mac_age_mode_t>
+  {
+    const static mac_age_mode_t ON;
+    const static mac_age_mode_t OFF;
+
+  private:
+    /**
+     * Private constructor taking the value and the string name
+     */
+    mac_age_mode_t(int v, const std::string& s);
+  };
+
+  /**
+   * Bridge Domain Learning mode
+   */
+  struct flood_mode_t : enum_base<flood_mode_t>
+  {
+    const static flood_mode_t ON;
+    const static flood_mode_t OFF;
+
+  private:
+    /**
+     * Private constructor taking the value and the string name
+     */
+    flood_mode_t(int v, const std::string& s);
+  };
+
   /**
    * The value of the defaultbridge domain
    */
@@ -39,16 +104,37 @@ public:
   /**
    * Construct a new object matching the desried state
    */
-  bridge_domain(uint32_t id);
+  bridge_domain(uint32_t id,
+                const learning_mode_t& lmode = learning_mode_t::ON,
+                const arp_term_mode_t& amode = arp_term_mode_t::ON,
+                const flood_mode_t& fmode = flood_mode_t::ON,
+                const mac_age_mode_t& mmode = mac_age_mode_t::OFF);
+
   /**
    * Copy Constructor
    */
   bridge_domain(const bridge_domain& o);
+
   /**
    * Destructor
    */
   ~bridge_domain();
 
+  /**
+   * Comparison operator - for UT
+   */
+  bool operator==(const bridge_domain& b) const;
+
+  /**
+   * Return the bridge domain's VPP ID
+   */
+  uint32_t id() const;
+
+  /**
+   * Return the bridge domain's key
+   */
+  const key_t& key() const;
+
   /**
    * Return the matchin 'singular' instance of the bridge-domain
    */
@@ -59,15 +145,10 @@ public:
    */
   std::string to_string(void) const;
 
-  /**
-   * Return VPP's handle for this obejct
-   */
-  uint32_t id() const;
-
   /**
    * Static function to find the bridge_domain in the model
    */
-  static std::shared_ptr<bridge_domain> find(uint32_t id);
+  static std::shared_ptr<bridge_domain> find(const key_t& key);
 
   /**
    * Dump all bridge-doamin into the stream provided
@@ -128,7 +209,7 @@ private:
   /**
    * It's the singular_db class that calls replay()
    */
-  friend class singular_db<uint32_t, bridge_domain>;
+  friend class singular_db<key_t, bridge_domain>;
 
   /**
    * Sweep/reap the object if still stale
@@ -145,10 +226,30 @@ private:
    */
   HW::item<uint32_t> m_id;
 
+  /**
+   * The learning mode of the bridge
+   */
+  learning_mode_t m_learning_mode;
+
+  /**
+   * The ARP termination mode of the bridge
+   */
+  arp_term_mode_t m_arp_term_mode;
+
+  /**
+   * The flood mode of the bridge
+   */
+  flood_mode_t m_flood_mode;
+
+  /**
+   * The MAC aging mode of the bridge
+   */
+  mac_age_mode_t m_mac_age_mode;
+
   /**
    * A map of all interfaces key against the interface's name
    */
-  static singular_db<uint32_t, bridge_domain> m_db;
+  static singular_db<key_t, bridge_domain> m_db;
 };
 };