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 final Long CONST_OSNR = 1L;
30 private double maxOSNR = (CONST_OSNR / (Math.pow(10, (24 / 10.0))));
33 public RoutingConstraintsSp.PceMetric getPceMetrics() {
37 public void setPceMetrics(RoutingConstraintsSp.PceMetric pceMetrics) {
38 this.pceMetrics = pceMetrics;
41 // Latency of path is used by Graph to validate path
42 // if -1 , latency is not applicable (not mentioned in constraints)
43 public Long getMaxLatency() {
44 LOG.debug("in Pceconstraints getMaxLatency = {}", maxLatency);
48 public void setMaxLatency(Long maxLatency) {
49 LOG.debug("in Pceconstraints setMaxLatency = {}", maxLatency);
50 this.maxLatency = maxLatency;
53 // Exclude nodes / SRLD /
54 public List<String> getExcludeNodes() {
55 LOG.debug("in Pceconstraints getExcludeNodes size = {}", nodesToExclude.size());
56 return nodesToExclude;
59 public void setExcludeNodes(List<String> nodes) {
60 LOG.debug("in Pceconstraints setExcludeNodes size = {}", nodes.size());
61 nodesToExclude.addAll(nodes);
64 public List<String> getExcludeSRLG() {
65 LOG.debug("in Pceconstraints getExcludeSRLG size = {}", srlgToExclude.size());
69 public void setExcludeSRLG(List<String> srlg) {
70 LOG.debug("in Pceconstraints setExcludeSRLG size = {}", srlg.size());
71 srlgToExclude.addAll(srlg);
76 public List<String> getIncludeNodes() {
77 LOG.debug("in Pceconstraints getIncludeNodes size = {}", nodesToInclude.size());
78 return nodesToInclude;
81 public void setIncludeNodes(List<String> nodes) {
82 LOG.debug("in Pceconstraints setIncludeNodes size = {}", nodes.size());
83 nodesToInclude.addAll(nodes);
86 public List<PceNode> getIncludePceNodes() {
87 LOG.debug("in Pceconstraints getIncludePceNodes size = {}", pceNodesToInclude.size());
88 return pceNodesToInclude;
91 public void setIncludePceNode(PceNode node) {
92 LOG.info("in Pceconstraints setIncludePceNode new node = {}", node.toString());
93 this.pceNodesToInclude.add(node);
96 public Double getMaxOSNR() {
97 LOG.debug("in Pceconstraints getMaxOSNR = {}", maxOSNR);