From 0c501ffd69150962a20ead542d75cc6e3662106f Mon Sep 17 00:00:00 2001 From: Gilles Thouenon Date: Wed, 18 Oct 2023 19:34:05 +0200 Subject: [PATCH] Fix PCE bug to select the correct client port 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 Change-Id: Idd21a62dd67a4e3668a4d32f5074d347abbd20a2 --- .../transportpce/pce/PcePathDescription.java | 8 ++++---- .../pce/networkanalyzer/PceCalculation.java | 12 ++++++------ .../pce/networkanalyzer/PceLink.java | 19 ++++++++++++++----- .../pce/PcePathDescriptionTests.java | 2 +- .../pce/graph/PceGraphEdgeTest.java | 2 +- .../transportpce/pce/graph/PceGraphTest.java | 2 +- .../pce/networkanalyzer/PceLinkTest.java | 6 +++--- 7 files changed, 30 insertions(+), 21 deletions(-) diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java b/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java index 91a8ae846..6e2f3d5b3 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java @@ -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(); diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java index eaa8b1d52..facffa8c1 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java @@ -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); diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java index b8502021e..dbec53d6f 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java @@ -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 diff --git a/pce/src/test/java/org/opendaylight/transportpce/pce/PcePathDescriptionTests.java b/pce/src/test/java/org/opendaylight/transportpce/pce/PcePathDescriptionTests.java index 445144c39..4399afda1 100644 --- a/pce/src/test/java/org/opendaylight/transportpce/pce/PcePathDescriptionTests.java +++ b/pce/src/test/java/org/opendaylight/transportpce/pce/PcePathDescriptionTests.java @@ -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"); diff --git a/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphEdgeTest.java b/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphEdgeTest.java index 9b6bcf1fa..e6d9aa7e8 100644 --- a/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphEdgeTest.java +++ b/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphEdgeTest.java @@ -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); } diff --git a/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphTest.java b/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphTest.java index 4ce657c45..53ac45a77 100644 --- a/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphTest.java +++ b/pce/src/test/java/org/opendaylight/transportpce/pce/graph/PceGraphTest.java @@ -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); diff --git a/pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLinkTest.java b/pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLinkTest.java index a612b1506..90e53324b 100644 --- a/pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLinkTest.java +++ b/pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLinkTest.java @@ -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()); -- 2.36.6