Fix for modulation display and power strings
Change-Id: I6d74b6d2d0946c8fac456f5a9e8e65571b9b1136
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 f87bb07..9abd2f1 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
@@ -256,7 +256,7 @@
if (port.type().equals(Port.Type.OCH)) {
modulation = roadmService.getModulation(deviceId, portNumber);
}
- return RoadmUtil.objectToString(modulation, RoadmUtil.UNKNOWN);
+ return RoadmUtil.objectToString(modulation, RoadmUtil.UNKNOWN).toLowerCase();
}
// Returns modulation as a string, Unknown if modulation is expected but
diff --git a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmUtil.java b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmUtil.java
index 73a2dba..6ce3903 100644
--- a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmUtil.java
+++ b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmUtil.java
@@ -131,7 +131,7 @@
GridType gridType = ochPort.lambda().gridType();
ChannelSpacing channelSpacing = ochPort.lambda().channelSpacing();
int slotGranularity = ochPort.lambda().slotGranularity();
- int multiplier = getMultplier(wavelength, gridType, channelSpacing);
+ int multiplier = getMultiplier(wavelength, gridType, channelSpacing);
return new OchSignal(gridType, channelSpacing, multiplier, slotGranularity);
} else {
return null;
@@ -139,7 +139,7 @@
}
- private static int getMultplier(double wavelength, GridType gridType, ChannelSpacing channelSpacing) {
+ private static int getMultiplier(double wavelength, GridType gridType, ChannelSpacing channelSpacing) {
long baseFreq;
switch (gridType) {
case DWDM:
@@ -152,10 +152,6 @@
baseFreq = 0L;
break;
}
- if (wavelength > baseFreq) {
- return (int) ((wavelength - baseFreq) / (channelSpacing.frequency().asMHz()));
- } else {
- return (int) ((baseFreq - wavelength) / (channelSpacing.frequency().asMHz()));
- }
+ return (int) ((wavelength - baseFreq) / (channelSpacing.frequency().asMHz()));
}
}
\ No newline at end of file
diff --git a/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html b/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html
index 0385b03..fc5461d 100644
--- a/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html
+++ b/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html
@@ -73,9 +73,9 @@
<td colId="currentFreq">CURRENT FREQ (THz)</td>
<td colId="modulation">MODULATION</td>
<td colId="powerRange">POWER RANGE (dBm)</td>
- <td colId="currentPower">CURRENT POWER (dBm)</td>
+ <td colId="currentPower">CURRENT OUTPUT POWER (dBm)</td>
<td colId="currentInputPower">CURRENT INPUT POWER (dBm)</td>
- <td colId="targetPower">TARGET POWER (dBm)</td>
+ <td colId="targetPower">TARGET OUTPUT POWER (dBm)</td>
<td colId="hasTargetPower">HAS TARGET POWER</td>
<td colId="serviceState">SERVICE STATE</td>
</tr>
@@ -94,9 +94,9 @@
<td [ngClass]="(isDelta() ? 'delta' : '')">{{port.name}}</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type}}</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">{{port.enabled}}</td>
- <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.minFreq:""}}</td>
- <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.maxFreq:""}}</td>
- <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.grid:""}}</td>
+ <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH' || port.type=='OMS'?port.minFreq:""}}</td>
+ <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH' || port.type=='OMS'?port.maxFreq:""}}</td>
+ <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH' || port.type=='OMS'?port.grid:""}}</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">
<form [formGroup]="freqForm" (ngSubmit)="submitFrequency(devId, port.id)" *ngIf="port.type=='OCH'">
<input type="text" style="width:50px" value="{{port.type=='OCH'?port.currFreq:''}}" formControlName="newFreq" required>
@@ -116,7 +116,7 @@
<td [ngClass]="(isDelta() ? 'delta' : '')">{{convertNumber(port.currentPower) | number: '1.2-2'}}</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">{{convertNumber(port.currentInputPower) | number: '1.2-2'}}</td>
<td [ngClass]="(isDelta() ? 'delta' : '')">
- <form [formGroup]="powerForm" (ngSubmit)="submitPower(devId, port.id)" *ngIf="port.type=='OCH'">
+ <form [formGroup]="powerForm" (ngSubmit)="submitPower(devId, port.id)" *ngIf="port.type=='OCH' || port.type=='OMS'">
<input type="number" step="any" style="width:50px" value="{{convertNumber(port.targetPower) | number: '1.2-2'}}" formControlName="newPower" required>
<button type="submit">Submit</button>
</form>