FD.io VPP  v18.10-34-gcce845e
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_list_t& paths);
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_list_t m_paths;
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 
75  /**
76  * Issue the command to VPP/HW
77  */
78  rc_t issue(connection& con);
79 
80  /**
81  * convert to string format for debug purposes
82  */
83  std::string to_string() const;
84 
85  /**
86  * Comparison operator - only used for UT
87  */
88  bool operator==(const delete_cmd& i) const;
89 
90 private:
91  route::table_id_t m_id;
92  prefix_t m_prefix;
93 };
94 
95 /**
96  * A cmd class that Dumps ipv4 fib
97  */
98 class dump_v4_cmd : public VOM::dump_cmd<vapi::Ip_fib_dump>
99 {
100 public:
101  /**
102  * Constructor
103  */
104  dump_v4_cmd();
105  dump_v4_cmd(const dump_cmd& d);
106 
107  /**
108  * Issue the command to VPP/HW
109  */
110  rc_t issue(connection& con);
111  /**
112  * convert to string format for debug purposes
113  */
114  std::string to_string() const;
115 
116  /**
117  * Comparison operator - only used for UT
118  */
119  bool operator==(const dump_v4_cmd& i) const;
120 
121 private:
122  /**
123  * HW reutrn code
124  */
126 };
127 
128 /**
129  * A cmd class that Dumps ipv6 fib
130  */
131 class dump_v6_cmd : public VOM::dump_cmd<vapi::Ip6_fib_dump>
132 {
133 public:
134  /**
135  * Constructor
136  */
137  dump_v6_cmd();
138  dump_v6_cmd(const dump_cmd& d);
139 
140  /**
141  * Issue the command to VPP/HW
142  */
143  rc_t issue(connection& con);
144  /**
145  * convert to string format for debug purposes
146  */
147  std::string to_string() const;
148 
149  /**
150  * Comparison operator - only used for UT
151  */
152  bool operator==(const dump_v6_cmd& i) const;
153 
154 private:
155  /**
156  * HW reutrn code
157  */
159 };
160 
161 }; // namespace ip_route_cmds
162 }; // namespace route
163 }; // namespace VOM
164 
165 /*
166  * fd.io coding-style-patch-verification: ON
167  *
168  * Local Variables:
169  * eval: (c-set-style "mozilla")
170  * End:
171  */
172 
173 #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:131
bool operator==(const update_cmd &i) const
Comparison operator - only used for UT.
Definition: route_cmds.cpp:79
A command class that creates or updates the route.
Definition: route_cmds.hpp:32
int i
update_cmd(HW::item< bool > &item, table_id_t id, const prefix_t &prefix, const path_list_t &paths)
Constructor.
Definition: route_cmds.cpp:65
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
std::string to_string() const
convert to string format for debug purposes
Definition: route_cmds.cpp:107
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:38
std::set< path > path_list_t
A path-list is a set of paths.
Definition: route.hpp:210
A cmd class that deletes a route.
Definition: route_cmds.hpp:67
A cmd class that Dumps ipv4 fib.
Definition: route_cmds.hpp:98
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: route_cmds.cpp:85
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
typedef prefix
Definition: ip_types.api:40
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:64