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_TAP_INTERFACE_CMDS_H__
17 #define __VOM_TAP_INTERFACE_CMDS_H__
19 #include "vom/interface.hpp"
20 #include "vom/tap_interface.hpp"
21 #include "vom/dump_cmd.hpp"
22 #include "vom/rpc_cmd.hpp"
24 #include <vapi/interface.api.vapi.hpp>
25 #include <vapi/tap.api.vapi.hpp>
26 #include <vapi/tapv2.api.vapi.hpp>
29 namespace tap_interface_cmds {
32 * A functor class that creates an interface
34 class tap_create_cmd : public interface::create_cmd<vapi::Tap_connect>
37 tap_create_cmd(HW::item<handle_t>& item,
38 const std::string& name,
39 route::prefix_t& prefix,
40 const l2_address_t& l2_address);
43 * Issue the command to VPP/HW
45 rc_t issue(connection& con);
47 * convert to string format for debug purposes
49 std::string to_string() const;
52 route::prefix_t& m_prefix;
53 const l2_address_t& m_l2_address;
57 * A functor class that deletes a Tap interface
59 class tap_delete_cmd : public interface::delete_cmd<vapi::Tap_delete>
62 tap_delete_cmd(HW::item<handle_t>& item);
65 * Issue the command to VPP/HW
67 rc_t issue(connection& con);
69 * convert to string format for debug purposes
71 std::string to_string() const;
75 * A cmd class that Dumps all the Vpp Interfaces
77 class tap_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_dump>
86 * Issue the command to VPP/HW
88 rc_t issue(connection& con);
90 * convert to string format for debug purposes
92 std::string to_string() const;
95 * Comparison operator - only used for UT
97 bool operator==(const tap_dump_cmd& i) const;
101 * A functor class that creates an interface
103 class tapv2_create_cmd : public interface::create_cmd<vapi::Tap_create_v2>
106 tapv2_create_cmd(HW::item<handle_t>& item,
107 const std::string& name,
108 route::prefix_t& prefix,
109 const l2_address_t& l2_address);
112 * Issue the command to VPP/HW
114 rc_t issue(connection& con);
116 * convert to string format for debug purposes
118 std::string to_string() const;
121 route::prefix_t& m_prefix;
122 const l2_address_t& m_l2_address;
126 * A functor class that deletes a Tap interface
128 class tapv2_delete_cmd : public interface::delete_cmd<vapi::Tap_delete_v2>
131 tapv2_delete_cmd(HW::item<handle_t>& item);
134 * Issue the command to VPP/HW
136 rc_t issue(connection& con);
138 * convert to string format for debug purposes
140 std::string to_string() const;
144 * A cmd class that Dumps all the Vpp Interfaces
146 class tapv2_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_v2_dump>
150 * Default Constructor
155 * Issue the command to VPP/HW
157 rc_t issue(connection& con);
159 * convert to string format for debug purposes
161 std::string to_string() const;
164 * Comparison operator - only used for UT
166 bool operator==(const tapv2_dump_cmd& i) const;
169 }; // namespace tap_interface_cmds