Reintroduce SP 1.6 models in TPCE
[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 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;
15
16 // internal type after parsing
17 public class PceConstraints {
18     /* Logging. */
19     private static final Logger LOG = LoggerFactory.getLogger(PceCalculation.class);
20
21     // TODO. for now metrics are set into hard structure
22     private RoutingConstraintsSp.PceMetric pceMetrics = RoutingConstraintsSp.PceMetric.HopCount;
23     private Long maxLatency = (long) -1;
24
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>();
30
31
32     public RoutingConstraintsSp.PceMetric getPceMetrics() {
33         return pceMetrics;
34     }
35
36     public void setPceMetrics(RoutingConstraintsSp.PceMetric pceMetrics) {
37         this.pceMetrics = pceMetrics;
38     }
39
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);
44         return maxLatency;
45     }
46
47     public void setMaxLatency(Long maxLatency) {
48         LOG.debug("in Pceconstraints setMaxLatency = {}", maxLatency);
49         this.maxLatency = maxLatency;
50     }
51
52     // Exclude nodes / SRLD /
53     public List<String> getExcludeNodes() {
54         LOG.debug("in Pceconstraints getExcludeNodes size = {}", nodesToExclude.size());
55         return nodesToExclude;
56     }
57
58     public void setExcludeNodes(List<String> nodes) {
59         LOG.debug("in Pceconstraints setExcludeNodes size = {}", nodes.size());
60         nodesToExclude.addAll(nodes);
61     }
62
63     public List<String> getExcludeSRLG() {
64         LOG.debug("in Pceconstraints getExcludeSRLG size = {}", srlgToExclude.size());
65         return srlgToExclude;
66     }
67
68     public void setExcludeSRLG(List<String> srlg) {
69         LOG.debug("in Pceconstraints setExcludeSRLG size = {}", srlg.size());
70         srlgToExclude.addAll(srlg);
71     }
72
73
74     // Include nodes
75     public List<String> getIncludeNodes() {
76         LOG.debug("in Pceconstraints getIncludeNodes size = {}", nodesToInclude.size());
77         return nodesToInclude;
78     }
79
80     public void setIncludeNodes(List<String> nodes) {
81         LOG.debug("in Pceconstraints setIncludeNodes size = {}", nodes.size());
82         nodesToInclude.addAll(nodes);
83     }
84
85     public List<PceNode> getIncludePceNodes() {
86         LOG.debug("in Pceconstraints getIncludePceNodes size = {}", pceNodesToInclude.size());
87         return pceNodesToInclude;
88     }
89
90     public void setIncludePceNode(PceNode node) {
91         LOG.info("in Pceconstraints setIncludePceNode new node = {}", node.toString());
92         this.pceNodesToInclude.add(node);
93     }
94
95 }