bit error rate ui and cli for retrieve pre and post fec ber
Change-Id: Ic68ed02ba4516c326baacac814569cb4eebd086f
diff --git a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java
index 9abd2f1..647b22e 100644
--- a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java
+++ b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java
@@ -30,6 +30,7 @@
import org.onosproject.net.OchSignal;
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
+import org.onosproject.net.behaviour.BitErrorRateState;
import org.onosproject.net.behaviour.PowerConfig;
import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointState;
import org.onosproject.net.behaviour.protection.TransportEndpointState;
@@ -94,11 +95,15 @@
private static final String TARGET_POWER = "targetPower";
private static final String MODULATION = "modulation";
private static final String HAS_TARGET_POWER = "hasTargetPower";
+ private static final String PRE_FEC_BER = "preFecBitErrorRate";
+ private static final String POST_FEC_BER = "postFecBitErrorRate";
private static final String SERVICE_STATE = "serviceState";
+
private static final String[] COLUMN_IDS = {
ID, REVERSE_PORT, TYPE, NAME, ENABLED, MIN_FREQ, MAX_FREQ, GRID, CURR_FREQ, POWER_RANGE,
- CURRENT_POWER, CURRENT_INPUT_POWER, SERVICE_STATE, TARGET_POWER, MODULATION, HAS_TARGET_POWER
+ CURRENT_POWER, CURRENT_INPUT_POWER, SERVICE_STATE, TARGET_POWER, MODULATION, HAS_TARGET_POWER,
+ PRE_FEC_BER, POST_FEC_BER
};
private RoadmService roadmService;
@@ -172,7 +177,9 @@
.cell(SERVICE_STATE, getPortServiceState(deviceId, portNum))
.cell(MODULATION, getModulation(deviceId, portNum))
.cell(TARGET_POWER, getTargetPower(deviceId, portNum))
- .cell(HAS_TARGET_POWER, roadmService.hasPortTargetPower(deviceId, portNum));
+ .cell(HAS_TARGET_POWER, roadmService.hasPortTargetPower(deviceId, portNum))
+ .cell(PRE_FEC_BER, getPreFecBer(deviceId, portNum))
+ .cell(POST_FEC_BER, getPostFecBer(deviceId, portNum));
}
private String getPortServiceState(DeviceId deviceId, PortNumber portNumber) {
@@ -238,6 +245,28 @@
return RoadmUtil.objectToString(inputPowerVal, RoadmUtil.UNKNOWN);
}
+ // Returns the current input power as a string, Unknown if no value can be found.
+ private String getPreFecBer(DeviceId deviceId, PortNumber portNumber) {
+ BitErrorRateState bitErrorRateState = deviceService.getDevice(deviceId).as(BitErrorRateState.class);
+ Optional<Double> preFecBer = bitErrorRateState.getPreFecBer(deviceId, portNumber);
+ Double preFecBerVal = null;
+ if (preFecBer.isPresent()) {
+ preFecBerVal = preFecBer.orElse(Double.MIN_VALUE);
+ }
+ return RoadmUtil.objectToString(preFecBerVal, RoadmUtil.UNKNOWN);
+ }
+
+ // Returns the current input power as a string, Unknown if no value can be found.
+ private String getPostFecBer(DeviceId deviceId, PortNumber portNumber) {
+ BitErrorRateState bitErrorRateState = deviceService.getDevice(deviceId).as(BitErrorRateState.class);
+ Optional<Double> postFecBer = bitErrorRateState.getPostFecBer(deviceId, portNumber);
+ Double postFecBerVal = null;
+ if (postFecBer.isPresent()) {
+ postFecBerVal = postFecBer.orElse(Double.MIN_VALUE);
+ }
+ return RoadmUtil.objectToString(postFecBerVal, RoadmUtil.UNKNOWN);
+ }
+
// Returns target power as a string, Unknown if target power is expected but
// cannot be found, N/A if port does not have configurable target power
private String getTargetPower(DeviceId deviceId, PortNumber portNumber) {
diff --git a/apps/roadm/web/roadm-gui/lib/port/port.component.html b/apps/roadm/web/roadm-gui/lib/port/port.component.html
index fc5461d..5c82dc4 100644
--- a/apps/roadm/web/roadm-gui/lib/port/port.component.html
+++ b/apps/roadm/web/roadm-gui/lib/port/port.component.html
@@ -77,6 +77,8 @@
<td colId="currentInputPower">CURRENT INPUT POWER (dBm)</td>
<td colId="targetPower">TARGET OUTPUT POWER (dBm)</td>
<td colId="hasTargetPower">HAS TARGET POWER</td>
+ <td colId="PRE_FEC_BER">PRE FEC BER</td>
+ <td colId="POST_FEC_BER">POST FEC BER</td>
<td colId="serviceState">SERVICE STATE</td>
</tr>
</table>
@@ -122,6 +124,8 @@
</form>
</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">{{port.hasTargetPower}}</td>
+ <td [ngClass]="(isDelta() ? 'delta' : '')">{{convertNumber(port.preFecBitErrorRate)}}</td>
+ <td [ngClass]="(isDelta() ? 'delta' : '')">{{convertNumber(port.postFecBitErrorRate)}}</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">{{port.serviceState}}</td>
</tr>
</table>