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 org.opendaylight.transportpce.common.ResponseCodes;
12 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 public class PceResult {
19 private static final Logger LOG = LoggerFactory.getLogger(PceResult.class);
20 private String calcMessage = "503 Calculator Unavailable";
21 private boolean calcStatus = false;
22 private String responseCode = ResponseCodes.RESPONSE_FAILED;
23 private long resultWavelength = -1;
24 // for now it is constant returned as received from A-end
25 private long rate = -1;
27 public enum LocalCause {
28 NONE, TOO_HIGH_LATENCY, NO_PATH_EXISTS, INT_PROBLEM;
31 private LocalCause localCause = LocalCause.NONE;
33 private AToZDirection atozdirection = null;
34 private ZToADirection ztoadirection = null;
39 public void setRC(String rc) {
41 case ResponseCodes.RESPONSE_OK :
42 calcMessage = "Path is calculated";
44 responseCode = ResponseCodes.RESPONSE_OK;
46 case ResponseCodes.RESPONSE_FAILED :
47 responseCode = ResponseCodes.RESPONSE_FAILED;
49 calcMessage = "No path available";
52 LOG.error("setRC: RespondeCodes unknown");
56 public String toString() {
57 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength="
58 + resultWavelength + " localCause=" + localCause + " rate="
62 public boolean getStatus() {
66 public String getMessage() {
70 public String getResponseCode() {
74 public long getResultWavelength() {
75 return resultWavelength;
78 public void setResultWavelength(long resultWavelength) {
79 this.resultWavelength = resultWavelength;
82 public AToZDirection getAtoZDirection() {
86 public ZToADirection getZtoADirection() {
90 public void setAtoZDirection(AToZDirection atozDirection) {
91 this.atozdirection = atozDirection;
94 public void setZtoADirection(ZToADirection ztoaDirection) {
95 this.ztoadirection = ztoaDirection;
98 public long getRate() {
102 public void setRate(long rate) {
106 public LocalCause getLocalCause() {
110 public void setLocalCause(LocalCause lc) {
111 // For now keep the very first fatal problem
112 // TODO. Later this value might become history of algo if all
113 // significant problems are added here as to List
114 if (localCause == LocalCause.NONE) {
115 this.localCause = lc;
119 public void setCalcMessage(String calcMessage) {
120 this.calcMessage = calcMessage;