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 #ifndef __VOM_ROUTE_CMDS_H__
17 #define __VOM_ROUTE_CMDS_H__
19 #include "vom/dump_cmd.hpp"
20 #include "vom/route.hpp"
21 #include "vom/srpc_cmd.hpp"
23 #include <vapi/ip.api.vapi.hpp>
27 namespace ip_route_cmds {
30 * A command class that creates or updates the route
32 class update_cmd : public srpc_cmd<vapi::Ip_route_add_del>
38 update_cmd(HW::item<handle_t>& item,
40 const prefix_t& prefix,
41 const path_list_t& pl);
44 * Issue the command to VPP/HW
46 rc_t issue(connection& con);
49 * convert to string format for debug purposes
51 std::string to_string() const;
54 * Comparison operator - only used for UT
56 bool operator==(const update_cmd& i) const;
59 route::table_id_t m_id;
61 const path_list_t& m_pl;
65 * A cmd class that deletes a route
67 class delete_cmd : public rpc_cmd<HW::item<handle_t>, vapi::Ip_route_add_del>
73 delete_cmd(HW::item<handle_t>& item, table_id_t id, const prefix_t& prefix);
76 * Issue the command to VPP/HW
78 rc_t issue(connection& con);
81 * convert to string format for debug purposes
83 std::string to_string() const;
86 * Comparison operator - only used for UT
88 bool operator==(const delete_cmd& i) const;
91 route::table_id_t m_id;
96 * A cmd class that Dumps ip fib routes
98 class dump_cmd : public VOM::dump_cmd<vapi::Ip_route_dump>
104 dump_cmd(route::table_id_t id, const l3_proto_t& proto);
105 dump_cmd(const dump_cmd& d);
108 * Issue the command to VPP/HW
110 rc_t issue(connection& con);
112 * convert to string format for debug purposes
114 std::string to_string() const;
117 * Comparison operator - only used for UT
119 bool operator==(const dump_cmd& i) const;
126 route::table_id_t m_id;
127 const l3_proto_t& m_proto;
130 }; // namespace ip_route_cmds
131 }; // namespace route
135 * fd.io coding-style-patch-verification: ON
138 * eval: (c-set-style "mozilla")