FD.io VPP  v18.04-17-g3a0d853
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
32  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_lldp>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  const handle_t& itf,
40  const std::string& port_desc);
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  /**
52  * Comparison operator - only used for UT
53  */
54  bool operator==(const bind_cmd& i) const;
55 
56 private:
57  /**
58  * Reference to the HW::item of the interface to bind
59  */
60  const handle_t& m_itf;
61 
62  /**
63  * The LLDP client's hostname
64  */
65  const std::string m_port_desc;
66 };
67 
68 /**
69  * A cmd class that Unbinds Lldp Config from an interface
70  */
72  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_lldp>
73 {
74 public:
75  /**
76  * Constructor
77  */
78  unbind_cmd(HW::item<bool>& item, const handle_t& itf);
79 
80  /**
81  * Issue the command to VPP/HW
82  */
83  rc_t issue(connection& con);
84  /**
85  * convert to string format for debug purposes
86  */
87  std::string to_string() const;
88 
89  /**
90  * Comparison operator - only used for UT
91  */
92  bool operator==(const unbind_cmd& i) const;
93 
94 private:
95  /**
96  * Reference to the HW::item of the interface to unbind
97  */
98  const handle_t& m_itf;
99 };
100 
101 }; // namespace lldp_binding_cmds
102 }; // naemspace 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 
112 #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:90
A representation of the connection to VPP.
Definition: connection.hpp:33
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:64
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:38
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:236
A command class that binds the LLDP config to the interface.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
rc_t issue(connection &con)
Issue the command to VPP/HW.