FD.io VPP  v19.04-6-g6f05f72
Vector Packet Processing
interface_span_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_INTERFACE_SPAN_CMDS_H__
17 #define __VOM_INTERFACE_SPAN_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/interface_span.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/span.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace interface_span_cmds {
27 
28 /**
29  * A command class that configures the interface span
30  */
32  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_span_enable_disable>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  const handle_t& itf_from,
40  const handle_t& itf_to,
42 
43  /**
44  * Issue the command to VPP/HW
45  */
46  rc_t issue(connection& con);
47  /**
48  * convert to string format for debug purposes
49  */
50  std::string to_string() const;
51 
52  /**
53  * Comparison operator - only used for UT
54  */
55  bool operator==(const config_cmd& i) const;
56 
57 private:
58  /**
59  * Reference to the interface to be mirrored
60  */
61  const handle_t& m_itf_from;
62  /**
63  * Reference to the interface where the traffic is mirrored
64  */
65  const handle_t& m_itf_to;
66  /**
67  * the state (rx, tx or both) of the interface to be mirrored
68  */
69  const interface_span::state_t& m_state;
70 };
71 
72 /**
73  * A cmd class that Unconfigs interface span
74  */
76  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_span_enable_disable>
77 {
78 public:
79  /**
80  * Constructor
81  */
83  const handle_t& itf_from,
84  const handle_t& itf_to);
85 
86  /**
87  * Issue the command to VPP/HW
88  */
89  rc_t issue(connection& con);
90  /**
91  * convert to string format for debug purposes
92  */
93  std::string to_string() const;
94 
95  /**
96  * Comparison operator - only used for UT
97  */
98  bool operator==(const unconfig_cmd& i) const;
99 
100 private:
101  /**
102  * Reference to the interface to be mirrored
103  */
104  const handle_t& m_itf_from;
105  /**
106  * Reference to the interface where the traffic is mirrored
107  */
108  const handle_t& m_itf_to;
109 };
110 
111 /**
112  * A cmd class that Dumps all the interface spans
113  */
114 class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_span_dump>
115 {
116 public:
117  /**
118  * Constructor
119  */
120  dump_cmd();
121  dump_cmd(const dump_cmd& d);
122 
123  /**
124  * Issue the command to VPP/HW
125  */
126  rc_t issue(connection& con);
127  /**
128  * convert to string format for debug purposes
129  */
130  std::string to_string() const;
131 
132  /**
133  * Comparison operator - only used for UT
134  */
135  bool operator==(const dump_cmd& i) const;
136 
137 private:
138  /**
139  * HW reutrn code
140  */
142 };
143 };
144 };
145 
146 /*
147  * fd.io coding-style-patch-verification: ON
148  *
149  * Local Variables:
150  * eval: (c-set-style "mozilla")
151  * End:
152  */
153 
154 #endif
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A command class that configures the interface span.
A cmd class that Unconfigs interface span.
vhost_vring_state_t state
Definition: vhost_user.h:120
A representation of the connection to VPP.
Definition: connection.hpp:33
config_cmd(HW::item< bool > &item, const handle_t &itf_from, const handle_t &itf_to, const interface_span::state_t &state)
Constructor.
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
A cmd class that Dumps all the interface spans.
std::string to_string() const
convert to string format for debug purposes
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
rc_t issue(connection &con)
Issue the command to VPP/HW.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
The state of the interface - rx/tx or both to be mirrored.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66