import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
+
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
this.networkTransactionService = networkTransactionService;
// TODO. for now metrics are set into hard structure
- LOG.info("In PceConstraintsCalc: read PceMetric {}", pceMetrics.toString());
+ LOG.info("In PceConstraintsCalc: read PceMetric {}", pceMetrics);
pceHardConstraints.setPceMetrics(pceMetrics);
calcHardconstraints(input);
CoRouting tmpCoRouting = null;
if (coRoutingOrGeneral instanceof General) {
- LOG.info("In readconstraints General {}", coRoutingOrGeneral.toString());
+ LOG.info("In readconstraints General {}", coRoutingOrGeneral);
tmpGeneral = (General) coRoutingOrGeneral;
readGeneralContrains(tmpGeneral, constraints);
return;
}
if (coRoutingOrGeneral instanceof CoRouting) {
- LOG.info("In readconstraints CoRouting {}", coRoutingOrGeneral.toString());
+ LOG.info("In readconstraints CoRouting {}", coRoutingOrGeneral);
tmpCoRouting = (CoRouting) coRoutingOrGeneral;
readCoRoutingContrains(tmpCoRouting, constraints);
- return;
}
-
- return;
-
}
private void readGeneralContrains(General tmpGeneral, PceConstraints constraints) {
Latency latency = tmpGeneral.getLatency();
if (latency != null) {
constraints.setMaxLatency(latency.getMaxLatency().toJava());
- LOG.info("In readGeneralContrains: read latency {}", latency.toString());
+ LOG.info("In readGeneralContrains: read latency {}", latency);
}
Exclude exclude = tmpGeneral.getExclude();
elementsToExclude = exclude.getSRLG();
if (elementsToExclude != null) {
- List<Long> srlgToExclude = new ArrayList<Long>();
+ List<Long> srlgToExclude = new ArrayList<>();
for (String str : elementsToExclude) {
srlgToExclude.add(Long.parseLong(str));
}
if (listHops != null) {
readIncludeNodes(listHops, constraints);
}
- LOG.debug("in readGeneralContrains INCLUDE {} ", include.toString());
+ LOG.debug("in readGeneralContrains INCLUDE {} ", include);
}
Diversity diversity = tmpGeneral.getDiversity();
if (temp == null) {
return;
}
- if (temp.isNode()) {
+ if (Boolean.TRUE.equals(temp.isNode())) {
rt = PceConstraints.ResourceType.NODE;
}
- if (temp.isSrlg()) {
+ if (Boolean.TRUE.equals(temp.isSrlg())) {
rt = PceConstraints.ResourceType.SRLG;
}
- if (temp.isClli()) {
+ if (Boolean.TRUE.equals(temp.isClli())) {
rt = PceConstraints.ResourceType.CLLI;
}
- LOG.info("in readGeneralContrains {} list is :{}", rt, diversity.toString());
+ LOG.info("in readGeneralContrains {} list is :{}", rt, diversity);
readDiversity(diversity.getExistingService(), constraints, rt);
}
.rev171017.ordered.constraints.sp.hop.type.hop.type.Node
node = (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing
.constraints.rev171017.ordered.constraints.sp.hop.type.hop.type.Node) hoptype;
- constraints.setListToInclude(constraints.new ResourcePair(PceConstraints.ResourceType.NODE,
+ constraints.setListToInclude(new PceConstraints.ResourcePair(PceConstraints.ResourceType.NODE,
node.getNodeId()));
break;
case "SRLG":
.rev171017.ordered.constraints.sp.hop.type.hop.type.SRLG
srlg = (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing
.constraints.rev171017.ordered.constraints.sp.hop.type.hop.type.SRLG) hoptype;
- constraints.setListToInclude(constraints.new ResourcePair(PceConstraints.ResourceType.SRLG,
+ constraints.setListToInclude(new PceConstraints.ResourcePair(PceConstraints.ResourceType.SRLG,
srlg.getSRLG()));
break;
case "Clli":
.rev171017.ordered.constraints.sp.hop.type.hop.type.Clli
clli = (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing
.constraints.rev171017.ordered.constraints.sp.hop.type.hop.type.Clli) hoptype;
- constraints.setListToInclude(constraints.new ResourcePair(PceConstraints.ResourceType.CLLI,
+ constraints.setListToInclude(new PceConstraints.ResourcePair(PceConstraints.ResourceType.CLLI,
clli.getClli()));
break;
default:
private void readDiversity(List<String> srvList, PceConstraints constraints, PceConstraints.ResourceType rt) {
- List<String> elementsToExclude = new ArrayList<String>();
- LOG.info("in readDiversity {}", srvList.toString());
+ List<String> elementsToExclude = new ArrayList<>();
+ LOG.info("in readDiversity {}", srvList);
for (String srv : srvList) {
Optional<PathDescription> service = getPathDescriptionFromDatastore(srv);
if (service.isPresent()) {
- LOG.info("in readDiversity service list {}", service.toString());
+ LOG.info("in readDiversity service list {}", service);
switch (rt) {
case NODE:
- elementsToExclude
- .addAll(getAToZNodeList(service.get()));
+ elementsToExclude.addAll(getAToZNodeList(service.get()));
LOG.info("readDiversity NODE : {}", elementsToExclude);
if (elementsToExclude != null) {
constraints.setExcludeNodes(elementsToExclude);
}
break;
case SRLG:
- elementsToExclude
- .addAll(getSRLGList(service.get()));
+ elementsToExclude.addAll(getSRLGList(service.get()));
LOG.info("readDiversity SRLG : {}", elementsToExclude);
if (elementsToExclude != null) {
constraints.setExcludeSrlgLinks(elementsToExclude);
case CLLI:
/// Retrieve nodes into dedicated CLLI list
/// during node validation check their CLLI and build CLLI exclude list
- elementsToExclude
- .addAll(getAToZNodeList(service.get()));
+ elementsToExclude.addAll(getAToZNodeList(service.get()));
LOG.info("readDiversity CLLI : {}", elementsToExclude);
if (elementsToExclude != null) {
constraints.setExcludeClliNodes(elementsToExclude);
if (tmpcoRouting == null) {
LOG.info("In readCoRoutingContrains: no General constraints.");
- return;
}
}