2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netvirt.aclservice;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.opendaylight.netvirt.aclservice.api.AclServiceListener;
14 import org.opendaylight.netvirt.aclservice.api.AclServiceManager;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
17 public class AclServiceManagerImpl implements AclServiceManager {
19 private List<AclServiceListener> aclServiceListenerList;
22 * Initialize the ACL service listener list.
24 public AclServiceManagerImpl() {
25 aclServiceListenerList = new ArrayList<>();
29 public void addAclServiceListner(AclServiceListener aclServiceListner) {
30 aclServiceListenerList.add(aclServiceListner);
34 public void removeAclServiceListner(AclServiceListener aclServiceListner) {
35 aclServiceListenerList.remove(aclServiceListner);
39 public void notify(Interface port, Action action) {
40 for (AclServiceListener aclServiceListener : aclServiceListenerList) {
41 if (action == Action.ADD) {
42 aclServiceListener.applyAcl(port);
43 } else if (action == Action.UPDATE) {
44 aclServiceListener.updateAcl(port);
45 } else if (action == Action.REMOVE) {
46 aclServiceListener.removeAcl(port);