Update portmapping model
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / networkanalyzer / PceCalculation.java
index e7d7a6c563cebe3cd542b9f04663a56e2cf3c191..373a3d695f156b8f160a33f97a25f1b5b8497e91 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.transportpce.common.service.ServiceTypes;
 import org.opendaylight.transportpce.pce.PceComplianceCheck;
 import org.opendaylight.transportpce.pce.constraints.PceConstraints;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mc.capabilities.McCapabilities;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mc.capabilities.McCapabilities;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
@@ -160,6 +160,7 @@ public class PceCalculation {
             case StringConstants.SERVICE_TYPE_ODU4:
             case StringConstants.SERVICE_TYPE_ODUC4:
             case StringConstants.SERVICE_TYPE_100GE_M:
+            case StringConstants.SERVICE_TYPE_100GE_S:
             case StringConstants.SERVICE_TYPE_10GE:
             case StringConstants.SERVICE_TYPE_1GE:
                 anodeId = input.getServiceAEnd().getTxDirection().getPort().getPortDeviceName();
@@ -184,6 +185,7 @@ public class PceCalculation {
                     .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
                 break;
             case StringConstants.SERVICE_TYPE_100GE_M:
+            case StringConstants.SERVICE_TYPE_100GE_S:
             case StringConstants.SERVICE_TYPE_ODU4:
             case StringConstants.SERVICE_TYPE_ODUC4:
             case StringConstants.SERVICE_TYPE_10GE:
@@ -210,7 +212,7 @@ public class PceCalculation {
             LOG.warn("no otn links in otn-topology");
         } else {
             allLinks = nw1.nonnullLink().values().stream().sorted((l1, l2)
-                -> l1.getSource().getSourceTp().toString().compareTo(l2.getSource().getSourceTp().toString()))
+                -> l1.getSource().getSourceTp().getValue().compareTo(l2.getSource().getSourceTp().getValue()))
                     .collect(Collectors.toList());
         }
         if (allNodes == null || allNodes.isEmpty()) {
@@ -390,6 +392,7 @@ public class PceCalculation {
             case StringConstants.SERVICE_TYPE_ODU4:
             case StringConstants.SERVICE_TYPE_10GE:
             case StringConstants.SERVICE_TYPE_100GE_M:
+            case StringConstants.SERVICE_TYPE_100GE_S:
             case StringConstants.SERVICE_TYPE_ODUC4:
             case StringConstants.SERVICE_TYPE_1GE:
                 return processPceOtnLink(link, source, dest);
@@ -591,12 +594,12 @@ public class PceCalculation {
                     pcelink.getlinkType(), pcelink);
                 break;
             case ADDLINK:
-                pcelink.setClient(source.getRdmSrgClient(pcelink.getSourceTP().toString()));
+                pcelink.setClient(source.getRdmSrgClient(pcelink.getSourceTP().getValue()));
                 addLinks.add(pcelink);
                 LOG.debug("validateLink: ADD-LINK saved  {}", pcelink);
                 break;
             case DROPLINK:
-                pcelink.setClient(dest.getRdmSrgClient(pcelink.getDestTP().toString()));
+                pcelink.setClient(dest.getRdmSrgClient(pcelink.getDestTP().getValue()));
                 dropLinks.add(pcelink);
                 LOG.debug("validateLink: DROP-LINK saved  {}", pcelink);
                 break;
@@ -604,13 +607,13 @@ public class PceCalculation {
                 // store separately all SRG links directly
                 azSrgs.add(sourceId);
                 // connected to A/Z
-                if (!dest.checkTP(pcelink.getDestTP().toString())) {
+                if (!dest.checkTP(pcelink.getDestTP().getValue())) {
                     LOG.debug(
                         "validateLink: XPONDER-INPUT is rejected as NW port is busy - {} ", pcelink);
                     return false;
                 }
-                if (dest.getXpdrClient(pcelink.getDestTP().toString()) != null) {
-                    pcelink.setClient(dest.getXpdrClient(pcelink.getDestTP().toString()));
+                if (dest.getXpdrClient(pcelink.getDestTP().getValue()) != null) {
+                    pcelink.setClient(dest.getXpdrClient(pcelink.getDestTP().getValue()));
                 }
                 allPceLinks.put(linkId, pcelink);
                 source.addOutgoingLink(pcelink);
@@ -621,13 +624,13 @@ public class PceCalculation {
                 // store separately all SRG links directly
                 azSrgs.add(destId);
                 // connected to A/Z
-                if (!source.checkTP(pcelink.getSourceTP().toString())) {
+                if (!source.checkTP(pcelink.getSourceTP().getValue())) {
                     LOG.debug(
                         "validateLink: XPONDER-OUTPUT is rejected as NW port is busy - {} ", pcelink);
                     return false;
                 }
-                if (source.getXpdrClient(pcelink.getSourceTP().toString()) != null) {
-                    pcelink.setClient(source.getXpdrClient(pcelink.getSourceTP().toString()));
+                if (source.getXpdrClient(pcelink.getSourceTP().getValue()) != null) {
+                    pcelink.setClient(source.getXpdrClient(pcelink.getSourceTP().getValue()));
                 }
                 allPceLinks.put(linkId, pcelink);
                 source.addOutgoingLink(pcelink);
@@ -657,10 +660,12 @@ public class PceCalculation {
 
         switch (pceOtnLink.getlinkType()) {
             case OTNLINK:
-                if (dest.getXpdrClient(pceOtnLink.getDestTP().toString()) != null) {
-                    pceOtnLink.setClient(dest.getXpdrClient(pceOtnLink.getDestTP().toString()));
+                if (source.getXpdrClient(pceOtnLink.getSourceTP().getValue()) != null) {
+                    pceOtnLink.setClient(source.getXpdrClient(pceOtnLink.getSourceTP().getValue()));
+                }
+                if (dest.getXpdrClient(pceOtnLink.getDestTP().getValue()) != null) {
+                    pceOtnLink.setClient(dest.getXpdrClient(pceOtnLink.getDestTP().getValue()));
                 }
-
                 allPceLinks.put(linkId, pceOtnLink);
                 source.addOutgoingLink(pceOtnLink);
                 LOG.info("validateLink: OTN-LINK added to allPceLinks {}", pceOtnLink);