FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
gbp_endpoint_group.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_ENDPOINT_GROUP_H__
17 #define __VOM_GBP_ENDPOINT_GROUP_H__
18 
19 #include "vom/interface.hpp"
20 #include "vom/singular_db.hpp"
21 #include "vom/types.hpp"
22 
24 #include "vom/gbp_route_domain.hpp"
25 #include "vom/gbp_types.hpp"
26 
27 namespace VOM {
28 
29 /**
30  * A entry in the ARP termination table of a Bridge Domain
31  */
33 {
34 public:
35  /**
36  * Endpoint Retention Policy Settings
37  */
38  struct retention_t
39  {
40  retention_t();
42 
43  retention_t(const retention_t&) = default;
44  retention_t& operator=(const retention_t&) = default;
45 
46  bool operator==(const retention_t& o) const;
47  std::string to_string() const;
48 
49  /**
50  * Remote Endpoint timeout/ageing
51  */
53  };
54 
55  /**
56  * The key for a GBP endpoint group is its ID
57  */
58  typedef sclass_t key_t;
59 
60  /**
61  * Construct a GBP endpoint_group
62  */
65  const interface& itf,
66  const gbp_route_domain& rd,
67  const gbp_bridge_domain& bd);
70  const gbp_route_domain& rd,
71  const gbp_bridge_domain& bd);
73  const gbp_route_domain& rd,
74  const gbp_bridge_domain& bd);
75 
76  /**
77  * Copy Construct
78  */
80 
81  /**
82  * Destructor
83  */
85 
86  /**
87  * Return the object's key
88  */
89  const key_t key() const;
90 
91  /**
92  * comparison operator
93  */
94  bool operator==(const gbp_endpoint_group& bdae) const;
95 
96  /**
97  * Return the matching 'singular instance'
98  */
99  std::shared_ptr<gbp_endpoint_group> singular() const;
100 
101  /**
102  * Find the instnace of the bridge_domain domain in the OM
103  */
104  static std::shared_ptr<gbp_endpoint_group> find(const key_t& k);
105 
106  /**
107  * Dump all bridge_domain-doamin into the stream provided
108  */
109  static void dump(std::ostream& os);
110 
111  /**
112  * replay the object to create it in hardware
113  */
114  void replay(void);
115 
116  /**
117  * Convert to string for debugging
118  */
119  std::string to_string() const;
120 
121  /**
122  * Get the ID of the EPG
123  */
124  vnid_t vnid() const;
125  sclass_t sclass() const;
126 
127  const std::shared_ptr<gbp_route_domain> get_route_domain() const;
128  const std::shared_ptr<gbp_bridge_domain> get_bridge_domain() const;
129 
130  void set(const retention_t& retention);
131 
132 private:
133  /**
134  * Class definition for listeners to OM events
135  */
137  {
138  public:
139  event_handler();
140  virtual ~event_handler() = default;
141 
142  /**
143  * Handle a populate event
144  */
145  void handle_populate(const client_db::key_t& key);
146 
147  /**
148  * Handle a replay event
149  */
150  void handle_replay();
151 
152  /**
153  * Show the object in the Singular DB
154  */
155  void show(std::ostream& os);
156 
157  /**
158  * Get the sortable Id of the listener
159  */
160  dependency_t order() const;
161  };
162 
163  /**
164  * event_handler to register with OM
165  */
166  static event_handler m_evh;
167 
168  /**
169  * Commit the acculmulated changes into VPP. i.e. to a 'HW" write.
170  */
171  void update(const gbp_endpoint_group& obj);
172 
173  /**
174  * Find or add the instnace of the bridge_domain domain in the OM
175  */
176  static std::shared_ptr<gbp_endpoint_group> find_or_add(
177  const gbp_endpoint_group& temp);
178 
179  /*
180  * It's the VPPHW class that updates the objects in HW
181  */
182  friend class OM;
183 
184  /**
185  * It's the singular_db class that calls replay()
186  */
188 
189  /**
190  * Sweep/reap the object if still stale
191  */
192  void sweep(void);
193 
194  /**
195  * HW configuration for the result of creating the endpoint_group
196  */
197  HW::item<bool> m_hw;
198 
199  /**
200  * The EPG ID
201  */
202  vnid_t m_vnid;
203 
204  /**
205  * The SClass on the wire
206  */
207  uint16_t m_sclass;
208 
209  /**
210  * The uplink interface for the endpoint group
211  */
212  std::shared_ptr<interface> m_itf;
213 
214  /**
215  * The route-domain the EPG uses
216  */
217  std::shared_ptr<gbp_route_domain> m_rd;
218 
219  /**
220  * The bridge-domain the EPG uses
221  */
222  std::shared_ptr<gbp_bridge_domain> m_bd;
223 
224  /**
225  * The Group's EP retention Policy
226  */
227  retention_t m_retention;
228 
229  /**
230  * A map of all bridge_domains
231  */
233 };
234 
235 }; // namespace
236 
237 /*
238  * fd.io coding-style-patch-verification: OFF
239  *
240  * Local Variables:
241  * eval: (c-set-style "mozilla")
242  * End:
243  */
244 
245 #endif
VOM::gbp_endpoint_group::operator==
bool operator==(const gbp_endpoint_group &bdae) const
comparison operator
Definition: gbp_endpoint_group.cpp:132
VOM::gbp_endpoint_group::retention_t::operator=
retention_t & operator=(const retention_t &)=default
VOM::HW::item< bool >
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::gbp_endpoint_group::retention_t::to_string
std::string to_string() const
Definition: gbp_endpoint_group.cpp:43
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_endpoint_group::retention_t::retention_t
retention_t()
Definition: gbp_endpoint_group.cpp:27
VOM::OM
The interface to writing objects into VPP OM.
Definition: om.hpp:140
VOM::gbp_endpoint_group::get_route_domain
const std::shared_ptr< gbp_route_domain > get_route_domain() const
Definition: gbp_endpoint_group.cpp:206
types.hpp
VOM::inspect::command_handler
inspect command handler Handler
Definition: inspect.hpp:54
gbp_bridge_domain.hpp
VOM::gbp_endpoint_group::get_bridge_domain
const std::shared_ptr< gbp_bridge_domain > get_bridge_domain() const
Definition: gbp_endpoint_group.cpp:212
VOM::OM::listener
Class definition for listeners to OM events.
Definition: om.hpp:284
VOM::sclass_t
uint16_t sclass_t
Definition: gbp_types.hpp:27
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1071
VOM::gbp_endpoint_group::retention_t::operator==
bool operator==(const retention_t &o) const
Definition: gbp_endpoint_group.cpp:37
VOM::gbp_endpoint_group::to_string
std::string to_string() const
Convert to string for debugging.
Definition: gbp_endpoint_group.cpp:159
VOM::gbp_endpoint_group::find
static std::shared_ptr< gbp_endpoint_group > find(const key_t &k)
Find the instnace of the bridge_domain domain in the OM.
Definition: gbp_endpoint_group.cpp:188
VOM::gbp_endpoint_group::gbp_endpoint_group
gbp_endpoint_group(vnid_t vnid, sclass_t sclass, const interface &itf, const gbp_route_domain &rd, const gbp_bridge_domain &bd)
Construct a GBP endpoint_group.
Definition: gbp_endpoint_group.cpp:48
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
retention
vl_api_gbp_endpoint_retention_t retention
Definition: gbp.api:191
VOM::gbp_endpoint_group::retention_t::remote_ep_timeout
uint32_t remote_ep_timeout
Remote Endpoint timeout/ageing.
Definition: gbp_endpoint_group.hpp:52
gbp_types.hpp
VOM::gbp_endpoint_group::key
const key_t key() const
Return the object's key.
Definition: gbp_endpoint_group.cpp:108
VOM::vnid_t
uint32_t vnid_t
EPG IDs are 32 bit integers.
Definition: gbp_types.hpp:26
VOM::gbp_endpoint_group::retention_t
Endpoint Retention Policy Settings.
Definition: gbp_endpoint_group.hpp:38
singular_db.hpp
VOM::gbp_endpoint_group::replay
void replay(void)
replay the object to create it in hardware
Definition: gbp_endpoint_group.cpp:149
VOM::gbp_endpoint_group::singular
std::shared_ptr< gbp_endpoint_group > singular() const
Return the matching 'singular instance'.
Definition: gbp_endpoint_group.cpp:194
interface.hpp
VOM::gbp_route_domain
A entry in the ARP termination table of a Route Domain.
Definition: gbp_route_domain.hpp:30
VOM::singular_db
A Database to store the unique 'singular' instances of a single object type.
Definition: singular_db.hpp:33
VOM::gbp_endpoint_group::dump
static void dump(std::ostream &os)
Dump all bridge_domain-doamin into the stream provided.
Definition: gbp_endpoint_group.cpp:200
VOM::gbp_endpoint_group::key_t
sclass_t key_t
The key for a GBP endpoint group is its ID.
Definition: gbp_endpoint_group.hpp:58
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_endpoint_group::~gbp_endpoint_group
~gbp_endpoint_group()
Destructor.
Definition: gbp_endpoint_group.cpp:101
VOM::gbp_endpoint_group
A entry in the ARP termination table of a Bridge Domain.
Definition: gbp_endpoint_group.hpp:32
VOM::gbp_endpoint_group::sclass
sclass_t sclass() const
Definition: gbp_endpoint_group.cpp:126
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
VOM::gbp_endpoint_group::set
void set(const retention_t &retention)
Definition: gbp_endpoint_group.cpp:120
VOM::gbp_endpoint_group::vnid
vnid_t vnid() const
Get the ID of the EPG.
Definition: gbp_endpoint_group.cpp:114
string
const char *const string
Definition: cJSON.h:172