Merge changes I453a92fd,I68ba6341
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / networkanalyzer / PceOpticalNode.java
index 826d34244faa2e424976d926fef09eb8e28879f7..611263d68a3f43e490abc0af1ab034a9146faa65 100644 (file)
@@ -21,8 +21,9 @@ import org.opendaylight.transportpce.common.StringConstants;
 import org.opendaylight.transportpce.common.fixedflex.GridConstant;
 import org.opendaylight.transportpce.common.mapping.PortMapping;
 import org.opendaylight.transportpce.pce.SortPortsByName;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.Endpoints;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.Preference;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.Endpoints;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
@@ -102,7 +103,7 @@ public class PceOpticalNode implements PceNode {
         }
     }
 
-    public void initSrgTps() {
+    public void initSrgTps(Preference portPreference) {
         this.availableSrgPp.clear();
         this.availableSrgCp.clear();
         if (!isValid()) {
@@ -141,6 +142,10 @@ public class PceOpticalNode implements PceNode {
                 case SRGTXPP:
                 case SRGTXRXPP:
                     LOG.debug("initSrgTpList: SRG-PP tp = {} found", tp.getTpId().getValue());
+                    if (!portPreference.isPreferredPort(nodeId.getValue(), tp.getTpId().getValue())) {
+                        LOG.warn("initSrgTpList: SRG-PP tp = {} is rejected by the client", tp.getTpId().getValue());
+                        break;
+                    }
                     if (isTerminationPointAvailable(nttp1)) {
                         LOG.debug("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
                         this.availableSrgPp.put(tp.getTpId().getValue(), cntp1.getTpType());