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/bridge_domain_entry_cmds.hpp"
19 namespace bridge_domain_entry_cmds {
20 create_cmd::create_cmd(HW::item<bool>& item,
21 const mac_address_t& mac,
34 create_cmd::operator==(const create_cmd& other) const
36 return ((m_mac == other.m_mac) && (m_tx_itf == other.m_tx_itf) &&
37 (m_bd == other.m_bd) && (m_is_bvi == other.m_is_bvi));
41 create_cmd::issue(connection& con)
43 msg_t req(con.ctx(), std::ref(*this));
45 auto& payload = req.get_request().get_payload();
48 m_mac.to_bytes(payload.mac, 6);
49 payload.sw_if_index = m_tx_itf.value();
50 payload.bvi_mac = m_is_bvi;
52 VAPI_CALL(req.execute());
54 m_hw_item.set(wait());
60 create_cmd::to_string() const
63 s << "bridge-domain-entry-create: " << m_hw_item.to_string() << " bd:" << m_bd
64 << " mac:" << m_mac.to_string() << " tx:" << m_tx_itf
65 << " bvi:" << m_is_bvi;
70 delete_cmd::delete_cmd(HW::item<bool>& item,
71 const mac_address_t& mac,
82 delete_cmd::operator==(const delete_cmd& other) const
84 return ((m_mac == other.m_mac) && (m_bd == other.m_bd) &&
85 (m_is_bvi == other.m_is_bvi));
89 delete_cmd::issue(connection& con)
91 msg_t req(con.ctx(), std::ref(*this));
93 auto& payload = req.get_request().get_payload();
96 m_mac.to_bytes(payload.mac, 6);
97 payload.sw_if_index = ~0;
98 payload.bvi_mac = m_is_bvi;
100 VAPI_CALL(req.execute());
103 m_hw_item.set(rc_t::NOOP);
109 delete_cmd::to_string() const
111 std::ostringstream s;
112 s << "bridge-domain-entry-delete: " << m_hw_item.to_string() << " bd:" << m_bd
113 << " mac:" << m_mac.to_string() << " bvi:" << m_is_bvi;
123 dump_cmd::operator==(const dump_cmd& other) const
129 dump_cmd::issue(connection& con)
131 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
133 auto& payload = m_dump->get_request().get_payload();
136 VAPI_CALL(m_dump->execute());
144 dump_cmd::to_string() const
146 return ("bridge-domain-entry-dump");
152 * fd.io coding-style-patch-verification: ON
155 * eval: (c-set-style "mozilla")