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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __VOM_INTERFACE_SPAN_CMDS_H__
17 #define __VOM_INTERFACE_SPAN_CMDS_H__
19 #include "vom/dump_cmd.hpp"
20 #include "vom/interface_span.hpp"
21 #include "vom/rpc_cmd.hpp"
23 #include <vapi/span.api.vapi.hpp>
26 namespace interface_span_cmds {
29 * A command class that configures the interface span
32 : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_span_enable_disable>
38 config_cmd(HW::item<bool>& item,
39 const handle_t& itf_from,
40 const handle_t& itf_to,
41 const interface_span::state_t& state);
44 * Issue the command to VPP/HW
46 rc_t issue(connection& con);
48 * convert to string format for debug purposes
50 std::string to_string() const;
53 * Comparison operator - only used for UT
55 bool operator==(const config_cmd& i) const;
59 * Reference to the interface to be mirrored
61 const handle_t& m_itf_from;
63 * Reference to the interface where the traffic is mirrored
65 const handle_t& m_itf_to;
67 * the state (rx, tx or both) of the interface to be mirrored
69 const interface_span::state_t& m_state;
73 * A cmd class that Unconfigs interface span
76 : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_span_enable_disable>
82 unconfig_cmd(HW::item<bool>& item,
83 const handle_t& itf_from,
84 const handle_t& itf_to);
87 * Issue the command to VPP/HW
89 rc_t issue(connection& con);
91 * convert to string format for debug purposes
93 std::string to_string() const;
96 * Comparison operator - only used for UT
98 bool operator==(const unconfig_cmd& i) const;
102 * Reference to the interface to be mirrored
104 const handle_t& m_itf_from;
106 * Reference to the interface where the traffic is mirrored
108 const handle_t& m_itf_to;
112 * A cmd class that Dumps all the interface spans
114 class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_span_dump>
121 dump_cmd(const dump_cmd& d);
124 * Issue the command to VPP/HW
126 rc_t issue(connection& con);
128 * convert to string format for debug purposes
130 std::string to_string() const;
133 * Comparison operator - only used for UT
135 bool operator==(const dump_cmd& i) const;
147 * fd.io coding-style-patch-verification: ON
150 * eval: (c-set-style "mozilla")