FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
arp_proxy_config_cmds.hpp
Go to the documentation of this file.
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/arp.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>, vapi::Proxy_arp_add_del>
31 {
32 public:
33  /**
34  * Constructor
35  */
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  */
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 : public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_add_del>
66 {
67 public:
68  /**
69  * Constructor
70  */
72  const boost::asio::ip::address_v4& lo,
73  const boost::asio::ip::address_v4& hig);
74 
75  /**
76  * Issue the command to VPP/HW
77  */
79  /**
80  * convert to string format for debug purposes
81  */
82  std::string to_string() const;
83 
84  /**
85  * Comparison operator - only used for UT
86  */
87  bool operator==(const unconfig_cmd& i) const;
88 
89 private:
90  /**
91  * Address range
92  */
93  const boost::asio::ip::address_v4 m_low;
94  const boost::asio::ip::address_v4 m_high;
95 };
96 
97 /**
98  * A cmd class that Dumps all the Proxy ARP configs
99  */
100 class dump_cmd : public VOM::dump_cmd<vapi::Proxy_arp_dump>
101 {
102 public:
103  /**
104  * Constructor
105  */
106  dump_cmd() = default;
107 
108  /**
109  * Issue the command to VPP/HW
110  */
112  /**
113  * convert to string format for debug purposes
114  */
115  std::string to_string() const;
116 
117  /**
118  * Comparison operator - only used for UT
119  */
120  bool operator==(const dump_cmd& i) const;
121 
122 private:
123  /**
124  * HW reutrn code
125  */
126  HW::item<bool> item;
127 };
128 
129 }; // namespace cmds
130 }; // namespace VOM
131 
132 /*
133  * fd.io coding-style-patch-verification: OFF
134  *
135  * Local Variables:
136  * eval: (c-set-style "mozilla")
137  * End:
138  */
139 
140 #endif
VOM::HW::item< bool >
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::arp_proxy_config_cmds::config_cmd::config_cmd
config_cmd(HW::item< bool > &item, const boost::asio::ip::address_v4 &lo, const boost::asio::ip::address_v4 &high)
Constructor.
Definition: arp_proxy_config_cmds.cpp:24
VOM::arp_proxy_config_cmds::config_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: arp_proxy_config_cmds.cpp:39
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::arp_proxy_config_cmds::config_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: arp_proxy_config_cmds.cpp:57
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::arp_proxy_config_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: arp_proxy_config_cmds.cpp:116
VOM::arp_proxy_config_cmds::unconfig_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: arp_proxy_config_cmds.cpp:81
VOM::arp_proxy_config_cmds::dump_cmd
A cmd class that Dumps all the Proxy ARP configs.
Definition: arp_proxy_config_cmds.hpp:100
VOM::arp_proxy_config_cmds::unconfig_cmd::operator==
bool operator==(const unconfig_cmd &i) const
Comparison operator - only used for UT.
Definition: arp_proxy_config_cmds.cpp:75
VOM::arp_proxy_config_cmds::unconfig_cmd::unconfig_cmd
unconfig_cmd(HW::item< bool > &item, const boost::asio::ip::address_v4 &lo, const boost::asio::ip::address_v4 &hig)
Constructor.
Definition: arp_proxy_config_cmds.cpp:66
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::arp_proxy_config_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: arp_proxy_config_cmds.cpp:110
VOM::arp_proxy_config_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: arp_proxy_config_cmds.cpp:128
VOM::arp_proxy_config_cmds::config_cmd
A command class that adds the ARP Proxy config.
Definition: arp_proxy_config_cmds.hpp:30
dump_cmd.hpp
VOM::arp_proxy_config_cmds::unconfig_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: arp_proxy_config_cmds.cpp:100
VOM::rpc_cmd< HW::item< bool >, vapi::Proxy_arp_add_del >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
arp_proxy_config.hpp
VOM::arp_proxy_config_cmds::unconfig_cmd
A cmd class that Unconfigs ArpProxy Config from an interface.
Definition: arp_proxy_config_cmds.hpp:65
VOM::arp_proxy_config_cmds::dump_cmd::dump_cmd
dump_cmd()=default
Constructor.
i
int i
Definition: flowhash_template.h:376
VOM::arp_proxy_config_cmds::config_cmd::operator==
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
Definition: arp_proxy_config_cmds.cpp:33
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
VOM::dump_cmd
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
lo
lo
Definition: vector_altivec.h:87
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172