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=56aaddf50df789c2ee6b63a96565704ad5415749;hb=f49968974e1477d4fd9cfdd87d867c9ad347678e;hp=a38682dec36aa124ea4c6a6ea1dbf28374f15b75;hpb=7f30d5b1d8c5f1e04a9a1595887aa260ff84a46f;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 a38682dec..56aaddf50 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 @@ -8,23 +8,24 @@ package org.opendaylight.transportpce.pce.networkanalyzer; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; import java.io.Serializable; 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.rev181130.Link1; -import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.span.attributes.LinkConcatenation; -import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.span.attributes.LinkConcatenation.FiberType; -import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.span.attributes.LinkConcatenationKey; -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.http.transportpce.topology.rev200129.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.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.http.transportpce.topology.rev220123.OtnLinkType; 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; 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; @@ -51,13 +52,15 @@ public class PceLink implements Serializable { private final OpenroadmLinkType linkType; private final NodeId sourceId; private final NodeId destId; - private transient Object sourceTP; - private transient Object destTP; + private final TpId sourceTP; + private final TpId destTP; private final String sourceNetworkSupNodeId; private final String destNetworkSupNodeId; private final String sourceCLLI; private final String destCLLI; private final LinkId oppositeLink; + private final AdminStates adminStates; + private final State state; private final Long latency; private final Long availableBandwidth; private final Long usedBandwidth; @@ -92,6 +95,9 @@ public class PceLink implements Serializable { this.oppositeLink = calcOpposite(link); + this.adminStates = link.augmentation(Link1.class).getAdministrativeState(); + this.state = link.augmentation(Link1.class).getOperationalState(); + if (this.linkType == OpenroadmLinkType.ROADMTOROADM) { this.omsAttributesSpan = MapUtils.getOmsAttributesSpan(link); this.srlgList = MapUtils.getSRLG(link); @@ -146,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; + tmp += entry.getValue().getSRLGLength().doubleValue() / CELERITY; LOG.info("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; } @@ -168,7 +174,8 @@ public class PceLink implements Serializable { 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) @@ -210,11 +217,19 @@ public class PceLink implements Serializable { return oppositeLink; } - public Object getSourceTP() { + public AdminStates getAdminStates() { + return adminStates; + } + + public State getState() { + return state; + } + + public TpId getSourceTP() { return sourceTP; } - public Object getDestTP() { + public TpId getDestTP() { return destTP; } @@ -304,7 +319,7 @@ public class PceLink implements Serializable { } OtnLinkType otnLinkType = link - .augmentation(org.opendaylight.yang.gen.v1.http.transportpce.topology.rev200129.Link1.class) + .augmentation(org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1.class) .getOtnLinkType(); if (this.availableBandwidth == 0L) { LOG.error("PceLink: No bandwidth available for OTN Link, link {} is ignored ", linkId); @@ -314,8 +329,31 @@ 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; + } + neededBW = 400000L; + neededType = OtnLinkType.OTUC4; + break; case "ODU4": + case "100GEs": if (this.usedBandwidth != 0L) { return false; } @@ -332,6 +370,11 @@ public class PceLink implements Serializable { case "ODU1": neededBW = 2500L; break; + case "100GEm": + neededBW = 100000L; + // TODO: Here link type needs to be changed, based on the line-rate + neededType = OtnLinkType.ODUC4; + break; case "10GE": neededBW = 10000L; neededType = OtnLinkType.ODTU4; @@ -359,6 +402,10 @@ public class PceLink implements Serializable { LOG.error("PceLink: No Link type or opposite link is available. Link is ignored {}", linkId); return false; } + if ((this.adminStates == null) || (this.state == null)) { + LOG.error("PceLink: Link is not available. Link is ignored {}", linkId); + return false; + } if ((this.sourceId == null) || (this.destId == null) || (this.sourceTP == null) || (this.destTP == null)) { LOG.error("PceLink: No Link source or destination is available. Link is ignored {}", linkId); return false; @@ -380,16 +427,4 @@ public class PceLink implements Serializable { public String toString() { return "PceLink type=" + linkType + " ID=" + linkId.getValue() + " latency=" + latency; } - - private void writeObject(ObjectOutputStream out) throws IOException { - out.defaultWriteObject(); - out.writeObject(this.sourceTP); - out.writeObject(this.destTP); - } - - private void readObject(ObjectInputStream in) throws IOException,ClassNotFoundException { - in.defaultReadObject(); - this.sourceTP = in.readObject(); - this.destTP = in.readObject(); - } }