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
9 package org.opendaylight.transportpce.pce.networkanalyzer;
11 import java.util.List;
14 import org.opendaylight.transportpce.common.ResponseCodes;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
16 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
17 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class PceResult {
23 private static final Logger LOG = LoggerFactory.getLogger(PceResult.class);
24 private String calcMessage = "503 Calculator Unavailable";
25 private boolean calcStatus = false;
26 private String responseCode = ResponseCodes.RESPONSE_FAILED;
27 private long resultWavelength = -1;
28 private Map<String, Integer> resultTribPort;
29 private Map<String, List<Integer>> resultTribSlot;
30 private Integer resultTribSlotNb = -1;
31 private String serviceType = "";
33 // for now it is constant returned as received from A-end
34 private long rate = -1;
35 private ServiceFormat serviceFormat = ServiceFormat.OC;
37 public enum LocalCause {
38 NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
41 private LocalCause localCause = LocalCause.NONE;
43 private AToZDirection atozdirection = null;
44 private ZToADirection ztoadirection = null;
49 public void setRC(String rc) {
51 case ResponseCodes.RESPONSE_OK :
52 calcMessage = "Path is calculated by PCE";
54 responseCode = ResponseCodes.RESPONSE_OK;
56 case ResponseCodes.RESPONSE_FAILED :
57 responseCode = ResponseCodes.RESPONSE_FAILED;
59 calcMessage = "No path available by PCE";
62 LOG.error("setRC: RespondeCodes unknown");
66 public String toString() {
67 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
68 + localCause + " rate=" + rate + " serviceType = " + serviceType);
71 public boolean getStatus() {
75 public String getMessage() {
79 public String getResponseCode() {
83 public long getResultWavelength() {
84 return resultWavelength;
87 public void setResultWavelength(long resultWavelength) {
88 this.resultWavelength = resultWavelength;
91 public AToZDirection getAtoZDirection() {
95 public ZToADirection getZtoADirection() {
99 public void setAtoZDirection(AToZDirection atozDirection) {
100 this.atozdirection = atozDirection;
103 public void setZtoADirection(ZToADirection ztoaDirection) {
104 this.ztoadirection = ztoaDirection;
107 public long getRate() {
111 public void setRate(long rate) {
115 public ServiceFormat getServiceFormat() {
116 return serviceFormat;
119 public void setServiceFormat(ServiceFormat serviceFormat) {
120 this.serviceFormat = serviceFormat;
123 public LocalCause getLocalCause() {
127 public void setLocalCause(LocalCause lc) {
128 // For now keep the very first fatal problem
129 // TODO. Later this value might become history of algo if all
130 // significant problems are added here as to List
131 if (localCause == LocalCause.NONE) {
132 this.localCause = lc;
136 public void setCalcMessage(String calcMessage) {
137 this.calcMessage = calcMessage;
140 public Map<String, Integer> getResultTribPort() {
141 return resultTribPort;
144 public void setResultTribPort(Map<String, Integer> resultTribPort) {
145 this.resultTribPort = resultTribPort;
148 public Map<String, List<Integer>> getResultTribSlot() {
149 return resultTribSlot;
152 public void setResultTribSlot(Map<String, List<Integer>> resultTribSlot) {
153 this.resultTribSlot = resultTribSlot;
156 public int getResultTribSlotNb() {
157 return resultTribSlotNb;
160 public void setResultTribSlotNb(int resultTribSlotNb) {
161 this.resultTribSlotNb = resultTribSlotNb;
164 public String getServiceType() {
168 public void setServiceType(String serviceType) {
169 this.serviceType = serviceType;