Merge "[CORD-2253] Update ONOS to 1.10.10" into cord-4.1
diff --git a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java
index f406ed5..9b18473 100644
--- a/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java
+++ b/global/ce-orchestration/src/main/java/org/opencord/ce/global/orchestration/MetroOrchestrationManager.java
@@ -75,6 +75,7 @@
 import static org.opencord.ce.api.models.CarrierEthernetLogicalTerminationPoint.Role;
 import static org.opencord.ce.api.models.CarrierEthernetVirtualConnection.Type;
 import static org.onosproject.net.config.basics.SubjectFactories.CONNECT_POINT_SUBJECT_FACTORY;
+import static org.opencord.ce.api.services.channel.Symbols.MEF_PORT_TYPE;
 import static org.slf4j.LoggerFactory.getLogger;
 
 /**
@@ -1116,42 +1117,20 @@
     }
 
     /**
-     * Validates whether the provided connect point can be associated with an LTP of the provided type.
-     *
-     * Conditions for validating the LTP type:
-     * - If UNI: ConnectPoint is not associated with any link
-     * - If INNI/ENNI: ConnectPoint is associated with a link
+     * Validates whether the provided connect point can be associated with an LTP of the provided type
+     * based on port annotation. This is consistent with how underlying domains configure
+     * Carrier Ethernet interfaces to expose to the global controller.
      *
      * @param cp the connect point associated with the LTP to be validated
      * @param ltpType the type of the LTP to be validated or null in case a type is to be decided by the method
      * @return the ltpType if validation succeeded, a new type depending on cp and topo, or null if validation failed
-     */
+     * */
     private CarrierEthernetNetworkInterface.Type validateLtpType(
             ConnectPoint cp, CarrierEthernetNetworkInterface.Type ltpType) {
-        if (linkService.getEgressLinks(cp).isEmpty() && linkService.getIngressLinks(cp).isEmpty()) {
-            // A connect point can be a UNI only if it doesn't belong to any link
-            if (ltpType == null) {
-                // If provided type is null, decide about the LTP type based on connectivity
-                return CarrierEthernetNetworkInterface.Type.UNI;
-            } else if (ltpType.equals(CarrierEthernetNetworkInterface.Type.UNI)) {
-                // Validate type
-                return ltpType;
-            } else {
-                return null;
-            }
-        } else {
-            // A connect point can be an INNI or ENNI only if it belongs to a link
-            if (ltpType == null) {
-                // If provided type is null, decide about the LTP type based on connectivity
-                return CarrierEthernetNetworkInterface.Type.INNI;
-            } else if (ltpType.equals(CarrierEthernetNetworkInterface.Type.INNI) ||
-                    ltpType.equals(CarrierEthernetNetworkInterface.Type.ENNI)) {
-                // Validate type
-                return ltpType;
-            } else {
-                return null;
-            }
-        }
+        Port port = deviceService.getPort(cp);
+        CarrierEthernetNetworkInterface.Type type = CarrierEthernetNetworkInterface.Type.valueOf(
+                port.annotations().value(MEF_PORT_TYPE));
+        return (type == ltpType) ? type : null;
     }
 
     @Override