2 * Copyright © 2017 AT&T, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.pce;
10 import java.util.ArrayList;
11 import java.util.List;
12 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 // internal type after parsing
17 public class PceConstraints {
19 private static final Logger LOG = LoggerFactory.getLogger(PceCalculation.class);
21 // TODO. for now metrics are set into hard structure
22 private RoutingConstraintsSp.PceMetric pceMetrics = RoutingConstraintsSp.PceMetric.HopCount;
23 private Long maxLatency = (long) -1;
25 private List<String> nodesToExclude = new ArrayList<String>();
26 private List<String> srlgToExclude = new ArrayList<String>();
27 private List<String> nodesToInclude = new ArrayList<String>();
28 private List<PceNode> pceNodesToInclude = new ArrayList<PceNode>();
29 public static Long constOSNR = 1L;
30 private double maxOSNR = (constOSNR / (Math.pow(10, (24 / 10.0))));
31 // List<String> srlgToInclude = new ArrayList<String>();
34 public RoutingConstraintsSp.PceMetric getPceMetrics() {
38 public void setPceMetrics(RoutingConstraintsSp.PceMetric pceMetrics) {
39 this.pceMetrics = pceMetrics;
42 // Latency of path is used by Graph to validate path
43 // if -1 , latency is not applicable (not mentioned in constraints)
44 public Long getMaxLatency() {
45 LOG.debug("in Pceconstraints getMaxLatency = {}", maxLatency);
49 public void setMaxLatency(Long maxLatency) {
50 LOG.debug("in Pceconstraints setMaxLatency = {}", maxLatency);
51 this.maxLatency = maxLatency;
54 // Exclude nodes / SRLD /
55 public List<String> getExcludeNodes() {
56 LOG.debug("in Pceconstraints getExcludeNodes size = {}", nodesToExclude.size());
57 return nodesToExclude;
60 public void setExcludeNodes(List<String> nodes) {
61 LOG.debug("in Pceconstraints setExcludeNodes size = {}", nodes.size());
62 nodesToExclude.addAll(nodes);
65 public List<String> getExcludeSRLG() {
66 LOG.debug("in Pceconstraints getExcludeSRLG size = {}", srlgToExclude.size());
70 public void setExcludeSRLG(List<String> srlg) {
71 LOG.debug("in Pceconstraints setExcludeSRLG size = {}", srlg.size());
72 srlgToExclude.addAll(srlg);
77 public List<String> getIncludeNodes() {
78 LOG.debug("in Pceconstraints getIncludeNodes size = {}", nodesToInclude.size());
79 return nodesToInclude;
82 public void setIncludeNodes(List<String> nodes) {
83 LOG.debug("in Pceconstraints setIncludeNodes size = {}", nodes.size());
84 nodesToInclude.addAll(nodes);
87 public List<PceNode> getIncludePceNodes() {
88 LOG.debug("in Pceconstraints getIncludePceNodes size = {}", pceNodesToInclude.size());
89 return pceNodesToInclude;
92 public void setIncludePceNode(PceNode node) {
93 LOG.info("in Pceconstraints setIncludePceNode new node = {}", node.toString());
94 this.pceNodesToInclude.add(node);
97 public Double getMaxOSNR() {
98 LOG.debug("in Pceconstraints getMaxOSNR = {}", maxOSNR);