From: Martial COULIBALY Date: Thu, 8 Feb 2018 15:03:28 +0000 (+0100) Subject: Pathdescription Update X-Git-Tag: v0.2.0~63 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F73544%2F5;p=transportpce.git Pathdescription Update 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 Co-Authored-By: Shweta Vachhani Co-Authored-By: Masha Dorfman <> Co-Authored-By: Archana Soundararajan Co-Authored-By: Juraj Veverka Co-Authored-By: Samuel Kontri Co-Authored-By: Andrej Zan Co-Authored-By: Milan Fratrik <> Co-authored-by: Martial COULIBALY Change-Id: Iee8e334d01661cee1fdc792273862b4e5f97075e Signed-off-by: Martial COULIBALY Signed-off-by: Shweta --- diff --git a/api/src/main/yang/service_path/transportpce-pathDescription@2017-04-26.yang b/api/src/main/yang/service_path/transportpce-pathDescription@2017-04-26.yang index dff1bd49b..cfab2cb6b 100644 --- a/api/src/main/yang/service_path/transportpce-pathDescription@2017-04-26.yang +++ b/api/src/main/yang/service_path/transportpce-pathDescription@2017-04-26.yang @@ -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 { diff --git a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/SendingPceRPCs.java b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/SendingPceRPCs.java index 76f727f6e..2f2137d96 100644 --- a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/SendingPceRPCs.java +++ b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/SendingPceRPCs.java @@ -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; diff --git a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/TpNodeTp.java b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/TpNodeTp.java index ebb2ac6b9..76e40b79a 100644 --- a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/TpNodeTp.java +++ b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/TpNodeTp.java @@ -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(); diff --git a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/InterNodePath.java b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/InterNodePath.java index b2781d37b..f5a18634e 100644 --- a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/InterNodePath.java +++ b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/InterNodePath.java @@ -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 result = new ArrayList(); 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 result = new ArrayList(); 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); } diff --git a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/NodePath.java b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/NodePath.java index a0facda7f..e8da8c2cf 100644 --- a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/NodePath.java +++ b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/NodePath.java @@ -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 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 direction = new ArrayList(); 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 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 resLinks,List 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)); } diff --git a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/SuperNodePath.java b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/SuperNodePath.java index ef455f5a5..d6d3b0a4c 100644 --- a/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/SuperNodePath.java +++ b/tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/SuperNodePath.java @@ -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 {