2 * Copyright (c) 2018 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_IP_PUNT_REDIRECT_CMDS_H__
17 #define __VOM_IP_PUNT_REDIRECT_CMDS_H__
19 #include "vom/ip_punt_redirect.hpp"
20 #include "vom/rpc_cmd.hpp"
22 #include <vapi/ip.api.vapi.hpp>
25 namespace ip_punt_redirect_cmds {
28 *A command class that configures the IP punt_redirect
30 class config_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_punt_redirect>
36 config_cmd(HW::item<bool>& item,
37 const handle_t& rx_itf,
38 const handle_t& tx_itf,
39 const boost::asio::ip::address& addr);
42 * Issue the command to VPP/HW
44 rc_t issue(connection& con);
46 * convert to string format for debug purposes
48 std::string to_string() const;
51 * Comparison operator - only used for UT
53 bool operator==(const config_cmd& i) const;
57 * Reference to the interface from which traffic is coming
59 const handle_t& m_rx_itf;
61 * Reference to the interface where traffic will be redirected
63 const handle_t& m_tx_itf;
66 * Reference to nexh hop ip address
68 const boost::asio::ip::address& m_addr;
72 * A cmd class that Unconfigs Ip punt redirect
74 class unconfig_cmd : public rpc_cmd<HW::item<bool>, vapi::Ip_punt_redirect>
80 unconfig_cmd(HW::item<bool>& item,
81 const handle_t& rx_itf,
82 const handle_t& tx_itf,
83 const boost::asio::ip::address& addr);
86 * Issue the command to VPP/HW
88 rc_t issue(connection& con);
90 * convert to string format for debug purposes
92 std::string to_string() const;
95 * Comparison operator - only used for UT
97 bool operator==(const unconfig_cmd& i) const;
101 * Reference to the interface from which traffic is coming
103 const handle_t& m_rx_itf;
105 * Reference to the interface where traffic will be redirected
107 const handle_t& m_tx_itf;
110 * Reference to nexh hop ip address
112 const boost::asio::ip::address& m_addr;
115 }; // namespace ip_punt_redirect_cmds
119 * fd.io coding-style-patch-verification: ON
122 * eval: (c-set-style "mozilla")