FD.io VPP  v19.08.3-2-gbabecb413
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  */
46  rc_t issue(connection& con);
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  */
92  rc_t issue(connection& con);
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: ON
125  *
126  * Local Variables:
127  * eval: (c-set-style "mozilla")
128  * End:
129  */
130 
131 #endif
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A functor class that binds L2 configuration to an interface.
A representation of the connection to VPP.
Definition: connection.hpp:33
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
std::string to_string() const
convert to string format for debug purposes
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
A cmd class that Unbinds L2 configuration from an interface.
bind_cmd(HW::item< bool > &item, const handle_t &itf, uint32_t bd, const l2_binding::l2_port_type_t &port_type)
Constructor.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
rc_t issue(connection &con)
Issue the command to VPP/HW.
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.