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.hpp"
19 bridge_domain_entry::create_cmd::create_cmd(HW::item<bool>& item,
20 const mac_address_t& mac,
31 bridge_domain_entry::create_cmd::operator==(const create_cmd& other) const
33 return ((m_mac == other.m_mac) && (m_tx_itf == other.m_tx_itf) &&
34 (m_bd == other.m_bd));
38 bridge_domain_entry::create_cmd::issue(connection& con)
40 msg_t req(con.ctx(), std::ref(*this));
42 auto& payload = req.get_request().get_payload();
45 payload.mac = m_mac.to_u64();
46 payload.sw_if_index = m_tx_itf.value();
48 VAPI_CALL(req.execute());
50 m_hw_item.set(wait());
56 bridge_domain_entry::create_cmd::to_string() const
59 s << "bridge-domain-entry-create: " << m_hw_item.to_string() << " bd:" << m_bd
60 << " mac:" << m_mac.to_string() << " tx:" << m_tx_itf;
65 bridge_domain_entry::delete_cmd::delete_cmd(HW::item<bool>& item,
66 const mac_address_t& mac,
75 bridge_domain_entry::delete_cmd::operator==(const delete_cmd& other) const
77 return ((m_mac == other.m_mac) && (m_bd == other.m_bd));
81 bridge_domain_entry::delete_cmd::issue(connection& con)
83 msg_t req(con.ctx(), std::ref(*this));
85 auto& payload = req.get_request().get_payload();
88 payload.mac = m_mac.to_u64();
89 payload.sw_if_index = ~0;
91 VAPI_CALL(req.execute());
94 m_hw_item.set(rc_t::NOOP);
100 bridge_domain_entry::delete_cmd::to_string() const
102 std::ostringstream s;
103 s << "bridge-domain-entry-delete: " << m_hw_item.to_string() << " bd:" << m_bd
104 << " mac:" << m_mac.to_string();
109 bridge_domain_entry::dump_cmd::dump_cmd()
114 bridge_domain_entry::dump_cmd::operator==(const dump_cmd& other) const
120 bridge_domain_entry::dump_cmd::issue(connection& con)
122 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
124 auto& payload = m_dump->get_request().get_payload();
127 VAPI_CALL(m_dump->execute());
135 bridge_domain_entry::dump_cmd::to_string() const
137 return ("bridge-domain-entry-dump");
142 * fd.io coding-style-patch-verification: ON
145 * eval: (c-set-style "mozilla")