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/tapv2.api.vapi.hpp>
28 namespace tap_interface_cmds {
31 * A functor class that creates an interface
33 class tapv2_create_cmd : public interface::create_cmd<vapi::Tap_create_v2>
36 tapv2_create_cmd(HW::item<handle_t>& item,
37 const std::string& name,
38 const route::prefix_t& prefix,
39 const l2_address_t& l2_address);
42 * Issue the command to VPP/HW
44 rc_t issue(connection& con);
46 * convert to string format for debug purposes
48 std::string to_string() const;
51 const route::prefix_t& m_prefix;
52 const l2_address_t& m_l2_address;
56 * A functor class that deletes a Tap interface
58 class tapv2_delete_cmd : public interface::delete_cmd<vapi::Tap_delete_v2>
61 tapv2_delete_cmd(HW::item<handle_t>& item);
64 * Issue the command to VPP/HW
66 rc_t issue(connection& con);
68 * convert to string format for debug purposes
70 std::string to_string() const;
74 * A cmd class that Dumps all the Vpp Interfaces
76 class tapv2_dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_v2_dump>
85 * Issue the command to VPP/HW
87 rc_t issue(connection& con);
89 * convert to string format for debug purposes
91 std::string to_string() const;
94 * Comparison operator - only used for UT
96 bool operator==(const tapv2_dump_cmd& i) const;
99 }; // namespace tap_interface_cmds