.filter(val -> val.getUpToBoundary().doubleValue() >= calculatedParameter)
// takes the immediate greater or equal value
.findFirst().orElse(null);
- return penalty == null
+ if (penalty == null) {
//means a boundary that is greater than calculatedParameter couldn't be found
// Out of specification!
- ? 9999.9
- // In spec, return penalty associated with calculatedParameter
- : penalty.getPenaltyValue().getValue().doubleValue();
+ return 9999.9;
+ }
+ // In spec, return penalty associated with calculatedParameter
+ LOG.info("Penalty for {} is {} dB", impairmentType, penalty.getPenaltyValue().getValue().doubleValue());
+ return penalty.getPenaltyValue().getValue().doubleValue();
}
/**
if (ResponseCodes.RESPONSE_OK.equals(pceResult.getResponseCode())) {
LOG.info("Path is validated");
} else {
- LOG.warn("Path not validated - cause: {}", pceResult.getLocalCause());
- }
-
- if (!pceResult.getResponseCode().equals(ResponseCodes.RESPONSE_OK)) {
- LOG.warn("In calcPath: post algo validations DROPPED the path {}", path);
+ LOG.warn("In calcPath: post algo validations DROPPED the path {}; for following cause: {}",
+ path, pceResult.getLocalCause());
continue;
}
}
public static LinkId extractOppositeLink(Link link) {
- LinkId tmpoppositeLink = null;
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1 linkOpposite
+ var linkOpposite
= link.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1.class);
- tmpoppositeLink = linkOpposite.getOppositeLink();
+ if (linkOpposite == null) {
+ LOG.error("No opposite link augmentation for network link {}", link);
+ return null;
+ }
LOG.debug("PceLink: reading oppositeLink. {}", linkOpposite);
+ LinkId tmpoppositeLink = linkOpposite.getOppositeLink();
if (tmpoppositeLink == null) {
LOG.error("PceLink: Error reading oppositeLink. Link is ignored {}", link.getLinkId().getValue());
return null;
return tmpoppositeLink;
}
-
}
this.state = node.augmentation(org.opendaylight.yang.gen.v1.http
.org.openroadm.common.network.rev211210.Node1.class).getOperationalState();
} else {
- LOG.error("PceNode: one of parameters is not populated : nodeId, node type, slot width granularity");
+ LOG.error("PceNode {} : one of parameters is not populated : nodeId, node type, slot width granularity",
+ deviceNodeId);
this.valid = false;
}
}
return;
}
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .node.TerminationPoint tp : allTps) {
+ .node.TerminationPoint tp : allTps) {
TerminationPoint1 cntp1 = tp.augmentation(TerminationPoint1.class);
+ if (cntp1 == null) {
+ LOG.error("initXndrTps: {} - {} has no tp type", this.nodeId, tp.getTpId().toString());
+ continue;
+ }
if (cntp1.getTpType() != OpenroadmTpType.XPONDERNETWORK) {
LOG.debug("initXndrTps: {} is not an Xponder network port", cntp1.getTpType().getName());
continue;
public boolean isValid() {
if (node == null || nodeId == null || nodeType == null || this.getSupNetworkNodeId() == null
- || this.getSupClliNodeId() == null || adminStates == null || state == null) {
- LOG.error("PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId, "
- + "admin state, operational state");
+ || this.getSupClliNodeId() == null || adminStates == null || state == null) {
+ LOG.error("PceNode {}, nodeId {} NodeType {} : one of parameters is not populated : nodeId, node type,"
+ + " supporting nodeId, admin state, operational state", deviceNodeId, nodeId, nodeType);
valid = false;
}
return valid;