WIFI-780: Change Opensync Gateway to process RF survey data as percentile data

Change ChannelInfo reports to reflect Survey data showing
percentage values for samples.
ApNode report still being addressed.
This commit is contained in:
Mike Hansen
2020-09-15 17:23:03 -04:00
parent f5007a73d0
commit 93b3deec4b

View File

@@ -1425,7 +1425,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
int oBSS = 0; int oBSS = 0;
int iBSS = 0; int iBSS = 0;
int totalBusy = 0; int totalBusy = 0;
int durationMs = 0; int totalDurationMs = 0;
RadioType radioType = RadioType.UNSUPPORTED; RadioType radioType = RadioType.UNSUPPORTED;
List<Integer> noiseList = new ArrayList<>(); List<Integer> noiseList = new ArrayList<>();
@@ -1434,19 +1434,19 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
continue; continue;
} }
iBSS += surveySample.getBusySelf() + surveySample.getBusyTx(); // we need to perform a weighted average here because the
oBSS += surveySample.getBusyRx(); // samples are in percentage, and may be of different durations
totalBusy += surveySample.getBusy(); iBSS += (surveySample.getBusySelf() + surveySample.getBusyTx()) * surveySample.getDurationMs();
durationMs += surveySample.getDurationMs(); oBSS += surveySample.getBusyRx() * surveySample.getDurationMs();
totalBusy += surveySample.getBusy() * surveySample.getDurationMs();
totalDurationMs += surveySample.getDurationMs();
noiseList.add(getNegativeSignedIntFrom8BitUnsigned(surveySample.getNoise())); noiseList.add(getNegativeSignedIntFrom8BitUnsigned(surveySample.getNoise()));
RadioUtilization radioUtil = new RadioUtilization(); RadioUtilization radioUtil = new RadioUtilization();
radioUtil.setTimestampSeconds((int) ((survey.getTimestampMs() + surveySample.getOffsetMs()) / 1000)); radioUtil.setTimestampSeconds((int) ((survey.getTimestampMs() + surveySample.getOffsetMs()) / 1000));
radioUtil.setAssocClientTx((100 * surveySample.getBusyTx()) / surveySample.getDurationMs()); radioUtil.setAssocClientTx(surveySample.getBusyTx());
radioUtil.setAssocClientRx((100 * surveySample.getBusyRx()) / surveySample.getDurationMs()); radioUtil.setAssocClientRx(surveySample.getBusySelf());
// TODO not totally correct, NonWifi = totalBusy - iBSS - oBSS // TODO not totally correct, NonWifi = totalBusy - iBSS - oBSS
radioUtil.setNonWifi( radioUtil.setNonWifi(surveySample.getBusy() - surveySample.getBusyTx() - surveySample.getBusySelf());
(100 * (surveySample.getBusy() - surveySample.getBusyTx() - surveySample.getBusyRx()))
/ surveySample.getDurationMs());
switch (survey.getBand()) { switch (survey.getBand()) {
case BAND2G: case BAND2G:
@@ -1480,8 +1480,9 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
avgNoiseFloor.put(radioType, noiseAvg); avgNoiseFloor.put(radioType, noiseAvg);
apNodeMetrics.setNoiseFloor(radioType, noiseAvg); apNodeMetrics.setNoiseFloor(radioType, noiseAvg);
} }
Double totalUtilization = (100D * totalBusy) / durationMs; if (totalDurationMs > 0) {
Double totalNonWifi = (100D * (totalBusy - iBSS - oBSS)) / durationMs; Long totalUtilization = Math.round((double) totalBusy / totalDurationMs);
Long totalNonWifi = Math.round((double) totalBusy - (double) iBSS - (double) oBSS / totalDurationMs);
EquipmentCapacityDetails cap = new EquipmentCapacityDetails(); EquipmentCapacityDetails cap = new EquipmentCapacityDetails();
cap.setUnavailableCapacity(totalNonWifi.intValue()); cap.setUnavailableCapacity(totalNonWifi.intValue());
@@ -1496,6 +1497,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
capacityDetails.put(radioType, cap); capacityDetails.put(radioType, cap);
} }
} }
}
new RadioStatistics(); new RadioStatistics();
@@ -2147,28 +2149,31 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
ChannelInfo createChannelInfo(long equipmentId, RadioType radioType, List<SurveySample> surveySampleList, ChannelInfo createChannelInfo(long equipmentId, RadioType radioType, List<SurveySample> surveySampleList,
ChannelBandwidth channelBandwidth) { ChannelBandwidth channelBandwidth) {
LOG.debug("createChannelInfo::SurveySampleList {}", surveySampleList);
int busyTx = 0; /* Tx */ int busyTx = 0; /* Tx */
int busySelf = 0; /* Rx_self (derived from succesful Rx frames) */ int busySelf = 0; /* Rx_self (derived from succesful Rx frames) */
int busy = 0; /* Busy = Rx + Tx + Interference */ int busy = 0; /* Busy = Rx + Tx + Interference */
long durationMs = 0; long totalDurationMs = 0;
ChannelInfo channelInfo = new ChannelInfo(); ChannelInfo channelInfo = new ChannelInfo();
int[] noiseArray = new int[surveySampleList.size()]; int[] noiseArray = new int[surveySampleList.size()];
int index = 0; int index = 0;
for (SurveySample sample : surveySampleList) { for (SurveySample sample : surveySampleList) {
LOG.debug("createChannelInfo::SurveySample {}", sample); busyTx += sample.getBusyTx() * sample.getDurationMs();
busyTx += sample.getBusyTx(); busySelf += sample.getBusySelf() * sample.getDurationMs(); // successful
busySelf += sample.getBusySelf(); // successful Rx // Rx
busy += sample.getBusy(); busy += sample.getBusy() * sample.getDurationMs();
channelInfo.setChanNumber(sample.getChannel()); channelInfo.setChanNumber(sample.getChannel());
noiseArray[index++] = getNegativeSignedIntFrom8BitUnsigned(sample.getNoise()); noiseArray[index++] = getNegativeSignedIntFrom8BitUnsigned(sample.getNoise());
durationMs += sample.getDurationMs(); totalDurationMs += sample.getDurationMs();
} }
int iBSS = busyTx + busySelf; int iBSS = busyTx + busySelf;
Double totalUtilization = (100D * busy) / durationMs; Long totalUtilization = Math.round((double) busy / totalDurationMs);
Double totalNonWifi = (100D * (busy - iBSS )) / durationMs; Long totalNonWifi = Math.round(((double) busy - (double) iBSS) / totalDurationMs);
channelInfo.setTotalUtilization(totalUtilization.intValue()); channelInfo.setTotalUtilization(totalUtilization.intValue());
channelInfo.setWifiUtilization(totalUtilization.intValue() - totalNonWifi.intValue()); channelInfo.setWifiUtilization(totalUtilization.intValue() - totalNonWifi.intValue());