fix import extra separations
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / networkanalyzer / PceResult.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
9 package org.opendaylight.transportpce.pce.networkanalyzer;
10
11 import java.util.List;
12 import java.util.Map;
13 import org.opendaylight.transportpce.common.ResponseCodes;
14 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
15 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
16 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
17 import org.opendaylight.yangtools.yang.common.Uint16;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 public class PceResult {
22     private static final Logger LOG = LoggerFactory.getLogger(PceResult.class);
23     private String calcMessage = "503 Calculator Unavailable";
24     private boolean calcStatus = false;
25     private String responseCode = ResponseCodes.RESPONSE_FAILED;
26     private long resultWavelength = -1;
27     private Map<String, Uint16> resultTribPort;
28     private Map<String, List<Uint16>> resultTribSlot;
29     private Integer resultTribSlotNb = -1;
30     private String serviceType = "";
31
32     // for now it is constant returned as received from A-end
33     private long rate = -1;
34     private  ServiceFormat serviceFormat = ServiceFormat.OC;
35
36     public enum LocalCause {
37         NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
38     }
39
40     private LocalCause localCause = LocalCause.NONE;
41
42     private AToZDirection atozdirection = null;
43     private ZToADirection ztoadirection = null;
44
45     public PceResult() {
46     }
47
48     public void setRC(String rc) {
49         switch (rc) {
50             case ResponseCodes.RESPONSE_OK :
51                 calcMessage = "Path is calculated by PCE";
52                 calcStatus = true;
53                 responseCode = ResponseCodes.RESPONSE_OK;
54                 break;
55             case ResponseCodes.RESPONSE_FAILED :
56                 responseCode = ResponseCodes.RESPONSE_FAILED;
57                 calcStatus = false;
58                 calcMessage = "No path available by PCE";
59                 break;
60             default:
61                 LOG.error("setRC: RespondeCodes unknown");
62         }
63     }
64
65     public String toString() {
66         return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
67                 + localCause + " rate=" + rate + " serviceType = " + serviceType);
68     }
69
70     public boolean getStatus() {
71         return calcStatus;
72     }
73
74     public String getMessage() {
75         return calcMessage;
76     }
77
78     public String getResponseCode() {
79         return responseCode;
80     }
81
82     public long getResultWavelength() {
83         return resultWavelength;
84     }
85
86     public void setResultWavelength(long resultWavelength) {
87         this.resultWavelength = resultWavelength;
88     }
89
90     public AToZDirection getAtoZDirection() {
91         return atozdirection;
92     }
93
94     public ZToADirection getZtoADirection() {
95         return ztoadirection;
96     }
97
98     public void setAtoZDirection(AToZDirection atozDirection) {
99         this.atozdirection = atozDirection;
100     }
101
102     public void setZtoADirection(ZToADirection ztoaDirection) {
103         this.ztoadirection = ztoaDirection;
104     }
105
106     public long getRate() {
107         return rate;
108     }
109
110     public void setRate(long rate) {
111         this.rate = rate;
112     }
113
114     public ServiceFormat getServiceFormat() {
115         return serviceFormat;
116     }
117
118     public void setServiceFormat(ServiceFormat serviceFormat) {
119         this.serviceFormat = serviceFormat;
120     }
121
122     public LocalCause getLocalCause() {
123         return localCause;
124     }
125
126     public void setLocalCause(LocalCause lc) {
127         this.localCause = lc;
128     }
129
130     public void setCalcMessage(String calcMessage) {
131         this.calcMessage = calcMessage;
132     }
133
134     public Map<String, Uint16> getResultTribPort() {
135         return resultTribPort;
136     }
137
138     public void setResultTribPort(Map<String, Uint16> resultTribPort) {
139         this.resultTribPort = resultTribPort;
140     }
141
142     public Map<String, List<Uint16>> getResultTribSlot() {
143         return resultTribSlot;
144     }
145
146     public void setResultTribSlot(Map<String, List<Uint16>> resultTribSlot) {
147         this.resultTribSlot = resultTribSlot;
148     }
149
150     public int getResultTribSlotNb() {
151         return resultTribSlotNb;
152     }
153
154     public void setResultTribSlotNb(int resultTribSlotNb) {
155         this.resultTribSlotNb = resultTribSlotNb;
156     }
157
158     public String getServiceType() {
159         return serviceType;
160     }
161
162     public void setServiceType(String serviceType) {
163         this.serviceType = serviceType;
164     }
165
166 }