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"
17 #include "vom/api_types.hpp"
20 namespace bridge_domain_arp_entry_cmds {
22 create_cmd::create_cmd(HW::item<bool>& item,
24 const mac_address_t& mac,
25 const boost::asio::ip::address& ip_addr)
34 create_cmd::operator==(const create_cmd& other) const
36 return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
37 (m_bd == other.m_bd));
41 create_cmd::issue(connection& con)
43 msg_t req(con.ctx(), std::ref(*this));
45 auto& payload = req.get_request().get_payload();
46 payload.entry.bd_id = m_bd;
48 to_api(m_mac, payload.entry.mac);
49 to_api(m_ip_addr, payload.entry.ip);
51 VAPI_CALL(req.execute());
57 create_cmd::to_string() const
60 s << "bridge-domain-arp-entry-create: " << m_hw_item.to_string()
61 << " bd:" << m_bd << " mac:" << m_mac.to_string()
62 << " ip:" << m_ip_addr.to_string();
67 delete_cmd::delete_cmd(HW::item<bool>& item,
69 const mac_address_t& mac,
70 const boost::asio::ip::address& ip_addr)
79 delete_cmd::operator==(const delete_cmd& other) const
81 return ((m_mac == other.m_mac) && (m_ip_addr == other.m_ip_addr) &&
82 (m_bd == other.m_bd));
86 delete_cmd::issue(connection& con)
88 msg_t req(con.ctx(), std::ref(*this));
90 auto& payload = req.get_request().get_payload();
91 payload.entry.bd_id = m_bd;
93 to_api(m_mac, payload.entry.mac);
94 to_api(m_ip_addr, payload.entry.ip);
96 VAPI_CALL(req.execute());
99 m_hw_item.set(rc_t::NOOP);
105 delete_cmd::to_string() const
107 std::ostringstream s;
108 s << "bridge-domain-arp-entry-delete: " << m_hw_item.to_string()
109 << " bd:" << m_bd << " mac:" << m_mac.to_string()
110 << " ip:" << m_ip_addr.to_string();
115 dump_cmd::dump_cmd(uint32_t bd_id)
120 dump_cmd::dump_cmd(const dump_cmd& d)
126 dump_cmd::operator==(const dump_cmd& other) const
132 dump_cmd::issue(connection& con)
134 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
136 auto& payload = m_dump->get_request().get_payload();
137 payload.bd_id = m_bd;
139 VAPI_CALL(m_dump->execute());
147 dump_cmd::to_string() const
149 return ("bridge-domain-arp-entry-dump");
152 }; // namespace bridge_domain_arp_entry
156 * fd.io coding-style-patch-verification: ON
159 * eval: (c-set-style "mozilla")