FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
qos_map_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 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_QOS_MAP_CMDS_H__
17 #define __VOM_QOS_MAP_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/qos_map.hpp"
21 
22 #include <vapi/qos.api.vapi.hpp>
23 
24 namespace VOM {
25 namespace QoS {
26 namespace map_cmds {
27 
28 /**
29  * A command class that creates or updates the GBP endpoint
30  */
31 class create_cmd : public rpc_cmd<HW::item<bool>, vapi::Qos_egress_map_update>
32 {
33 public:
34  /**
35  * Constructor
36  */
37  create_cmd(HW::item<bool>& item, uint32_t id, const map::outputs_t& o);
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  uint32_t m_id;
56  const map::outputs_t& m_outputs;
57 };
58 
59 /**
60  * A cmd class that deletes a GBP endpoint
61  */
62 class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::Qos_egress_map_update>
63 {
64 public:
65  /**
66  * Constructor
67  */
68  delete_cmd(HW::item<bool>& item, uint32_t id);
69 
70  /**
71  * Issue the command to VPP/HW
72  */
74 
75  /**
76  * convert to string format for debug purposes
77  */
78  std::string to_string() const;
79 
80  /**
81  * Comparison operator - only used for UT
82  */
83  bool operator==(const delete_cmd& i) const;
84 
85 private:
86  uint32_t m_id;
87 };
88 
89 /**
90  * A cmd class that Dumps all the GBP endpoints
91  */
92 class dump_cmd : public VOM::dump_cmd<vapi::Qos_egress_map_dump>
93 {
94 public:
95  /**
96  * Constructor
97  */
98  dump_cmd();
99  dump_cmd(const dump_cmd& d);
100 
101  /**
102  * Issue the command to VPP/HW
103  */
105  /**
106  * convert to string format for debug purposes
107  */
108  std::string to_string() const;
109 
110  /**
111  * Comparison operator - only used for UT
112  */
113  bool operator==(const dump_cmd& i) const;
114 
115 private:
116  /**
117  * HW reutrn code
118  */
119  HW::item<bool> item;
120 };
121 }; // namespace map_cmds
122 }; // namespace Qos
123 }; // namespace VOM
124 
125 /*
126  * fd.io coding-style-patch-verification: OFF
127  *
128  * Local Variables:
129  * eval: (c-set-style "mozilla")
130  * End:
131  */
132 
133 #endif
VOM::HW::item< bool >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::QoS::map_cmds::create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: qos_map_cmds.cpp:47
VOM::QoS::map_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: qos_map_cmds.cpp:109
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::QoS::map::outputs_t
std::array< std::array< bits_t, 256 >, 4 > outputs_t
Definition: qos_map.hpp:38
VOM::QoS::map_cmds::delete_cmd::operator==
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
Definition: qos_map_cmds.cpp:77
VOM::QoS::map_cmds::dump_cmd
A cmd class that Dumps all the GBP endpoints.
Definition: qos_map_cmds.hpp:92
VOM::QoS::map_cmds::create_cmd
A command class that creates or updates the GBP endpoint.
Definition: qos_map_cmds.hpp:31
VOM::QoS::map_cmds::delete_cmd
A cmd class that deletes a GBP endpoint.
Definition: qos_map_cmds.hpp:62
VOM::QoS::map_cmds::create_cmd::operator==
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
Definition: qos_map_cmds.cpp:41
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::QoS::map_cmds::create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: qos_map_cmds.cpp:62
qos_map.hpp
dump_cmd.hpp
VOM::rpc_cmd< HW::item< bool >, vapi::Qos_egress_map_update >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::QoS::map_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: qos_map_cmds.cpp:127
VOM::QoS::map_cmds::create_cmd::create_cmd
create_cmd(HW::item< bool > &item, uint32_t id, const map::outputs_t &o)
Constructor.
Definition: qos_map_cmds.cpp:31
VOM::QoS::map_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: qos_map_cmds.cpp:83
VOM::QoS::map_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: qos_map_cmds.cpp:96
i
int i
Definition: flowhash_template.h:376
VOM::QoS::map_cmds::dump_cmd::dump_cmd
dump_cmd()
Constructor.
Definition: qos_map_cmds.cpp:104
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
VOM::QoS::map_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: qos_map_cmds.cpp:115
VOM::QoS::map_cmds::delete_cmd::delete_cmd
delete_cmd(HW::item< bool > &item, uint32_t id)
Constructor.
Definition: qos_map_cmds.cpp:70
string
const char *const string
Definition: cJSON.h:172