Pathdescription Update 44/73544/5
authorMartial COULIBALY <martial.coulibaly@gfi.fr>
Thu, 8 Feb 2018 15:03:28 +0000 (16:03 +0100)
committerguillaume.lambert <guillaume.lambert@orange.com>
Wed, 18 Jul 2018 09:09:48 +0000 (11:09 +0200)
Modify 'transportpce-pathdescription@2017-04-26' yang file, more
precisely grouping PCE-resource to add container identifiers for
termination-point, link and node.
This modification was made in ATT-SandBox commit 'Renderer and OLM
update' https://git.opendaylight.org/gerrit/66651 and involves stubpce
java code to be modified.

Co-Authored-By: Dhruv Bhardwaj <db929a@att.com>
Co-Authored-By: Shweta Vachhani <sv111y@att.com>
Co-Authored-By: Masha Dorfman <>
Co-Authored-By: Archana Soundararajan <as7463@att.com>
Co-Authored-By: Juraj Veverka <Juraj.Veverka@pantheon.tech>
Co-Authored-By: Samuel Kontri <samuel.kontris@pantheon.sk>
Co-Authored-By: Andrej Zan <andrej.zan@pantheon.sk>
Co-Authored-By: Milan Fratrik <>
Co-authored-by: Martial COULIBALY <martial.coulibaly@gfi.fr>
Change-Id: Iee8e334d01661cee1fdc792273862b4e5f97075e
Signed-off-by: Martial COULIBALY <martial.coulibaly@gfi.fr>
Signed-off-by: Shweta <sv111y@att.com>
api/src/main/yang/service_path/transportpce-pathDescription@2017-04-26.yang
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/SendingPceRPCs.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/TpNodeTp.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/InterNodePath.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/NodePath.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/SuperNodePath.java

index dff1bd49ba6df7175c771f596a358ec0b3e8576b..cfab2cb6beeb370966e59e8934c6efb2b611c582 100644 (file)
@@ -50,35 +50,41 @@ module transportpce-pathDescription {
   }
 
   grouping PCE-resource {
-    description
-      "This resource identifier is intended to provide a generic identifer
-       for any resource that can be used without specific knowledge of
-       the resource.";
-    container resource {
-      choice resource {
-        case termination-point {
-          leaf tp-id {
-              type string; //to be clarified with topology model
-          }
-          leaf tp-node-id {
-              type string; //to be clarified with topology model
+      description
+        "This resource identifier is intended to provide a generic identifer
+         for any resource that can be used without specific knowledge of
+         the resource.";
+      container resource {
+        choice resource {
+          case termination-point {
+            container termination-point-identifier {
+              leaf tp-id {
+                  type string; //to be clarified with topology model
+              }
+              leaf node-id {
+                  type string; //to be clarified with topology model
+              }
+            }
           }
-        }
 
-        case link {
-          leaf link-id {
-              type string; //to be clarified with topology model
+          case link {
+            container link-identifier {
+              leaf link-id {
+                  type string; //to be clarified with topology model
+              }
+            }
           }
-        }
 
-        case node {
-          leaf node-id {
-              type string; // to be clarified with topology model
+          case node {
+            container node-identifier {
+              leaf node-id {
+                  type string; // to be clarified with topology model
+              }
+            }
           }
         }
       }
     }
-  }
 
 
   grouping path-description {
index 76f727f6e6c1aacfc6cc5ee3dbe9cf8ae18a8554..2f2137d963f461f232ef91082c5c7af913aa0a66 100644 (file)
@@ -124,8 +124,8 @@ public class SendingPceRPCs {
             if (pathAend instanceof Node && pathZend instanceof Node) {
                 Node aend = (Node) pathAend;
                 Node zend = (Node) pathZend;
-                if (aend.getNodeId().compareToIgnoreCase(inputAend) == 0) {
-                    if (zend.getNodeId().compareToIgnoreCase(inputZend) == 0) {
+                if (aend.getNodeIdentifier().getNodeId().compareToIgnoreCase(inputAend) == 0) {
+                    if (zend.getNodeIdentifier().getNodeId().compareToIgnoreCase(inputZend) == 0) {
                         result = true;
                     }
                 }
@@ -149,15 +149,18 @@ public class SendingPceRPCs {
             if (res1 instanceof Node && res2 instanceof Node) {
                 Node node1 = (Node)res1;
                 Node node2 = (Node)res2;
-                if (node1.getNodeId().compareTo(node2.getNodeId()) == 0) {
+                if (node1.getNodeIdentifier().getNodeId()
+                        .compareTo(node2.getNodeIdentifier().getNodeId()) == 0) {
                     result = true;
                 }
             }
             if (res1 instanceof TerminationPoint && res2 instanceof TerminationPoint) {
                 TerminationPoint tp1 = (TerminationPoint)res1;
                 TerminationPoint tp2 = (TerminationPoint)res2;
-                if (tp1.getTpNodeId().compareTo(tp2.getTpNodeId()) == 0) {
-                    if (tp1.getTpId().compareTo(tp2.getTpId()) == 0) {
+                if (tp1.getTerminationPointIdentifier().getNodeId()
+                        .compareTo(tp2.getTerminationPointIdentifier().getNodeId()) == 0) {
+                    if (tp1.getTerminationPointIdentifier().getTpId()
+                            .compareTo(tp2.getTerminationPointIdentifier().getTpId()) == 0) {
                         result = true;
                     }
                 }
@@ -165,7 +168,7 @@ public class SendingPceRPCs {
             if (res1 instanceof Link && res2 instanceof Link) {
                 Link link1 = (Link)res1;
                 Link link2 = (Link)res2;
-                if (link1.getLinkId().compareTo(link2.getLinkId()) == 0) {
+                if (link1.getLinkIdentifier().getLinkId().compareTo(link2.getLinkIdentifier().getLinkId()) == 0) {
                     result = true;
                 }
 
@@ -298,7 +301,7 @@ public class SendingPceRPCs {
                     if (res != null && res instanceof Node) {
                         Node node = (Node) res;
                         for (String exclude : nodes) {
-                            if (exclude.compareToIgnoreCase(node.getNodeId()) == 0) {
+                            if (exclude.compareToIgnoreCase(node.getNodeIdentifier().getNodeId()) == 0) {
                                 LOG.info("Node not excluded !");
                                 found = true;
                                 break;
index ebb2ac6b948995fd0393429fbe9666bc4b7ba65d..76e40b79a8ddf18908ab55820fbd9810526797d4 100644 (file)
@@ -68,11 +68,13 @@ public class TpNodeTp {
         ztoa.clear();
 
         resources.add(new ResourceBuilder().setResource(tpIn).build());
-        ids.add(tpIn.getTpNodeId().concat("-").concat(tpIn.getTpId()));
+        ids.add(tpIn.getTerminationPointIdentifier().getNodeId().concat("-")
+                .concat(tpIn.getTerminationPointIdentifier().getTpId()));
         resources.add(new ResourceBuilder().setResource(node).build());
-        ids.add(node.getNodeId());
+        ids.add(node.getNodeIdentifier().getNodeId());
         resources.add(new ResourceBuilder().setResource(tpOut).build());
-        ids.add(tpOut.getTpNodeId().concat("-").concat(tpOut.getTpId()));
+        ids.add(tpOut.getTerminationPointIdentifier().getNodeId().concat("-")
+                .concat(tpOut.getTerminationPointIdentifier().getTpId()));
     }
 
     /**
@@ -122,9 +124,9 @@ public class TpNodeTp {
     @Override
     public String toString() {
         StringBuilder result = new StringBuilder("[ ");
-        result.append("tpIn : " + tpIn.getTpId());
-        result.append(" - Node : " + node.getNodeId());
-        result.append(" - tpOut : " + tpOut.getTpId());
+        result.append("tpIn : " + tpIn.getTerminationPointIdentifier().getTpId());
+        result.append(" - Node : " + node.getNodeIdentifier().getNodeId());
+        result.append(" - tpOut : " + tpOut.getTerminationPointIdentifier().getTpId());
         result.append(" ]");
         return result.toString();
 
index b2781d37b1cbe916860eb21719656f9229c38dbf..f5a18634eec4501ebdaa7d34ce2ac252c08d8cdf 100644 (file)
@@ -31,6 +31,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;
 
@@ -191,7 +192,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 +204,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 +233,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) {
@@ -292,15 +293,15 @@ public class InterNodePath {
             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 +313,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) {
@@ -360,7 +361,7 @@ public class InterNodePath {
                                 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 +370,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);
                                         }
                                     }
@@ -426,7 +428,9 @@ public class InterNodePath {
                                 .rev170426.pce.resource.resource.Resource res = atoz.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());
                                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
@@ -472,7 +476,7 @@ public class InterNodePath {
                             .rev170426.pce.resource.resource.Resource res = atoz.getResource().getResource();
                         if (res != null  && res instanceof TerminationPoint) {
                             TerminationPoint tp = (TerminationPoint) res;
-                            if (tp != null && tp.getTpId().contains(beginBy)) {
+                            if (tp != null && tp.getTerminationPointIdentifier().getTpId().contains(beginBy)) {
                                 LOG.info("tmp : {}", tmp.toString());
                                 result.add(tmp);
                             }
index a0facda7f51e59f3e0139c63710090e4be6ea244..e8da8c2cf08e69d36889499162a0160735a340de 100644 (file)
@@ -19,6 +19,9 @@ 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.NodeBuilder;
 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.TerminationPointBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.link.LinkIdentifierBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.node.NodeIdentifierBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.termination.point.TerminationPointIdentifierBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -96,7 +99,9 @@ public class NodePath {
             List<LogicalConnectionPoint> resLcps = resource.getLcps();
             for (String tmp : resLinks) {
                 Link link = new LinkBuilder()
-                        .setLinkId(tmp)
+                        .setLinkIdentifier(new LinkIdentifierBuilder()
+                                .setLinkId(tmp)
+                                .build())
                         .build();
                 links.add(link);
             }
@@ -105,7 +110,9 @@ public class NodePath {
                 xpdr = true;
                 buildXpdrTopo(nodeid,resLinks,resLcps,xpdr);
                 links.add(new LinkBuilder()
-                        .setLinkId("TAIL-LINKS")
+                        .setLinkIdentifier(new LinkIdentifierBuilder()
+                                .setLinkId("TAIL-LINKS")
+                                .build())
                         .build());
             }
             if (nodeid.contains("SRG")) {
@@ -117,7 +124,9 @@ public class NodePath {
                 xpdr = false;
                 buildXpdrTopo(nodeid,resLinks,resLcps,xpdr);
                 links.add(new LinkBuilder()
-                        .setLinkId("EXTERNAL-LINKS")
+                        .setLinkIdentifier(new LinkIdentifierBuilder()
+                                .setLinkId("EXTERNAL-LINKS")
+                                .build())
                         .build());
             }
         }
@@ -149,10 +158,10 @@ public class NodePath {
         Path resourcePath = null;
         List<TpNodeTp> direction = new ArrayList<TpNodeTp>();
         for (Link link : links) {
-            String linkId = link.getLinkId();
+            String linkId = link.getLinkIdentifier().getLinkId();
             LOG.info("LinkId : {}", linkId);
             if (!isXpdrSrgAbsent) {
-                if (StringUtils.countMatches(link.getLinkId(), "ROADM") < 2) {
+                if (StringUtils.countMatches(link.getLinkIdentifier().getLinkId(), "ROADM") < 2) {
                     if ((linkId.contains("XPDR") && linkId.startsWith("ROADM"))
                         || ((linkId.startsWith("DEG") && linkId.contains("SRG")))
                         || (nodeId.contains("XPDR") && linkId.contains("TAIL-LINKS"))) {
@@ -165,7 +174,7 @@ public class NodePath {
                     LOG.info("link is deg to deg link !");
                 }
             } else {
-                if (StringUtils.countMatches(link.getLinkId(), "ROADM") == 2) {
+                if (StringUtils.countMatches(link.getLinkIdentifier().getLinkId(), "ROADM") == 2) {
                     direction = reverseTpNodetpList();
                 } else {
                     direction = tpNodeTps;
@@ -237,17 +246,23 @@ public class NodePath {
         List<String> lcps = getOrderedTps(xpdr,resLcps);
         if (lcps.size() == 2) {
             in = new TerminationPointBuilder()
-                    .setTpNodeId(nodeid)
-                    .setTpId(lcps.get(0));
+                    .setTerminationPointIdentifier(new TerminationPointIdentifierBuilder()
+                            .setNodeId(nodeid)
+                            .setTpId(lcps.get(0))
+                            .build());
             out = new TerminationPointBuilder()
-                    .setTpNodeId(nodeid)
-                    .setTpId(lcps.get(1));
+                    .setTerminationPointIdentifier(new TerminationPointIdentifierBuilder()
+                            .setNodeId(nodeid)
+                            .setTpId(lcps.get(1))
+                            .build());
         } else {
             LOG.info("lcps size not equal to 2");
 
         }
         Node node = new NodeBuilder()
-                .setNodeId(nodeid)
+                .setNodeIdentifier(new NodeIdentifierBuilder()
+                        .setNodeId(nodeid)
+                        .build())
                 .build();
         TpNodeTp tmp = new TpNodeTp(in.build(), out.build(), node);
         tpNodeTps.add(tmp);
@@ -265,18 +280,23 @@ public class NodePath {
     private void buildSRGTopo(String nodeid, List<String> resLinks,List<LogicalConnectionPoint> resLcps) {
         /** build TpNodetp .*/
         Node node = new NodeBuilder()
-                .setNodeId(nodeid)
+                .setNodeIdentifier(new NodeIdentifierBuilder()
+                        .setNodeId(nodeid)
+                        .build())
                 .build();
         TerminationPoint out = new TerminationPointBuilder()
-                .setTpNodeId(nodeid)
-                .setTpId("SRG1-CP-TXRX")
+                .setTerminationPointIdentifier(new TerminationPointIdentifierBuilder()
+                        .setNodeId(nodeid)
+                        .setTpId("SRG1-CP-TXRX")
+                        .build())
                 .build();
-
         for (LogicalConnectionPoint lcp : resLcps) {
             if (lcp.getTpId().compareTo("SRG1-CP-TXRX") != 0) {
                 TerminationPoint in = new TerminationPointBuilder()
-                        .setTpNodeId(nodeid)
-                        .setTpId(lcp.getTpId())
+                        .setTerminationPointIdentifier(new TerminationPointIdentifierBuilder()
+                                .setNodeId(nodeid)
+                                .setTpId(lcp.getTpId())
+                                .build())
                         .build();
                 tpNodeTps.add(new TpNodeTp(in, out, node));
             }
index ef455f5a545386078141cd42ed96f09ba277a151..d6d3b0a4c2875f4ed11dd44acc443df67fabe4a3 100644 (file)
@@ -31,6 +31,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.ResourceBuilder;
 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.link.LinkIdentifierBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -453,13 +454,14 @@ public class SuperNodePath {
                     if (resLink != null) {
                         if (resLink instanceof Link) {
                             Link link = (Link) resLink;
-                            String newLinkId = reverseLinkId(link.getLinkId());
+                            String newLinkId = reverseLinkId(link.getLinkIdentifier().getLinkId());
                             if (newLinkId != null) {
-                                resource = new ResourceBuilder().setResource(
-                                        new LinkBuilder()
-                                        .setLinkId(newLinkId)
-                                        .build()
-                                        ).build();
+                                resource = new ResourceBuilder().setResource(new LinkBuilder()
+                                        .setLinkIdentifier(new LinkIdentifierBuilder()
+                                                .setLinkId(newLinkId)
+                                                .build())
+                                        .build())
+                                    .build();
                             }
 
                         } else {