package ietf-network 2015-06-08 yang models
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / PceNode.java
index 3ec85d9f70156ab622b7bb58849a783e70ba4c24..1fc66905b94ce223c863721fc0da1ed78b9887bc 100644 (file)
@@ -12,7 +12,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.Node1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.TerminationPoint1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev170929.OpenroadmNodeType;
@@ -52,34 +51,34 @@ public class PceNode {
 
         if ((node == null) || (nodeId == null) || (nodeType == null)) {
             LOG.error("PceNode: one of parameters is not populated : nodeId, node type");
-            valid = false;
+            this.valid = false;
         }
     }
 
     public void initWLlist() {
 
-        availableWLindex.clear();
+        this.availableWLindex.clear();
 
         if (!isValid()) {
             return;
         }
 
-        Node1 node1 = node.getAugmentation(Node1.class);
+        Node1 node1 = this.node.augmentation(Node1.class);
 
-        switch (nodeType) {
+        switch (this.nodeType) {
             case SRG:
                 List<org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev170929.srg.node.attributes
                     .AvailableWavelengths> srgAvailableWL = node1.getSrgAttributes().getAvailableWavelengths();
 
                 if (srgAvailableWL == null) {
-                    valid = false;
+                    this.valid = false;
                     LOG.error("initWLlist: SRG AvailableWavelengths is empty for node  {}", this.toString());
                     return;
                 }
 
                 for (org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev170929.srg.node.attributes
                     .AvailableWavelengths awl : srgAvailableWL) {
-                    availableWLindex.add(awl.getIndex());
+                    this.availableWLindex.add(awl.getIndex());
                     LOG.debug("initWLlist: SRG next = {} in {}" , awl.getIndex() , this.toString());
                 }
 
@@ -90,14 +89,14 @@ public class PceNode {
                     .AvailableWavelengths> degAvailableWL = node1.getDegreeAttributes().getAvailableWavelengths();
 
                 if (degAvailableWL == null) {
-                    valid = false;
+                    this.valid = false;
                     LOG.error("initWLlist: DEG AvailableWavelengths is empty for node  {}", this.toString());
                     return;
                 }
 
                 for (org.opendaylight.yang.gen.v1.http.org.openroadm.degree.rev170929.degree.node.attributes
                     .AvailableWavelengths awl : degAvailableWL) {
-                    availableWLindex.add(awl.getIndex());
+                    this.availableWLindex.add(awl.getIndex());
                     LOG.debug("initWLlist: DEGREE next = {} in {}", awl.getIndex(), this.toString());
                 }
 
@@ -107,21 +106,21 @@ public class PceNode {
 
                 // HARD CODED 96
                 for (long i = 1; i <= 96; i++) {
-                    availableWLindex.add(i);
+                    this.availableWLindex.add(i);
                 }
 
                 break;
 
             default:
-                LOG.error("initWLlist: unsupported node type {} in node {}" , nodeType, this.toString());
+                LOG.error("initWLlist: unsupported node type {} in node {}" , this.nodeType, this.toString());
                 break;
         }
 
-        if (availableWLindex.size() == 0) {
+        if (this.availableWLindex.size() == 0) {
             LOG.debug("initWLlist: There are no available wavelengths in node {}", this.toString());
-            valid = false;
+            this.valid = false;
         }
-        LOG.debug("initWLlist: availableWLindex size = {} in {}" , availableWLindex.size(), this.toString());
+        LOG.debug("initWLlist: availableWLindex size = {} in {}" , this.availableWLindex.size(), this.toString());
 
         return;
     }
@@ -133,32 +132,32 @@ public class PceNode {
         }
 
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.Node1 nodeTp =
-            node.getAugmentation(
+            this.node.augmentation(
                 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.Node1.class);
 
         List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node
             .TerminationPoint> allTps = nodeTp.getTerminationPoint();
 
         if (allTps == null) {
-            valid = false;
+            this.valid = false;
             LOG.error("initXndrTps: XPONDER TerminationPoint list is empty for node {}", this.toString());
             return;
         }
 
-        valid = false;
+        this.valid = false;
 
         for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node
             .TerminationPoint tp : allTps) {
 
-            TerminationPoint1 tp1 = tp.getAugmentation(TerminationPoint1.class);
+            TerminationPoint1 tp1 = tp.augmentation(TerminationPoint1.class);
 
             if (tp1.getTpType() == OpenroadmTpType.XPONDERNETWORK) {
 
                 if (tp1.getXpdrNetworkAttributes().getWavelength() != null) {
-                    usedXpndrNWTps.add(tp.getTpId().getValue());
+                    this.usedXpndrNWTps.add(tp.getTpId().getValue());
                     LOG.debug("initWLlist: XPONDER tp = {} is used", tp.getTpId().getValue());
                 } else {
-                    valid = true;
+                    this.valid = true;
                 }
 
                 // find Client of this network TP
@@ -166,9 +165,9 @@ public class PceNode {
                 if ((client.equals("")) || (client == null)) {
                     LOG.error("initXndrTps: XPONDER {} NW TP doesn't have defined Client {}",
                         this.toString(),tp.getTpId().getValue());
-                    valid = false;
+                    this.valid = false;
                 }
-                clientPerNwTp.put(tp.getTpId().getValue(), client);
+                this.clientPerNwTp.put(tp.getTpId().getValue(), client);
 
             }
         }
@@ -181,25 +180,25 @@ public class PceNode {
     }
 
     public boolean checkTP(String tp) {
-        if (usedXpndrNWTps.contains(tp)) {
+        if (this.usedXpndrNWTps.contains(tp)) {
             return false;
         }
         return true;
     }
 
     public boolean checkWL(long index) {
-        if (availableWLindex.contains(index)) {
+        if (this.availableWLindex.contains(index)) {
             return true;
         }
         return false;
     }
 
     public boolean isValid() {
-        return valid;
+        return this.valid;
     }
 
     public List<Long> getAvailableWLs() {
-        return availableWLindex;
+        return this.availableWLindex;
     }
 
     public void addOutgoingLink(PceLink outLink) {
@@ -207,16 +206,16 @@ public class PceNode {
     }
 
     public List<PceLink> getOutgoingLinks() {
-        return outgoingLinks;
+        return this.outgoingLinks;
     }
 
     public String getClient(String tp) {
-        return clientPerNwTp.get(tp);
+        return this.clientPerNwTp.get(tp);
     }
 
     @Override
     public String toString() {
-        return "PceNode type=" + nodeType + " ID=" + nodeId.getValue();
+        return "PceNode type=" + this.nodeType + " ID=" + this.nodeId.getValue();
     }
 
 }