Update transportpce-topology enums
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / networkanalyzer / PceLink.java
index 0da2abcc58cbf0c3814e62f037b943581ea9c1b4..cda77d137b2c0dc9a6866ffbcbbc7b26a98805ad 100644 (file)
@@ -8,9 +8,6 @@
 
 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;
@@ -24,9 +21,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev200529.span.attri
 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.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 +51,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;
@@ -225,11 +223,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 +317,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 +327,15 @@ public class PceLink implements Serializable {
         long neededBW;
         OtnLinkType neededType = null;
         switch (serviceType) {
-
+            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 +352,10 @@ public class PceLink implements Serializable {
             case "ODU1":
                 neededBW = 2500L;
                 break;
+            case "100GEm":
+                neededBW = 100000L;
+                neededType = OtnLinkType.ODUC4;
+                break;
             case "10GE":
                 neededBW = 10000L;
                 neededType = OtnLinkType.ODTU4;
@@ -399,16 +408,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();
-    }
 }