From 403c6fc1ceedebc10b1c971ff65ac54402d9a656 Mon Sep 17 00:00:00 2001 From: Christophe Betoule Date: Wed, 25 Nov 2020 16:06:58 +0100 Subject: [PATCH] Fix issue in PCE - manage the case when openroadm-topology contains multiple XPDR nodes with the same supporting node-ref in openroadm-network - update network topology for PCE func tests by adding tp-type for SGR in complex openroadm-topology Co-authored-by: Gilles Thouenon Signed-off-by: Christophe Betoule Change-Id: I7212181d5eb84a56c13e0eb9ff918d46136c2ca2 --- .../pce/networkanalyzer/PceCalculation.java | 34 +- tests/sample_configs/NW-for-test-5-4.xml | 1020 +++++++++++++---- 2 files changed, 848 insertions(+), 206 deletions(-) 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 fa5a3fd7e..033b3a9eb 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 @@ -483,16 +483,15 @@ public class PceCalculation { LOG.warn(" validateNode: Node is ignored"); return false; } - if (validateNodeConstraints(pceNode).equals(ConstraintTypes.HARD_EXCLUDE)) { return false; } - if ((pceNode.getSupNetworkNodeId().equals(anodeId) && (this.aendPceNode == null)) - && (Boolean.TRUE.equals(endPceNode(nodeType, pceNode.getNodeId(), pceNode)))) { + if (endPceNode(nodeType, pceNode.getNodeId(), pceNode) && this.aendPceNode == null + && isAZendPceNode(this.serviceFormatA, pceNode, anodeId, "A")) { this.aendPceNode = pceNode; } - if ((pceNode.getSupNetworkNodeId().equals(znodeId) && (this.zendPceNode == null)) - && (Boolean.TRUE.equals(endPceNode(nodeType, pceNode.getNodeId(), pceNode)))) { + if (endPceNode(nodeType, pceNode.getNodeId(), pceNode) && this.zendPceNode == null + && isAZendPceNode(this.serviceFormatZ, pceNode, znodeId, "Z")) { this.zendPceNode = pceNode; } @@ -501,8 +500,31 @@ public class PceCalculation { return true; } - private boolean validateOtnNode(Node node) { + private boolean isAZendPceNode(String serviceFormat, PceOpticalNode pceNode, String azNodeId, String azEndPoint) { + switch (serviceFormat) { + case "Ethernet": + case "OC": + if (pceNode.getSupNetworkNodeId().equals(azNodeId)) { + return true; + } + return false; + case "OTU": + if ("A".equals(azEndPoint) && pceNode.getNodeId().getValue() + .equals(this.input.getServiceAEnd().getRxDirection().getPort().getPortDeviceName())) { + return true; + } + if ("Z".equals(azEndPoint) && pceNode.getNodeId().getValue() + .equals(this.input.getServiceZEnd().getRxDirection().getPort().getPortDeviceName())) { + return true; + } + return false; + default: + LOG.debug("Unsupported service Format {} for node {}", serviceFormat, pceNode.getNodeId().getValue()); + return false; + } + } + private boolean validateOtnNode(Node node) { LOG.info("validateOtnNode: {} ", node.getNodeId().getValue()); // PceOtnNode will be used in Graph algorithm if (node.augmentation(Node1.class) != null) { diff --git a/tests/sample_configs/NW-for-test-5-4.xml b/tests/sample_configs/NW-for-test-5-4.xml index e335b70c8..a6da041d6 100644 --- a/tests/sample_configs/NW-for-test-5-4.xml +++ b/tests/sample_configs/NW-for-test-5-4.xml @@ -67,16 +67,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-1-1 openroadm-networkXPONDER-1-1 @@ -190,16 +221,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-1-2 openroadm-networkXPONDER-1-2 @@ -313,16 +375,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-1-3 openroadm-networkXPONDER-1-3 @@ -436,16 +529,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-1-4 openroadm-networkXPONDER-1-4 @@ -559,16 +683,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-2-1 openroadm-networkXPONDER-2-1 @@ -682,16 +837,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-2-2 openroadm-networkXPONDER-2-2 @@ -805,16 +991,47 @@ > - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-2-3 openroadm-networkXPONDER-2-3 @@ -928,16 +1145,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-2-4 openroadm-networkXPONDER-2-4 @@ -1051,16 +1299,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-3-1 openroadm-networkXPONDER-3-1 @@ -1174,16 +1453,47 @@ > - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-3-2 openroadm-networkXPONDER-3-2 @@ -1297,16 +1607,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-3-3 openroadm-networkXPONDER-3-3 @@ -1420,16 +1761,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-3-4 openroadm-networkXPONDER-3-4 @@ -1543,16 +1915,47 @@ > - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-4-1 openroadm-networkXPONDER-4-1 @@ -1666,16 +2069,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-4-2 openroadm-networkXPONDER-4-2 @@ -1789,16 +2223,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-4-3 openroadm-networkXPONDER-4-3 @@ -1912,16 +2377,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-4-4 openroadm-networkXPONDER-4-4 @@ -2035,16 +2531,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-5-1 openroadm-networkXPONDER-5-1 @@ -2158,16 +2685,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-5-2 openroadm-networkXPONDER-5-2 @@ -2281,16 +2839,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-5-3 openroadm-networkXPONDER-5-3 @@ -2404,16 +2993,47 @@ - SRG1-CP-RX - SRG1-CP-TX - SRG1-PP1-RX - SRG1-PP1-TX - SRG1-PP2-RX - SRG1-PP2-TX - SRG1-PP3-RX - SRG1-PP3-TX - SRG1-PP4-RX - SRG1-PP4-TX + + SRG1-CP-RX + SRG-RX-CP + + + SRG1-CP-TX + SRG-TX-CP + + + SRG1-PP1-RX + SRG-RX-PP + + + SRG1-PP1-TX + SRG-TX-PP + + + SRG1-PP2-RX + SRG-RX-PP + + + SRG1-PP2-TX + SRG-TX-PP + + + SRG1-PP3-RX + SRG-RX-PP + + + SRG1-PP3-TX + SRG-TX-PP + + + SRG1-PP4-RX + SRG-RX-PP + + + SRG1-PP4-TX + SRG-TX-PP + + XPONDER-5-4 openroadm-networkXPONDER-5-4 -- 2.36.6