FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ip_unnumbered_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_IP_UNNUMBERED_CMDS_H__
17 #define __VOM_IP_UNNUMBERED_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/ip_unnumbered.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/interface.api.vapi.hpp>
24 #include <vapi/ip.api.vapi.hpp>
25 
26 namespace VOM {
27 namespace ip_unnumbered_cmds {
28 
29 /**
30 *A command class that configures the IP unnumbered
31 */
33  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_unnumbered>
34 {
35 public:
36  /**
37  * Constructor
38  */
39  config_cmd(HW::item<bool>& item, const handle_t& itf, const handle_t& l3_itf);
40 
41  /**
42  * Issue the command to VPP/HW
43  */
45  /**
46  * convert to string format for debug purposes
47  */
48  std::string to_string() const;
49 
50  /**
51  * Comparison operator - only used for UT
52  */
53  bool operator==(const config_cmd& i) const;
54 
55 private:
56  /**
57  * Reference to the interface for which the address is required
58  */
59  const handle_t& m_itf;
60  /**
61  * Reference to the interface which has an address
62  */
63  const handle_t& m_l3_itf;
64 };
65 
66 /**
67  * A cmd class that Unconfigs L3 Config from an interface
68  */
70  : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_set_unnumbered>
71 {
72 public:
73  /**
74  * Constructor
75  */
77  const handle_t& itf,
78  const handle_t& l3_itf);
79 
80  /**
81  * Issue the command to VPP/HW
82  */
84  /**
85  * convert to string format for debug purposes
86  */
87  std::string to_string() const;
88 
89  /**
90  * Comparison operator - only used for UT
91  */
92  bool operator==(const unconfig_cmd& i) const;
93 
94 private:
95  /**
96  * Reference to the interface for which the address is required
97  */
98  const handle_t& m_itf;
99  /**
100  * Reference to the interface which has an address
101  */
102  const handle_t& m_l3_itf;
103 };
104 
105 /**
106  * A cmd class that Dumps all the IP unnumbered interfaces
107  */
108 class dump_cmd : public VOM::dump_cmd<vapi::Ip_unnumbered_dump>
109 {
110 public:
111  /**
112  * Constructor
113  */
114  dump_cmd() = default;
115 
116  /**
117  * Issue the command to VPP/HW
118  */
120  /**
121  * convert to string format for debug purposes
122  */
123  std::string to_string() const;
124 
125  /**
126  * Comparison operator - only used for UT
127  */
128  bool operator==(const dump_cmd& i) const;
129 
130 private:
131  /**
132  * HW reutrn code
133  */
134  HW::item<bool> item;
135 };
136 }; // namespace ip_unnumbered_cmds
137 }; // namespace VOM
138 
139 /*
140  * fd.io coding-style-patch-verification: OFF
141  *
142  * Local Variables:
143  * eval: (c-set-style "mozilla")
144  * End:
145  */
146 
147 #endif
VOM::ip_unnumbered_cmds::config_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: ip_unnumbered_cmds.cpp:54
VOM::HW::item< bool >
VOM::ip_unnumbered_cmds::unconfig_cmd
A cmd class that Unconfigs L3 Config from an interface.
Definition: ip_unnumbered_cmds.hpp:69
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::rpc_cmd
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
VOM::ip_unnumbered_cmds::dump_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: ip_unnumbered_cmds.cpp:113
VOM::ip_unnumbered_cmds::dump_cmd::dump_cmd
dump_cmd()=default
Constructor.
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::ip_unnumbered_cmds::unconfig_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: ip_unnumbered_cmds.cpp:79
VOM::ip_unnumbered_cmds::dump_cmd
A cmd class that Dumps all the IP unnumbered interfaces.
Definition: ip_unnumbered_cmds.hpp:108
VOM::ip_unnumbered_cmds::unconfig_cmd::operator==
bool operator==(const unconfig_cmd &i) const
Comparison operator - only used for UT.
Definition: ip_unnumbered_cmds.cpp:73
VOM::ip_unnumbered_cmds::config_cmd::operator==
bool operator==(const config_cmd &i) const
Comparison operator - only used for UT.
Definition: ip_unnumbered_cmds.cpp:33
VOM::ip_unnumbered_cmds::config_cmd::config_cmd
config_cmd(HW::item< bool > &item, const handle_t &itf, const handle_t &l3_itf)
Constructor.
Definition: ip_unnumbered_cmds.cpp:23
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::ip_unnumbered_cmds::unconfig_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: ip_unnumbered_cmds.cpp:97
ip_unnumbered.hpp
VOM::ip_unnumbered_cmds::config_cmd
A command class that configures the IP unnumbered.
Definition: ip_unnumbered_cmds.hpp:32
VOM::handle_t
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
VOM::ip_unnumbered_cmds::dump_cmd::to_string
std::string to_string() const
convert to string format for debug purposes
Definition: ip_unnumbered_cmds.cpp:128
dump_cmd.hpp
VOM::ip_unnumbered_cmds::unconfig_cmd::unconfig_cmd
unconfig_cmd(HW::item< bool > &item, const handle_t &itf, const handle_t &l3_itf)
Constructor.
Definition: ip_unnumbered_cmds.cpp:63
VOM::rpc_cmd< HW::item< bool >, vapi::Sw_interface_set_unnumbered >::item
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66
i
int i
Definition: flowhash_template.h:376
VOM::ip_unnumbered_cmds::dump_cmd::operator==
bool operator==(const dump_cmd &i) const
Comparison operator - only used for UT.
Definition: ip_unnumbered_cmds.cpp:107
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
VOM::ip_unnumbered_cmds::config_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: ip_unnumbered_cmds.cpp:39
rpc_cmd.hpp
string
const char *const string
Definition: cJSON.h:172