package org.opendaylight.transportpce.pce;
import java.util.List;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.Link1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.network.link.oms.attributes.Span;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev170929.OpenroadmLinkType;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev150608.NodeId;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.LinkId;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.Link;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.Link1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.networks.network.link.oms.attributes.Span;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.OpenroadmLinkType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
private OpenroadmLinkType calcType(Link link) {
- Link1 link1 = null;
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.@Nullable Link1 link1 = null;
OpenroadmLinkType tmplType = null;
// ID and type
- link1 = link.augmentation(Link1.class);
+ link1 = link.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130
+ .Link1.class);
if (link1 == null) {
this.isValid = false;
LOG.error("PceLink: No Link augmentation available. Link is ignored {}", this.linkId);
private LinkId calcOpposite(Link link) {
// opposite link
LinkId tmpoppositeLink = null;
- org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1 linkOpposite = link
- .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1.class);
- tmpoppositeLink = linkOpposite.getOppositeLink();
+ Link1 linkOpposite = link.augmentation(Link1.class);
+ if (linkOpposite.getOppositeLink() != null) {
+ tmpoppositeLink = linkOpposite.getOppositeLink();
+ } else {
+ LOG.error("link {} has no opposite link", link.getLinkId().getValue());
+ }
LOG.debug("PceLink: reading oppositeLink. {}", linkOpposite.toString());
if (tmpoppositeLink == null) {
this.isValid = false;
@SuppressWarnings("checkstyle:VariableDeclarationUsageDistance")
public double retrieveOSNR() {
- double sum = 0; // sum of 1 over the span OSNRs (linear units)
- double linkOsnrDb; // link OSNR, in dB
- double linkOsnrLu; // link OSNR, in dB
- double spanOsnrDb; // span OSNR, in dB
- double spanOsnrLu; // span OSNR, in linear units
- double ampNoise = 5.5; // default amplifier noise value, in dB
- double loss; // fiber span measured loss, in dB
- double power; // launch power, in dB
+ // sum of 1 over the span OSNRs (linear units)
+ double sum = 0;
+ // link OSNR, in dB
+ double linkOsnrDb;
+ // link OSNR, in dB
+ double linkOsnrLu;
+ // span OSNR, in dB
+ double spanOsnrDb;
+ // span OSNR, in linear units
+ double spanOsnrLu;
+ // default amplifier noise value, in dB
+ double ampNoise = 5.5;
+ // fiber span measured loss, in dB
+ double loss;
+ // launch power, in dB
+ double power;
double constantA = 38.97293;
double constantB = 0.72782;
double constantC = -0.532331;
double lowerBoundOSNR = 0.1;
if (omsAttributesSpan == null) {
- return 0L; // indicates no data or N/A
+ // indicates no data or N/A
+ return 0L;
}
loss = omsAttributesSpan.getSpanlossCurrent().getValue().doubleValue();
switch (omsAttributesSpan.getLinkConcatenation().get(0).getFiberType()) {
spanOsnrDb = lowerBoundOSNR;
}
spanOsnrLu = Math.pow(10, (spanOsnrDb / 10.0));
- sum = PceConstraints.constOSNR / spanOsnrLu;
+ sum = PceConstraints.CONST_OSNR / spanOsnrLu;
linkOsnrLu = sum;
//link_OSNR_dB = 10 * Math.log10(1 / sum);
LOG.debug("In retrieveOSNR: link OSNR is {} dB", linkOsnrLu);