FD.io VPP  v21.01.1
Vector Packet Processing
bond_group_binding_cmds.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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_BOND_GROUP_BINDING_CMDS_H__
17 #define __VOM_BOND_GROUP_BINDING_CMDS_H__
18 
20 #include "vom/dump_cmd.hpp"
21 
22 #include <vapi/bond.api.vapi.hpp>
23 
24 namespace VOM {
25 namespace bond_group_binding_cmds {
26 /**
27  * A command class that binds the slave interface to the bond interface
28  */
29 class bind_cmd : public rpc_cmd<HW::item<bool>, vapi::Bond_enslave>
30 {
31 public:
32  /**
33  * Constructor
34  */
36  const handle_t& bond_itf,
37  const bond_member& itf);
38 
39  /**
40  * Issue the command to VPP/HW
41  */
42  rc_t issue(connection& con);
43  /**
44  * convert to string format for debug purposes
45  */
46  std::string to_string() const;
47 
48  /**
49  * Comparison operator - only used for UT
50  */
51  bool operator==(const bind_cmd& i) const;
52 
53 private:
54  /**
55  * sw_if_index of bond interface
56  */
57  const handle_t m_bond_itf;
58 
59  /**
60  * member interface of bond group
61  */
62  const bond_member m_itf;
63 };
64 
65 /**
66  * A cmd class that detach slave from a bond interface
67  */
68 class unbind_cmd : public rpc_cmd<HW::item<bool>, vapi::Bond_detach_slave>
69 {
70 public:
71  /**
72  * Constructor
73  */
74  unbind_cmd(HW::item<bool>& item, const handle_t& itf);
75 
76  /**
77  * Issue the command to VPP/HW
78  */
79  rc_t issue(connection& con);
80  /**
81  * convert to string format for debug purposes
82  */
83  std::string to_string() const;
84 
85  /**
86  * Comparison operator - only used for UT
87  */
88  bool operator==(const unbind_cmd& i) const;
89 
90 private:
91  /**
92  * slave interface of bond group
93  */
94  const handle_t m_itf;
95 };
96 
97 /**
98  * A cmd class that Dumps slave itfs
99  */
100 class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_slave_dump>
101 {
102 public:
103  /**
104  * Default Constructor
105  */
106  dump_cmd(const handle_t& itf);
107  dump_cmd(const dump_cmd& d);
108  /**
109  * Issue the command to VPP/HW
110  */
111  rc_t issue(connection& con);
112  /**
113  * convert to string format for debug purposes
114  */
115  std::string to_string() const;
116  /**
117  * Comparison operator - only used for UT
118  */
119  bool operator==(const dump_cmd& i) const;
120 
121 private:
122  /**
123  * The interface to get the addresses for
124  */
125  const handle_t m_itf;
126 };
127 };
128 };
129 
130 /*
131  * fd.io coding-style-patch-verification: OFF
132  *
133  * Local Variables:
134  * eval: (c-set-style "mozilla")
135  * End:
136  */
137 
138 #endif
rc_t issue(connection &con)
Issue the command to VPP/HW.
const char *const string
Definition: cJSON.h:172
A cmd class that detach slave from a bond interface.
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A cmd class that Dumps slave itfs.
A bond-member.
Definition: bond_member.hpp:26
bind_cmd(HW::item< bool > &item, const handle_t &bond_itf, const bond_member &itf)
Constructor.
std::string to_string() const
convert to string format for debug purposes
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
A command class that binds the slave interface to the bond interface.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.