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 // List<String> srlgToInclude = new ArrayList<String>();
32 public RoutingConstraintsSp.PceMetric getPceMetrics() {
36 public void setPceMetrics(RoutingConstraintsSp.PceMetric pceMetrics) {
37 this.pceMetrics = pceMetrics;
40 // Latency of path is used by Graph to validate path
41 // if -1 , latency is not applicable (not mentioned in constraints)
42 public Long getMaxLatency() {
43 LOG.debug("in Pceconstraints getMaxLatency = {}", maxLatency);
47 public void setMaxLatency(Long maxLatency) {
48 LOG.debug("in Pceconstraints setMaxLatency = {}", maxLatency);
49 this.maxLatency = maxLatency;
52 // Exclude nodes / SRLD /
53 public List<String> getExcludeNodes() {
54 LOG.debug("in Pceconstraints getExcludeNodes size = {}", nodesToExclude.size());
55 return nodesToExclude;
58 public void setExcludeNodes(List<String> nodes) {
59 LOG.debug("in Pceconstraints setExcludeNodes size = {}", nodes.size());
60 nodesToExclude.addAll(nodes);
63 public List<String> getExcludeSRLG() {
64 LOG.debug("in Pceconstraints getExcludeSRLG size = {}", srlgToExclude.size());
68 public void setExcludeSRLG(List<String> srlg) {
69 LOG.debug("in Pceconstraints setExcludeSRLG size = {}", srlg.size());
70 srlgToExclude.addAll(srlg);
75 public List<String> getIncludeNodes() {
76 LOG.debug("in Pceconstraints getIncludeNodes size = {}", nodesToInclude.size());
77 return nodesToInclude;
80 public void setIncludeNodes(List<String> nodes) {
81 LOG.debug("in Pceconstraints setIncludeNodes size = {}", nodes.size());
82 nodesToInclude.addAll(nodes);
85 public List<PceNode> getIncludePceNodes() {
86 LOG.debug("in Pceconstraints getIncludePceNodes size = {}", pceNodesToInclude.size());
87 return pceNodesToInclude;
90 public void setIncludePceNode(PceNode node) {
91 LOG.info("in Pceconstraints setIncludePceNode new node = {}", node.toString());
92 this.pceNodesToInclude.add(node);