FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
sub_interface_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_SUB_INTERFACE_CMDS_H__
17 #define __VOM_SUB_INTERFACE_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/rpc_cmd.hpp"
21 #include "vom/sub_interface.hpp"
22 
23 #include <vapi/interface.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace sub_interface_cmds {
27 
28 /**
29  * A functor class that creates an interface
30  */
31 class create_cmd : public interface::create_cmd<vapi::Create_vlan_subif>
32 {
33 public:
34  /**
35  * Cstrunctor taking the reference to the parent
36  * and the sub-interface's VLAN
37  */
39  const std::string& name,
40  const handle_t& parent,
41  uint16_t vlan);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
47 
48  /**
49  * convert to string format for debug purposes
50  */
51  std::string to_string() const;
52 
53  /**
54  * Comparison operator - only used for UT
55  */
56  bool operator==(const create_cmd& i) const;
57 
58 private:
59  /**
60  * Refernece to the parents handle
61  */
62  const handle_t& m_parent;
63 
64  /**
65  * The VLAN of the sub-interface
66  */
67  uint16_t m_vlan;
68 };
69 
70 /**
71  * A cmd class that Delete an interface
72  */
73 class delete_cmd : public interface::delete_cmd<vapi::Delete_subif>
74 {
75 public:
76  /**
77  * Constructor
78  */
80 
81  /**
82  * Issue the command to VPP/HW
83  */
85 
86  /**
87  * convert to string format for debug purposes
88  */
89  std::string to_string() const;
90 
91  /**
92  * Comparison operator - only used for UT
93  */
94  bool operator==(const delete_cmd& i) const;
95 };
96 
97 }; // namespace sub_interface_cmds
98 }; // namespace VOM
99 
100 /*
101  * fd.io coding-style-patch-verification: OFF
102  *
103  * Local Variables:
104  * eval: (c-set-style "mozilla")
105  * End:
106  */
107 
108 #endif
VOM::HW::item< handle_t >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::sub_interface_cmds::delete_cmd::delete_cmd
delete_cmd(HW::item< handle_t > &item)
Constructor.
Definition: sub_interface_cmds.cpp:70
name
string name[64]
Definition: fib.api:25
VOM::sub_interface_cmds::delete_cmd::operator==
bool operator==(const delete_cmd &i) const
Comparison operator - only used for UT.
Definition: sub_interface_cmds.cpp:76
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::sub_interface_cmds::create_cmd::create_cmd
create_cmd(HW::item< handle_t > &item, const std::string &name, const handle_t &parent, uint16_t vlan)
Cstrunctor taking the reference to the parent and the sub-interface's VLAN.
Definition: sub_interface_cmds.cpp:24
VOM::interface::delete_cmd
Base class for intterface Delete commands.
Definition: interface.hpp:376
VOM::sub_interface_cmds::create_cmd::operator==
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
Definition: sub_interface_cmds.cpp:35
VOM::sub_interface_cmds::create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: sub_interface_cmds.cpp:62
sub_interface.hpp
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::sub_interface_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: sub_interface_cmds.cpp:99
VOM::sub_interface_cmds::create_cmd
A functor class that creates an interface.
Definition: sub_interface_cmds.hpp:31
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::sub_interface_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: sub_interface_cmds.cpp:82
VOM::interface::create_cmd
A base class for interface Create commands.
Definition: interface.hpp:309
dump_cmd.hpp
VOM::rpc_cmd< HW::item< handle_t >, vapi::Create_vlan_subif >::item
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::sub_interface_cmds::delete_cmd
A cmd class that Delete an interface.
Definition: sub_interface_cmds.hpp:73
VOM::sub_interface_cmds::create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: sub_interface_cmds.cpp:42
i
int i
Definition: flowhash_template.h:376
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172