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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __VOM_L2_BINDING_CMDS_H__
17 #define __VOM_L2_BINDING_CMDS_H__
19 #include "vom/l2_binding.hpp"
20 #include "vom/rpc_cmd.hpp"
22 #include <vapi/l2.api.vapi.hpp>
23 #include <vapi/vpe.api.vapi.hpp>
26 namespace l2_binding_cmds {
29 * A functor class that binds L2 configuration to an interface
32 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
38 bind_cmd(HW::item<bool>& item, const handle_t& itf, uint32_t bd, bool is_bvi);
41 * Issue the command to VPP/HW
43 rc_t issue(connection& con);
45 * convert to string format for debug purposes
47 std::string to_string() const;
50 * Comparison operator - only used for UT
52 bool operator==(const bind_cmd& i) const;
56 * The interface to bind
61 * The bridge-domain to bind to
66 * Is it a BVI interface that is being bound
72 * A cmd class that Unbinds L2 configuration from an interface
75 : public rpc_cmd<HW::item<bool>, rc_t, vapi::Sw_interface_set_l2_bridge>
81 unbind_cmd(HW::item<bool>& item,
87 * Issue the command to VPP/HW
89 rc_t issue(connection& con);
91 * convert to string format for debug purposes
93 std::string to_string() const;
96 * Comparison operator - only used for UT
98 bool operator==(const unbind_cmd& i) const;
102 * The interface to bind
104 const handle_t m_itf;
107 * The bridge-domain to bind to
112 * Is it a BVI interface that is being bound
118 * A cmd class sets the VTR operation
120 class set_vtr_op_cmd : public rpc_cmd<HW::item<l2_binding::l2_vtr_op_t>,
122 vapi::L2_interface_vlan_tag_rewrite>
128 set_vtr_op_cmd(HW::item<l2_binding::l2_vtr_op_t>& item,
133 * Issue the command to VPP/HW
135 rc_t issue(connection& con);
138 * convert to string format for debug purposes
140 std::string to_string() const;
143 * Comparison operator - only used for UT
145 bool operator==(const set_vtr_op_cmd& i) const;
149 * The interface to bind
151 const handle_t m_itf;
154 * The tag for the operation
159 }; // namespace l2_binding_cmds
163 * fd.io coding-style-patch-verification: ON
166 * eval: (c-set-style "mozilla")