FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
interface_ip6_nd_cmds.cpp
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 #include "vom/interface_ip6_nd.hpp"
17 
18 #include <vapi/ip6_nd.api.vapi.hpp>
19 
20 namespace VOM {
21 template<>
22 rc_t
24 {
25  msg_t req(con.ctx(), std::ref(*this));
26 
27  auto& payload = req.get_request().get_payload();
28  payload.sw_if_index = m_itf.value();
29  m_cls.to_vpp(payload);
30  payload.is_no = 0;
31 
32  VAPI_CALL(req.execute());
33 
34  return (wait());
35 }
36 
37 template<>
38 rc_t
40 {
41  msg_t req(con.ctx(), std::ref(*this));
42 
43  auto& payload = req.get_request().get_payload();
44  payload.sw_if_index = m_itf.value();
45  m_cls.to_vpp(payload);
46  payload.is_no = 1;
47 
48  VAPI_CALL(req.execute());
49 
50  wait();
52 
53  return rc_t::OK;
54 }
55 
56 template<>
57 rc_t
59 {
60  msg_t req(con.ctx(), std::ref(*this));
61 
62  auto& payload = req.get_request().get_payload();
63  payload.sw_if_index = m_itf.value();
64  m_cls.to_vpp(payload);
65  payload.is_no = 0;
66 
67  VAPI_CALL(req.execute());
68 
69  return (wait());
70 }
71 
72 template<>
73 rc_t
75 {
76  msg_t req(con.ctx(), std::ref(*this));
77 
78  auto& payload = req.get_request().get_payload();
79  payload.sw_if_index = m_itf.value();
80  m_cls.to_vpp(payload);
81  payload.is_no = 1;
82 
83  VAPI_CALL(req.execute());
84 
85  wait();
87 
88  return rc_t::OK;
89 }
90 }
91 
92 /*
93  * fd.io coding-style-patch-verification: OFF
94  *
95  * Local Variables:
96  * eval: (c-set-style "mozilla")
97  * End:
98  */
VOM::rpc_cmd< HW::item< bool >, CMD >::wait
rc_t wait()
Wait on the commands promise.
Definition: rpc_cmd.hpp:82
VOM::HW::item::set
void set(const rc_t &rc)
Set the HW return code - should only be called from the family of Command objects.
Definition: hw.hpp:125
VOM
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
VOM::rc_t::OK
const static rc_t OK
The HW write was successfull.
Definition: types.hpp:109
VOM::handle_t::value
uint32_t value() const
get the value of the handle
Definition: types.cpp:93
con
Connection con
Definition: vapi_cpp_test.cpp:56
VOM::rpc_cmd< HW::item< bool >, CMD >::m_hw_item
HW::item< bool > & m_hw_item
A reference to an object's HW::item that the command will update.
Definition: rpc_cmd.hpp:134
VAPI_CALL
#define VAPI_CALL(_stmt)
Convenince wrapper macro for error handling in VAPI sends.
Definition: types.hpp:29
VOM::connection
A representation of the connection to VPP.
Definition: connection.hpp:33
VOM::interface_ip6_nd::unconfig_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_ip6_nd_cmds.cpp:39
VOM::rc_t::NOOP
const static rc_t NOOP
The HW write/update action was/has not been attempted.
Definition: types.hpp:104
interface_ip6_nd.hpp
VOM::rpc_cmd< HW::item< bool >, CMD >::msg_t
CMD msg_t
convenient typedef
Definition: rpc_cmd.hpp:46
VOM::interface_ip6_nd::config_cmd::issue
rc_t issue(connection &con)
Issue the command to VPP/HW.
Definition: interface_ip6_nd_cmds.cpp:23
VOM::rc_t
Error codes that VPP will return during a HW write.
Definition: types.hpp:89