FD.io VPP  v18.11-rc0-18-g2a3fb1a
Vector Packet Processing
bond_interface_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_INTERFACE_CMDS_H__
17 #define __VOM_BOND_INTERFACE_CMDS_H__
18 
19 #include "vom/bond_interface.hpp"
20 #include "vom/dump_cmd.hpp"
21 #include "vom/interface.hpp"
22 #include "vom/rpc_cmd.hpp"
23 
24 #include <vapi/bond.api.vapi.hpp>
25 #include <vapi/interface.api.vapi.hpp>
26 
27 namespace VOM {
28 namespace bond_interface_cmds {
29 
30 /**
31  * A functor class that creates an interface
32  */
33 class create_cmd : public interface::create_cmd<vapi::Bond_create>
34 {
35 public:
37  const std::string& name,
38  const bond_interface::mode_t& mode,
39  const bond_interface::lb_t& lb,
40  const l2_address_t& l2_address);
41 
42  /**
43  * Issue the command to VPP/HW
44  */
45  rc_t issue(connection& con);
46  /**
47  * convert to string format for debug purposes
48  */
49  std::string to_string() const;
50 
51 private:
52  const bond_interface::mode_t m_mode;
53  const bond_interface::lb_t m_lb;
54  const l2_address_t m_l2_address;
55 };
56 
57 /**
58  * A functor class that deletes a Tap interface
59  */
60 class delete_cmd : public interface::delete_cmd<vapi::Bond_delete>
61 {
62 public:
64 
65  /**
66  * Issue the command to VPP/HW
67  */
68  rc_t issue(connection& con);
69  /**
70  * convert to string format for debug purposes
71  */
72  std::string to_string() const;
73 };
74 
75 /**
76  * A cmd class that Dumps all the Vpp Interfaces
77  */
78 class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_bond_dump>
79 {
80 public:
81  /**
82  * Default Constructor
83  */
84  dump_cmd();
85 
86  /**
87  * Issue the command to VPP/HW
88  */
89  rc_t issue(connection& con);
90  /**
91  * convert to string format for debug purposes
92  */
93  std::string to_string() const;
94 
95  /**
96  * Comparison operator - only used for UT
97  */
98  bool operator==(const dump_cmd& i) const;
99 };
100 
101 }; // namespace bond_interface_cmds
102 }; // namespace VOM
103 
104 /*
105  * fd.io coding-style-patch-verification: ON
106  *
107  * Local Variables:
108  * eval: (c-set-style "mozilla")
109  * End:
110  */
111 #endif
A functor class that deletes a Tap interface.
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
std::string to_string() const
convert to string format for debug purposes
rc_t issue(connection &con)
Issue the command to VPP/HW.
A bond interface load balance.
Type def of a L2 address as read from VPP.
Definition: types.hpp:334
A representation of the connection to VPP.
Definition: connection.hpp:33
A cmd class that Dumps all the Vpp Interfaces.
A functor class that creates an interface.
virtual bool operator==(const create_cmd &o) const
Comparison operator - only used for UT.
Definition: interface.hpp:301
create_cmd(HW::item< handle_t > &item, const std::string &name, const bond_interface::mode_t &mode, const bond_interface::lb_t &lb, const l2_address_t &l2_address)
Base class for intterface Delete commands.
Definition: interface.hpp:350
A bond interface mode.
A base class for interface Create commands.
Definition: interface.hpp:284
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64