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=0da2abcc58cbf0c3814e62f037b943581ea9c1b4;hpb=2f13d2e6564596df4500eea94928bf13d4829808;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 0da2abcc5..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,25 +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.rev200529.Link1; +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.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; @@ -53,8 +52,8 @@ 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; @@ -153,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; } @@ -175,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) @@ -225,11 +225,11 @@ public class PceLink implements Serializable { return state; } - public Object getSourceTP() { + public TpId getSourceTP() { return sourceTP; } - public Object getDestTP() { + public TpId getDestTP() { return destTP; } @@ -319,7 +319,7 @@ 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.transportpce.topology.rev220123.Link1.class) .getOtnLinkType(); if (this.availableBandwidth == 0L) { LOG.error("PceLink: No bandwidth available for OTN Link, link {} is ignored ", linkId); @@ -329,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; } @@ -347,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; @@ -399,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(); - } }