FD.io VPP  v19.01.3-6-g70449b9b9
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/interface.hpp"
21 #include "vom/singular_db.hpp"
22 #include "vom/types.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 pari of EPG-IDs
34  */
36 
37  /**
38  * Construct a GBP bridge_domain
39  */
40  gbp_bridge_domain(const bridge_domain& bd, const interface& bvi);
42  const interface& bvi,
43  const interface& uu_fwd);
45  const std::shared_ptr<interface> bvi,
46  const std::shared_ptr<interface> uu_fwd);
48  const interface& bvi,
49  const std::shared_ptr<interface> uu_fwd);
50 
51  /**
52  * Copy Construct
53  */
55 
56  /**
57  * Destructor
58  */
60 
61  /**
62  * Return the object's key
63  */
64  const key_t key() const;
65 
66  /**
67  * Return the bridge domain's VPP ID
68  */
69  uint32_t id() const;
70 
71  /**
72  * comparison operator
73  */
74  bool operator==(const gbp_bridge_domain& bdae) const;
75 
76  /**
77  * Return the matching 'singular instance'
78  */
79  std::shared_ptr<gbp_bridge_domain> singular() const;
80 
81  /**
82  * Find the instnace of the bridge_domain domain in the OM
83  */
84  static std::shared_ptr<gbp_bridge_domain> find(const key_t& k);
85 
86  /**
87  * Dump all bridge_domain-doamin into the stream provided
88  */
89  static void dump(std::ostream& os);
90 
91  /**
92  * replay the object to create it in hardware
93  */
94  void replay(void);
95 
96  /**
97  * Convert to string for debugging
98  */
99  std::string to_string() const;
100 
101  const std::shared_ptr<bridge_domain> get_bridge_domain();
102  const std::shared_ptr<interface> get_bvi();
103 
104 private:
105  /**
106  * Class definition for listeners to OM events
107  */
109  {
110  public:
111  event_handler();
112  virtual ~event_handler() = default;
113 
114  /**
115  * Handle a populate event
116  */
117  void handle_populate(const client_db::key_t& key);
118 
119  /**
120  * Handle a replay event
121  */
122  void handle_replay();
123 
124  /**
125  * Show the object in the Singular DB
126  */
127  void show(std::ostream& os);
128 
129  /**
130  * Get the sortable Id of the listener
131  */
132  dependency_t order() const;
133  };
134 
135  /**
136  * event_handler to register with OM
137  */
138  static event_handler m_evh;
139 
140  /**
141  * Commit the acculmulated changes into VPP. i.e. to a 'HW" write.
142  */
143  void update(const gbp_bridge_domain& obj);
144 
145  /**
146  * Find or add the instance of the bridge_domain domain in the OM
147  */
148  static std::shared_ptr<gbp_bridge_domain> find_or_add(
149  const gbp_bridge_domain& temp);
150 
151  /*
152  * It's the VPPHW class that updates the objects in HW
153  */
154  friend class OM;
155 
156  /**
157  * It's the singular_db class that calls replay()
158  */
159  friend class singular_db<key_t, gbp_bridge_domain>;
160 
161  /**
162  * Sweep/reap the object if still stale
163  */
164  void sweep(void);
165 
166  /**
167  * HW configuration for the result of creating the endpoint
168  */
169  HW::item<uint32_t> m_id;
170 
171  std::shared_ptr<bridge_domain> m_bd;
172  std::shared_ptr<interface> m_bvi;
173  std::shared_ptr<interface> m_uu_fwd;
174 
175  /**
176  * A map of all bridge_domains
177  */
179 };
180 
181 }; // namespace
182 
183 /*
184  * fd.io coding-style-patch-verification: ON
185  *
186  * Local Variables:
187  * eval: (c-set-style "mozilla")
188  * End:
189  */
190 
191 #endif
const 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
const std::shared_ptr< interface > get_bvi()
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
std::shared_ptr< gbp_bridge_domain > singular() const
Return the matching &#39;singular instance&#39;.
void replay(void)
replay the object to create it in hardware
static std::shared_ptr< gbp_bridge_domain > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
bool operator==(const gbp_bridge_domain &bdae) const
comparison operator
A entry in the ARP termination table of a Bridge Domain.
gbp_bridge_domain(const bridge_domain &bd, const interface &bvi)
Construct a GBP bridge_domain.
A Database to store the unique &#39;singular&#39; instances of a single object type.
Definition: singular_db.hpp:33
bridge_domain::key_t key_t
The key for a bridge_domain is the pari of EPG-IDs.
A representation of an interface in VPP.
Definition: interface.hpp:41
A base class for all object_base in the VPP object_base-Model.
Class definition for listeners to OM events.
Definition: om.hpp:284
inspect command handler Handler
Definition: inspect.hpp:54
void event_handler(void *tls_async)
Definition: tls_async.c:340
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
The interface to writing objects into VPP OM.
Definition: om.hpp:140
uint32_t key_t
Key Type for Bridge Domains in the sigular DB.
A base class for all object_base in the VPP object_base-Model.
Definition: object_base.hpp:29
std::string to_string() const
Convert to string for debugging.
const std::shared_ptr< bridge_domain > get_bridge_domain()
const key_t key() const
Return the object&#39;s key.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
void show(char *chroot_path, int verbose)
Definition: svmtool.c:105
uint32_t id() const
Return the bridge domain&#39;s VPP ID.