Fix syncronization issue in table 220 flows 10/81110/9
authorR P Karthika <r.p.karthika@ericsson.com>
Mon, 13 May 2019 10:17:32 +0000 (15:47 +0530)
committerFaseela K <faseela.k@ericsson.com>
Fri, 21 Jun 2019 09:34:29 +0000 (09:34 +0000)
Change-Id: Id7c6a1f967c561a969b47b59ad93134d622028a6
Signed-off-by: R P Karthika <r.p.karthika@ericsson.com>
interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/listeners/InterfaceInventoryStateListener.java
interfacemanager/interfacemanager-impl/src/main/java/org/opendaylight/genius/interfacemanager/servicebindings/flowbased/listeners/FlowBasedServicesInterfaceStateListener.java

index 717d80f7acb298304c5ffc0c85c00c33f165f52a..551aeea17ce04ad11fdfe0b99902a08719664bf3 100644 (file)
@@ -427,10 +427,12 @@ public class InterfaceInventoryStateListener
                         }
                         // remove ingress flow only for northbound configured interfaces
                         // skip this check for non-unique ports(Ex: br-int,br-ex)
-                        if (iface != null || !interfaceName.contains(fcNodeConnectorOld.getName())) {
+
+                        if (iface != null) {
                             FlowBasedServicesUtils.removeIngressFlow(interfaceName, dpId, txRunner, futures);
+                            IfmUtil.unbindService(txRunner, coordinator, iface.getName(),
+                                    FlowBasedServicesUtils.buildDefaultServiceId(iface.getName()));
                         }
-
                         // Delete the Vpn Interface from DpnToInterface Op DS.
                         InterfaceManagerCommonUtils.deleteDpnToInterface(dpId, interfaceName, operTx);
                     }
index ab2668283a55ce7ef23517cf74a8305d4e1133c2..b58ceec9b5a4dc9cce421958ae4b1bcdd896752a 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.Callable;
 import javax.inject.Inject;
@@ -26,7 +25,6 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.genius.interfacemanager.IfmConstants;
-import org.opendaylight.genius.interfacemanager.IfmUtil;
 import org.opendaylight.genius.interfacemanager.recovery.impl.InterfaceServiceRecoveryHandler;
 import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.state.factory.FlowBasedServicesStateAddable;
 import org.opendaylight.genius.interfacemanager.servicebindings.flowbased.state.factory.FlowBasedServicesStateRendererFactoryResolver;
@@ -36,13 +34,10 @@ import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
 import org.opendaylight.serviceutils.srm.RecoverableListener;
 import org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry;
 import org.opendaylight.serviceutils.tools.mdsal.listener.AbstractClusteredSyncDataTreeChangeListener;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.L2vlan;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Other;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
@@ -81,17 +76,7 @@ public class FlowBasedServicesInterfaceStateListener extends AbstractClusteredSy
     @Override
     public void remove(@NonNull final InstanceIdentifier<Interface> instanceIdentifier,
                        @NonNull final Interface interfaceStateOld) {
-        if (Other.class.equals(interfaceStateOld.getType()) || !entityOwnershipUtils
-                .isEntityOwner(IfmConstants.INTERFACE_SERVICE_BINDING_ENTITY,
-                               IfmConstants.INTERFACE_SERVICE_BINDING_ENTITY)) {
-            return;
-        }
-
-        LOG.debug("Received interface state remove event for {}", interfaceStateOld.getName());
-        // Unbind Default Egress Dispatcher Service when interface-state is removed.
-        coordinator.enqueueJob(interfaceStateOld.getName(),
-                               new RendererStateInterfaceUnbindWorker(coordinator, txRunner, interfaceStateOld),
-                               IfmConstants.JOB_MAX_RETRIES);
+        //Do Nothing
     }
 
     @Override
@@ -165,44 +150,4 @@ public class FlowBasedServicesInterfaceStateListener extends AbstractClusteredSy
             return futures;
         }
     }
-
-    private static class RendererStateInterfaceUnbindWorker implements Callable<List<ListenableFuture<Void>>> {
-        private final Interface iface;
-        private final JobCoordinator coordinator;
-        private final ManagedNewTransactionRunner txRunner;
-
-        RendererStateInterfaceUnbindWorker(JobCoordinator coordinator, ManagedNewTransactionRunner txRunner,
-                                           Interface iface) {
-            this.iface = iface;
-            this.coordinator = coordinator;
-            this.txRunner = txRunner;
-        }
-
-        @Override
-        public List<ListenableFuture<Void>> call() {
-            coordinator.enqueueJob(iface.getName(), () -> Collections
-                    .singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> {
-                        LOG.debug("unbinding services on interface {}", iface.getName());
-                        ServicesInfo servicesInfo = FlowBasedServicesUtils
-                                .getServicesInfoForInterface(tx, iface.getName(), ServiceModeEgress.class);
-                        if (servicesInfo == null) {
-                            LOG.trace("service info is null for interface {}", iface.getName());
-                            return;
-                        }
-
-                        List<BoundServices> allServices = servicesInfo.getBoundServices();
-                        if (allServices == null || allServices.isEmpty()) {
-                            LOG.trace("bound services is empty for interface {}", iface.getName());
-                            return;
-                        }
-
-                        if (L2vlan.class.equals(iface.getType())) {
-                            // remove the default egress service bound on the interface
-                            IfmUtil.unbindService(tx, iface.getName(),
-                                                  FlowBasedServicesUtils.buildDefaultServiceId(iface.getName()));
-                        }
-                    })));
-            return Collections.emptyList();
-        }
-    }
 }