FD.io VPP  v21.01.1
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  */
42  rc_t issue(connection& con);
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  */
73  rc_t issue(connection& con);
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  */
104  rc_t issue(connection& con);
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  */
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
const char *const string
Definition: cJSON.h:172
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
create_cmd(HW::item< bool > &item, uint32_t id, const map::outputs_t &o)
Constructor.
std::string to_string() const
convert to string format for debug purposes
A cmd class that deletes a GBP endpoint.
A representation of the connection to VPP.
Definition: connection.hpp:33
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
A cmd class that Dumps all the GBP endpoints.
std::array< std::array< bits_t, 256 >, 4 > outputs_t
Definition: qos_map.hpp:38
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
A command class that creates or updates the GBP endpoint.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
rc_t issue(connection &con)
Issue the command to VPP/HW.
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66