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.hpp"
17 #include "vom/acl_binding_cmds.hpp"
23 l2_binding::event_handler::handle_populate(const client_db::key_t& key)
26 * dump VPP Bridge domains
28 std::shared_ptr<binding_cmds::l2_dump_cmd> cmd =
29 std::make_shared<binding_cmds::l2_dump_cmd>();
34 for (auto& record : *cmd) {
35 auto& payload = record.get_payload();
37 std::shared_ptr<interface> itf = interface::find(payload.sw_if_index);
39 for (int ii = 0; ii < payload.count; ii++) {
40 std::shared_ptr<l2_list> acl = l2_list::find(payload.acls[ii]);
42 l2_binding binding(direction_t::INPUT, *itf, *acl);
44 OM::commit(key, binding);
51 l3_binding::event_handler::handle_populate(const client_db::key_t& key)
53 std::shared_ptr<binding_cmds::l3_dump_cmd> cmd =
54 std::make_shared<binding_cmds::l3_dump_cmd>();
59 for (auto& record : *cmd) {
60 auto& payload = record.get_payload();
62 std::shared_ptr<interface> itf = interface::find(payload.sw_if_index);
63 uint8_t n_input = payload.n_input;
65 for (int ii = 0; ii < payload.count; ii++) {
66 std::shared_ptr<l3_list> acl = l3_list::find(payload.acls[ii]);
69 l3_binding binding(direction_t::INPUT, *itf, *acl);
71 OM::commit(key, binding);
73 l3_binding binding(direction_t::OUTPUT, *itf, *acl);
74 OM::commit(key, binding);
82 l3_binding::update(const binding& obj)
85 HW::enqueue(new binding_cmds::l3_bind_cmd(
86 m_binding, m_direction, m_itf->handle(), m_acl->handle()));
93 l3_binding::sweep(void)
96 HW::enqueue(new binding_cmds::l3_unbind_cmd(
97 m_binding, m_direction, m_itf->handle(), m_acl->handle()));
104 l3_binding::replay(void)
107 HW::enqueue(new binding_cmds::l3_bind_cmd(
108 m_binding, m_direction, m_itf->handle(), m_acl->handle()));
114 l2_binding::update(const binding& obj)
117 HW::enqueue(new binding_cmds::l2_bind_cmd(
118 m_binding, m_direction, m_itf->handle(), m_acl->handle()));
125 l2_binding::sweep(void)
128 HW::enqueue(new binding_cmds::l2_unbind_cmd(
129 m_binding, m_direction, m_itf->handle(), m_acl->handle()));
136 l2_binding::replay(void)
139 HW::enqueue(new binding_cmds::l2_bind_cmd(
140 m_binding, m_direction, m_itf->handle(), m_acl->handle()));
146 operator<<(std::ostream& os,
147 const std::pair<direction_t, interface::key_t>& key)
149 os << "[" << key.first.to_string() << " " << key.second << "]";
156 * fd.io coding-style-patch-verification: ON
159 * eval: (c-set-style "mozilla")