FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
route_domain_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_DOMAIN_CMDS_H__
17 #define __VOM_ROUTE_DOMAIN_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/route_domain.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/ip.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace route_domain_cmds {
27 
28 /**
29  * A command class that creates the IP table
30  */
31 class create_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_table_add_del>
32 {
33 public:
34  /**
35  * Constructor
36  */
38 
39  /**
40  * Issue the command to VPP/HW
41  */
43 
44  /**
45  * convert to string format for debug purposes
46  */
47  std::string to_string() const;
48 
49  /**
50  * Comparison operator - only used for UT
51  */
52  bool operator==(const create_cmd& i) const;
53 
54 private:
55  /**
56  * table-ID to create
57  */
58  route::table_id_t m_id;
59 
60  /**
61  * L3 protocol of the table
62  */
63  l3_proto_t m_proto;
64 };
65 
66 /**
67  * A cmd class that Deletes the IP Table
68  */
69 class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_table_add_del>
70 {
71 public:
72  /**
73  * Constructor
74  */
76 
77  /**
78  * Issue the command to VPP/HW
79  */
81 
82  /**
83  * convert to string format for debug purposes
84  */
85  std::string to_string() const;
86 
87  /**
88  * Comparison operator - only used for UT
89  */
90  bool operator==(const delete_cmd& i) const;
91 
92 private:
93  /**
94  * table-ID to create
95  */
96  route::table_id_t m_id;
97 
98  /**
99  * L3 protocol of the table
100  */
101  l3_proto_t m_proto;
102 };
103 
104 /**
105  * A cmd class that Dumps IP fib tables
106  */
107 class dump_cmd : public VOM::dump_cmd<vapi::Ip_table_dump>
108 {
109 public:
110  /**
111  * Constructor
112  */
113  dump_cmd();
114  dump_cmd(const dump_cmd& d);
115 
116  /**
117  * Issue the command to VPP/HW
118  */
120  /**
121  * convert to string format for debug purposes
122  */
123  std::string to_string() const;
124 
125  /**
126  * Comparison operator - only used for UT
127  */
128  bool operator==(const dump_cmd& i) const;
129 
130 private:
131  /**
132  * HW reutrn code
133  */
134  HW::item<bool> item;
135 };
136 
137 }; // namespace route_domain_cmds
138 }; // namespace VOM
139 
140 /*
141  * fd.io coding-style-patch-verification: OFF
142  *
143  * Local Variables:
144  * eval: (c-set-style "mozilla")
145  * End:
146  */
147 
148 #endif
VOM::HW::item< bool >
VOM::route_domain_cmds::create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: route_domain_cmds.cpp:52
VOM::route_domain_cmds::dump_cmd::dump_cmd
dump_cmd()
Constructor.
Definition: route_domain_cmds.cpp:104
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::route_domain_cmds::delete_cmd::operator==
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
Definition: route_domain_cmds.cpp:71
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::route_domain_cmds::delete_cmd::delete_cmd
delete_cmd(HW::item< bool > &item, l3_proto_t proto, route::table_id_t id)
Constructor.
Definition: route_domain_cmds.cpp:61
VOM::route_domain_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: route_domain_cmds.cpp:109
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::route_domain_cmds::create_cmd::create_cmd
create_cmd(HW::item< bool > &item, l3_proto_t proto, route::table_id_t id)
Constructor.
Definition: route_domain_cmds.cpp:21
VOM::route_domain_cmds::create_cmd
A command class that creates the IP table.
Definition: route_domain_cmds.hpp:31
dump_cmd.hpp
VOM::route_domain_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: route_domain_cmds.cpp:77
VOM::rpc_cmd< HW::item< bool >, vapi::Ip_table_add_del >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::l3_proto_t
An L3 protocol can be used to construct a prefix that is used to match packets are part of a route.
Definition: prefix.hpp:52
VOM::route_domain_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: route_domain_cmds.cpp:95
VOM::route_domain_cmds::delete_cmd
A cmd class that Deletes the IP Table.
Definition: route_domain_cmds.hpp:69
VOM::route_domain_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: route_domain_cmds.cpp:115
VOM::route_domain_cmds::dump_cmd
A cmd class that Dumps IP fib tables.
Definition: route_domain_cmds.hpp:107
route_domain.hpp
i
int i
Definition: flowhash_template.h:376
VOM::route_domain_cmds::create_cmd::operator==
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
Definition: route_domain_cmds.cpp:31
VOM::route::table_id_t
uint32_t table_id_t
type def the table-id
Definition: prefix.hpp:121
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
VOM::route_domain_cmds::create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: route_domain_cmds.cpp:37
VOM::route_domain_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: route_domain_cmds.cpp:127
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172