Fix PCE bug to select the correct client port 06/108506/3
authorGilles Thouenon <gilles.thouenon@orange.com>
Wed, 18 Oct 2023 17:34:05 +0000 (19:34 +0200)
committerGilles Thouenon <gilles.thouenon@orange.com>
Thu, 19 Oct 2023 17:20:48 +0000 (19:20 +0200)
Introduce a clientA and clientZ into PceLink to allow having different
values at both ends of the path.

JIRA: TRNSPRTPCE-768
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Idd21a62dd67a4e3668a4d32f5074d347abbd20a2

pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java
pce/src/test/java/org/opendaylight/transportpce/pce/PcePathDescriptionTests.java
pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphEdgeTest.java
pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphTest.java
pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLinkTest.java

index 91a8ae84621958e6fc989ed7be909260c90b3b68..6e2f3d5b37d84f59ee9102314cee5e2c8e28e6b3 100644 (file)
@@ -199,7 +199,7 @@ public class PcePathDescription {
         AToZ lastResource = null;
 
         // build A side Client TP
-        String tpName = path.get(0).getClient();
+        String tpName = path.get(0).getClientA();
         String xname = path.get(0).getSourceId().getValue();
         TerminationPoint stp = new TerminationPointBuilder()
                 .setTpId(tpName).setTpNodeId(xname)
@@ -284,7 +284,7 @@ public class PcePathDescription {
         }
 
         // build Z side Client TP
-        tpName = lastLink.getClient();
+        tpName = lastLink.getClientZ();
         xname = lastLink.getDestId().getValue();
         stp = new TerminationPointBuilder()
                 .setTpNodeId(xname).setTpId(tpName)
@@ -305,7 +305,7 @@ public class PcePathDescription {
 
         // build Z size Client TP
         PceLink pcelink = this.allPceLinks.get(path.get(0).getOppositeLink());
-        String tpName = pcelink.getClient();
+        String tpName = pcelink.getClientA();
         String xname = pcelink.getSourceId().getValue();
         TerminationPoint stp = new TerminationPointBuilder()
                 .setTpNodeId(xname).setTpId(tpName)
@@ -393,7 +393,7 @@ public class PcePathDescription {
         }
 
         // build Z side Client TP
-        tpName = lastLink.getClient();
+        tpName = lastLink.getClientZ();
         xname = lastLink.getDestId().getValue();
         stp = new TerminationPointBuilder()
                 .setTpNodeId(xname).setTpId(tpName).build();
index eaa8b1d5280a4f7ed0758daf61f769e75ef99487..facffa8c17085f09bf95dc7e8d2448f21a7f76a6 100644 (file)
@@ -668,13 +668,13 @@ public class PceCalculation {
                     pcelink.getlinkType(), pcelink);
                 break;
             case ADDLINK:
-                pcelink.setClient(
+                pcelink.setClientA(
                     source.getRdmSrgClient(pcelink.getSourceTP().getValue(), StringConstants.SERVICE_DIRECTION_AZ));
                 addLinks.add(pcelink);
                 LOG.debug("validateLink: ADD-LINK saved  {}", pcelink);
                 break;
             case DROPLINK:
-                pcelink.setClient(
+                pcelink.setClientZ(
                     dest.getRdmSrgClient(pcelink.getDestTP().getValue(), StringConstants.SERVICE_DIRECTION_ZA));
                 dropLinks.add(pcelink);
                 LOG.debug("validateLink: DROP-LINK saved  {}", pcelink);
@@ -689,7 +689,7 @@ public class PceCalculation {
                     return false;
                 }
                 if (dest.getXpdrClient(pcelink.getDestTP().getValue()) != null) {
-                    pcelink.setClient(dest.getXpdrClient(pcelink.getDestTP().getValue()));
+                    pcelink.setClientZ(dest.getXpdrClient(pcelink.getDestTP().getValue()));
                 }
                 allPceLinks.put(linkId, pcelink);
                 source.addOutgoingLink(pcelink);
@@ -706,7 +706,7 @@ public class PceCalculation {
                     return false;
                 }
                 if (source.getXpdrClient(pcelink.getSourceTP().getValue()) != null) {
-                    pcelink.setClient(source.getXpdrClient(pcelink.getSourceTP().getValue()));
+                    pcelink.setClientA(source.getXpdrClient(pcelink.getSourceTP().getValue()));
                 }
                 allPceLinks.put(linkId, pcelink);
                 source.addOutgoingLink(pcelink);
@@ -737,10 +737,10 @@ public class PceCalculation {
         switch (pceOtnLink.getlinkType()) {
             case OTNLINK:
                 if (source.getXpdrClient(pceOtnLink.getSourceTP().getValue()) != null) {
-                    pceOtnLink.setClient(source.getXpdrClient(pceOtnLink.getSourceTP().getValue()));
+                    pceOtnLink.setClientA(source.getXpdrClient(pceOtnLink.getSourceTP().getValue()));
                 }
                 if (dest.getXpdrClient(pceOtnLink.getDestTP().getValue()) != null) {
-                    pceOtnLink.setClient(dest.getXpdrClient(pceOtnLink.getDestTP().getValue()));
+                    pceOtnLink.setClientZ(dest.getXpdrClient(pceOtnLink.getDestTP().getValue()));
                 }
                 allPceLinks.put(linkId, pceOtnLink);
                 source.addOutgoingLink(pceOtnLink);
index b8502021e77084b35315f1e3b11b8566d5743215..dbec53d6fbdc5894ce7bbb2b39e9c0b56fd9df1a 100644 (file)
@@ -49,7 +49,8 @@ public class PceLink implements Serializable {
 
     // this member is for XPONDER INPUT/OUTPUT links.
     // it keeps name of client corresponding to NETWORK TP
-    private String client = "";
+    private String clientA = "";
+    private String clientZ = "";
     private final LinkId linkId;
     private final OpenroadmLinkType linkType;
     private final NodeId sourceId;
@@ -372,16 +373,24 @@ public class PceLink implements Serializable {
         return destId;
     }
 
-    public String getClient() {
-        return client;
+    public String getClientA() {
+        return clientA;
     }
 
     public Double getLength() {
         return length;
     }
 
-    public void setClient(String client) {
-        this.client = client;
+    public void setClientA(String client) {
+        this.clientA = client;
+    }
+
+    public String getClientZ() {
+        return clientZ;
+    }
+
+    public void setClientZ(String client) {
+        this.clientZ = client;
     }
 
     // Double for transformer of JUNG graph
index 445144c399196fde19aaa3abf64169368cc54320..4399afda1da3930a672d3f1415044424c2498b9f 100644 (file)
@@ -71,7 +71,7 @@ public class PcePathDescriptionTests extends AbstractTest {
                 GridConstant.SLOT_WIDTH_50);
 
         pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode2);
-        pceLink.setClient("XPONDER-CLIENT");
+        pceLink.setClientA("XPONDER-CLIENT");
 
         pceResult = new PceResult();
         pceResult.setRC("200");
index 9b6bcf1fafbce7b91c8d4ea6a998c0d55ff4a623..e6d9aa7e8f8afe1cde78b992311c0373fe8e36e9 100644 (file)
@@ -50,7 +50,7 @@ public class PceGraphEdgeTest {
                 OpenroadmNodeType.SRG, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
                 GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
         pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode2);
-        pceLink.setClient("XPONDER-CLIENT");
+        pceLink.setClientA("XPONDER-CLIENT");
 
         pceGraphEdge = new PceGraphEdge(pceLink);
     }
index 4ce657c45e1c86e0e30b67bb8de63cd2c11e539f..53ac45a7728722819be79423055d770ee024a518 100644 (file)
@@ -404,7 +404,7 @@ public class PceGraphTest extends AbstractTest {
         pceOtnNode2.checkAvailableTribSlot();
 
         pceLink1 = new PceLink(link1, pceOtnNode, pceOtnNode2);
-        pceLink1.setClient("XPONDER-CLIENT");
+        pceLink1.setClientA("XPONDER-CLIENT");
 
         pceLink1.getDestId();
         pceOtnNode.addOutgoingLink(pceLink1);
index a612b1506661df9bda08155cf4279a548161fc08..90e53324b2f4bdabf52dc5e4bd7108823d550ea0 100644 (file)
@@ -176,9 +176,9 @@ public class PceLinkTest extends AbstractTest {
         assertNotNull(pceLink.getLinkId());
         assertNotNull(pceLink.getSourceId());
         assertNotNull(pceLink.getDestId());
-        pceLink.setClient("specific_client");
-        assertTrue(pceLink.getClient().equals("specific_client"));
-        assertNotNull(pceLink.getClient());
+        pceLink.setClientA("specific_client");
+        assertTrue(pceLink.getClientA().equals("specific_client"));
+        assertNotNull(pceLink.getClientA());
         assertNotNull(pceLink.getLatency());
         assertNotNull(pceLink.getAvailableBandwidth());
         assertNotNull(pceLink.getUsedBandwidth());