Update port-mapping model with port states
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / networkanalyzer / PceResult.java
index abce70280999dc79d203304105e8ecfc8daebaa3..b84c95ba6429ee8f50daeab4031dca0313adb5a7 100644 (file)
@@ -8,10 +8,15 @@
 
 package org.opendaylight.transportpce.pce.networkanalyzer;
 
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
 import org.opendaylight.transportpce.common.ResponseCodes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
-
+import org.opendaylight.transportpce.common.fixedflex.GridConstant;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.AToZDirection;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.ZToADirection;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -20,8 +25,17 @@ public class PceResult {
     private String calcMessage = "503 Calculator Unavailable";
     private boolean calcStatus = false;
     private String responseCode = ResponseCodes.RESPONSE_FAILED;
-    private long resultWavelength = -1;
+    private long resultWavelength = GridConstant.IRRELEVANT_WAVELENGTH_NUMBER;
+    private Map<String, Uint16> resultTribPort;
+    private Map<String, List<Uint16>> resultTribSlot;
+    private Integer resultTribSlotNb = -1;
+    private String serviceType = "";
+    private BigDecimal minFreq;
+    private BigDecimal maxFreq;
+
+    // for now it is constant returned as received from A-end
     private long rate = -1;
+    private  ServiceFormat serviceFormat = ServiceFormat.OC;
 
     public enum LocalCause {
         NONE, TOO_HIGH_LATENCY, OUT_OF_SPEC_OSNR, NO_PATH_EXISTS, INT_PROBLEM, HD_NODE_INCLUDE;
@@ -32,9 +46,6 @@ public class PceResult {
     private AToZDirection atozdirection = null;
     private ZToADirection ztoadirection = null;
 
-    public PceResult() {
-    }
-
     public void setRC(String rc) {
         switch (rc) {
             case ResponseCodes.RESPONSE_OK :
@@ -53,9 +64,8 @@ public class PceResult {
     }
 
     public String toString() {
-        return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength="
-                + resultWavelength + " localCause=" + localCause + " rate="
-                + rate);
+        return ("[" + calcMessage + "] code:[" + responseCode + "] wavelength=" + resultWavelength + " localCause="
+                + localCause + " rate=" + rate + " serviceType = " + serviceType);
     }
 
     public boolean getStatus() {
@@ -102,21 +112,88 @@ public class PceResult {
         this.rate = rate;
     }
 
+    public ServiceFormat getServiceFormat() {
+        return serviceFormat;
+    }
+
+    public void setServiceFormat(ServiceFormat serviceFormat) {
+        this.serviceFormat = serviceFormat;
+    }
+
     public LocalCause getLocalCause() {
         return localCause;
     }
 
     public void setLocalCause(LocalCause lc) {
-        // For now keep the very first fatal problem
-        // TODO. Later this value might become history of algo if all
-        // significant problems are added here as to List
-        if (localCause == LocalCause.NONE) {
-            this.localCause = lc;
-        }
+        this.localCause = lc;
     }
 
     public void setCalcMessage(String calcMessage) {
         this.calcMessage = calcMessage;
     }
 
+    public Map<String, Uint16> getResultTribPort() {
+        return resultTribPort;
+    }
+
+    public void setResultTribPort(Map<String, Uint16> resultTribPort) {
+        this.resultTribPort = resultTribPort;
+    }
+
+    public Map<String, List<Uint16>> getResultTribSlot() {
+        return resultTribSlot;
+    }
+
+    public void setResultTribSlot(Map<String, List<Uint16>> resultTribSlot) {
+        this.resultTribSlot = resultTribSlot;
+    }
+
+    public int getResultTribSlotNb() {
+        return resultTribSlotNb;
+    }
+
+    public void setResultTribSlotNb(int resultTribSlotNb) {
+        this.resultTribSlotNb = resultTribSlotNb;
+    }
+
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    public void setServiceType(String serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    /**
+     * Get the minimal frequency.
+     * @return the minFreq.
+     */
+    public BigDecimal getMinFreq() {
+        return minFreq;
+    }
+
+    /**
+     * Set the minimal frequency.
+     * @param minFreq the minFreq to set.
+     */
+    public void setMinFreq(BigDecimal minFreq) {
+        this.minFreq = minFreq;
+    }
+
+    /**
+     * Get the maximal frequency.
+     * @return the maxFreq.
+     */
+    public BigDecimal getMaxFreq() {
+        return maxFreq;
+    }
+
+    /**
+     * Set the maximal frequency.
+     * @param maxFreq the maxFreq to set.
+     */
+    public void setMaxFreq(BigDecimal maxFreq) {
+        this.maxFreq = maxFreq;
+    }
+
 }