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/gbp_route_domain_cmds.hpp"
19 namespace gbp_route_domain_cmds {
21 create_cmd::create_cmd(HW::item<uint32_t>& item,
22 const handle_t ip4_uu_fwd,
23 const handle_t ip6_uu_fwd)
25 , m_ip4_uu_fwd(ip4_uu_fwd)
26 , m_ip6_uu_fwd(ip6_uu_fwd)
31 create_cmd::operator==(const create_cmd& other) const
33 return ((m_hw_item.data() == other.m_hw_item.data()) &&
34 (m_ip4_uu_fwd == other.m_ip4_uu_fwd) &&
35 (m_ip6_uu_fwd == other.m_ip6_uu_fwd));
39 create_cmd::issue(connection& con)
41 msg_t req(con.ctx(), std::ref(*this));
43 auto& payload = req.get_request().get_payload();
45 payload.rd.rd_id = m_hw_item.data();
46 payload.rd.ip4_uu_sw_if_index = m_ip4_uu_fwd.value();
47 payload.rd.ip6_uu_sw_if_index = m_ip6_uu_fwd.value();
49 VAPI_CALL(req.execute());
55 create_cmd::to_string() const
58 s << "gbp-route-domain: " << m_hw_item.to_string()
59 << " ip4-uu-fwd:" << m_ip4_uu_fwd.to_string()
60 << " ip6-uu-fwd:" << m_ip6_uu_fwd.to_string();
65 delete_cmd::delete_cmd(HW::item<uint32_t>& item)
71 delete_cmd::operator==(const delete_cmd& other) const
73 return (m_hw_item.data() == other.m_hw_item.data());
77 delete_cmd::issue(connection& con)
79 msg_t req(con.ctx(), std::ref(*this));
81 auto& payload = req.get_request().get_payload();
83 payload.rd_id = m_hw_item.data();
85 VAPI_CALL(req.execute());
88 m_hw_item.set(rc_t::NOOP);
94 delete_cmd::to_string() const
97 s << "gbp-route-domain: " << m_hw_item.to_string();
103 dump_cmd::operator==(const dump_cmd& other) const
109 dump_cmd::issue(connection& con)
111 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
113 VAPI_CALL(m_dump->execute());
121 dump_cmd::to_string() const
123 return ("gbp-route-domain-dump");
126 }; // namespace gbp_route_domain_cmds
130 * fd.io coding-style-patch-verification: ON
133 * eval: (c-set-style "mozilla")