FD.io VPP  v21.06-3-gbb25fbf28
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,
39  const bond_interface::lb_t& lb,
40  const l2_address_t& l2_address);
41 
42  /**
43  * Issue the command to VPP/HW
44  */
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  */
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  */
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: OFF
106  *
107  * Local Variables:
108  * eval: (c-set-style "mozilla")
109  * End:
110  */
111 #endif
VOM::HW::item< handle_t >
VOM::bond_interface_cmds::delete_cmd::delete_cmd
delete_cmd(HW::item< handle_t > &item)
Definition: bond_interface_cmds.cpp:72
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
name
string name[64]
Definition: fib.api:25
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
VOM::bond_interface_cmds::delete_cmd
A functor class that deletes a Tap interface.
Definition: bond_interface_cmds.hpp:60
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::interface::delete_cmd
Base class for intterface Delete commands.
Definition: interface.hpp:376
VOM::bond_interface_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: bond_interface_cmds.cpp:114
VOM::bond_interface::lb_t
A bond interface load balance.
Definition: bond_interface.hpp:73
bond_interface.hpp
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::bond_interface_cmds::create_cmd
A functor class that creates an interface.
Definition: bond_interface_cmds.hpp:33
VOM::bond_interface_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: bond_interface_cmds.cpp:126
VOM::bond_interface_cmds::create_cmd::create_cmd
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)
Definition: bond_interface_cmds.cpp:22
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
VOM::bond_interface_cmds::delete_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: bond_interface_cmds.cpp:95
VOM::bond_interface_cmds::delete_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: bond_interface_cmds.cpp:78
VOM::bond_interface_cmds::dump_cmd
A cmd class that Dumps all the Vpp Interfaces.
Definition: bond_interface_cmds.hpp:78
VOM::interface::create_cmd
A base class for interface Create commands.
Definition: interface.hpp:309
dump_cmd.hpp
VOM::bond_interface_cmds::create_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: bond_interface_cmds.cpp:64
VOM::bond_interface_cmds::create_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: bond_interface_cmds.cpp:35
VOM::l2_address_t
Type def of a L2 address as read from VPP.
Definition: types.hpp:339
VOM::rpc_cmd< HW::item< handle_t >, vapi::Bond_create >::item
HW::item< handle_t > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::bond_interface_cmds::dump_cmd::dump_cmd
dump_cmd()
Default Constructor.
Definition: bond_interface_cmds.cpp:103
VOM::bond_interface::mode_t
A bond interface mode.
Definition: bond_interface.hpp:31
interface.hpp
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::bond_interface_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: bond_interface_cmds.cpp:108
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172