Revert "[VOL-4746] removing sub based on programmed data"
Reverted because of ONUAutoDiscovery test failures in periodic bbsim tests

This reverts commit 89e2f040e1eae7306839ff0bbc61ba7f774d09ef.

Change-Id: Iddc95adf8341572c947abbd024a1bb55fe1e3cab
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java b/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
index 4cd96ee..f438fee 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
@@ -111,7 +111,6 @@
 import static org.opencord.olt.impl.OltUtils.flowOpToString;
 import static org.opencord.olt.impl.OltUtils.getPortName;
 import static org.opencord.olt.impl.OltUtils.portWithName;
-import static org.opencord.olt.impl.OltUtils.getProgrammedSubscriber;
 import static org.opencord.olt.impl.OsgiPropertyConstants.*;
 import static org.opencord.olt.impl.fttb.FttbUtils.FTTB_FLOW_DIRECTION;
 import static org.opencord.olt.impl.fttb.FttbUtils.FTTB_FLOW_DOWNSTREAM;
@@ -271,7 +270,7 @@
     public void activate(ComponentContext context) {
         cfgService.registerProperties(getClass());
         appId = coreService.registerApplication(APP_NAME);
-        internalFlowListener = new InternalFlowListener(this);
+        internalFlowListener = new InternalFlowListener();
 
         modified(context);
 
@@ -402,13 +401,16 @@
             cpStatusReadLock.lock();
 
             cpStatus.forEach((sk, status) -> {
-                ConnectPoint cp = sk.getPort().connectPoint();
-                Device device = deviceService.getDevice(cp.deviceId());
-                boolean notNni = !oltDeviceService.isNniPort(device, cp.port());
-                boolean notEapol = !sk.getService().equals(defaultEapolUniTag);
-                boolean hasHsia = status.subscriberFlowsStatus.hasFlow();
-                boolean hasDhcp = status.dhcpStatus.hasFlow();
-                if (notNni && notEapol && (hasHsia || hasDhcp)) {
+                if (
+                    // not NNI Port
+                        !oltDeviceService.isNniPort(deviceService.getDevice(sk.getPort().connectPoint().deviceId()),
+                                sk.getPort().connectPoint().port()) &&
+                                // not EAPOL flow
+                                !sk.getService().equals(defaultEapolUniTag) &&
+                                !status.subscriberFlowsStatus.equals(OltFlowsStatus.PENDING_REMOVE)
+                                && !status.subscriberFlowsStatus.equals(OltFlowsStatus.REMOVED)
+
+                ) {
                     subscribers.put(sk, sk.getService());
                 }
             });
@@ -1599,13 +1601,6 @@
     }
 
     protected class InternalFlowListener implements FlowRuleListener {
-
-        private OltFlowServiceInterface oltFlowService;
-
-        public InternalFlowListener(OltFlowServiceInterface oltFlowService) {
-            this.oltFlowService = oltFlowService;
-        }
-
         @Override
         public void event(FlowRuleEvent event) {
             if (appId.id() != (event.subject().appId())) {
@@ -1733,12 +1728,7 @@
         }
 
         private ServiceKey getSubscriberKeyFromFlowRule(FlowRule flowRule, Port flowPort) {
-            AccessDevicePort accessDevicePort = new AccessDevicePort(flowPort);
-            SubscriberAndDeviceInformation si = getProgrammedSubscriber(oltFlowService, accessDevicePort);
-            if (si == null) {
-                log.debug("si not found in programmedSubscribers, getting it from sadis.");
-                si = subsService.get(getPortName(flowPort));
-            }
+            SubscriberAndDeviceInformation si = subsService.get(getPortName(flowPort));
 
             Boolean isNni = oltDeviceService.isNniPort(deviceService.getDevice(flowRule.deviceId()), flowPort.number());
             if (si == null && !isNni) {