2 * Copyright (c) 2019 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/qos_map_cmds.hpp"
17 #include "vom/qos_types_api.hpp"
24 to_api(const map::outputs_t& o, vapi_type_qos_egress_map_row rows[4])
26 for (uint32_t ii = 0; ii < 4; ii++) {
27 std::copy(o[ii].begin(), o[ii].end(), std::begin(rows[ii].outputs));
31 create_cmd::create_cmd(HW::item<bool>& item,
33 const map::outputs_t& o)
41 create_cmd::operator==(const create_cmd& other) const
43 return (m_id == other.m_id && m_outputs == other.m_outputs);
47 create_cmd::issue(connection& con)
49 msg_t req(con.ctx(), std::ref(*this));
51 auto& payload = req.get_request().get_payload();
53 payload.map.id = m_id;
54 to_api(m_outputs, payload.map.rows);
56 VAPI_CALL(req.execute());
62 create_cmd::to_string() const
65 s << "qos-map-create: " << m_hw_item.to_string() << " map:" << m_id;
70 delete_cmd::delete_cmd(HW::item<bool>& item, uint32_t id)
77 delete_cmd::operator==(const delete_cmd& other) const
79 return (m_hw_item == other.m_hw_item && m_id == other.m_id);
83 delete_cmd::issue(connection& con)
85 msg_t req(con.ctx(), std::ref(*this));
87 auto& payload = req.get_request().get_payload();
88 payload.map.id = m_id;
90 VAPI_CALL(req.execute());
96 delete_cmd::to_string() const
99 s << "qos-map-delete: " << m_hw_item.to_string() << " map:" << m_id;
109 dump_cmd::operator==(const dump_cmd& other) const
115 dump_cmd::issue(connection& con)
117 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
119 VAPI_CALL(m_dump->execute());
127 dump_cmd::to_string() const
129 return ("qos-map-dump");
132 }; // namespace map_cmds
137 * fd.io coding-style-patch-verification: ON
140 * eval: (c-set-style "mozilla")