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.math.BigDecimal;
12 import java.util.List;
13 import org.opendaylight.transportpce.common.ResponseCodes;
14 import org.opendaylight.transportpce.common.fixedflex.GridConstant;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev181130.OpucnTribSlotDef;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
17 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
18 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.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 = GridConstant.IRRELEVANT_WAVELENGTH_NUMBER;
28 private List<OpucnTribSlotDef> resultTribSlotDefList;
29 private String serviceType = "";
30 private BigDecimal minFreq;
31 private BigDecimal maxFreq;
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;
46 public void setRC(String rc) {
48 case ResponseCodes.RESPONSE_OK :
49 calcMessage = "Path is calculated by PCE";
51 responseCode = ResponseCodes.RESPONSE_OK;
53 case ResponseCodes.RESPONSE_FAILED :
54 responseCode = ResponseCodes.RESPONSE_FAILED;
56 calcMessage = "No path available by PCE";
59 LOG.error("setRC: RespondeCodes unknown");
63 public String toString() {
64 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
65 + localCause + " rate=" + rate + " serviceType = " + serviceType);
68 public boolean getStatus() {
72 public String getMessage() {
76 public String getResponseCode() {
80 public long getResultWavelength() {
81 return resultWavelength;
84 public void setResultWavelength(long resultWavelength) {
85 this.resultWavelength = resultWavelength;
88 public AToZDirection getAtoZDirection() {
92 public ZToADirection getZtoADirection() {
96 public void setAtoZDirection(AToZDirection atozDirection) {
97 this.atozdirection = atozDirection;
100 public void setZtoADirection(ZToADirection ztoaDirection) {
101 this.ztoadirection = ztoaDirection;
104 public long getRate() {
108 public void setRate(long rate) {
112 public ServiceFormat getServiceFormat() {
113 return serviceFormat;
116 public void setServiceFormat(ServiceFormat serviceFormat) {
117 this.serviceFormat = serviceFormat;
120 public LocalCause getLocalCause() {
124 public void setLocalCause(LocalCause lc) {
125 this.localCause = lc;
128 public void setCalcMessage(String calcMessage) {
129 this.calcMessage = calcMessage;
132 public List<OpucnTribSlotDef> getResultTribPortTribSlot() {
133 return resultTribSlotDefList;
136 public void setResultTribPortTribSlot(List<OpucnTribSlotDef> resultTribPortTribSlot) {
137 this.resultTribSlotDefList = resultTribPortTribSlot;
140 public String getServiceType() {
144 public void setServiceType(String serviceType) {
145 this.serviceType = serviceType;
149 * Get the minimal frequency.
150 * @return the minFreq.
152 public BigDecimal getMinFreq() {
157 * Set the minimal frequency.
158 * @param minFreq the minFreq to set.
160 public void setMinFreq(BigDecimal minFreq) {
161 this.minFreq = minFreq;
165 * Get the maximal frequency.
166 * @return the maxFreq.
168 public BigDecimal getMaxFreq() {
173 * Set the maximal frequency.
174 * @param maxFreq the maxFreq to set.
176 public void setMaxFreq(BigDecimal maxFreq) {
177 this.maxFreq = maxFreq;