VOL-2391: Invalid Flows in ONOS when NNI is misconfigured

Change-Id: I48bd0943382398bc7de95f52817c5a3944a8acb3
diff --git a/app/src/main/java/org/opencord/olt/impl/Olt.java b/app/src/main/java/org/opencord/olt/impl/Olt.java
index 3c0fa97..50a8fd6 100644
--- a/app/src/main/java/org/opencord/olt/impl/Olt.java
+++ b/app/src/main/java/org/opencord/olt/impl/Olt.java
@@ -97,6 +97,8 @@
 
     private final Logger log = getLogger(getClass());
 
+    private static final String NNI = "nni-";
+
     @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected FlowObjectiveService flowObjectiveService;
 
@@ -847,7 +849,14 @@
         if (ulPort != null) {
             return (ulPort.number().toLong() != p.number().toLong());
         }
-        return false;
+        //handles a special case where NNI port is misconfigured in SADIS and getUplinkPort(d) returns null
+        //checks whether the port name starts with nni- which is the signature of an NNI Port
+        if (p.annotations().value(AnnotationKeys.PORT_NAME) != null &&
+                p.annotations().value(AnnotationKeys.PORT_NAME).startsWith(NNI)) {
+            log.error("NNI port number {} is not matching with configured value", p.number().toLong());
+            return false;
+        }
+        return true;
     }
 
     /**