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;
18 import org.opendaylight.yangtools.yang.common.Uint16;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
23 public class PceResult {
24 private static final Logger LOG = LoggerFactory.getLogger(PceResult.class);
25 private String calcMessage = "503 Calculator Unavailable";
26 private boolean calcStatus = false;
27 private String responseCode = ResponseCodes.RESPONSE_FAILED;
28 private long resultWavelength = -1;
29 private Map<String, Uint16> resultTribPort;
30 private Map<String, List<Uint16>> resultTribSlot;
31 private Integer resultTribSlotNb = -1;
32 private String serviceType = "";
34 // for now it is constant returned as received from A-end
35 private long rate = -1;
36 private ServiceFormat serviceFormat = ServiceFormat.OC;
38 public enum LocalCause {
39 NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
42 private LocalCause localCause = LocalCause.NONE;
44 private AToZDirection atozdirection = null;
45 private ZToADirection ztoadirection = null;
50 public void setRC(String rc) {
52 case ResponseCodes.RESPONSE_OK :
53 calcMessage = "Path is calculated by PCE";
55 responseCode = ResponseCodes.RESPONSE_OK;
57 case ResponseCodes.RESPONSE_FAILED :
58 responseCode = ResponseCodes.RESPONSE_FAILED;
60 calcMessage = "No path available by PCE";
63 LOG.error("setRC: RespondeCodes unknown");
67 public String toString() {
68 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
69 + localCause + " rate=" + rate + " serviceType = " + serviceType);
72 public boolean getStatus() {
76 public String getMessage() {
80 public String getResponseCode() {
84 public long getResultWavelength() {
85 return resultWavelength;
88 public void setResultWavelength(long resultWavelength) {
89 this.resultWavelength = resultWavelength;
92 public AToZDirection getAtoZDirection() {
96 public ZToADirection getZtoADirection() {
100 public void setAtoZDirection(AToZDirection atozDirection) {
101 this.atozdirection = atozDirection;
104 public void setZtoADirection(ZToADirection ztoaDirection) {
105 this.ztoadirection = ztoaDirection;
108 public long getRate() {
112 public void setRate(long rate) {
116 public ServiceFormat getServiceFormat() {
117 return serviceFormat;
120 public void setServiceFormat(ServiceFormat serviceFormat) {
121 this.serviceFormat = serviceFormat;
124 public LocalCause getLocalCause() {
128 public void setLocalCause(LocalCause lc) {
129 this.localCause = lc;
132 public void setCalcMessage(String calcMessage) {
133 this.calcMessage = calcMessage;
136 public Map<String, Uint16> getResultTribPort() {
137 return resultTribPort;
140 public void setResultTribPort(Map<String, Uint16> resultTribPort) {
141 this.resultTribPort = resultTribPort;
144 public Map<String, List<Uint16>> getResultTribSlot() {
145 return resultTribSlot;
148 public void setResultTribSlot(Map<String, List<Uint16>> resultTribSlot) {
149 this.resultTribSlot = resultTribSlot;
152 public int getResultTribSlotNb() {
153 return resultTribSlotNb;
156 public void setResultTribSlotNb(int resultTribSlotNb) {
157 this.resultTribSlotNb = resultTribSlotNb;
160 public String getServiceType() {
164 public void setServiceType(String serviceType) {
165 this.serviceType = serviceType;