FD.io VPP  v19.01.3-6-g70449b9b9
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  */
44  rc_t issue(connection& con);
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  */
81  rc_t issue(connection& con);
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: ON
104  *
105  * Local Variables:
106  * eval: (c-set-style "mozilla")
107  * End:
108  */
109 
110 #endif
std::string to_string() const
convert to string format for debug purposes
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A representation of the connection to VPP.
Definition: connection.hpp:33
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
bind_cmd(HW::item< bool > &item, const handle_t &itf, const std::string &port_desc)
Constructor.
A cmd class that Unbinds Lldp Config from an interface.
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
A command class that binds the LLDP config to the interface.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
rc_t issue(connection &con)
Issue the command to VPP/HW.
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66