FD.io VPP  v18.01-8-g0eacf49
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>, rc_t, vapi::Sw_interface_set_l2_bridge>
33 {
34 public:
35  /**
36  * Constructor
37  */
38  bind_cmd(HW::item<bool>& item, const handle_t& itf, uint32_t bd, bool is_bvi);
39 
40  /**
41  * Issue the command to VPP/HW
42  */
43  rc_t issue(connection& con);
44  /**
45  * convert to string format for debug purposes
46  */
47  std::string to_string() const;
48 
49  /**
50  * Comparison operator - only used for UT
51  */
52  bool operator==(const bind_cmd& i) const;
53 
54 private:
55  /**
56  * The interface to bind
57  */
58  const handle_t m_itf;
59 
60  /**
61  * The bridge-domain to bind to
62  */
63  uint32_t m_bd;
64 
65  /**
66  * Is it a BVI interface that is being bound
67  */
68  bool m_is_bvi;
69 };
70 
71 /**
72  * A cmd class that Unbinds L2 configuration from an interface
73  */
75  : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
76 {
77 public:
78  /**
79  * Constructor
80  */
82  const handle_t& itf,
83  uint32_t bd,
84  bool is_bvi);
85 
86  /**
87  * Issue the command to VPP/HW
88  */
89  rc_t issue(connection& con);
90  /**
91  * convert to string format for debug purposes
92  */
93  std::string to_string() const;
94 
95  /**
96  * Comparison operator - only used for UT
97  */
98  bool operator==(const unbind_cmd& i) const;
99 
100 private:
101  /**
102  * The interface to bind
103  */
104  const handle_t m_itf;
105 
106  /**
107  * The bridge-domain to bind to
108  */
109  uint32_t m_bd;
110 
111  /**
112  * Is it a BVI interface that is being bound
113  */
114  bool m_is_bvi;
115 };
116 
117 /**
118  * A cmd class sets the VTR operation
119  */
120 class set_vtr_op_cmd : public rpc_cmd<HW::item<l2_binding::l2_vtr_op_t>,
121  rc_t,
122  vapi::L2_interface_vlan_tag_rewrite>
123 {
124 public:
125  /**
126  * Constructor
127  */
129  const handle_t& itf,
130  uint16_t tag);
131 
132  /**
133  * Issue the command to VPP/HW
134  */
135  rc_t issue(connection& con);
136 
137  /**
138  * convert to string format for debug purposes
139  */
140  std::string to_string() const;
141 
142  /**
143  * Comparison operator - only used for UT
144  */
145  bool operator==(const set_vtr_op_cmd& i) const;
146 
147 private:
148  /**
149  * The interface to bind
150  */
151  const handle_t m_itf;
152 
153  /**
154  * The tag for the operation
155  */
156  uint16_t m_tag;
157 };
158 
159 }; // namespace l2_binding_cmds
160 }; // namespace VOM
161 
162 /*
163  * fd.io coding-style-patch-verification: ON
164  *
165  * Local Variables:
166  * eval: (c-set-style "mozilla")
167  * End:
168  */
169 
170 #endif
std::string to_string() const
convert to string format for debug purposes
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
Error codes that VPP will return during a HW write.
Definition: types.hpp:84
A functor class that binds L2 configuration to an interface.
A representation of the connection to VPP.
Definition: connection.hpp:33
bind_cmd(HW::item< bool > &item, const handle_t &itf, uint32_t bd, bool is_bvi)
Constructor.
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
A type declaration of an interface handle in VPP.
Definition: types.hpp:164
A cmd class that Unbinds L2 configuration from an interface.
bool operator==(const bind_cmd &i) const
Comparison operator - only used for UT.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
A cmd class sets the VTR operation.
rc_t issue(connection &con)
Issue the command to VPP/HW.