X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fnetworkanalyzer%2FPceCalculation.java;h=e880d02b441e9e2cf61ffa77aec0fc9320d61ae7;hb=bc9a08be9d7cdeb30ecffd3c82ddd656a3a23043;hp=fd8f3a28007fea337672ec7a5ce060b3e3b82346;hpb=e6f1b3acce76396e50731b0c97b07c36dca7224d;p=transportpce.git 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 fd8f3a280..e880d02b4 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 @@ -11,14 +11,12 @@ package org.opendaylight.transportpce.pce.networkanalyzer; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; - import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.common.ResponseCodes; @@ -112,8 +110,6 @@ public class PceCalculation { } private boolean parseInput() { - anodeId = input.getServiceAEnd().getNodeId(); - znodeId = input.getServiceZEnd().getNodeId(); if (input.getServiceAEnd().getServiceFormat() == null || input.getServiceZEnd().getServiceFormat() == null || input.getServiceAEnd().getServiceRate() == null) { LOG.error("Service Format and Service Rate are required for a path calculation"); @@ -160,6 +156,13 @@ public class PceCalculation { LOG.debug("parseInput: unsupported service type: Format {} Rate {}", serviceFormatA, serviceRate); } + if ("ODU4".equals(serviceType) || "10GE".equals(serviceType) || "1GE".equals(serviceType)) { + anodeId = input.getServiceAEnd().getTxDirection().getPort().getPortDeviceName(); + znodeId = input.getServiceZEnd().getTxDirection().getPort().getPortDeviceName(); + } else { + anodeId = input.getServiceAEnd().getNodeId(); + znodeId = input.getServiceZEnd().getNodeId(); + } returnStructure.setRate(input.getServiceAEnd().getServiceRate().toJava()); returnStructure.setServiceFormat(input.getServiceAEnd().getServiceFormat()); @@ -205,12 +208,13 @@ public class PceCalculation { LOG.error("readMdSal: network is null: {}", nwInstanceIdentifier); return false; } - allNodes = nw.getNode().stream().sorted((n1, n2) -> n1.getNodeId().getValue().compareTo(n2.getNodeId() - .getValue())).collect(Collectors.toList()); + allNodes = nw.nonnullNode().values().stream().sorted((n1, n2) + -> n1.getNodeId().getValue().compareTo(n2.getNodeId().getValue())).collect(Collectors.toList()); Network1 nw1 = nw.augmentation(Network1.class); if (nw1 != null) { - allLinks = nw1.getLink().stream().sorted((l1, l2) -> l1.getSource().getSourceTp().toString().compareTo(l2 - .getSource().getSourceTp().toString())).collect(Collectors.toList()); + allLinks = nw1.nonnullLink().values().stream().sorted((l1, l2) + -> l1.getSource().getSourceTp().toString().compareTo(l2.getSource().getSourceTp().toString())) + .collect(Collectors.toList()); } else { LOG.warn("no otn links in otn-topology"); } @@ -628,12 +632,10 @@ public class PceCalculation { return returnStructure; } - private static void printNodesInfo(Map allpcenodes) { - Iterator> nodes = allpcenodes.entrySet().iterator(); - while (nodes.hasNext()) { - PceNode pcenode = nodes.next().getValue(); - List links = pcenode.getOutgoingLinks(); - LOG.info("In printNodes in node {} : outgoing links {} ", pcenode.getNodeId().getValue(), links); - } + private static void printNodesInfo(Map allPceNodes) { + allPceNodes.forEach(((nodeId, pceNode) -> { + LOG.info("In printNodes in node {} : outgoing links {} ", pceNode.getNodeId().getValue(), + pceNode.getOutgoingLinks()); + })); } }