FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
l2_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_L2_BINDING_CMDS_H__
17 #define __VOM_L2_BINDING_CMDS_H__
18 
19 #include "vom/l2_binding.hpp"
20 #include "vom/rpc_cmd.hpp"
21 
22 #include <vapi/l2.api.vapi.hpp>
23 #include <vapi/vpe.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace l2_binding_cmds {
27 
28 /**
29  * A functor class that binds L2 configuration to an interface
30  */
31 class bind_cmd
32  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_l2_bridge>
33 {
34 public:
35  /**
36  * Constructor
37  */
39  const handle_t& itf,
40  uint32_t bd,
41  const l2_binding::l2_port_type_t& port_type);
42 
43  /**
44  * Issue the command to VPP/HW
45  */
47  /**
48  * convert to string format for debug purposes
49  */
50  std::string to_string() const;
51 
52  /**
53  * Comparison operator - only used for UT
54  */
55  bool operator==(const bind_cmd& i) const;
56 
57 private:
58  /**
59  * The interface to bind
60  */
61  const handle_t m_itf;
62 
63  /**
64  * The bridge-domain to bind to
65  */
66  uint32_t m_bd;
67 
68  /**
69  * What is the port type i.e. normal, bvi, uu-fwd that is being bound
70  */
71  const l2_binding::l2_port_type_t& m_port_type;
72 };
73 
74 /**
75  * A cmd class that Unbinds L2 configuration from an interface
76  */
78  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_l2_bridge>
79 {
80 public:
81  /**
82  * Constructor
83  */
85  const handle_t& itf,
86  uint32_t bd,
87  const l2_binding::l2_port_type_t& port_type);
88 
89  /**
90  * Issue the command to VPP/HW
91  */
93  /**
94  * convert to string format for debug purposes
95  */
96  std::string to_string() const;
97 
98  /**
99  * Comparison operator - only used for UT
100  */
101  bool operator==(const unbind_cmd& i) const;
102 
103 private:
104  /**
105  * The interface to bind
106  */
107  const handle_t m_itf;
108 
109  /**
110  * The bridge-domain to bind to
111  */
112  uint32_t m_bd;
113 
114  /**
115  * What is the port type i.e. bvi, normal or uu-fwd that is being bound
116  */
117  const l2_binding::l2_port_type_t& m_port_type;
118 };
119 
120 }; // namespace l2_binding_cmds
121 }; // namespace VOM
122 
123 /*
124  * fd.io coding-style-patch-verification: OFF
125  *
126  * Local Variables:
127  * eval: (c-set-style "mozilla")
128  * End:
129  */
130 
131 #endif
VOM::l2_binding_cmds::unbind_cmd::unbind_cmd
unbind_cmd(HW::item< bool > &item, const handle_t &itf, uint32_t bd, const l2_binding::l2_port_type_t &port_type)
Constructor.
Definition: l2_binding_cmds.cpp:71
VOM::HW::item< bool >
VOM::l2_binding_cmds::unbind_cmd
A cmd class that Unbinds L2 configuration from an interface.
Definition: l2_binding_cmds.hpp:77
VOM::l2_binding_cmds::bind_cmd::operator==
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
Definition: l2_binding_cmds.cpp:32
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::l2_binding_cmds::bind_cmd::bind_cmd
bind_cmd(HW::item< bool > &item, const handle_t &itf, uint32_t bd, const l2_binding::l2_port_type_t &port_type)
Constructor.
Definition: l2_binding_cmds.cpp:20
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::l2_binding_cmds::bind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: l2_binding_cmds.cpp:39
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::l2_binding_cmds::unbind_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: l2_binding_cmds.cpp:90
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::l2_binding_cmds::bind_cmd
A functor class that binds L2 configuration to an interface.
Definition: l2_binding_cmds.hpp:31
VOM::rpc_cmd< HW::item< bool >, vapi::Sw_interface_set_l2_bridge >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
VOM::l2_binding_cmds::unbind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: l2_binding_cmds.cpp:116
VOM::l2_binding_cmds::bind_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: l2_binding_cmds.cpp:62
VOM::l2_binding::l2_port_type_t
Definition: l2_binding.hpp:41
i
int i
Definition: flowhash_template.h:376
l2_binding.hpp
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
rpc_cmd.hpp
VOM::l2_binding_cmds::unbind_cmd::operator==
bool operator==(const unbind_cmd &i) const
Comparison operator - only used for UT.
Definition: l2_binding_cmds.cpp:83
string
const char *const string
Definition: cJSON.h:172