FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
gbp_bridge_domain.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __VOM_GBP_BRIDGE_DOMAIN_H__
17 #define __VOM_GBP_BRIDGE_DOMAIN_H__
18 
19 #include "vom/bridge_domain.hpp"
20 #include "vom/gbp_route_domain.hpp"
21 #include "vom/interface.hpp"
22 #include "vom/singular_db.hpp"
23 
24 namespace VOM {
25 
26 /**
27  * A entry in the ARP termination table of a Bridge Domain
28  */
30 {
31 public:
32  /**
33  * The key for a bridge_domain is the pair of EPG-IDs
34  */
36 
37  struct flags_t : enum_base<flags_t>
38  {
39  const static flags_t NONE;
40  const static flags_t DO_NOT_LEARN;
41  const static flags_t UU_FWD_DROP;
42  const static flags_t MCAST_DROP;
43  const static flags_t UCAST_ARP;
44 
45  static const flags_t& from_vpp(int i);
46 
47  private:
48  flags_t(int v, const std::string& s);
49  flags_t();
50  };
51 
52  /**
53  * Construct a GBP bridge_domain
54  */
56  const gbp_route_domain& rd,
57  const interface& bvi,
58  const flags_t& flags = flags_t::NONE);
60  const gbp_route_domain& rd,
61  const interface& bvi,
62  const interface& uu_fwd,
63  const interface& bm_flood,
64  const flags_t& flags = flags_t::NONE);
66  const gbp_route_domain& rd,
67  const std::shared_ptr<interface> bvi,
68  const std::shared_ptr<interface> uu_fwd,
69  const std::shared_ptr<interface> bm_flood,
70  const flags_t& flags = flags_t::NONE);
72  const gbp_route_domain& rd,
73  const interface& bvi,
74  const std::shared_ptr<interface> uu_fwd,
75  const std::shared_ptr<interface> bm_flood,
76  const flags_t& flags = flags_t::NONE);
77 
78  /**
79  * Copy Construct
80  */
82 
83  /**
84  * Destructor
85  */
87 
88  /**
89  * Return the object's key
90  */
91  const key_t key() const;
92 
93  /**
94  * Return the bridge domain's VPP ID
95  */
96  uint32_t id() const;
97 
98  /**
99  * comparison operator
100  */
101  bool operator==(const gbp_bridge_domain& bdae) const;
102 
103  /**
104  * Return the matching 'singular instance'
105  */
106  std::shared_ptr<gbp_bridge_domain> singular() const;
107 
108  /**
109  * Find the instnace of the bridge_domain domain in the OM
110  */
111  static std::shared_ptr<gbp_bridge_domain> find(const key_t& k);
112 
113  /**
114  * Dump all bridge_domain-doamin into the stream provided
115  */
116  static void dump(std::ostream& os);
117 
118  /**
119  * replay the object to create it in hardware
120  */
121  void replay(void);
122 
123  /**
124  * Convert to string for debugging
125  */
126  std::string to_string() const;
127 
128  const std::shared_ptr<bridge_domain> get_bridge_domain() const;
129  const std::shared_ptr<interface> get_bvi() const;
130 
131 private:
132  /**
133  * Class definition for listeners to OM events
134  */
136  {
137  public:
138  event_handler();
139  virtual ~event_handler() = default;
140 
141  /**
142  * Handle a populate event
143  */
144  void handle_populate(const client_db::key_t& key);
145 
146  /**
147  * Handle a replay event
148  */
149  void handle_replay();
150 
151  /**
152  * Show the object in the Singular DB
153  */
154  void show(std::ostream& os);
155 
156  /**
157  * Get the sortable Id of the listener
158  */
159  dependency_t order() const;
160  };
161 
162  /**
163  * event_handler to register with OM
164  */
165  static event_handler m_evh;
166 
167  /**
168  * Commit the acculmulated changes into VPP. i.e. to a 'HW" write.
169  */
170  void update(const gbp_bridge_domain& obj);
171 
172  /**
173  * Find or add the instance of the bridge_domain domain in the OM
174  */
175  static std::shared_ptr<gbp_bridge_domain> find_or_add(
176  const gbp_bridge_domain& temp);
177 
178  /*
179  * It's the VPPHW class that updates the objects in HW
180  */
181  friend class OM;
182 
183  /**
184  * It's the singular_db class that calls replay()
185  */
187 
188  /**
189  * Sweep/reap the object if still stale
190  */
191  void sweep(void);
192 
193  /**
194  * HW configuration for the result of creating the endpoint
195  */
196  HW::item<uint32_t> m_id;
197 
198  std::shared_ptr<bridge_domain> m_bd;
199  std::shared_ptr<gbp_route_domain> m_rd;
200  std::shared_ptr<interface> m_bvi;
201  std::shared_ptr<interface> m_uu_fwd;
202  std::shared_ptr<interface> m_bm_flood;
203  flags_t m_flags;
204 
205  /**
206  * A map of all bridge_domains
207  */
209 };
210 
211 }; // namespace
212 
213 /*
214  * fd.io coding-style-patch-verification: OFF
215  *
216  * Local Variables:
217  * eval: (c-set-style "mozilla")
218  * End:
219  */
220 
221 #endif
VOM::bridge_domain
A base class for all object_base in the VPP object_base-Model.
Definition: bridge_domain.hpp:31
VOM::HW::item< uint32_t >
VOM::gbp_bridge_domain::flags_t::UCAST_ARP
const static flags_t UCAST_ARP
Definition: gbp_bridge_domain.hpp:43
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::gbp_bridge_domain
A entry in the ARP termination table of a Bridge Domain.
Definition: gbp_bridge_domain.hpp:29
VOM::dependency_t
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
Definition: types.hpp:43
VOM::gbp_bridge_domain::get_bridge_domain
const std::shared_ptr< bridge_domain > get_bridge_domain() const
Definition: gbp_bridge_domain.cpp:149
VOM::gbp_bridge_domain::flags_t::DO_NOT_LEARN
const static flags_t DO_NOT_LEARN
Definition: gbp_bridge_domain.hpp:40
VOM::OM
The interface to writing objects into VPP OM.
Definition: om.hpp:140
VOM::inspect::command_handler
inspect command handler Handler
Definition: inspect.hpp:54
VOM::gbp_bridge_domain::flags_t::from_vpp
static const flags_t & from_vpp(int i)
VOM::OM::listener
Class definition for listeners to OM events.
Definition: om.hpp:284
VOM::gbp_bridge_domain::dump
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
Definition: gbp_bridge_domain.cpp:267
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1071
VOM::gbp_bridge_domain::replay
void replay(void)
replay the object to create it in hardware
Definition: gbp_bridge_domain.cpp:199
VOM::gbp_bridge_domain::get_bvi
const std::shared_ptr< interface > get_bvi() const
Definition: gbp_bridge_domain.cpp:155
VOM::gbp_bridge_domain::operator==
bool operator==(const gbp_bridge_domain &bdae) const
comparison operator
Definition: gbp_bridge_domain.cpp:161
VOM::gbp_bridge_domain::singular
std::shared_ptr< gbp_bridge_domain > singular() const
Return the matching 'singular instance'.
Definition: gbp_bridge_domain.cpp:261
VOM::gbp_bridge_domain::find
static std::shared_ptr< gbp_bridge_domain > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
Definition: gbp_bridge_domain.cpp:235
VOM::enum_base
A template base class for all enum types.
Definition: enum_base.hpp:30
VOM::interface
A representation of an interface in VPP.
Definition: interface.hpp:41
VOM::client_db::key_t
const typedef std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
Definition: client_db.hpp:51
VOM::gbp_bridge_domain::key_t
bridge_domain::key_t key_t
The key for a bridge_domain is the pair of EPG-IDs.
Definition: gbp_bridge_domain.hpp:35
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
VOM::gbp_bridge_domain::gbp_bridge_domain
gbp_bridge_domain(const bridge_domain &bd, const gbp_route_domain &rd, const interface &bvi, const flags_t &flags=flags_t::NONE)
Construct a GBP bridge_domain.
Definition: gbp_bridge_domain.cpp:53
bridge_domain.hpp
VOM::gbp_bridge_domain::to_string
std::string to_string() const
Convert to string for debugging.
Definition: gbp_bridge_domain.cpp:218
singular_db.hpp
VOM::gbp_bridge_domain::flags_t
Definition: gbp_bridge_domain.hpp:37
VOM::gbp_bridge_domain::key
const key_t key() const
Return the object's key.
Definition: gbp_bridge_domain.cpp:137
interface.hpp
VOM::gbp_route_domain
A entry in the ARP termination table of a Route Domain.
Definition: gbp_route_domain.hpp:30
VOM::gbp_bridge_domain::~gbp_bridge_domain
~gbp_bridge_domain()
Destructor.
Definition: gbp_bridge_domain.cpp:209
VOM::gbp_bridge_domain::flags_t::UU_FWD_DROP
const static flags_t UU_FWD_DROP
Definition: gbp_bridge_domain.hpp:41
VOM::singular_db
A Database to store the unique 'singular' instances of a single object type.
Definition: singular_db.hpp:33
VOM::gbp_bridge_domain::flags_t::MCAST_DROP
const static flags_t MCAST_DROP
Definition: gbp_bridge_domain.hpp:42
show
void show(char *chroot_path, int verbose)
Definition: svmtool.c:104
event_handler
void event_handler(void *tls_async)
Definition: tls_async.c:334
VOM::gbp_bridge_domain::flags_t::NONE
const static flags_t NONE
Definition: gbp_bridge_domain.hpp:39
VOM::bridge_domain::key_t
uint32_t key_t
Key Type for Bridge Domains in the sigular DB.
Definition: bridge_domain.hpp:37
VOM::gbp_bridge_domain::id
uint32_t id() const
Return the bridge domain's VPP ID.
Definition: gbp_bridge_domain.cpp:143
VOM::object_base
A base class for all object_base in the VPP object_base-Model.
Definition: object_base.hpp:29
gbp_route_domain.hpp
string
const char *const string
Definition: cJSON.h:172
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105