From cea90c48d3d0c22eff268b17ad66534409e79463 Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Wed, 2 Sep 2020 17:19:37 -0400 Subject: [PATCH] WIFI-638: Reported Noise floor looks inaccurate Should have noise floor sent as a signed value, is currently coming as an uint32 I believe the AP actually translates the signed value to that. ON channel reports more than just the channel in use on the radio which is making a mess as well, I have added a filter on the OSGW as a workaround which will prevent OFF channel values being used during calculation of channel info for on channel reporting. This may become unnecessary when the AP fix comes in but for now might clear things up a bit. After we change to a signed value, combined with correct channel survey reporting, we should have a better value. --- .../OpensyncExternalIntegrationCloud.java | 104 ++++++++---------- 1 file changed, 43 insertions(+), 61 deletions(-) diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java index bb2f4e2..10a1f13 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java @@ -2,9 +2,7 @@ package com.telecominfraproject.wlan.opensync.external.integration; import java.net.InetAddress; import java.net.UnknownHostException; -import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -133,7 +131,6 @@ import com.telecominfraproject.wlan.status.models.StatusCode; import com.telecominfraproject.wlan.status.models.StatusDataType; import com.telecominfraproject.wlan.status.network.models.NetworkAdminStatusData; -import javassist.bytecode.ByteArray; import sts.OpensyncStats; import sts.OpensyncStats.AssocType; import sts.OpensyncStats.Client; @@ -2514,91 +2511,76 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra long equipmentId, long locationId) { LOG.debug("populateChannelInfoReports for Customer {} Equipment {}", customerId, equipmentId); - ServiceMetric smr = new ServiceMetric(); - smr.setCustomerId(customerId); - smr.setEquipmentId(equipmentId); - smr.setLocationId(locationId); - - ChannelInfoReports channelInfoReports = new ChannelInfoReports(); - - smr.setDetails(channelInfoReports); - metricRecordList.add(smr); for (Survey survey : report.getSurveyList()) { - smr.setCreatedTimestamp(survey.getTimestampMs()); - LOG.info("Survey {}", survey); + ServiceMetric smr = new ServiceMetric(); + smr.setCustomerId(customerId); + smr.setEquipmentId(equipmentId); + smr.setLocationId(locationId); + + ChannelInfoReports channelInfoReports = new ChannelInfoReports(); + Map> channelInfoMap = channelInfoReports + .getChannelInformationReportsPerRadio(); RadioType radioType = null; - if (survey.getBand() == RadioBandType.BAND2G) { - radioType = RadioType.is2dot4GHz; - } else if (survey.getBand() == RadioBandType.BAND5G) { - radioType = RadioType.is5GHz; - } else if (survey.getBand() == RadioBandType.BAND5GL) { - radioType = RadioType.is5GHzL; - } else if (survey.getBand() == RadioBandType.BAND5GU) { - radioType = RadioType.is5GHzU; + + if (survey.hasBand()) { + radioType = getRadioTypeFromOpensyncRadioBand(survey.getBand()); + } else { + continue; } + ChannelBandwidth channelBandwidth = ((ApElementConfiguration) equipmentServiceInterface.get(equipmentId) .getDetails()).getRadioMap().get(radioType).getChannelBandwidth(); - if (survey.getSurveyType().equals(SurveyType.OFF_CHANNEL) - || survey.getSurveyType().equals(SurveyType.FULL)) { + Map> sampleByChannelMap = new HashMap<>(); - // in this case, we have multiple channels (potentially) and - // will make - // ChannelInfo entries per surveyed channel - Map> sampleByChannelMap = new HashMap<>(); + survey.getSurveyListList().stream().filter(new Predicate() { - survey.getSurveyListList().stream().forEach(s -> { - List surveySampleList; - if (sampleByChannelMap.get(s.getChannel()) == null) { - surveySampleList = new ArrayList<>(); + @Override + public boolean test(SurveySample t) { + if (survey.getSurveyType().equals(SurveyType.ON_CHANNEL)) { + return t.hasDurationMs() && t.getDurationMs() > 0 && t.hasChannel() && t.hasBusy() + && t.hasBusyTx() && t.hasNoise(); } else { - surveySampleList = sampleByChannelMap.get(s.getChannel()); + return t.hasDurationMs() && t.hasChannel(); } - surveySampleList.add(s); - sampleByChannelMap.put(s.getChannel(), surveySampleList); - }); - - for (List surveySampleList : sampleByChannelMap.values()) { - ChannelInfo channelInfo = createChannelInfo(equipmentId, radioType, surveySampleList, - channelBandwidth); - - List channelInfoList = channelInfoReports.getRadioInfo(radioType); - if (channelInfoList == null) { - channelInfoList = new ArrayList<>(); - } - channelInfoList.add(channelInfo); - Map> channelInfoMap = channelInfoReports - .getChannelInformationReportsPerRadio(); - channelInfoMap.put(radioType, channelInfoList); - channelInfoReports.setChannelInformationReportsPerRadio(channelInfoMap); } - } else { - - List surveySampleList = survey.getSurveyListList(); + }).forEach(s -> { + List surveySampleList; + if (sampleByChannelMap.get(s.getChannel()) == null) { + surveySampleList = new ArrayList<>(); + } else { + surveySampleList = sampleByChannelMap.get(s.getChannel()); + } + surveySampleList.add(s); + sampleByChannelMap.put(s.getChannel(), surveySampleList); + }); + for (List surveySampleList : sampleByChannelMap.values()) { ChannelInfo channelInfo = createChannelInfo(equipmentId, radioType, surveySampleList, channelBandwidth); - if (LOG.isTraceEnabled()) { - LOG.trace("ChannelInfo for Survey {}", channelInfo.toPrettyString()); - } List channelInfoList = channelInfoReports.getRadioInfo(radioType); if (channelInfoList == null) { channelInfoList = new ArrayList<>(); } channelInfoList.add(channelInfo); - Map> channelInfoMap = channelInfoReports - .getChannelInformationReportsPerRadio(); channelInfoMap.put(radioType, channelInfoList); channelInfoReports.setChannelInformationReportsPerRadio(channelInfoMap); } + + channelInfoReports.setChannelInformationReportsPerRadio(channelInfoMap); + smr.setDetails(channelInfoReports); + smr.setCreatedTimestamp(survey.getTimestampMs()); + metricRecordList.add(smr); + + LOG.debug("ChannelInfoReports {}", channelInfoReports); + } - LOG.debug("ChannelInfoReports {}", channelInfoReports); } @@ -2612,7 +2594,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra int[] noiseArray = new int[surveySampleList.size()]; int index = 0; for (SurveySample sample : surveySampleList) { - + LOG.debug("createChannelInfo::SurveySample {}", sample); busyTx += sample.getBusyTx(); busySelf += sample.getBusySelf(); busy += sample.getBusy(); @@ -2632,7 +2614,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } return channelInfo; } - + @Override public void processMqttMessage(String topic, FlowReport flowReport) {