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/arp_proxy_config_cmds.hpp"
17 #include "vom/api_types.hpp"
19 DEFINE_VAPI_MSG_IDS_ARP_API_JSON;
22 namespace arp_proxy_config_cmds {
24 config_cmd::config_cmd(HW::item<bool>& item,
25 const boost::asio::ip::address_v4& low,
26 const boost::asio::ip::address_v4& high)
33 config_cmd::operator==(const config_cmd& o) const
35 return ((m_low == o.m_low) && (m_high == o.m_high));
39 config_cmd::issue(connection& con)
41 msg_t req(con.ctx(), std::ref(*this));
43 auto& payload = req.get_request().get_payload();
46 to_api(m_low, payload.proxy.low);
47 to_api(m_high, payload.proxy.hi);
49 VAPI_CALL(req.execute());
57 config_cmd::to_string() const
60 s << "ARP-proxy-config: " << m_hw_item.to_string()
61 << " low:" << m_low.to_string() << " high:" << m_high.to_string();
66 unconfig_cmd::unconfig_cmd(HW::item<bool>& item,
67 const boost::asio::ip::address_v4& low,
68 const boost::asio::ip::address_v4& high)
75 unconfig_cmd::operator==(const unconfig_cmd& o) const
77 return ((m_low == o.m_low) && (m_high == o.m_high));
81 unconfig_cmd::issue(connection& con)
83 msg_t req(con.ctx(), std::ref(*this));
85 auto& payload = req.get_request().get_payload();
88 to_api(m_low, payload.proxy.low);
89 to_api(m_high, payload.proxy.hi);
91 VAPI_CALL(req.execute());
94 m_hw_item.set(rc_t::NOOP);
100 unconfig_cmd::to_string() const
102 std::ostringstream s;
103 s << "ARP-proxy-unconfig: " << m_hw_item.to_string()
104 << " low:" << m_low.to_string() << " high:" << m_high.to_string();
110 dump_cmd::operator==(const dump_cmd& other) const
116 dump_cmd::issue(connection& con)
118 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
120 VAPI_CALL(m_dump->execute());
128 dump_cmd::to_string() const
130 return ("ARP-proxy-dump");
137 * fd.io coding-style-patch-verification: ON
140 * eval: (c-set-style "mozilla")