From 2d4fea02cd291920e94bd36f4f32299a27508206 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joakim=20T=C3=B6rnqvist?= Date: Thu, 7 Dec 2023 13:50:03 +0000 Subject: [PATCH] Spectrum assignment skipped the last node in path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit APIImpact Corrects an issue were the last node in a path was not taken into account during spectrum assignment. A path consists of a list of source/destination node pairs, eg [(N1,N2) (N2,N3) (N3,N4)]. Consider this network: [A] ----- [B], were A and B are ROADMs. During path computation the above example may produce a path such as: [(A-SRG1, A-DEG1) (A-DEG1, B-DEG1) (B-DEG1, B-SRG1)] The bug caused the code to skip checking for available spectrum on B-SRG1. This was due to spectrum assignment is only processed in the A-Z direction, combined with an iteration only taking the source node into account. JIRA: TRNSPRTPCE-772 Change-Id: Ia0822a1cdb0e4b5f67d9c9675e1203f0a0746ef6 Signed-off-by: Joakim Törnqvist --- .../pce/graph/PostAlgoPathValidator.java | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PostAlgoPathValidator.java b/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PostAlgoPathValidator.java index 7a3124b49..32624da2f 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PostAlgoPathValidator.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PostAlgoPathValidator.java @@ -1005,36 +1005,46 @@ public class PostAlgoPathValidator { BitSet result = BitSet.valueOf(freqMap); boolean isFlexGrid = true; LOG.debug("Processing path {} with length {}", path, path.getLength()); + BitSet pceNodeFreqMap; + Set pceNodes = new LinkedHashSet<>(); + for (PceGraphEdge edge : path.getEdgeList()) { - NodeId srcNodeId = edge.link().getSourceId(); - LOG.debug("Processing source {} ", srcNodeId); - if (allPceNodes.containsKey(srcNodeId)) { - PceNode pceNode = allPceNodes.get(srcNodeId); - LOG.debug("Processing PCE node {}", pceNode); - String pceNodeVersion = pceNode.getVersion(); - NodeId pceNodeId = pceNode.getNodeId(); - BigDecimal sltWdthGran = pceNode.getSlotWidthGranularity(); - BigDecimal ctralFreqGran = pceNode.getCentralFreqGranularity(); - if (StringConstants.OPENROADM_DEVICE_VERSION_1_2_1.equals(pceNodeVersion)) { - LOG.debug("Node {}: version is {} and slot width granularity is {} -> fixed grid mode", - pceNodeId, pceNodeVersion, sltWdthGran); - isFlexGrid = false; - } - if (sltWdthGran.setScale(0, RoundingMode.CEILING).equals(GridConstant.SLOT_WIDTH_50) - && ctralFreqGran.setScale(0, RoundingMode.CEILING).equals(GridConstant.SLOT_WIDTH_50)) { - LOG.debug("Node {}: version is {} with slot width granularity {} and central " - + "frequency granularity is {} -> fixed grid mode", - pceNodeId, pceNodeVersion, sltWdthGran, ctralFreqGran); - isFlexGrid = false; - } - BitSet pceNodeFreqMap = pceNode.getBitSetData(); - LOG.debug("Pce node bitset {}", pceNodeFreqMap); - if (pceNodeFreqMap != null) { - result.and(pceNodeFreqMap); - LOG.debug("intermediate bitset {}", result); - } + PceLink link = edge.link(); + LOG.debug("Processing {} to {}", link.getSourceId().getValue(), link.getDestId().getValue()); + if (allPceNodes.containsKey(link.getSourceId())) { + pceNodes.add(allPceNodes.get(link.getSourceId())); + } + if (allPceNodes.containsKey(link.getDestId())) { + pceNodes.add(allPceNodes.get(link.getDestId())); } } + + for (PceNode pceNode : pceNodes) { + LOG.debug("Processing PCE node {}", pceNode); + String pceNodeVersion = pceNode.getVersion(); + NodeId pceNodeId = pceNode.getNodeId(); + BigDecimal sltWdthGran = pceNode.getSlotWidthGranularity(); + BigDecimal ctralFreqGran = pceNode.getCentralFreqGranularity(); + if (StringConstants.OPENROADM_DEVICE_VERSION_1_2_1.equals(pceNodeVersion)) { + LOG.debug("Node {}: version is {} and slot width granularity is {} -> fixed grid mode", + pceNodeId, pceNodeVersion, sltWdthGran); + isFlexGrid = false; + } + if (sltWdthGran.setScale(0, RoundingMode.CEILING).equals(GridConstant.SLOT_WIDTH_50) + && ctralFreqGran.setScale(0, RoundingMode.CEILING).equals(GridConstant.SLOT_WIDTH_50)) { + LOG.debug("Node {}: version is {} with slot width granularity {} and central " + + "frequency granularity is {} -> fixed grid mode", + pceNodeId, pceNodeVersion, sltWdthGran, ctralFreqGran); + isFlexGrid = false; + } + pceNodeFreqMap = pceNode.getBitSetData(); + LOG.debug("Pce node bitset {}", pceNodeFreqMap); + if (pceNodeFreqMap != null) { + result.and(pceNodeFreqMap); + LOG.debug("intermediate bitset {}", result); + } + + } LOG.debug("Bitset result {}", result); return computeBestSpectrumAssignment(result, spectralWidthSlotNumber, isFlexGrid); } -- 2.36.6