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.openroadm.service.format.rev190531.ServiceFormat;
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
14 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 public class PceResult {
20 private static final Logger LOG = LoggerFactory.getLogger(PceResult.class);
21 private String calcMessage = "503 Calculator Unavailable";
22 private boolean calcStatus = false;
23 private String responseCode = ResponseCodes.RESPONSE_FAILED;
24 private long resultWavelength = -1;
25 private long rate = -1;
26 private ServiceFormat serviceFormat = ServiceFormat.OC;
28 public enum LocalCause {
29 NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
32 private LocalCause localCause = LocalCause.NONE;
34 private AToZDirection atozdirection = null;
35 private ZToADirection ztoadirection = null;
40 public void setRC(String rc) {
42 case ResponseCodes.RESPONSE_OK :
43 calcMessage = "Path is calculated by PCE";
45 responseCode = ResponseCodes.RESPONSE_OK;
47 case ResponseCodes.RESPONSE_FAILED :
48 responseCode = ResponseCodes.RESPONSE_FAILED;
50 calcMessage = "No path available by PCE";
53 LOG.error("setRC: RespondeCodes unknown");
57 public String toString() {
58 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength="
59 + resultWavelength + " localCause=" + localCause + " rate="
63 public boolean getStatus() {
67 public String getMessage() {
71 public String getResponseCode() {
75 public long getResultWavelength() {
76 return resultWavelength;
79 public void setResultWavelength(long resultWavelength) {
80 this.resultWavelength = resultWavelength;
83 public AToZDirection getAtoZDirection() {
87 public ZToADirection getZtoADirection() {
91 public void setAtoZDirection(AToZDirection atozDirection) {
92 this.atozdirection = atozDirection;
95 public void setZtoADirection(ZToADirection ztoaDirection) {
96 this.ztoadirection = ztoaDirection;
99 public long getRate() {
103 public void setRate(long rate) {
107 public ServiceFormat getServiceFormat() {
108 return serviceFormat;
111 public void setServiceFormat(ServiceFormat serviceFormat) {
112 this.serviceFormat = serviceFormat;
115 public LocalCause getLocalCause() {
119 public void setLocalCause(LocalCause lc) {
120 // For now keep the very first fatal problem
121 // TODO. Later this value might become history of algo if all
122 // significant problems are added here as to List
123 if (localCause == LocalCause.NONE) {
124 this.localCause = lc;
128 public void setCalcMessage(String calcMessage) {
129 this.calcMessage = calcMessage;