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;
14 import org.opendaylight.transportpce.common.ResponseCodes;
15 import org.opendaylight.transportpce.common.fixedflex.GridConstant;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
17 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.AToZDirection;
18 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201126.path.description.ZToADirection;
19 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 = GridConstant.IRRELEVANT_WAVELENGTH_NUMBER;
29 private Map<String, Uint16> resultTribPort;
30 private Map<String, List<Uint16>> resultTribSlot;
31 private Integer resultTribSlotNb = -1;
32 private String serviceType = "";
33 private BigDecimal minFreq;
34 private BigDecimal maxFreq;
36 // for now it is constant returned as received from A-end
37 private long rate = -1;
38 private ServiceFormat serviceFormat = ServiceFormat.OC;
40 public enum LocalCause {
41 NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
44 private LocalCause localCause = LocalCause.NONE;
46 private AToZDirection atozdirection = null;
47 private ZToADirection ztoadirection = null;
49 public void setRC(String rc) {
51 case ResponseCodes.RESPONSE_OK :
52 calcMessage = "Path is calculated by PCE";
54 responseCode = ResponseCodes.RESPONSE_OK;
56 case ResponseCodes.RESPONSE_FAILED :
57 responseCode = ResponseCodes.RESPONSE_FAILED;
59 calcMessage = "No path available by PCE";
62 LOG.error("setRC: RespondeCodes unknown");
66 public String toString() {
67 return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
68 + localCause + " rate=" + rate + " serviceType = " + serviceType);
71 public boolean getStatus() {
75 public String getMessage() {
79 public String getResponseCode() {
83 public long getResultWavelength() {
84 return resultWavelength;
87 public void setResultWavelength(long resultWavelength) {
88 this.resultWavelength = resultWavelength;
91 public AToZDirection getAtoZDirection() {
95 public ZToADirection getZtoADirection() {
99 public void setAtoZDirection(AToZDirection atozDirection) {
100 this.atozdirection = atozDirection;
103 public void setZtoADirection(ZToADirection ztoaDirection) {
104 this.ztoadirection = ztoaDirection;
107 public long getRate() {
111 public void setRate(long rate) {
115 public ServiceFormat getServiceFormat() {
116 return serviceFormat;
119 public void setServiceFormat(ServiceFormat serviceFormat) {
120 this.serviceFormat = serviceFormat;
123 public LocalCause getLocalCause() {
127 public void setLocalCause(LocalCause lc) {
128 this.localCause = lc;
131 public void setCalcMessage(String calcMessage) {
132 this.calcMessage = calcMessage;
135 public Map<String, Uint16> getResultTribPort() {
136 return resultTribPort;
139 public void setResultTribPort(Map<String, Uint16> resultTribPort) {
140 this.resultTribPort = resultTribPort;
143 public Map<String, List<Uint16>> getResultTribSlot() {
144 return resultTribSlot;
147 public void setResultTribSlot(Map<String, List<Uint16>> resultTribSlot) {
148 this.resultTribSlot = resultTribSlot;
151 public int getResultTribSlotNb() {
152 return resultTribSlotNb;
155 public void setResultTribSlotNb(int resultTribSlotNb) {
156 this.resultTribSlotNb = resultTribSlotNb;
159 public String getServiceType() {
163 public void setServiceType(String serviceType) {
164 this.serviceType = serviceType;
168 * Get the minimal frequency.
169 * @return the minFreq.
171 public BigDecimal getMinFreq() {
176 * Set the minimal frequency.
177 * @param minFreq the minFreq to set.
179 public void setMinFreq(BigDecimal minFreq) {
180 this.minFreq = minFreq;
184 * Get the maximal frequency.
185 * @return the maxFreq.
187 public BigDecimal getMaxFreq() {
192 * Set the maximal frequency.
193 * @param maxFreq the maxFreq to set.
195 public void setMaxFreq(BigDecimal maxFreq) {
196 this.maxFreq = maxFreq;