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_arp_entry_cmds.hpp"
19 namespace bridge_domain_arp_entry_cmds {
21 create_cmd::create_cmd(HW::item<bool>& item,
23 const mac_address_t& mac,
24 const boost::asio::ip::address& ip_addr)
33 create_cmd::operator==(const create_cmd& other) const
35 return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
36 (m_bd == other.m_bd));
40 create_cmd::issue(connection& con)
42 msg_t req(con.ctx(), std::ref(*this));
44 auto& payload = req.get_request().get_payload();
47 m_mac.to_bytes(payload.mac_address, 6);
48 to_bytes(m_ip_addr, &payload.is_ipv6, payload.ip_address);
50 VAPI_CALL(req.execute());
56 create_cmd::to_string() const
59 s << "bridge-domain-arp-entry-create: " << m_hw_item.to_string()
60 << " bd:" << m_bd << " mac:" << m_mac.to_string()
61 << " ip:" << m_ip_addr.to_string();
66 delete_cmd::delete_cmd(HW::item<bool>& item,
68 const mac_address_t& mac,
69 const boost::asio::ip::address& ip_addr)
78 delete_cmd::operator==(const delete_cmd& other) const
80 return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
81 (m_bd == other.m_bd));
85 delete_cmd::issue(connection& con)
87 msg_t req(con.ctx(), std::ref(*this));
89 auto& payload = req.get_request().get_payload();
92 m_mac.to_bytes(payload.mac_address, 6);
93 to_bytes(m_ip_addr, &payload.is_ipv6, payload.ip_address);
95 VAPI_CALL(req.execute());
98 m_hw_item.set(rc_t::NOOP);
104 delete_cmd::to_string() const
106 std::ostringstream s;
107 s << "bridge-domain-arp-entry-delete: " << m_hw_item.to_string()
108 << " bd:" << m_bd << " mac:" << m_mac.to_string()
109 << " ip:" << m_ip_addr.to_string();
114 dump_cmd::dump_cmd(uint32_t bd_id)
119 dump_cmd::dump_cmd(const dump_cmd& d)
125 dump_cmd::operator==(const dump_cmd& other) const
131 dump_cmd::issue(connection& con)
133 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
135 auto& payload = m_dump->get_request().get_payload();
136 payload.bd_id = m_bd;
138 VAPI_CALL(m_dump->execute());
146 dump_cmd::to_string() const
148 return ("bridge-domain-arp-entry-dump");
151 }; // namespace bridge_domain_arp_entry
155 * fd.io coding-style-patch-verification: ON
158 * eval: (c-set-style "mozilla")