diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2019-03-22 15:13:31 +0100 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-04-04 07:29:34 +0000 |
commit | 8ea109e40a65c1d7696162fa3d4c1e386b6c9414 (patch) | |
tree | 949205872a9366ed13c3979bdc1b712101bc8c62 /extras/vom | |
parent | dc66aadb9ad7e4a7623e6689a21a46aadb9942b4 (diff) |
gbp: Add bd flags
Add flags for unknown unicast drop, multicast and broadcast
drop and arp unicast.
Change-Id: I1203137510b8bee0a20ecfe5f2efad8043d4bac6
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'extras/vom')
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain.cpp | 23 | ||||
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain.hpp | 3 | ||||
-rw-r--r-- | extras/vom/vom/gbp_bridge_domain_cmds.cpp | 19 |
3 files changed, 39 insertions, 6 deletions
diff --git a/extras/vom/vom/gbp_bridge_domain.cpp b/extras/vom/vom/gbp_bridge_domain.cpp index c8d42d264a3..cfa07681545 100644 --- a/extras/vom/vom/gbp_bridge_domain.cpp +++ b/extras/vom/vom/gbp_bridge_domain.cpp @@ -25,6 +25,15 @@ 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( 1, "do-not-learn"); +const gbp_bridge_domain::flags_t gbp_bridge_domain::flags_t::UU_FWD_DROP( + 2, + "uu-fwd-drop"); +const gbp_bridge_domain::flags_t gbp_bridge_domain::flags_t::MCAST_DROP( + 4, + "mcast-drop"); +const gbp_bridge_domain::flags_t gbp_bridge_domain::flags_t::UCAST_ARP( + 8, + "ucast-arp"); gbp_bridge_domain::flags_t::flags_t(int v, const std::string& s) : enum_base<gbp_bridge_domain::flags_t>(v, s) @@ -273,12 +282,22 @@ gbp_bridge_domain::event_handler::handle_populate(const client_db::key_t& key) std::shared_ptr<interface> bvi = interface::find(payload.bd.bvi_sw_if_index); + flags_t flags = gbp_bridge_domain::flags_t::NONE; + if (payload.bd.flags & GBP_BD_API_FLAG_DO_NOT_LEARN) + flags |= gbp_bridge_domain::flags_t::DO_NOT_LEARN; + if (payload.bd.flags & GBP_BD_API_FLAG_UU_FWD_DROP) + flags |= gbp_bridge_domain::flags_t::UU_FWD_DROP; + if (payload.bd.flags & GBP_BD_API_FLAG_MCAST_DROP) + flags |= gbp_bridge_domain::flags_t::MCAST_DROP; + if (payload.bd.flags & GBP_BD_API_FLAG_UCAST_ARP) + flags |= gbp_bridge_domain::flags_t::UCAST_ARP; + if (uu_fwd && bm_flood && bvi) { - gbp_bridge_domain bd(payload.bd.bd_id, bvi, uu_fwd, bm_flood); + gbp_bridge_domain bd(payload.bd.bd_id, bvi, uu_fwd, bm_flood, flags); OM::commit(key, bd); VOM_LOG(log_level_t::DEBUG) << "dump: " << bd.to_string(); } else if (bvi) { - gbp_bridge_domain bd(payload.bd.bd_id, *bvi); + gbp_bridge_domain bd(payload.bd.bd_id, *bvi, flags); OM::commit(key, bd); VOM_LOG(log_level_t::DEBUG) << "dump: " << bd.to_string(); } else { diff --git a/extras/vom/vom/gbp_bridge_domain.hpp b/extras/vom/vom/gbp_bridge_domain.hpp index 2c470aa3a6e..64429fc730e 100644 --- a/extras/vom/vom/gbp_bridge_domain.hpp +++ b/extras/vom/vom/gbp_bridge_domain.hpp @@ -38,6 +38,9 @@ public: { const static flags_t NONE; const static flags_t DO_NOT_LEARN; + const static flags_t UU_FWD_DROP; + const static flags_t MCAST_DROP; + const static flags_t UCAST_ARP; static const flags_t& from_vpp(int i); diff --git a/extras/vom/vom/gbp_bridge_domain_cmds.cpp b/extras/vom/vom/gbp_bridge_domain_cmds.cpp index 6fa8c49f9e5..082bd4bb48d 100644 --- a/extras/vom/vom/gbp_bridge_domain_cmds.cpp +++ b/extras/vom/vom/gbp_bridge_domain_cmds.cpp @@ -51,10 +51,21 @@ create_cmd::issue(connection& con) payload.bd.uu_fwd_sw_if_index = m_uu_fwd.value(); payload.bd.bm_flood_sw_if_index = m_bm_flood.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_enum_gbp_bridge_domain_flags flags = GBP_BD_API_FLAG_NONE; + if (gbp_bridge_domain::flags_t::DO_NOT_LEARN & m_flags) + flags = static_cast<vapi_enum_gbp_bridge_domain_flags>( + flags | GBP_BD_API_FLAG_DO_NOT_LEARN); + if (gbp_bridge_domain::flags_t::UU_FWD_DROP & m_flags) + flags = static_cast<vapi_enum_gbp_bridge_domain_flags>( + flags | GBP_BD_API_FLAG_UU_FWD_DROP); + if (gbp_bridge_domain::flags_t::MCAST_DROP & m_flags) + flags = static_cast<vapi_enum_gbp_bridge_domain_flags>( + flags | GBP_BD_API_FLAG_MCAST_DROP); + if (gbp_bridge_domain::flags_t::UCAST_ARP & m_flags) + flags = static_cast<vapi_enum_gbp_bridge_domain_flags>( + flags | GBP_BD_API_FLAG_UCAST_ARP); + + payload.bd.flags = flags; VAPI_CALL(req.execute()); return (wait()); |