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>, vapi::Sw_interface_set_l2_bridge>
38 bind_cmd(HW::item<bool>& item,
41 const l2_binding::l2_port_type_t& port_type);
44 * Issue the command to VPP/HW
46 rc_t issue(connection& con);
48 * convert to string format for debug purposes
50 std::string to_string() const;
53 * Comparison operator - only used for UT
55 bool operator==(const bind_cmd& i) const;
59 * The interface to bind
64 * The bridge-domain to bind to
69 * What is the port type i.e. normal, bvi, uu-fwd that is being bound
71 const l2_binding::l2_port_type_t& m_port_type;
75 * A cmd class that Unbinds L2 configuration from an interface
78 : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_l2_bridge>
84 unbind_cmd(HW::item<bool>& item,
87 const l2_binding::l2_port_type_t& port_type);
90 * Issue the command to VPP/HW
92 rc_t issue(connection& con);
94 * convert to string format for debug purposes
96 std::string to_string() const;
99 * Comparison operator - only used for UT
101 bool operator==(const unbind_cmd& i) const;
105 * The interface to bind
107 const handle_t m_itf;
110 * The bridge-domain to bind to
115 * What is the port type i.e. bvi, normal or uu-fwd that is being bound
117 const l2_binding::l2_port_type_t& m_port_type;
120 }; // namespace l2_binding_cmds
124 * fd.io coding-style-patch-verification: ON
127 * eval: (c-set-style "mozilla")