FD.io VPP  v18.04-17-g3a0d853
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  */
46  rc_t issue(connection& con);
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  */
84  rc_t issue(connection& con);
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: ON
102  *
103  * Local Variables:
104  * eval: (c-set-style "mozilla")
105  * End:
106  */
107 
108 #endif
bool operator==(const create_cmd &i) const
Comparison operator - only used for UT.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:90
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&#39;s VLAN.
A representation of the connection to VPP.
Definition: connection.hpp:33
rc_t issue(connection &con)
Issue the command to VPP/HW.
A functor class that creates an interface.
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64
A cmd class that Delete an interface.
Base class for intterface Delete commands.
Definition: interface.hpp:337
A type declaration of an interface handle in VPP.
Definition: types.hpp:236
A base class for interface Create commands.
Definition: interface.hpp:269
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
std::string to_string() const
convert to string format for debug purposes