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;
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.RoutingConstraintsSp;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 // internal type after parsing
19 public class PceConstraints {
21 private static final Logger LOG = LoggerFactory.getLogger(PceCalculation.class);
23 // TODO. for now metrics are set into hard structure
24 private RoutingConstraintsSp.PceMetric pceMetrics = RoutingConstraintsSp.PceMetric.HopCount;
25 private Long maxLatency = (long) -1;
27 private List<String> nodesToExclude = new ArrayList<String>();
28 private List<String> srlgToExclude = new ArrayList<String>();
29 private List<String> nodesToInclude = new ArrayList<String>();
30 private List<PceNode> pceNodesToInclude = new ArrayList<PceNode>();
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);