FD.io VPP  v21.10.1-2-g0a485f517
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  */
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  */
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  */
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
VOM::HW::item< bool >
VOM::bond_group_binding_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: bond_group_binding_cmds.cpp:131
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::bond_group_binding_cmds::unbind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: bond_group_binding_cmds.cpp:75
bond_group_binding.hpp
VOM::bond_group_binding_cmds::unbind_cmd
A cmd class that detach slave from a bond interface.
Definition: bond_group_binding_cmds.hpp:68
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::bond_group_binding_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: bond_group_binding_cmds.cpp:111
VOM::bond_group_binding_cmds::dump_cmd
A cmd class that Dumps slave itfs.
Definition: bond_group_binding_cmds.hpp:100
VOM::bond_group_binding_cmds::unbind_cmd::operator==
bool operator==(const unbind_cmd &i) const
Comparison operator - only used for UT.
Definition: bond_group_binding_cmds.cpp:69
VOM::bond_group_binding_cmds::bind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: bond_group_binding_cmds.cpp:52
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::bond_group_binding_cmds::unbind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: bond_group_binding_cmds.cpp:91
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::bond_group_binding_cmds::bind_cmd::operator==
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
Definition: bond_group_binding_cmds.cpp:31
VOM::bond_group_binding_cmds::unbind_cmd::unbind_cmd
unbind_cmd(HW::item< bool > &item, const handle_t &itf)
Constructor.
Definition: bond_group_binding_cmds.cpp:62
dump_cmd.hpp
VOM::rpc_cmd< HW::item< bool >, vapi::Bond_enslave >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::bond_member
A bond-member.
Definition: bond_member.hpp:26
VOM::bond_group_binding_cmds::bind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: bond_group_binding_cmds.cpp:37
VOM::dump_cmd< vapi::Sw_interface_slave_dump >::dump_cmd
dump_cmd()
Default Constructor.
Definition: dump_cmd.hpp:55
VOM::bond_group_binding_cmds::bind_cmd::bind_cmd
bind_cmd(HW::item< bool > &item, const handle_t &bond_itf, const bond_member &itf)
Constructor.
Definition: bond_group_binding_cmds.cpp:21
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
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
VOM::bond_group_binding_cmds::bind_cmd
A command class that binds the slave interface to the bond interface.
Definition: bond_group_binding_cmds.hpp:29
VOM::bond_group_binding_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: bond_group_binding_cmds.cpp:117
string
const char *const string
Definition: cJSON.h:172