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;
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;
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 = "";
32 // for now it is constant returned as received from A-end
33 private long rate = -1;
34 private ServiceFormat serviceFormat = ServiceFormat.OC;
36 public enum LocalCause {
37 NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
40 private LocalCause localCause = LocalCause.NONE;
42 private AToZDirection atozdirection = null;
43 private ZToADirection ztoadirection = null;
48 public void setRC(String rc) {
50 case ResponseCodes.RESPONSE_OK :
51 calcMessage = "Path is calculated by PCE";
53 responseCode = ResponseCodes.RESPONSE_OK;
55 case ResponseCodes.RESPONSE_FAILED :
56 responseCode = ResponseCodes.RESPONSE_FAILED;
58 calcMessage = "No path available by PCE";
61 LOG.error("setRC: RespondeCodes unknown");
65 public String toString() {
66 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
67 + localCause + " rate=" + rate + " serviceType = " + serviceType);
70 public boolean getStatus() {
74 public String getMessage() {
78 public String getResponseCode() {
82 public long getResultWavelength() {
83 return resultWavelength;
86 public void setResultWavelength(long resultWavelength) {
87 this.resultWavelength = resultWavelength;
90 public AToZDirection getAtoZDirection() {
94 public ZToADirection getZtoADirection() {
98 public void setAtoZDirection(AToZDirection atozDirection) {
99 this.atozdirection = atozDirection;
102 public void setZtoADirection(ZToADirection ztoaDirection) {
103 this.ztoadirection = ztoaDirection;
106 public long getRate() {
110 public void setRate(long rate) {
114 public ServiceFormat getServiceFormat() {
115 return serviceFormat;
118 public void setServiceFormat(ServiceFormat serviceFormat) {
119 this.serviceFormat = serviceFormat;
122 public LocalCause getLocalCause() {
126 public void setLocalCause(LocalCause lc) {
127 this.localCause = lc;
130 public void setCalcMessage(String calcMessage) {
131 this.calcMessage = calcMessage;
134 public Map<String, Uint16> getResultTribPort() {
135 return resultTribPort;
138 public void setResultTribPort(Map<String, Uint16> resultTribPort) {
139 this.resultTribPort = resultTribPort;
142 public Map<String, List<Uint16>> getResultTribSlot() {
143 return resultTribSlot;
146 public void setResultTribSlot(Map<String, List<Uint16>> resultTribSlot) {
147 this.resultTribSlot = resultTribSlot;
150 public int getResultTribSlotNb() {
151 return resultTribSlotNb;
154 public void setResultTribSlotNb(int resultTribSlotNb) {
155 this.resultTribSlotNb = resultTribSlotNb;
158 public String getServiceType() {
162 public void setServiceType(String serviceType) {
163 this.serviceType = serviceType;