ROADM To ROADM Path Calculation
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / PceConstraints.java
1 /*
2  * Copyright © 2017 AT&T, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.pce;
9
10 import java.util.ArrayList;
11 import java.util.List;
12
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.RoutingConstraintsSp;
14
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 // internal type after parsing
19 public class PceConstraints {
20     /* Logging. */
21     private static final Logger LOG = LoggerFactory.getLogger(PceCalculation.class);
22
23     // TODO. for now metrics are set into hard structure
24     private RoutingConstraintsSp.PceMetric pceMetrics = RoutingConstraintsSp.PceMetric.HopCount;
25     private Long maxLatency = (long) -1;
26
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>();
32
33
34     public RoutingConstraintsSp.PceMetric getPceMetrics() {
35         return pceMetrics;
36     }
37
38     public void setPceMetrics(RoutingConstraintsSp.PceMetric pceMetrics) {
39         this.pceMetrics = pceMetrics;
40     }
41
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);
46         return maxLatency;
47     }
48
49     public void setMaxLatency(Long maxLatency) {
50         LOG.debug("in Pceconstraints setMaxLatency = {}", maxLatency);
51         this.maxLatency = maxLatency;
52     }
53
54     // Exclude nodes / SRLD /
55     public List<String> getExcludeNodes() {
56         LOG.debug("in Pceconstraints getExcludeNodes size = {}", nodesToExclude.size());
57         return nodesToExclude;
58     }
59
60     public void setExcludeNodes(List<String> nodes) {
61         LOG.debug("in Pceconstraints setExcludeNodes size = {}", nodes.size());
62         nodesToExclude.addAll(nodes);
63     }
64
65     public List<String> getExcludeSRLG() {
66         LOG.debug("in Pceconstraints getExcludeSRLG size = {}", srlgToExclude.size());
67         return srlgToExclude;
68     }
69
70     public void setExcludeSRLG(List<String> srlg) {
71         LOG.debug("in Pceconstraints setExcludeSRLG size = {}", srlg.size());
72         srlgToExclude.addAll(srlg);
73     }
74
75
76     // Include nodes
77     public List<String> getIncludeNodes() {
78         LOG.debug("in Pceconstraints getIncludeNodes size = {}", nodesToInclude.size());
79         return nodesToInclude;
80     }
81
82     public void setIncludeNodes(List<String> nodes) {
83         LOG.debug("in Pceconstraints setIncludeNodes size = {}", nodes.size());
84         nodesToInclude.addAll(nodes);
85     }
86
87     public List<PceNode> getIncludePceNodes() {
88         LOG.debug("in Pceconstraints getIncludePceNodes size = {}", pceNodesToInclude.size());
89         return pceNodesToInclude;
90     }
91
92     public void setIncludePceNode(PceNode node) {
93         LOG.info("in Pceconstraints setIncludePceNode new node = {}", node.toString());
94         this.pceNodesToInclude.add(node);
95     }
96
97 }