FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
gbp_route_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_ROUTE_DOMAIN_H__
17 #define __VOM_GBP_ROUTE_DOMAIN_H__
18 
19 #include "vom/gbp_types.hpp"
20 #include "vom/interface.hpp"
21 #include "vom/route_domain.hpp"
22 #include "vom/singular_db.hpp"
23 #include "vom/types.hpp"
24 
25 namespace VOM {
26 
27 /**
28  * A entry in the ARP termination table of a Route Domain
29  */
31 {
32 public:
33  /**
34  * The key for a route_domain is the pair of EPG-IDs
35  */
37 
38  /**
39  * Construct a GBP route_domain
40  */
42 
44  scope_t scope,
45  const interface& ip4_uu_fwd,
46  const interface& ip6_uu_fwd);
48  scope_t scope,
49  const std::shared_ptr<interface> ip4_uu_fwd,
50  const std::shared_ptr<interface> ip6_uu_fwd);
51 
52  /**
53  * Copy Construct
54  */
56 
57  /**
58  * Destructor
59  */
61 
62  /**
63  * Return the object's key
64  */
65  const key_t key() const;
66 
67  /**
68  * Return the route domain's VPP ID
69  */
70  route::table_id_t id() const;
71 
72  /**
73  * comparison operator
74  */
75  bool operator==(const gbp_route_domain& rdae) const;
76 
77  /**
78  * Return the matching 'singular instance'
79  */
80  std::shared_ptr<gbp_route_domain> singular() const;
81 
82  /**
83  * Find the instnace of the route_domain domain in the OM
84  */
85  static std::shared_ptr<gbp_route_domain> find(const key_t& k);
86 
87  /**
88  * Dump all route_domain-doamin into the stream provided
89  */
90  static void dump(std::ostream& os);
91 
92  /**
93  * replay the object to create it in hardware
94  */
95  void replay(void);
96 
97  /**
98  * Convert to string for debugging
99  */
100  std::string to_string() const;
101 
102  /**
103  * Accessors for children
104  */
105  const std::shared_ptr<route_domain> get_route_domain() const;
106  const std::shared_ptr<interface> get_ip4_uu_fwd() const;
107  const std::shared_ptr<interface> get_ip6_uu_fwd() const;
108 
109 private:
110  /**
111  * Class definition for listeners to OM events
112  */
114  {
115  public:
116  event_handler();
117  virtual ~event_handler() = default;
118 
119  /**
120  * Handle a populate event
121  */
122  void handle_populate(const client_db::key_t& key);
123 
124  /**
125  * Handle a replay event
126  */
127  void handle_replay();
128 
129  /**
130  * Show the object in the Singular DB
131  */
132  void show(std::ostream& os);
133 
134  /**
135  * Get the sortable Id of the listener
136  */
137  dependency_t order() const;
138  };
139 
140  /**
141  * event_handler to register with OM
142  */
143  static event_handler m_evh;
144 
145  /**
146  * Commit the acculmulated changes into VPP. i.e. to a 'HW" write.
147  */
148  void update(const gbp_route_domain& obj);
149 
150  /**
151  * Find or add the instance of the route_domain domain in the OM
152  */
153  static std::shared_ptr<gbp_route_domain> find_or_add(
154  const gbp_route_domain& temp);
155 
156  /*
157  * It's the VPPHW class that updates the objects in HW
158  */
159  friend class OM;
160 
161  /**
162  * It's the singular_db class that calls replay()
163  */
165 
166  /**
167  * Sweep/reap the object if still stale
168  */
169  void sweep(void);
170 
171  /**
172  * HW configuration for the result of creating the endpoint
173  */
174  HW::item<uint32_t> m_id;
175 
176  std::shared_ptr<route_domain> m_rd;
177  scope_t m_scope;
178  std::shared_ptr<interface> m_ip4_uu_fwd;
179  std::shared_ptr<interface> m_ip6_uu_fwd;
180 
181  /**
182  * A map of all route_domains
183  */
185 };
186 
187 }; // namespace
188 
189 /*
190  * fd.io coding-style-patch-verification: OFF
191  *
192  * Local Variables:
193  * eval: (c-set-style "mozilla")
194  * End:
195  */
196 
197 #endif
VOM::HW::item< uint32_t >
VOM::gbp_route_domain::gbp_route_domain
gbp_route_domain(const route_domain &rd, scope_t scope)
Construct a GBP route_domain.
Definition: gbp_route_domain.cpp:71
VOM::gbp_route_domain::dump
static void dump(std::ostream &os)
Dump all route_domain-doamin into the stream provided.
Definition: gbp_route_domain.cpp:210
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::scope_t
uint16_t scope_t
Definition: gbp_types.hpp:28
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::OM
The interface to writing objects into VPP OM.
Definition: om.hpp:140
types.hpp
VOM::gbp_route_domain::key_t
route_domain::key_t key_t
The key for a route_domain is the pair of EPG-IDs.
Definition: gbp_route_domain.hpp:36
VOM::inspect::command_handler
inspect command handler Handler
Definition: inspect.hpp:54
VOM::OM::listener
Class definition for listeners to OM events.
Definition: om.hpp:284
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
VOM::gbp_route_domain::singular
std::shared_ptr< gbp_route_domain > singular() const
Return the matching 'singular instance'.
Definition: gbp_route_domain.cpp:204
VOM::gbp_route_domain::operator==
bool operator==(const gbp_route_domain &rdae) const
comparison operator
Definition: gbp_route_domain.cpp:111
VOM::gbp_route_domain::get_ip4_uu_fwd
const std::shared_ptr< interface > get_ip4_uu_fwd() const
Definition: gbp_route_domain.cpp:99
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
scope
vl_api_gbp_scope_t scope
Definition: gbp.api:78
VOM::gbp_route_domain::get_ip6_uu_fwd
const std::shared_ptr< interface > get_ip6_uu_fwd() const
Definition: gbp_route_domain.cpp:105
gbp_types.hpp
VOM::gbp_route_domain::get_route_domain
const std::shared_ptr< route_domain > get_route_domain() const
Accessors for children.
Definition: gbp_route_domain.cpp:93
singular_db.hpp
VOM::gbp_route_domain::~gbp_route_domain
~gbp_route_domain()
Destructor.
Definition: gbp_route_domain.cpp:154
interface.hpp
VOM::gbp_route_domain
A entry in the ARP termination table of a Route Domain.
Definition: gbp_route_domain.hpp:30
VOM::route_domain
A route-domain is a VRF.
Definition: route_domain.hpp:31
VOM::singular_db
A Database to store the unique 'singular' instances of a single object type.
Definition: singular_db.hpp:33
VOM::gbp_route_domain::id
route::table_id_t id() const
Return the route domain's VPP ID.
Definition: gbp_route_domain.cpp:87
route_domain.hpp
VOM::gbp_route_domain::replay
void replay(void)
replay the object to create it in hardware
Definition: gbp_route_domain.cpp:142
VOM::route::table_id_t
uint32_t table_id_t
type def the table-id
Definition: prefix.hpp:121
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_route_domain::key
const key_t key() const
Return the object's key.
Definition: gbp_route_domain.cpp:81
VOM::object_base
A base class for all object_base in the VPP object_base-Model.
Definition: object_base.hpp:29
VOM::route_domain::key_t
route::table_id_t key_t
The Key for a route-domain.
Definition: route_domain.hpp:37
VOM::gbp_route_domain::to_string
std::string to_string() const
Convert to string for debugging.
Definition: gbp_route_domain.cpp:163
VOM::gbp_route_domain::find
static std::shared_ptr< gbp_route_domain > find(const key_t &k)
Find the instnace of the route_domain domain in the OM.
Definition: gbp_route_domain.cpp:179
string
const char *const string
Definition: cJSON.h:172