clean some compilation warnings
[transportpce.git] / tests / stubpce / src / main / java / org / opendaylight / transportpce / stubpce / topology / InterNodePath.java
index b1bd4239a9a3deaf52e0f8292667f8d26b73990f..861bc84c13be5ba36c017e4e959e0f32a247453a 100644 (file)
 package org.opendaylight.transportpce.stubpce.topology;
 
 import com.google.common.collect.Lists;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ListIterator;
-
 import org.opendaylight.transportpce.stubpce.TpNodeTp;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirectionBuilder;
@@ -31,6 +29,7 @@ import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdes
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.Link;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.LinkBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.TerminationPoint;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.link.LinkIdentifierBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,19 +74,19 @@ public class InterNodePath {
         for (Path path : paths) {
             tpNodeTp = path.getTpNodeTp();
             tpNodeTp.createAToZListHop(order);
-            for (AToZ atoz : tpNodeTp.getAToZ()) {
-                atozList.add(atoz);
+            for (AToZ tmp : tpNodeTp.getAToZ()) {
+                atozList.add(tmp);
                 order++;
             }
             Link link = path.getLink();
             AToZKey atozKey = new AToZKey(Integer.toString(order));
             Resource resource = new ResourceBuilder().setResource(link).build();
-            AToZ hop = new AToZBuilder().setId(atozKey.getId()).setKey(atozKey).setResource(resource).build();
+            AToZ hop = new AToZBuilder().setId(atozKey.getId()).withKey(atozKey).setResource(resource).build();
             atozList.add(hop);
             order++;
         }
         atozDirection.setRate((long) 100).setAToZWavelengthNumber((long) 200).setAToZ(atozList);
-        atoz.add(atozDirection.build());
+        this.atoz.add(atozDirection.build());
     }
 
     /**
@@ -103,19 +102,19 @@ public class InterNodePath {
         for (Path path : paths) {
             tpNodeTp = path.getTpNodeTp();
             tpNodeTp.createZToAListHop(order);
-            for (ZToA ztoa : tpNodeTp.getZToA()) {
-                ztoaList.add(ztoa);
+            for (ZToA tmp : tpNodeTp.getZToA()) {
+                ztoaList.add(tmp);
                 order++;
             }
             Link link = path.getLink();
             ZToAKey ztoaKey = new ZToAKey(Integer.toString(order));
             Resource resource = new ResourceBuilder().setResource(link).build();
-            ZToA hop = new ZToABuilder().setId(ztoaKey.getId()).setKey(ztoaKey).setResource(resource).build();
+            ZToA hop = new ZToABuilder().setId(ztoaKey.getId()).withKey(ztoaKey).setResource(resource).build();
             ztoaList.add(hop);
             order++;
         }
         ztoaDirection.setRate((long) 100).setZToAWavelengthNumber((long) 200).setZToA(ztoaList);
-        ztoa.add(ztoaDirection.build());
+        this.ztoa.add(ztoaDirection.build());
     }
 
     /**
@@ -140,7 +139,7 @@ public class InterNodePath {
             NodePath srg = null;
             NodePath deg1 = null;
             NodePath deg2 = null;
-            for (NodePath node : nodepaths) {
+            for (NodePath node : this.nodepaths) {
                 //LOG.info(node.toString());
                 String id = node.getNodeId();
                 if (id.contains("XPDR")) {
@@ -171,7 +170,7 @@ public class InterNodePath {
         LOG.info("buildDegToDeg ...");
         NodePath deg1 = null;
         NodePath deg2 = null;
-        for (NodePath node : nodepaths) {
+        for (NodePath node : this.nodepaths) {
             //LOG.info(node.toString());
             String nodeId = node.getNodeId();
             if (nodeId.contains("DEG1")) {
@@ -181,7 +180,7 @@ public class InterNodePath {
                 deg2 = node;
             }
         }
-        if (deg1 != null && deg2 != null) {
+        if ((deg1 != null) && (deg2 != null)) {
             List<Path> result =  new ArrayList<Path>();
             NodePath deb = deg1;
             NodePath end = deg2;
@@ -191,7 +190,7 @@ public class InterNodePath {
             }
             for (Path deg1Path : deb.getPath()) {
                 TpNodeTp tmpdeg = deg1Path.getTpNodeTp();
-                if (tmpdeg.getTpIn().getTpId().contains("TTP")) {
+                if (tmpdeg.getTpIn().getTerminationPointIdentifier().getTpId().contains("TTP")) {
                     result.clear();
                     result.addAll(Lists.newArrayList(deg1Path));
                     if (!twotoOne) {
@@ -203,7 +202,7 @@ public class InterNodePath {
             }
             for (Path deg2Path : end.getPath()) {
                 TpNodeTp tmpdeg = deg2Path.getTpNodeTp();
-                if (tmpdeg.getTpIn().getTpId().contains("CTP")) {
+                if (tmpdeg.getTpIn().getTerminationPointIdentifier().getTpId().contains("CTP")) {
                     result.clear();
                     result.addAll(Lists.newArrayList(deg2Path));
                     if (!twotoOne) {
@@ -232,13 +231,13 @@ public class InterNodePath {
         List<Path> result =  new ArrayList<Path>();
         for (Path degPath : deg.getPath()) {
             TpNodeTp tmpdeg = degPath.getTpNodeTp();
-            if (tmpdeg.getTpIn().getTpId().contains("TTP")) {
+            if (tmpdeg.getTpIn().getTerminationPointIdentifier().getTpId().contains("TTP")) {
                 for (Path srgPath : srg.getPath()) {
                     TpNodeTp tmpsrg = srgPath.getTpNodeTp();
-                    if (tmpsrg.getTpIn().getTpId().contains("CP")) {
+                    if (tmpsrg.getTpIn().getTerminationPointIdentifier().getTpId().contains("CP")) {
                         for (Path xpdrPath : xpdr.getPath()) {
                             TpNodeTp tmpxpdr = xpdrPath.getTpNodeTp();
-                            if (tmpxpdr.getTpIn().getTpId().contains("NETWORK")) {
+                            if (tmpxpdr.getTpIn().getTerminationPointIdentifier().getTpId().contains("NETWORK")) {
                                 result.clear();
                                 result.addAll(Lists.newArrayList(degPath,srgPath,xpdrPath));
                                 if (reverse) {
@@ -267,7 +266,7 @@ public class InterNodePath {
      */
     private void buildDegToSrgToXpdr(NodePath xpdr,NodePath srg,NodePath deg1,NodePath deg2,boolean reverse) {
         LOG.info("buildDegToSrgToXpr ...");
-        if (xpdr != null && srg != null && deg1 != null && deg2 != null) {
+        if ((xpdr != null) && (srg != null) && (deg1 != null) && (deg2 != null)) {
             buildDeg(xpdr, srg, deg1, reverse);
             buildDeg(xpdr, srg, deg2, reverse);
         } else {
@@ -288,19 +287,19 @@ public class InterNodePath {
      */
     private void buildXpdrToSrgToDeg(NodePath xpdr,NodePath srg,NodePath deg1,NodePath deg2,boolean reverse) {
         LOG.info("buildXpdrToSrgToDeg ...");
-        if (xpdr != null && srg != null && deg1 != null && deg2 != null) {
+        if ((xpdr != null) && (srg != null) && (deg1 != null) && (deg2 != null)) {
             List<Path> result =  new ArrayList<Path>();
             for (Path xpdrPath : xpdr.getPath()) {
                 TpNodeTp tmpxpdr = xpdrPath.getTpNodeTp();
-                if (tmpxpdr.getTpIn().getTpId().contains("CLIENT")) {
+                if (tmpxpdr.getTpIn().getTerminationPointIdentifier().getTpId().contains("CLIENT")) {
                     for (Path srgPath : srg.getPath()) {
                         TpNodeTp tmp = srgPath.getTpNodeTp();
                         Link srglink = srgPath.getLink();
-                        if (tmp.getTpIn().getTpId().contains("PP")) {
+                        if (tmp.getTpIn().getTerminationPointIdentifier().getTpId().contains("PP")) {
                             for (Path deg1Path : deg1.getPath()) {
                                 TpNodeTp tmpdeg = deg1Path.getTpNodeTp();
-                                if (tmpdeg.getTpIn().getTpId().contains("CTP")
-                                        && srglink.getLinkId().contains("DEG1")) {
+                                if (tmpdeg.getTpIn().getTerminationPointIdentifier().getTpId().contains("CTP")
+                                        && srglink.getLinkIdentifier().getLinkId().contains("DEG1")) {
                                     result.clear();
                                     result.addAll(Lists.newArrayList(xpdrPath,srgPath,deg1Path));
                                     if (reverse) {
@@ -312,8 +311,8 @@ public class InterNodePath {
                             }
                             for (Path deg2Path : deg2.getPath()) {
                                 TpNodeTp tmpdeg = deg2Path.getTpNodeTp();
-                                if (tmpdeg.getTpIn().getTpId().contains("CTP")
-                                        && srglink.getLinkId().contains("DEG2")) {
+                                if (tmpdeg.getTpIn().getTerminationPointIdentifier().getTpId().contains("CTP")
+                                        && srglink.getLinkIdentifier().getLinkId().contains("DEG2")) {
                                     result.clear();
                                     result.addAll(Lists.newArrayList(xpdrPath,srgPath,deg2Path));
                                     if (reverse) {
@@ -351,16 +350,16 @@ public class InterNodePath {
                 String id = Integer.toString(size - index);
                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription
                     .rev170426.pce.resource.resource.Resource res = null;
-                for (AToZ atoz : atozList) {
-                    if (atoz.getId().compareTo(id) == 0) {
-                        res = atoz.getResource().getResource();
+                for (AToZ tmpAtoz : atozList) {
+                    if (tmpAtoz.getId().compareTo(id) == 0) {
+                        res = tmpAtoz.getResource().getResource();
                         if (res != null) {
 
                             switch (index) {
                                 case 1: //last link
                                     if (res instanceof Link) {
                                         Link tp = (Link) res;
-                                        if (tp != null && tp.getLinkId().contains(endBy)) {
+                                        if ((tp != null) && tp.getLinkIdentifier().getLinkId().contains(endBy)) {
                                             result.add(tmp);
                                         }
                                     }
@@ -369,7 +368,8 @@ public class InterNodePath {
                                 case 2: //last tp
                                     if (res instanceof TerminationPoint) {
                                         TerminationPoint tp = (TerminationPoint) res;
-                                        if (tp != null && tp.getTpId().contains(endBy)) {
+                                        if ((tp != null) && tp.getTerminationPointIdentifier().getTpId()
+                                                .contains(endBy)) {
                                             result.add(tmp);
                                         }
                                     }
@@ -385,7 +385,7 @@ public class InterNodePath {
                 LOG.info("firstnodeTpId is null !");
             }
         }
-        LOG.info("getAToZDirectionEndBy result size : " + result.size() + "\n " + result.toString());
+        LOG.info("getAToZDirectionEndBy result size : {}\n{}", result.size(),result.toString());
         return result;
     }
 
@@ -420,19 +420,21 @@ public class InterNodePath {
                 if (size > 0) {
                     String id = Integer.toString(size - 1);
                     for (ListIterator<AToZ> it = atozList.listIterator(); it.hasNext();) {
-                        AToZ atoz = it.next();
-                        if (atoz.getId().compareTo(id) == 0) {
+                        AToZ tmpAtoz = it.next();
+                        if (tmpAtoz.getId().compareTo(id) == 0) {
                             org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription
-                                .rev170426.pce.resource.resource.Resource res = atoz.getResource().getResource();
-                            if (res != null  && res instanceof Link) {
+                                .rev170426.pce.resource.resource.Resource res = tmpAtoz.getResource().getResource();
+                            if ((res != null)  && (res instanceof Link)) {
                                 Link link = new LinkBuilder()
-                                        .setLinkId(atozLink)
+                                        .setLinkIdentifier(new LinkIdentifierBuilder()
+                                                .setLinkId(atozLink)
+                                                .build())
                                         .build();
-                                AToZKey atozKey = new AToZKey(atoz.getKey());
+                                AToZKey atozKey = new AToZKey(tmpAtoz.key());
                                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
                                     .pathdescription.rev170426.pce.resource.Resource resource = new ResourceBuilder()
                                     .setResource(link).build();
-                                AToZ hop = new AToZBuilder().setId(atozKey.getId()).setKey(atozKey)
+                                AToZ hop = new AToZBuilder().setId(atozKey.getId()).withKey(atozKey)
                                         .setResource(resource).build();
                                 it.remove();
                                 if (!remove) {
@@ -445,7 +447,7 @@ public class InterNodePath {
                 }
             }
         } else {
-            LOG.info("getAToZDirectionEndBy size " + tmp.size());
+            LOG.info("getAToZDirectionEndBy size : {}", tmp.size());
         }
         return result;
     }
@@ -466,14 +468,14 @@ public class InterNodePath {
             int size = atozList.size();
             if (size > 0) {
                 String id = Integer.toString(0);
-                for (AToZ atoz : atozList) {
-                    if (atoz.getId().compareTo(id) == 0) {
+                for (AToZ tmpAtoz : atozList) {
+                    if (tmpAtoz.getId().compareTo(id) == 0) {
                         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription
-                            .rev170426.pce.resource.resource.Resource res = atoz.getResource().getResource();
-                        if (res != null  && res instanceof TerminationPoint) {
+                            .rev170426.pce.resource.resource.Resource res = tmpAtoz.getResource().getResource();
+                        if ((res != null)  && (res instanceof TerminationPoint)) {
                             TerminationPoint tp = (TerminationPoint) res;
-                            if (tp != null && tp.getTpId().contains(beginBy)) {
-                                LOG.info("tmp : " + tmp.toString());
+                            if ((tp != null) && tp.getTerminationPointIdentifier().getTpId().contains(beginBy)) {
+                                LOG.info("tmp : {}", tmp.toString());
                                 result.add(tmp);
                             }
                         }
@@ -481,7 +483,7 @@ public class InterNodePath {
                 }
             }
         }
-        LOG.info("result size : " + result.size());
+        LOG.info("result size : {}", result.size());
         return result;
     }
 
@@ -495,14 +497,14 @@ public class InterNodePath {
      * @param zend path zend Supernode nodeId
      */
     public void buildPath(String zend) {
-        if (superNode != null) {
-            for (org.opendaylight.transportpce.stubpce.topology.Resource res : superNode.getResources()) {
-                NodePath path = new NodePath(res, superNode.getSuperNodeId(), superNode.isXpdrSrgAbsent());
+        if (this.superNode != null) {
+            for (org.opendaylight.transportpce.stubpce.topology.Resource res : this.superNode.getResources()) {
+                NodePath path = new NodePath(res, this.superNode.getSuperNodeId(), this.superNode.isXpdrSrgAbsent());
                 path.fill();
-                nodepaths.add(path);
+                this.nodepaths.add(path);
             }
-            LOG.info("nodepaths size : " + nodepaths.size());
-            build(superNode.isXpdrSrgAbsent(),superNode.getSuperNodeId(), zend);
+            LOG.info("nodepaths size : {}", this.nodepaths.size());
+            build(this.superNode.isXpdrSrgAbsent(),this.superNode.getSuperNodeId(), zend);
         }
     }
 
@@ -520,7 +522,7 @@ public class InterNodePath {
     }
 
     public SuperNode getSuperNode() {
-        return superNode;
+        return this.superNode;
     }
 
     public void setSuperNode(SuperNode superNode) {
@@ -528,7 +530,7 @@ public class InterNodePath {
     }
 
     public List<AToZDirection> getAtoz() {
-        return atoz;
+        return this.atoz;
     }
 
     public void setAtoz(List<AToZDirection> atoz) {
@@ -536,7 +538,7 @@ public class InterNodePath {
     }
 
     public List<ZToADirection> getZtoa() {
-        return ztoa;
+        return this.ztoa;
     }
 
     public void setZtoa(List<ZToADirection> ztoa) {
@@ -544,7 +546,7 @@ public class InterNodePath {
     }
 
     public List<NodePath> getNodepaths() {
-        return nodepaths;
+        return this.nodepaths;
     }
 
     public void setNodepaths(List<NodePath> nodepaths) {