diff options
author | Neale Ranns <nranns@cisco.com> | 2019-01-10 08:00:22 -0800 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-01-22 07:17:43 +0000 |
commit | 5e82b050a5c140e195ba960b73fdcdefd5d9f3a5 (patch) | |
tree | 8102357010b1d311003b235db8831b231f789dde | |
parent | a0d82d68108a65ee28f7629da7eed74005b131c4 (diff) |
VOM: GBP bridge domain flags
Change-Id: Ib5e4a850e127dda51318ffe82ef2622b980bc947
Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain.cpp | 35 | ||||
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain.hpp | 30 | ||||
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain_cmds.cpp | 11 | ||||
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain_cmds.hpp | 4 | ||||
-rw-r--r-- | extras/vom/vom/gbp_endpoint_group.cpp | 4 | ||||
-rw-r--r-- | extras/vom/vom/gbp_endpoint_group.hpp | 4 | ||||
-rw-r--r-- | extras/vom/vom/gbp_route_domain.cpp | 2 | ||||
-rw-r--r-- | extras/vom/vom/gbp_route_domain.hpp | 2 |
8 files changed, 69 insertions, 23 deletions
diff --git a/extras/vom/vom/gbp_bridge_domain.cpp b/extras/vom/vom/gbp_bridge_domain.cpp index 03be83ddb9f..101209fc2c7 100644 --- a/extras/vom/vom/gbp_bridge_domain.cpp +++ b/extras/vom/vom/gbp_bridge_domain.cpp @@ -21,6 +21,16 @@ namespace VOM { +const gbp_bridge_domain::flags_t gbp_bridge_domain::flags_t::NONE(0, "none"); +const gbp_bridge_domain::flags_t gbp_bridge_domain::flags_t::DO_NOT_LEARN( + 0, + "do-not-learn"); + +gbp_bridge_domain::flags_t::flags_t(int v, const std::string& s) + : enum_base<gbp_bridge_domain::flags_t>(v, s) +{ +} + /** * A DB of al the interfaces, key on the name */ @@ -32,40 +42,48 @@ gbp_bridge_domain::event_handler gbp_bridge_domain::m_evh; * Construct a new object matching the desried state */ gbp_bridge_domain::gbp_bridge_domain(const bridge_domain& bd, - const interface& bvi) + const interface& bvi, + const flags_t& flags) : m_id(bd.id()) , m_bd(bd.singular()) , m_bvi(bvi.singular()) + , m_flags(flags) { } gbp_bridge_domain::gbp_bridge_domain(const bridge_domain& bd, const interface& bvi, - const interface& uu_fwd) + const interface& uu_fwd, + const flags_t& flags) : m_id(bd.id()) , m_bd(bd.singular()) , m_bvi(bvi.singular()) , m_uu_fwd(uu_fwd.singular()) + , m_flags(flags) { } gbp_bridge_domain::gbp_bridge_domain(const bridge_domain& bd, const std::shared_ptr<interface> bvi, - const std::shared_ptr<interface> uu_fwd) + const std::shared_ptr<interface> uu_fwd, + const flags_t& flags) : m_id(bd.id()) , m_bd(bd.singular()) , m_bvi(bvi->singular()) , m_uu_fwd(uu_fwd->singular()) + , m_flags(flags) { } gbp_bridge_domain::gbp_bridge_domain(const bridge_domain& bd, const interface& bvi, - const std::shared_ptr<interface> uu_fwd) + const std::shared_ptr<interface> uu_fwd, + const flags_t& flags) : m_id(bd.id()) , m_bd(bd.singular()) , m_bvi(bvi.singular()) , m_uu_fwd(uu_fwd->singular()) + , m_flags(flags) { } @@ -74,6 +92,7 @@ gbp_bridge_domain::gbp_bridge_domain(const gbp_bridge_domain& bd) , m_bd(bd.m_bd) , m_bvi(bd.m_bvi) , m_uu_fwd(bd.m_uu_fwd) + , m_flags(bd.m_flags) { } @@ -90,13 +109,13 @@ gbp_bridge_domain::id() const } const std::shared_ptr<bridge_domain> -gbp_bridge_domain::get_bridge_domain() +gbp_bridge_domain::get_bridge_domain() const { return m_bd; } const std::shared_ptr<interface> -gbp_bridge_domain::get_bvi() +gbp_bridge_domain::get_bvi() const { return m_bvi; } @@ -138,7 +157,7 @@ gbp_bridge_domain::replay() if (rc_t::OK == m_id.rc()) { HW::enqueue(new gbp_bridge_domain_cmds::create_cmd( m_id, (m_bvi ? m_bvi->handle() : handle_t::INVALID), - (m_uu_fwd ? m_uu_fwd->handle() : handle_t::INVALID))); + (m_uu_fwd ? m_uu_fwd->handle() : handle_t::INVALID), m_flags)); } } @@ -181,7 +200,7 @@ gbp_bridge_domain::update(const gbp_bridge_domain& desired) if (rc_t::OK != m_id.rc()) { HW::enqueue(new gbp_bridge_domain_cmds::create_cmd( m_id, (m_bvi ? m_bvi->handle() : handle_t::INVALID), - (m_uu_fwd ? m_uu_fwd->handle() : handle_t::INVALID))); + (m_uu_fwd ? m_uu_fwd->handle() : handle_t::INVALID), m_flags)); } } diff --git a/extras/vom/vom/gbp_bridge_domain.hpp b/extras/vom/vom/gbp_bridge_domain.hpp index c86c53ebf24..3fcb24cf07b 100644 --- a/extras/vom/vom/gbp_bridge_domain.hpp +++ b/extras/vom/vom/gbp_bridge_domain.hpp @@ -34,19 +34,36 @@ public: */ typedef bridge_domain::key_t key_t; + struct flags_t : enum_base<flags_t> + { + const static flags_t NONE; + const static flags_t DO_NOT_LEARN; + + static const flags_t& from_vpp(int i); + + private: + flags_t(int v, const std::string& s); + flags_t(); + }; + /** * Construct a GBP bridge_domain */ - gbp_bridge_domain(const bridge_domain& bd, const interface& bvi); gbp_bridge_domain(const bridge_domain& bd, const interface& bvi, - const interface& uu_fwd); + const flags_t& flags = flags_t::NONE); + gbp_bridge_domain(const bridge_domain& bd, + const interface& bvi, + const interface& uu_fwd, + const flags_t& flags = flags_t::NONE); gbp_bridge_domain(const bridge_domain& bd, const std::shared_ptr<interface> bvi, - const std::shared_ptr<interface> uu_fwd); + const std::shared_ptr<interface> uu_fwd, + const flags_t& flags = flags_t::NONE); gbp_bridge_domain(const bridge_domain& bd, const interface& bvi, - const std::shared_ptr<interface> uu_fwd); + const std::shared_ptr<interface> uu_fwd, + const flags_t& flags = flags_t::NONE); /** * Copy Construct @@ -98,8 +115,8 @@ public: */ std::string to_string() const; - const std::shared_ptr<bridge_domain> get_bridge_domain(); - const std::shared_ptr<interface> get_bvi(); + const std::shared_ptr<bridge_domain> get_bridge_domain() const; + const std::shared_ptr<interface> get_bvi() const; private: /** @@ -171,6 +188,7 @@ private: std::shared_ptr<bridge_domain> m_bd; std::shared_ptr<interface> m_bvi; std::shared_ptr<interface> m_uu_fwd; + const flags_t& m_flags; /** * A map of all bridge_domains diff --git a/extras/vom/vom/gbp_bridge_domain_cmds.cpp b/extras/vom/vom/gbp_bridge_domain_cmds.cpp index 60f7cddd9f3..8fc5250f192 100644 --- a/extras/vom/vom/gbp_bridge_domain_cmds.cpp +++ b/extras/vom/vom/gbp_bridge_domain_cmds.cpp @@ -20,10 +20,12 @@ namespace gbp_bridge_domain_cmds { create_cmd::create_cmd(HW::item<uint32_t>& item, const handle_t bvi, - const handle_t uu_fwd) + const handle_t uu_fwd, + const gbp_bridge_domain::flags_t& flags) : rpc_cmd(item) , m_bvi(bvi) , m_uu_fwd(uu_fwd) + , m_flags(flags) { } @@ -31,7 +33,8 @@ bool create_cmd::operator==(const create_cmd& other) const { return ((m_hw_item.data() == other.m_hw_item.data()) && - (m_bvi == other.m_bvi) && (m_uu_fwd == other.m_uu_fwd)); + (m_bvi == other.m_bvi) && (m_uu_fwd == other.m_uu_fwd) && + (m_flags == other.m_flags)); } rc_t @@ -45,6 +48,10 @@ create_cmd::issue(connection& con) payload.bd.bvi_sw_if_index = m_bvi.value(); payload.bd.uu_fwd_sw_if_index = m_uu_fwd.value(); + payload.bd.flags = GBP_BD_API_FLAG_NONE; + if (gbp_bridge_domain::flags_t::DO_NOT_LEARN == m_flags) + payload.bd.flags = GBP_BD_API_FLAG_DO_NOT_LEARN; + VAPI_CALL(req.execute()); return (wait()); diff --git a/extras/vom/vom/gbp_bridge_domain_cmds.hpp b/extras/vom/vom/gbp_bridge_domain_cmds.hpp index e7c501fc598..ec6b0a443fe 100644 --- a/extras/vom/vom/gbp_bridge_domain_cmds.hpp +++ b/extras/vom/vom/gbp_bridge_domain_cmds.hpp @@ -36,7 +36,8 @@ public: */ create_cmd(HW::item<uint32_t>& item, const handle_t bvi, - const handle_t uu_fwd); + const handle_t uu_fwd, + const gbp_bridge_domain::flags_t& flags); /** * Issue the command to VPP/HW @@ -55,6 +56,7 @@ public: private: const handle_t m_bvi; const handle_t m_uu_fwd; + const gbp_bridge_domain::flags_t& m_flags; }; /** diff --git a/extras/vom/vom/gbp_endpoint_group.cpp b/extras/vom/vom/gbp_endpoint_group.cpp index 5f09ed1ffc3..e63b09f7c1b 100644 --- a/extras/vom/vom/gbp_endpoint_group.cpp +++ b/extras/vom/vom/gbp_endpoint_group.cpp @@ -146,13 +146,13 @@ gbp_endpoint_group::dump(std::ostream& os) } const std::shared_ptr<gbp_route_domain> -gbp_endpoint_group::get_route_domain() +gbp_endpoint_group::get_route_domain() const { return m_rd; } const std::shared_ptr<gbp_bridge_domain> -gbp_endpoint_group::get_bridge_domain() +gbp_endpoint_group::get_bridge_domain() const { return m_bd; } diff --git a/extras/vom/vom/gbp_endpoint_group.hpp b/extras/vom/vom/gbp_endpoint_group.hpp index ed0d8d93cde..49578007361 100644 --- a/extras/vom/vom/gbp_endpoint_group.hpp +++ b/extras/vom/vom/gbp_endpoint_group.hpp @@ -102,8 +102,8 @@ public: */ epg_id_t id() const; - const std::shared_ptr<gbp_route_domain> get_route_domain(); - const std::shared_ptr<gbp_bridge_domain> get_bridge_domain(); + const std::shared_ptr<gbp_route_domain> get_route_domain() const; + const std::shared_ptr<gbp_bridge_domain> get_bridge_domain() const; private: /** diff --git a/extras/vom/vom/gbp_route_domain.cpp b/extras/vom/vom/gbp_route_domain.cpp index 8e44db5a4f8..96216a6cab5 100644 --- a/extras/vom/vom/gbp_route_domain.cpp +++ b/extras/vom/vom/gbp_route_domain.cpp @@ -77,7 +77,7 @@ gbp_route_domain::id() const } const std::shared_ptr<route_domain> -gbp_route_domain::get_route_domain() +gbp_route_domain::get_route_domain() const { return m_rd; } diff --git a/extras/vom/vom/gbp_route_domain.hpp b/extras/vom/vom/gbp_route_domain.hpp index ff13d1d6e05..0d133b377a5 100644 --- a/extras/vom/vom/gbp_route_domain.hpp +++ b/extras/vom/vom/gbp_route_domain.hpp @@ -96,7 +96,7 @@ public: */ std::string to_string() const; - const std::shared_ptr<route_domain> get_route_domain(); + const std::shared_ptr<route_domain> get_route_domain() const; private: /** |