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_L3_BINDING_CMDS_H__
17 #define __VOM_L3_BINDING_CMDS_H__
19 #include "vom/dump_cmd.hpp"
20 #include "vom/l3_binding.hpp"
21 #include "vom/rpc_cmd.hpp"
23 #include <vapi/interface.api.vapi.hpp>
24 #include <vapi/ip.api.vapi.hpp>
27 namespace l3_binding_cmds {
30 * A functor class that binds the L3 config to the interface
33 : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_add_del_address>
39 bind_cmd(HW::item<bool>& item,
41 const route::prefix_t& pfx);
44 * Issue the command to VPP/HW
46 rc_t issue(connection& con);
48 * convert to string format for debug purposes
50 std::string to_string() const;
53 * Comparison operator - only used for UT
55 bool operator==(const bind_cmd& i) const;
59 * Reference to the interface to bind to
61 const handle_t& m_itf;
66 const route::prefix_t& m_pfx;
70 * A cmd class that Unbinds L3 Config from an interface
73 : public rpc_cmd<HW::item<bool>, vapi::Sw_interface_add_del_address>
79 unbind_cmd(HW::item<bool>& item,
81 const route::prefix_t& pfx);
84 * Issue the command to VPP/HW
86 rc_t issue(connection& con);
88 * convert to string format for debug purposes
90 std::string to_string() const;
93 * Comparison operator - only used for UT
95 bool operator==(const unbind_cmd& i) const;
99 * Reference to the interface to unbind fomr
101 const handle_t& m_itf;
104 * The prefix to unbind
106 const route::prefix_t& m_pfx;
110 * A cmd class that Dumps all the IPv4 L3 configs
112 class dump_v4_cmd : public dump_cmd<vapi::Ip_address_dump>
118 dump_v4_cmd(const handle_t& itf);
119 dump_v4_cmd(const dump_v4_cmd& d);
122 * Issue the command to VPP/HW
124 rc_t issue(connection& con);
126 * convert to string format for debug purposes
128 std::string to_string() const;
131 * Comparison operator - only used for UT
133 bool operator==(const dump_v4_cmd& i) const;
142 * The interface to get the addresses for
144 const handle_t& m_itf;
147 }; // namespace l3_binding_cmds
151 * fd.io coding-style-patch-verification: ON
154 * eval: (c-set-style "mozilla")