X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fnetworkanalyzer%2FPceNode.java;h=52e01056ac19ec6af2a7aa5c992528536922b1a8;hb=aafa2ea596dc9ea93b5ce5a7156ae68acf4b403f;hp=c869f16757d785ad0995bd092fd89ecaa9209ef8;hpb=442088b23f7f20667badfa66759c15d48ee28605;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceNode.java b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceNode.java index c869f1675..52e01056a 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceNode.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceNode.java @@ -15,6 +15,7 @@ import java.util.Map; import java.util.Optional; import java.util.TreeMap; +import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.pce.SortPortsByName; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.TerminationPoint1; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.Node1; @@ -35,10 +36,11 @@ public class PceNode { private boolean valid = true; - private final Node node; - private final NodeId nodeId; - private final OpenroadmNodeType nodeType; + protected final Node node; + protected final NodeId nodeId; + protected final OpenroadmNodeType nodeType; private final String supNodeId; + private final String supNetworkNodeId; private final String clli; // wavelength calculation per node type @@ -48,13 +50,19 @@ public class PceNode { private List usedXpndrNWTps = new ArrayList(); private List outgoingLinks = new ArrayList(); private Map clientPerNwTp = new HashMap(); + private Map> tpAvailableTribPort = new TreeMap>(); + private Map> tpAvailableTribSlot = new TreeMap>(); public PceNode(Node node, OpenroadmNodeType nodeType, NodeId nodeId) { this.node = node; this.nodeId = nodeId; this.nodeType = nodeType; this.supNodeId = getSupNodeId(node); - this.clli = MapUtils.getCLLI(node); + this.supNetworkNodeId = getNetworkSupNodeId(node); + //this.clli = MapUtils.getCLLI(node); + this.clli = getClliSupNodeId(node); + this.tpAvailableTribPort.clear(); + this.tpAvailableTribSlot.clear(); if ((node == null) || (nodeId == null) || (nodeType == null)) { LOG.error("PceNode: one of parameters is not populated : nodeId, node type"); @@ -289,23 +297,49 @@ public class PceNode { } } + private String getClliSupNodeId(Node inputNode) { + TreeMap allSupNodes = new TreeMap(); + String tempNetworkSupNodeId = ""; + allSupNodes = MapUtils.getAllSupNode(inputNode); + if (allSupNodes.get(NetworkUtils.CLLI_NETWORK_ID) == null) { + LOG.error("getClliSupNodeId: No Supporting node at CLLI layer for node: [{}].", inputNode.getNodeId()); + } else { + tempNetworkSupNodeId = allSupNodes.get(NetworkUtils.CLLI_NETWORK_ID); + } + return tempNetworkSupNodeId; + } + + public String getClliSupNodeId() { + return clli; + } + + private String getNetworkSupNodeId(Node inputNode) { + TreeMap allSupNodes = new TreeMap(); + String tempNetworkSupNodeId = ""; + allSupNodes = MapUtils.getAllSupNode(inputNode); + if (allSupNodes.get(NetworkUtils.UNDERLAY_NETWORK_ID) == null) { + LOG.error( + "getNetworkSupNodeId: No Supporting node at NETWORK layer for node: [{}].", inputNode.getNodeId()); + } else { + tempNetworkSupNodeId = allSupNodes.get(NetworkUtils.UNDERLAY_NETWORK_ID); + } + return tempNetworkSupNodeId; + } + + public void validateAZxponder(String anodeId, String znodeId) { if (!isValid()) { return; } - if (this.nodeType != OpenroadmNodeType.XPONDER) { return; } - // Detect A and Z - if (this.supNodeId.equals(anodeId) || (this.supNodeId.equals(znodeId))) { - + if (this.supNetworkNodeId.equals(anodeId) || (this.supNetworkNodeId.equals(znodeId))) { LOG.info("validateAZxponder: A or Z node detected == {}", nodeId.getValue()); initXndrTps(); return; } - LOG.debug("validateAZxponder: XPONDER is ignored == {}", nodeId.getValue()); valid = false; } @@ -323,7 +357,7 @@ public class PceNode { } public boolean isValid() { - if ((node == null) || (nodeId == null) || (nodeType == null) || (supNodeId == null) || (clli == null)) { + if ((node == null) || (nodeId == null) || (nodeType == null) || (supNetworkNodeId == null) || (clli == null)) { LOG.error("PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId"); valid = false; } @@ -354,6 +388,10 @@ public class PceNode { return supNodeId; } + public String getSupNetworkNodeIdPceNode() { + return supNetworkNodeId; + } + public String getCLLI() { return clli; } @@ -366,4 +404,12 @@ public class PceNode { LOG.info(" outgoing links of node {} : {} ", nodeId.getValue(), this.getOutgoingLinks().toString()); } + public Map> getAvailableTribPorts() { + return tpAvailableTribPort; + } + + public Map> getAvailableTribSlots() { + return tpAvailableTribSlot; + } + }