blob: 534f7868a08385e51e20c081cbc7773bc67ab6b3 [file] [log] [blame]
Neale Ranns812ed392017-10-16 04:20:13 -07001/*
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
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070016#include "vom/acl_binding_cmds.hpp"
Neale Ranns812ed392017-10-16 04:20:13 -070017
18DEFINE_VAPI_MSG_IDS_ACL_API_JSON;
19
20namespace VOM {
21namespace ACL {
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070022namespace binding_cmds {
Neale Ranns812ed392017-10-16 04:20:13 -070023template <>
24rc_t
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070025l3_bind_cmd::issue(connection& con)
Neale Ranns812ed392017-10-16 04:20:13 -070026{
27 msg_t req(con.ctx(), std::ref(*this));
28
29 auto& payload = req.get_request().get_payload();
30 payload.sw_if_index = m_itf.value();
31 payload.is_add = 1;
32 payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
33 payload.acl_index = m_acl.value();
34
35 VAPI_CALL(req.execute());
36
37 m_hw_item.set(wait());
38
39 return rc_t::OK;
40}
41
42template <>
43rc_t
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070044l3_unbind_cmd::issue(connection& con)
Neale Ranns812ed392017-10-16 04:20:13 -070045{
46 msg_t req(con.ctx(), std::ref(*this));
47
48 auto& payload = req.get_request().get_payload();
49 payload.sw_if_index = m_itf.value();
50 payload.is_add = 0;
51 payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
52 payload.acl_index = m_acl.value();
53
54 VAPI_CALL(req.execute());
55
56 m_hw_item.set(wait());
57
58 return rc_t::OK;
59}
60
61template <>
62rc_t
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070063l3_dump_cmd::issue(connection& con)
Neale Ranns812ed392017-10-16 04:20:13 -070064{
65 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
66
67 auto& payload = m_dump->get_request().get_payload();
68 payload.sw_if_index = ~0;
69
70 VAPI_CALL(m_dump->execute());
71
72 wait();
73
74 return rc_t::OK;
75}
76
77template <>
78rc_t
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070079l2_bind_cmd::issue(connection& con)
Neale Ranns812ed392017-10-16 04:20:13 -070080{
81 msg_t req(con.ctx(), std::ref(*this));
82
83 auto& payload = req.get_request().get_payload();
84 payload.sw_if_index = m_itf.value();
85 payload.is_add = 1;
86 // payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
87 payload.acl_index = m_acl.value();
88
89 VAPI_CALL(req.execute());
90
91 m_hw_item.set(wait());
92
93 return rc_t::OK;
94}
95
96template <>
97rc_t
Neale Ranns9ef1c0a2017-11-03 04:39:05 -070098l2_unbind_cmd::issue(connection& con)
Neale Ranns812ed392017-10-16 04:20:13 -070099{
100 msg_t req(con.ctx(), std::ref(*this));
101
102 auto& payload = req.get_request().get_payload();
103 payload.sw_if_index = m_itf.value();
104 payload.is_add = 0;
105 // payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
106 payload.acl_index = m_acl.value();
107
108 VAPI_CALL(req.execute());
109
110 m_hw_item.set(wait());
111
112 return rc_t::OK;
113}
114
115template <>
116rc_t
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700117l2_dump_cmd::issue(connection& con)
Neale Ranns812ed392017-10-16 04:20:13 -0700118{
119 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
120
121 auto& payload = m_dump->get_request().get_payload();
122 payload.sw_if_index = ~0;
123
124 VAPI_CALL(m_dump->execute());
125
126 wait();
127
128 return rc_t::OK;
129}
Neale Ranns9ef1c0a2017-11-03 04:39:05 -0700130
131}; // namespace binding_cmds
132}; // namespace ACL
133}; // namespace VOM
Neale Ranns812ed392017-10-16 04:20:13 -0700134
135/*
136 * fd.io coding-style-patch-verification: ON
137 *
138 * Local Variables:
139 * eval: (c-set-style "mozilla")
140 * End:
141 */