blob: 1c1a3468c9b8a1638fc10b48f103b68f0f922edb [file] [log] [blame]
Neale Ranns9ef1c0a2017-11-03 04:39:05 -07001/*
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_TAP_INTERFACE_CMDS_H__
17#define __VOM_TAP_INTERFACE_CMDS_H__
18
19#include "vom/interface.hpp"
20#include "vom/tap_interface.hpp"
21#include "vom/dump_cmd.hpp"
22#include "vom/rpc_cmd.hpp"
23
24#include <vapi/interface.api.vapi.hpp>
25#include <vapi/tap.api.vapi.hpp>
26
27namespace VOM {
28namespace tap_interface_cmds {
29
30/**
31 * A functor class that creates an interface
32 */
33class create_cmd : public interface::create_cmd<vapi::Tap_connect>
34{
35public:
36 create_cmd(HW::item<handle_t>& item,
37 const std::string& name,
38 route::prefix_t& prefix,
39 const l2_address_t& l2_address);
40
41 /**
42 * Issue the command to VPP/HW
43 */
44 rc_t issue(connection& con);
45 /**
46 * convert to string format for debug purposes
47 */
48 std::string to_string() const;
49
50private:
51 route::prefix_t& m_prefix;
52 const l2_address_t& m_l2_address;
53};
54
55/**
56 * A functor class that deletes a Tap interface
57 */
58class delete_cmd : public interface::delete_cmd<vapi::Tap_delete>
59{
60public:
61 delete_cmd(HW::item<handle_t>& item);
62
63 /**
64 * Issue the command to VPP/HW
65 */
66 rc_t issue(connection& con);
67 /**
68 * convert to string format for debug purposes
69 */
70 std::string to_string() const;
71};
72
73/**
74 * A cmd class that Dumps all the Vpp Interfaces
75 */
76class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_tap_dump>
77{
78public:
79 /**
80 * Default Constructor
81 */
82 dump_cmd();
83
84 /**
85 * Issue the command to VPP/HW
86 */
87 rc_t issue(connection& con);
88 /**
89 * convert to string format for debug purposes
90 */
91 std::string to_string() const;
92
93 /**
94 * Comparison operator - only used for UT
95 */
96 bool operator==(const dump_cmd& i) const;
97};
98
99}; // namespace tap_interface_cmds
100}; // namespace VOM
101
102#endif