* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.transportpce.pce;
+
+package org.opendaylight.transportpce.pce.networkanalyzer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Optional;
import java.util.TreeMap;
+import org.opendaylight.transportpce.pce.SortPortsByName;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.Node1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.networks.network.node.termination.point.pp.attributes.UsedWavelength;
////////////////////////// NODES ///////////////////////////
/*
*/
+
private boolean valid = true;
+
private final Node node;
private final NodeId nodeId;
private final OpenroadmNodeType nodeType;
+ private final String supNodeId;
+ private final String clli;
+
// wavelength calculation per node type
private List<Long> availableWLindex = new ArrayList<Long>();
private Map<String, OpenroadmTpType> availableSrgPp = new TreeMap<String, OpenroadmTpType>();
this.node = node;
this.nodeId = nodeId;
this.nodeType = nodeType;
+ this.supNodeId = getSupNodeId(node);
+ this.clli = MapUtils.getCLLI(node);
+
if ((node == null) || (nodeId == null) || (nodeType == null)) {
LOG.error("PceNode: one of parameters is not populated : nodeId, node type");
this.valid = false;
return;
}
+
+
+/* public PceNode(Node node, OpenroadmNodeType nodeType, NodeId nodeId,
+ String supNodeId, String clli) {
+ this.node = node;
+ this.nodeId = nodeId;
+ this.nodeType = nodeType;
+ this.supNodeId = supNodeId;
+ this.clli = clli;
+
+ if ((node == null) || (nodeId == null) || (nodeType == null)
+ || (supNodeId == null) || (clli == null)) {
+ LOG.error(
+ "PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId");
+ valid = false;
+ }
+
+ LOG.debug(" PceNode built :{}", this.toString());
+ }
+*/
public void initWLlist() {
this.availableWLindex.clear();
if (!isValid()) {
}
}
+ private String getSupNodeId(Node inputNode) {
+ String tempSupId = "";
+ // TODO: supporting IDs exist as a List. this code takes just the
+ // first element
+ tempSupId = MapUtils.getSupNode(inputNode);
+ if (tempSupId.equals("")) {
+ LOG.error("getSupNodeId: Empty Supporting node for node: [{}]. Node is ignored", inputNode.getNodeId());
+ }
+ return tempSupId;
+ }
+
+ 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))) {
+
+ LOG.info("validateAZxponder: A or Z node detected == {}", nodeId.getValue());
+ initXndrTps();
+ return;
+ }
+
+ LOG.debug("validateAZxponder: XPONDER is ignored == {}", nodeId.getValue());
+ valid = false;
+ }
+
+ public String getXpdrClient(String tp) {
+ return this.clientPerNwTp.get(tp);
+ }
+
public boolean checkTP(String tp) {
return !(this.usedXpndrNWTps.contains(tp));
}
}
public boolean isValid() {
- return this.valid;
+ if ((node == null) || (nodeId == null) || (nodeType == null) || (supNodeId == null) || (clli == null)) {
+ LOG.error("PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId");
+ valid = false;
+ }
+ return valid;
}
public List<Long> getAvailableWLs() {
- return this.availableWLindex;
+ return availableWLindex;
}
public void addOutgoingLink(PceLink outLink) {
}
public List<PceLink> getOutgoingLinks() {
- return this.outgoingLinks;
+ return outgoingLinks;
}
- public String getXpdrClient(String tp) {
- return this.clientPerNwTp.get(tp);
+ public String getClient(String tp) {
+ return clientPerNwTp.get(tp);
+ }
+
+ public NodeId getNodeId() {
+ return nodeId;
+ }
+
+ public String getSupNodeIdPceNode() {
+ return supNodeId;
+ }
+
+ public String getCLLI() {
+ return clli;
}
- @Override
public String toString() {
- return "PceNode type=" + this.nodeType + " ID=" + this.nodeId.getValue();
+ return "PceNode type=" + nodeType + " ID=" + nodeId.getValue() + " CLLI=" + clli;
}
+
+ public void printLinksOfNode() {
+ LOG.info(" outgoing links of node {} : {} ", nodeId.getValue(), this.getOutgoingLinks().toString());
+ }
+
}