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.
18 #include "vom/api_types.hpp"
19 #include "vom/mroute_cmds.hpp"
20 #include "vom/route_api_types.hpp"
24 namespace ip_mroute_cmds {
26 update_cmd::update_cmd(HW::item<bool>& item,
28 const mprefix_t& mprefix,
30 const itf_flags_t& flags)
40 update_cmd::operator==(const update_cmd& other) const
42 return ((m_mprefix == other.m_mprefix) && (m_id == other.m_id));
46 update_cmd::issue(connection& con)
48 msg_t req(con.ctx(), std::ref(*this));
50 auto& payload = req.get_request().get_payload();
52 payload.table_id = m_id;
55 m_mprefix.to_vpp(&payload.is_ipv6, payload.src_address, payload.grp_address,
56 &payload.grp_address_length);
58 to_vpp(m_path, payload);
59 payload.itf_flags = m_flags.value();
61 VAPI_CALL(req.execute());
67 update_cmd::to_string() const
70 s << "ip-mroute-create: " << m_hw_item.to_string() << " table-id:" << m_id
71 << " mprefix:" << m_mprefix.to_string() << " path:" << m_path.to_string()
72 << " flags:" << m_flags;
77 delete_cmd::delete_cmd(HW::item<bool>& item,
79 const mprefix_t& mprefix,
81 const itf_flags_t& flags)
91 delete_cmd::operator==(const delete_cmd& other) const
93 return ((m_mprefix == other.m_mprefix) && (m_id == other.m_id));
97 delete_cmd::issue(connection& con)
99 msg_t req(con.ctx(), std::ref(*this));
101 auto& payload = req.get_request().get_payload();
102 payload.table_id = m_id;
105 m_mprefix.to_vpp(&payload.is_ipv6, payload.grp_address, payload.src_address,
106 &payload.grp_address_length);
108 to_vpp(m_path, payload);
109 payload.itf_flags = m_flags.value();
111 VAPI_CALL(req.execute());
114 m_hw_item.set(rc_t::NOOP);
120 delete_cmd::to_string() const
122 std::ostringstream s;
123 s << "ip-mroute-delete: " << m_hw_item.to_string() << " id:" << m_id
124 << " mprefix:" << m_mprefix.to_string();
129 dump_v4_cmd::dump_v4_cmd()
134 dump_v4_cmd::operator==(const dump_v4_cmd& other) const
140 dump_v4_cmd::issue(connection& con)
142 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
144 VAPI_CALL(m_dump->execute());
152 dump_v4_cmd::to_string() const
154 return ("ip-mroute-v4-dump");
157 dump_v6_cmd::dump_v6_cmd()
162 dump_v6_cmd::operator==(const dump_v6_cmd& other) const
168 dump_v6_cmd::issue(connection& con)
170 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
172 VAPI_CALL(m_dump->execute());
180 dump_v6_cmd::to_string() const
182 return ("ip-mroute-v6-dump");
184 } // namespace ip_mroute_cmds
185 } // namespace mroute
188 * fd.io coding-style-patch-verification: ON
191 * eval: (c-set-style "mozilla")