X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fconstraints%2FPceConstraints.java;h=4b63819f857a6961b96b9616158eec1a63404d16;hb=refs%2Fchanges%2F64%2F110164%2F10;hp=b5e8c7978ce4167d786089120296e5b353f41249;hpb=7c90be243c9c65418b81768e1e0ed6ac58bad4a8;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraints.java b/pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraints.java index b5e8c7978..4b63819f8 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraints.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraints.java @@ -9,9 +9,9 @@ package org.opendaylight.transportpce.pce.constraints; import java.util.ArrayList; import java.util.List; - -import org.opendaylight.transportpce.pce.networkanalyzer.PceNode; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp; +import java.util.StringJoiner; +import org.opendaylight.transportpce.pce.networkanalyzer.PceOpticalNode; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,43 +21,39 @@ public class PceConstraints { private static final Logger LOG = LoggerFactory.getLogger(PceConstraints.class); // TODO. for now metrics are set into hard structure - private RoutingConstraintsSp.PceMetric pceMetrics = RoutingConstraintsSp.PceMetric.HopCount; - private Long maxLatency = (long) -1; + private PceMetric pceMetrics = PceMetric.HopCount; + private Long maxLatency = -1L; - /////////////// EXCLUDE /////////////////// + // Structure related to EXCLUDE constraints // Nodes/CLLI/SRLG lists might consist of two types of elements : (1)from diversity constraints (2)from exclude list // e.g.: nodesToExclude - topo-level nodes IDs - comes from diversity constraints // : supNodesToExclude - supporting nodes IDs - comes from exclude list // "mapConstraints" class converts diversity elements into correct names - private List nodesToExclude = new ArrayList(); - private List supNodesToExclude = new ArrayList(); + private List nodesToExclude = new ArrayList<>(); + private List supNodesToExclude = new ArrayList<>(); - private List srlgToExclude = new ArrayList(); - private List srlgLinksToExclude = new ArrayList(); + private List srlgToExclude = new ArrayList<>(); + private List srlgLinksToExclude = new ArrayList<>(); - private List clliToExclude = new ArrayList(); - private List clliNodesToExclude = new ArrayList(); - private List nodesToInclude = new ArrayList(); - private List pceNodesToInclude = new ArrayList(); + private List clliToExclude = new ArrayList<>(); + private List clliNodesToExclude = new ArrayList<>(); - public static final Long CONST_OSNR = 1L; - private double maxOSNR = (CONST_OSNR / (Math.pow(10, (24 / 10.0)))); + ///Structures related to INCLUDE constraints + private List nodesToInclude = new ArrayList<>(); + private List pceNodesToInclude = new ArrayList<>(); + private List listToInclude = new ArrayList<>(); - /**. - * /////////////// INCLUDE CONSTRAINTS./////////////////// - */ - private List listToInclude = new ArrayList(); - private List srlgNames = new ArrayList(); + private List srlgNames = new ArrayList<>(); public enum ResourceType { NONE, NODE, SRLG, CLLI; } - public RoutingConstraintsSp.PceMetric getPceMetrics() { + public PceMetric getPceMetrics() { return pceMetrics; } - public void setPceMetrics(RoutingConstraintsSp.PceMetric pceMetrics) { + public void setPceMetrics(PceMetric pceMetrics) { this.pceMetrics = pceMetrics; } @@ -149,31 +145,42 @@ public class PceConstraints { nodesToInclude.addAll(nodes); } - public List getIncludePceNodes() { + public List getIncludePceNodes() { LOG.debug("in Pceconstraints getIncludePceNodes size = {}", pceNodesToInclude.size()); return pceNodesToInclude; } - public void setIncludePceNode(PceNode node) { - LOG.info("in Pceconstraints setIncludePceNode new node = {}", node.toString()); + public void setIncludePceNode(PceOpticalNode node) { + LOG.info("in Pceconstraints setIncludePceNode new node = {}", node); this.pceNodesToInclude.add(node); } - public Double getMaxOSNR() { - LOG.debug("in Pceconstraints getMaxOSNR = {}", maxOSNR); - return maxOSNR; - } + public static class ResourcePair { - public class ResourcePair { public ResourcePair(ResourceType type, String name) { super(); this.type = type; this.name = name; } - public ResourceType type = ResourceType.NODE; + private ResourceType type = ResourceType.NODE; + private String name = ""; + + public ResourceType getType() { + return type; + } - public String name = ""; + public String getName() { + return name; + } + + @Override + public String toString() { + return new StringJoiner(", ", ResourcePair.class.getSimpleName() + "[", "]") + .add("type=" + type) + .add("name='" + name + "'") + .toString(); + } } public List getListToInclude() {