FD.io VPP  v19.04.1-1-ge4a0f9f
Vector Packet Processing
route_cmds.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_ROUTE_CMDS_H__
17 #define __VOM_ROUTE_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/route.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace route {
27 namespace ip_route_cmds {
28 
29 /**
30  * A command class that creates or updates the route
31  */
32 class update_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_add_del_route>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  table_id_t id,
40  const prefix_t& prefix,
41  const path& path);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
46  rc_t issue(connection& con);
47 
48  /**
49  * convert to string format for debug purposes
50  */
51  std::string to_string() const;
52 
53  /**
54  * Comparison operator - only used for UT
55  */
56  bool operator==(const update_cmd& i) const;
57 
58 private:
59  route::table_id_t m_id;
60  prefix_t m_prefix;
61  const path m_path;
62 };
63 
64 /**
65  * A cmd class that deletes a route
66  */
67 class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_add_del_route>
68 {
69 public:
70  /**
71  * Constructor
72  */
74  table_id_t id,
75  const prefix_t& prefix,
76  const path& path);
77 
78  /**
79  * Issue the command to VPP/HW
80  */
81  rc_t issue(connection& con);
82 
83  /**
84  * convert to string format for debug purposes
85  */
86  std::string to_string() const;
87 
88  /**
89  * Comparison operator - only used for UT
90  */
91  bool operator==(const delete_cmd& i) const;
92 
93 private:
94  route::table_id_t m_id;
95  prefix_t m_prefix;
96  const path m_path;
97 };
98 
99 /**
100  * A cmd class that Dumps ipv4 fib
101  */
102 class dump_v4_cmd : public VOM::dump_cmd<vapi::Ip_fib_dump>
103 {
104 public:
105  /**
106  * Constructor
107  */
108  dump_v4_cmd();
109  dump_v4_cmd(const dump_cmd& d);
110 
111  /**
112  * Issue the command to VPP/HW
113  */
114  rc_t issue(connection& con);
115  /**
116  * convert to string format for debug purposes
117  */
118  std::string to_string() const;
119 
120  /**
121  * Comparison operator - only used for UT
122  */
123  bool operator==(const dump_v4_cmd& i) const;
124 
125 private:
126  /**
127  * HW reutrn code
128  */
130 };
131 
132 /**
133  * A cmd class that Dumps ipv6 fib
134  */
135 class dump_v6_cmd : public VOM::dump_cmd<vapi::Ip6_fib_dump>
136 {
137 public:
138  /**
139  * Constructor
140  */
141  dump_v6_cmd();
142  dump_v6_cmd(const dump_cmd& d);
143 
144  /**
145  * Issue the command to VPP/HW
146  */
147  rc_t issue(connection& con);
148  /**
149  * convert to string format for debug purposes
150  */
151  std::string to_string() const;
152 
153  /**
154  * Comparison operator - only used for UT
155  */
156  bool operator==(const dump_v6_cmd& i) const;
157 
158 private:
159  /**
160  * HW reutrn code
161  */
163 };
164 
165 }; // namespace ip_route_cmds
166 }; // namespace route
167 }; // namespace VOM
168 
169 /*
170  * fd.io coding-style-patch-verification: ON
171  *
172  * Local Variables:
173  * eval: (c-set-style "mozilla")
174  * End:
175  */
176 
177 #endif
uint32_t table_id_t
type def the table-id
Definition: prefix.hpp:82
A cmd class that Dumps ipv6 fib.
Definition: route_cmds.hpp:135
bool operator==(const update_cmd &i) const
Comparison operator - only used for UT.
Definition: route_cmds.cpp:37
A command class that creates or updates the route.
Definition: route_cmds.hpp:32
A path for IP or MPLS routes.
Definition: route.hpp:32
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
std::string to_string() const
convert to string format for debug purposes
Definition: route_cmds.cpp:64
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
A cmd class that deletes a route.
Definition: route_cmds.hpp:67
update_cmd(HW::item< bool > &item, table_id_t id, const prefix_t &prefix, const path &path)
Constructor.
Definition: route_cmds.cpp:25
A cmd class that Dumps ipv4 fib.
Definition: route_cmds.hpp:102
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: route_cmds.cpp:44
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
typedef prefix
Definition: ip_types.api:35
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
A prefix defintion.
Definition: prefix.hpp:92
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66