X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fnetworkanalyzer%2FPceLink.java;h=2d05a3e0989691eb4d65f8fd5cd54443c1fd3703;hb=21e44f9673e03245340291298869b27bf671497f;hp=028849f3f48e4b91a011ffe2a5117b318c668c0f;hpb=32dca3cd3f1894f783980b982ea4aaf527a274e2;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java index 028849f3f..2d05a3e09 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java @@ -13,15 +13,16 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; -import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev200529.span.attributes.LinkConcatenation; -import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev200529.span.attributes.LinkConcatenation.FiberType; -import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev200529.span.attributes.LinkConcatenationKey; -import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529.networks.network.link.oms.attributes.Span; -import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmLinkType; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.OtnLinkType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev211210.span.attributes.LinkConcatenation1; +import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev211210.span.attributes.LinkConcatenation1.FiberType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev211210.networks.network.link.oms.attributes.Span; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmLinkType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.link.concatenation.LinkConcatenation; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.link.concatenation.LinkConcatenationKey; 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.TpId; @@ -74,7 +75,7 @@ public class PceLink implements Serializable { private static final double LOWER_BOUND_OSNR = 0.1; public PceLink(Link link, PceNode source, PceNode dest) { - LOG.info("PceLink: : PceLink start "); + LOG.debug("PceLink: : PceLink start "); this.linkId = link.getLinkId(); @@ -151,14 +152,14 @@ public class PceLink implements Serializable { LOG.debug("In PceLink: cannot compute the latency for the link {}", link.getLinkId().getValue()); return 1L; } - tmp += entry.getValue().getSRLGLength().toJava() / CELERITY; - LOG.info("In PceLink: The latency of link {} == {}", link.getLinkId(), tmp); + tmp += entry.getValue().getSRLGLength().doubleValue() / CELERITY; + LOG.debug("In PceLink: The latency of link {} == {}", link.getLinkId(), tmp); } return (long) Math.ceil(tmp); } //Compute the OSNR of a span - public double calcSpanOSNR() { + private double calcSpanOSNR() { if (this.omsAttributesSpan == null) { return 0L; } @@ -172,8 +173,13 @@ public class PceLink implements Serializable { if (!linkConcatenationiterator.hasNext()) { return 0L; } + if (this.omsAttributesSpan.getSpanlossCurrent() == null) { + LOG.error("in PceLink : Spanloss is null"); + return 0L; + } // power on the output of the previous ROADM (dBm) - double pout = retrievePower(linkConcatenationiterator.next().getFiberType()); + double pout = retrievePower(linkConcatenationiterator.next().augmentation(LinkConcatenation1.class) + .getFiberType()); // span loss (dB) double spanLoss = this.omsAttributesSpan.getSpanlossCurrent().getValue().doubleValue(); // power on the input of the current ROADM (dBm) @@ -298,9 +304,14 @@ public class PceLink implements Serializable { LOG.error("PceLink: No Link type or opposite link is available. Link is ignored {}", linkId); } isValid = checkParams(); - if ((this.omsAttributesSpan == null) && (this.linkType == OpenroadmLinkType.ROADMTOROADM)) { - isValid = false; - LOG.error("PceLink: Error reading Span for OMS link. Link is ignored {}", linkId); + if (this.linkType == OpenroadmLinkType.ROADMTOROADM) { + if (this.omsAttributesSpan == null) { + isValid = false; + LOG.error("PceLink: Error reading Span for OMS link. Link is ignored {}", linkId); + } else if (this.omsAttributesSpan.getSpanlossCurrent() == null) { + isValid = false; + LOG.error("PceLink: Error reading Spanloss for OMS link. Link is ignored {}", linkId); + } } if ((this.srlgList != null) && (this.srlgList.isEmpty())) { isValid = false; @@ -317,7 +328,8 @@ public class PceLink implements Serializable { } OtnLinkType otnLinkType = link - .augmentation(org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.Link1.class) + .augmentation(org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils + .rev220630.Link1.class) .getOtnLinkType(); if (this.availableBandwidth == 0L) { LOG.error("PceLink: No bandwidth available for OTN Link, link {} is ignored ", linkId); @@ -327,6 +339,22 @@ public class PceLink implements Serializable { long neededBW; OtnLinkType neededType = null; switch (serviceType) { + case "ODUC2": + if (this.usedBandwidth != 0L) { + return false; + } + neededBW = 200000L; + // Add intermediate rate otn-link-type + neededType = OtnLinkType.OTUC2; + break; + case "ODUC3": + if (this.usedBandwidth != 0L) { + return false; + } + neededBW = 300000L; + // hange otn-link-type + neededType = OtnLinkType.OTUC3; + break; case "ODUC4": if (this.usedBandwidth != 0L) { return false; @@ -335,6 +363,7 @@ public class PceLink implements Serializable { neededType = OtnLinkType.OTUC4; break; case "ODU4": + case "100GEs": if (this.usedBandwidth != 0L) { return false; } @@ -353,6 +382,7 @@ public class PceLink implements Serializable { break; case "100GEm": neededBW = 100000L; + // TODO: Here link type needs to be changed, based on the line-rate neededType = OtnLinkType.ODUC4; break; case "10GE": @@ -370,7 +400,7 @@ public class PceLink implements Serializable { if ((this.availableBandwidth >= neededBW) && ((neededType == null) || (neededType.equals(otnLinkType)))) { - LOG.info("PceLink: Selected Link {} has available bandwidth and is eligible for {} creation ", + LOG.debug("PceLink: Selected Link {} has available bandwidth and is eligible for {} creation ", linkId, serviceType); }