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;
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;
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());
}
/**
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());
}
/**
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")) {
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")) {
deg2 = node;
}
}
- if (deg1 != null && deg2 != null) {
+ if ((deg1 != null) && (deg2 != null)) {
List<Path> result = new ArrayList<Path>();
NodePath deb = deg1;
NodePath end = deg2;
}
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) {
}
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) {
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) {
*/
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 {
*/
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) {
}
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) {
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);
}
}
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);
}
}
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;
}
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) {
}
}
} else {
- LOG.info("getAToZDirectionEndBy size " + tmp.size());
+ LOG.info("getAToZDirectionEndBy size : {}", tmp.size());
}
return result;
}
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);
}
}
}
}
}
- LOG.info("result size : " + result.size());
+ LOG.info("result size : {}", result.size());
return result;
}
* @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);
}
}
}
public SuperNode getSuperNode() {
- return superNode;
+ return this.superNode;
}
public void setSuperNode(SuperNode superNode) {
}
public List<AToZDirection> getAtoz() {
- return atoz;
+ return this.atoz;
}
public void setAtoz(List<AToZDirection> atoz) {
}
public List<ZToADirection> getZtoa() {
- return ztoa;
+ return this.ztoa;
}
public void setZtoa(List<ZToADirection> ztoa) {
}
public List<NodePath> getNodepaths() {
- return nodepaths;
+ return this.nodepaths;
}
public void setNodepaths(List<NodePath> nodepaths) {