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 #include "vom/l2_binding_cmds.hpp"
19 namespace l2_binding_cmds {
20 bind_cmd::bind_cmd(HW::item<bool>& item,
32 bind_cmd::operator==(const bind_cmd& other) const
34 return ((m_itf == other.m_itf) && (m_bd == other.m_bd) &&
35 (m_is_bvi == other.m_is_bvi));
39 bind_cmd::issue(connection& con)
41 msg_t req(con.ctx(), std::ref(*this));
43 auto& payload = req.get_request().get_payload();
44 payload.rx_sw_if_index = m_itf.value();
47 payload.bvi = m_is_bvi;
50 VAPI_CALL(req.execute());
56 bind_cmd::to_string() const
59 s << "L2-bind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
65 unbind_cmd::unbind_cmd(HW::item<bool>& item,
77 unbind_cmd::operator==(const unbind_cmd& other) const
79 return ((m_itf == other.m_itf) && (m_bd == other.m_bd) &&
80 (m_is_bvi == other.m_is_bvi));
84 unbind_cmd::issue(connection& con)
86 msg_t req(con.ctx(), std::ref(*this));
88 auto& payload = req.get_request().get_payload();
89 payload.rx_sw_if_index = m_itf.value();
92 payload.bvi = m_is_bvi;
95 VAPI_CALL(req.execute());
98 m_hw_item.set(rc_t::NOOP);
104 unbind_cmd::to_string() const
106 std::ostringstream s;
107 s << "L2-unbind: " << m_hw_item.to_string() << " itf:" << m_itf.to_string()
113 set_vtr_op_cmd::set_vtr_op_cmd(HW::item<l2_binding::l2_vtr_op_t>& item,
123 set_vtr_op_cmd::operator==(const set_vtr_op_cmd& other) const
126 (m_hw_item.data() == other.m_hw_item.data() && m_itf == other.m_itf) &&
127 (m_tag == other.m_tag));
131 set_vtr_op_cmd::issue(connection& con)
133 msg_t req(con.ctx(), std::ref(*this));
135 auto& payload = req.get_request().get_payload();
136 payload.sw_if_index = m_itf.value();
137 payload.vtr_op = m_hw_item.data().value();
138 payload.push_dot1q = 1;
139 payload.tag1 = m_tag;
141 VAPI_CALL(req.execute());
147 set_vtr_op_cmd::to_string() const
149 std::ostringstream s;
150 s << "L2-set-vtr-op: " << m_hw_item.to_string()
151 << " itf:" << m_itf.to_string() << " tag:" << m_tag;
156 }; // namespace l2_binding_cmds
160 * fd.io coding-style-patch-verification: ON
163 * eval: (c-set-style "mozilla")