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 #include "vom/acl_binding_cmds.hpp"
18 DEFINE_VAPI_MSG_IDS_ACL_API_JSON;
22 namespace binding_cmds {
25 l3_bind_cmd::issue(connection& con)
27 msg_t req(con.ctx(), std::ref(*this));
29 auto& payload = req.get_request().get_payload();
30 payload.sw_if_index = m_itf.value();
32 payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
33 payload.acl_index = m_acl.value();
35 VAPI_CALL(req.execute());
37 m_hw_item.set(wait());
44 l3_bind_cmd::to_string() const
47 s << "l3-acl-bind:[" << m_direction.to_string()
48 << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
55 l3_unbind_cmd::issue(connection& con)
57 msg_t req(con.ctx(), std::ref(*this));
59 auto& payload = req.get_request().get_payload();
60 payload.sw_if_index = m_itf.value();
62 payload.is_input = (m_direction == direction_t::INPUT ? 1 : 0);
63 payload.acl_index = m_acl.value();
65 VAPI_CALL(req.execute());
67 m_hw_item.set(wait());
74 l3_unbind_cmd::to_string() const
77 s << "l3-acl-unbind:[" << m_direction.to_string()
78 << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
85 l3_dump_cmd::issue(connection& con)
87 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
89 auto& payload = m_dump->get_request().get_payload();
90 payload.sw_if_index = ~0;
92 VAPI_CALL(m_dump->execute());
101 l3_dump_cmd::to_string() const
103 return ("l3-acl-bind-dump");
108 l2_bind_cmd::issue(connection& con)
110 msg_t req(con.ctx(), std::ref(*this));
112 auto& payload = req.get_request().get_payload();
113 payload.sw_if_index = m_itf.value();
115 payload.acl_index = m_acl.value();
117 VAPI_CALL(req.execute());
119 m_hw_item.set(wait());
126 l2_bind_cmd::to_string() const
128 std::ostringstream s;
129 s << "l2-acl-bind:[" << m_direction.to_string()
130 << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
137 l2_unbind_cmd::issue(connection& con)
139 msg_t req(con.ctx(), std::ref(*this));
141 auto& payload = req.get_request().get_payload();
142 payload.sw_if_index = m_itf.value();
144 payload.acl_index = m_acl.value();
146 VAPI_CALL(req.execute());
148 m_hw_item.set(wait());
155 l2_unbind_cmd::to_string() const
157 std::ostringstream s;
158 s << "l2-acl-unbind:[" << m_direction.to_string()
159 << " itf:" << m_itf.to_string() << " acl:" << m_acl.to_string() << "]";
166 l2_dump_cmd::issue(connection& con)
168 m_dump.reset(new msg_t(con.ctx(), std::ref(*this)));
170 auto& payload = m_dump->get_request().get_payload();
171 payload.sw_if_index = ~0;
173 VAPI_CALL(m_dump->execute());
182 l2_dump_cmd::to_string() const
184 return ("l2-acl-bind-dump");
187 }; // namespace binding_cmds
192 * fd.io coding-style-patch-verification: ON
195 * eval: (c-set-style "mozilla")