FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
lldp_binding_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_LLDP_BINDING_CMDS_H__
17 #define __VOM_LLDP_BINDING_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/lldp_binding.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/lldp.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace lldp_binding_cmds {
27 
28 /**
29 *A command class that binds the LLDP config to the interface
30 */
31 class bind_cmd : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_lldp>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  const handle_t& itf,
39  const std::string& port_desc);
40 
41  /**
42  * Issue the command to VPP/HW
43  */
45  /**
46  * convert to string format for debug purposes
47  */
48  std::string to_string() const;
49 
50  /**
51  * Comparison operator - only used for UT
52  */
53  bool operator==(const bind_cmd& i) const;
54 
55 private:
56  /**
57  * Reference to the HW::item of the interface to bind
58  */
59  const handle_t& m_itf;
60 
61  /**
62  * The LLDP client's hostname
63  */
64  const std::string m_port_desc;
65 };
66 
67 /**
68  * A cmd class that Unbinds Lldp Config from an interface
69  */
70 class unbind_cmd : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_lldp>
71 {
72 public:
73  /**
74  * Constructor
75  */
76  unbind_cmd(HW::item<bool>& item, const handle_t& itf);
77 
78  /**
79  * Issue the command to VPP/HW
80  */
82  /**
83  * convert to string format for debug purposes
84  */
85  std::string to_string() const;
86 
87  /**
88  * Comparison operator - only used for UT
89  */
90  bool operator==(const unbind_cmd& i) const;
91 
92 private:
93  /**
94  * Reference to the HW::item of the interface to unbind
95  */
96  const handle_t& m_itf;
97 };
98 
99 }; // namespace lldp_binding_cmds
100 }; // naemspace VOM
101 
102 /*
103  * fd.io coding-style-patch-verification: OFF
104  *
105  * Local Variables:
106  * eval: (c-set-style "mozilla")
107  * End:
108  */
109 
110 #endif
VOM::lldp_binding_cmds::unbind_cmd::unbind_cmd
unbind_cmd(HW::item< bool > &item, const handle_t &itf)
Constructor.
Definition: lldp_binding_cmds.cpp:64
VOM::HW::item< bool >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::lldp_binding_cmds::unbind_cmd
A cmd class that Unbinds Lldp Config from an interface.
Definition: lldp_binding_cmds.hpp:70
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::lldp_binding_cmds::unbind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: lldp_binding_cmds.cpp:76
con
Connection con
Definition: vapi_cpp_test.cpp:56
lldp_binding.hpp
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::lldp_binding_cmds::bind_cmd::bind_cmd
bind_cmd(HW::item< bool > &item, const handle_t &itf, const std::string &port_desc)
Constructor.
Definition: lldp_binding_cmds.cpp:23
VOM::lldp_binding_cmds::bind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: lldp_binding_cmds.cpp:55
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::lldp_binding_cmds::unbind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: lldp_binding_cmds.cpp:93
dump_cmd.hpp
VOM::lldp_binding_cmds::bind_cmd
A command class that binds the LLDP config to the interface.
Definition: lldp_binding_cmds.hpp:31
VOM::rpc_cmd< HW::item< bool >, vapi::Sw_interface_set_lldp >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::lldp_binding_cmds::bind_cmd::operator==
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
Definition: lldp_binding_cmds.cpp:32
VOM::lldp_binding_cmds::unbind_cmd::operator==
bool operator==(const unbind_cmd &i) const
Comparison operator - only used for UT.
Definition: lldp_binding_cmds.cpp:70
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::lldp_binding_cmds::bind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: lldp_binding_cmds.cpp:38
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172