import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
-import org.opendaylight.genius.mdsalutil.NwConstants;
+import org.opendaylight.genius.srm.RecoverableListener;
+import org.opendaylight.genius.srm.ServiceRecoveryRegistry;
import org.opendaylight.netvirt.aclservice.api.AclInterfaceCache;
import org.opendaylight.netvirt.aclservice.api.AclServiceManager;
import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionEgress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionIngress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.port.subnets.port.subnet.SubnetInfo;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Singleton
public class AclInterfaceStateListener extends AsyncDataTreeChangeListenerBase<Interface,
- AclInterfaceStateListener> implements ClusteredDataTreeChangeListener<Interface> {
+ AclInterfaceStateListener> implements ClusteredDataTreeChangeListener<Interface>, RecoverableListener {
private static final Logger LOG = LoggerFactory.getLogger(AclInterfaceStateListener.class);
@Inject
public AclInterfaceStateListener(AclServiceManager aclServiceManger, AclClusterUtil aclClusterUtil,
DataBroker dataBroker, AclDataUtil aclDataUtil, IInterfaceManager interfaceManager,
- AclInterfaceCache aclInterfaceCache, AclServiceUtils aclServicUtils) {
+ AclInterfaceCache aclInterfaceCache, AclServiceUtils aclServicUtils,
+ ServiceRecoveryRegistry serviceRecoveryRegistry) {
super(Interface.class, AclInterfaceStateListener.class);
this.aclServiceManger = aclServiceManger;
this.aclClusterUtil = aclClusterUtil;
this.interfaceManager = interfaceManager;
this.aclInterfaceCache = aclInterfaceCache;
this.aclServiceUtils = aclServicUtils;
+ serviceRecoveryRegistry.addRecoverableListener(AclServiceUtils.getRecoverServiceRegistryKey(), this);
}
@Override
@PostConstruct
public void init() {
LOG.info("{} start", getClass().getSimpleName());
+ registerListener();
+ }
+
+ @Override
+ public void registerListener() {
registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
aclServiceManger.notify(aclInterface, null, Action.REMOVE);
if (aclList != null) {
- AclServiceUtils.updateAclPortsLookup(aclInterface, aclList, aclInterface.getAllowedAddressPairs(),
- NwConstants.DEL_FLOW, this.dataBroker);
+ aclServiceUtils.deleteAclPortsLookup(aclInterface, aclList, aclInterface.getAllowedAddressPairs());
}
}
if (aclList != null) {
.isMarkedForDelete(false);
if (AclServiceUtils.isOfInterest(prevAclInterface)) {
- if (prevAclInterface.getSubnetIpPrefixes() == null) {
+ if (prevAclInterface.getSubnetInfo() == null) {
// For upgrades
- List<IpPrefixOrAddress> subnetIpPrefixes = AclServiceUtils.getSubnetIpPrefixes(dataBroker,
- added.getName());
- builder.subnetIpPrefixes(subnetIpPrefixes);
+ List<SubnetInfo> subnetInfo = aclServiceUtils.getSubnetInfo(added.getName());
+ builder.subnetInfo(subnetInfo);
}
SortedSet<Integer> ingressRemoteAclTags =
aclServiceUtils.getRemoteAclTags(aclInPort.getSecurityGroups(), DirectionIngress.class);
LOG.debug("On add event, notify ACL service manager to add ACL for interface: {}", aclInterface);
aclServiceManger.notify(aclInterface, null, Action.BIND);
if (aclList != null) {
- AclServiceUtils.updateAclPortsLookup(aclInterface, aclList, aclInterface.getAllowedAddressPairs(),
- NwConstants.ADD_FLOW, this.dataBroker);
+ aclServiceUtils.addAclPortsLookup(aclInterface, aclList, aclInterface.getAllowedAddressPairs());
}
aclServiceManger.notify(aclInterface, null, Action.ADD);
}