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