ARP proxy dumps
[vpp.git] / extras / vom / vom / arp_proxy_config_cmds.hpp
1 /*
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:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15
16 #ifndef __VOM_ARP_PROXY_CONFIG_CMDS_H__
17 #define __VOM_ARP_PROXY_CONFIG_CMDS_H__
18
19 #include "vom/arp_proxy_config.hpp"
20 #include "vom/dump_cmd.hpp"
21 #include "vom/rpc_cmd.hpp"
22
23 #include <vapi/ip.api.vapi.hpp>
24
25 namespace VOM {
26 namespace arp_proxy_config_cmds {
27 /**
28  * A command class that adds the ARP Proxy config
29  */
30 class config_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
31 {
32 public:
33   /**
34    * Constructor
35    */
36   config_cmd(HW::item<bool>& item,
37              const boost::asio::ip::address_v4& lo,
38              const boost::asio::ip::address_v4& high);
39
40   /**
41    * Issue the command to VPP/HW
42    */
43   rc_t issue(connection& con);
44   /**
45    * convert to string format for debug purposes
46    */
47   std::string to_string() const;
48
49   /**
50    * Comparison operator - only used for UT
51    */
52   bool operator==(const config_cmd& i) const;
53
54 private:
55   /**
56    * Address range
57    */
58   const boost::asio::ip::address_v4 m_low;
59   const boost::asio::ip::address_v4 m_high;
60 };
61
62 /**
63  * A cmd class that Unconfigs ArpProxy Config from an interface
64  */
65 class unconfig_cmd
66   : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
67 {
68 public:
69   /**
70    * Constructor
71    */
72   unconfig_cmd(HW::item<bool>& item,
73                const boost::asio::ip::address_v4& lo,
74                const boost::asio::ip::address_v4& hig);
75
76   /**
77    * Issue the command to VPP/HW
78    */
79   rc_t issue(connection& con);
80   /**
81    * convert to string format for debug purposes
82    */
83   std::string to_string() const;
84
85   /**
86    * Comparison operator - only used for UT
87    */
88   bool operator==(const unconfig_cmd& i) const;
89
90 private:
91   /**
92    * Address range
93    */
94   const boost::asio::ip::address_v4 m_low;
95   const boost::asio::ip::address_v4 m_high;
96 };
97
98 /**
99  * A cmd class that Dumps all the Proxy ARP configs
100  */
101 class dump_cmd : public VOM::dump_cmd<vapi::Proxy_arp_dump>
102 {
103 public:
104   /**
105    * Constructor
106    */
107   dump_cmd() = default;
108
109   /**
110    * Issue the command to VPP/HW
111    */
112   rc_t issue(connection& con);
113   /**
114    * convert to string format for debug purposes
115    */
116   std::string to_string() const;
117
118   /**
119    * Comparison operator - only used for UT
120    */
121   bool operator==(const dump_cmd& i) const;
122
123 private:
124   /**
125    * HW reutrn code
126    */
127   HW::item<bool> item;
128 };
129
130 }; // namespace cmds
131 }; // namespace VOM
132
133 /*
134  * fd.io coding-style-patch-verification: ON
135  *
136  * Local Variables:
137  * eval: (c-set-style "mozilla")
138  * End:
139  */
140
141 #endif