mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 02:27:49 +00:00 
			
		
		
		
	REVERT of [WIFI-2942] APNOS: RF Profile: Values not configured on AP for certain fields and no check on values in AP
AP does not support the functionality at present Signed-off-by: Mike Hansen <mike.hansen@netexperience.com>
This commit is contained in:
		| @@ -236,6 +236,7 @@ public class OvsdbDao extends OvsdbDaoBase { | ||||
|         ovsdbStats.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void updateEventReportingInterval(OvsdbClient ovsdbClient, long collectionIntervalSecEvent) { | ||||
|         ovsdbStats.updateEventReportingInterval(ovsdbClient, collectionIntervalSecEvent); | ||||
|     } | ||||
|   | ||||
| @@ -19,6 +19,7 @@ import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpF | ||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDeviceType; | ||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpManufId; | ||||
| import com.vmware.ovsdb.exception.OvsdbClientException; | ||||
| import com.vmware.ovsdb.protocol.operation.Insert; | ||||
| import com.vmware.ovsdb.protocol.operation.Operation; | ||||
| import com.vmware.ovsdb.protocol.operation.Select; | ||||
| import com.vmware.ovsdb.protocol.operation.Update; | ||||
| @@ -29,6 +30,7 @@ import com.vmware.ovsdb.protocol.operation.notation.Row; | ||||
| import com.vmware.ovsdb.protocol.operation.notation.Uuid; | ||||
| import com.vmware.ovsdb.protocol.operation.notation.Value; | ||||
| import com.vmware.ovsdb.protocol.operation.result.ErrorResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.InsertResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.OperationResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.SelectResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.UpdateResult; | ||||
| @@ -149,15 +151,6 @@ public class OvsdbDaoBase { | ||||
|     @org.springframework.beans.factory.annotation.Value("${tip.wlan.defaultOffChannelReportingIntervalSeconds:120}") | ||||
|     public int defaultOffChannelReportingIntervalSeconds; | ||||
|  | ||||
|     public  int is2dot4GHzScanDurationMillis = 65; | ||||
|     public  int is2dot4GHzSampleIntervalSec = 10; | ||||
|     public  int is5GHzScanDurationMillis = 65; | ||||
|     public  int is5GHzSampleIntervalSec = 10; | ||||
|     public  int is5GHzLScanDurationMillis = 65; | ||||
|     public  int is5GHzLSampleIntervalSec = 10; | ||||
|     public  int is5GHzUScanDurationMillis = 65; | ||||
|     public  int is5GHzUSampleIntervalSec = 10; | ||||
|      | ||||
|     public OvsdbDaoBase() { | ||||
|     } | ||||
|  | ||||
| @@ -168,6 +161,44 @@ public class OvsdbDaoBase { | ||||
|         return set; | ||||
|     } | ||||
|  | ||||
|     public void updateEventReportingInterval(OvsdbClient ovsdbClient, long eventReportingIntervalSeconds) { | ||||
|  | ||||
|         try { | ||||
|             List<Operation> operations = new ArrayList<>(); | ||||
|             Map<String, Value> updateColumns = new HashMap<>(); | ||||
|  | ||||
|             // turn on stats collection over MQTT: (reporting_interval is in | ||||
|             // seconds) | ||||
|             // $ ovsh i Wifi_Stats_Config reporting_interval:=10 | ||||
|             // radio_type:="2.4G" stats_type:="device" | ||||
|  | ||||
|             updateColumns.put("reporting_interval", new Atom<>(eventReportingIntervalSeconds)); | ||||
|             updateColumns.put("radio_type", new Atom<>("2.4G")); | ||||
|             updateColumns.put("stats_type", new Atom<>("event")); | ||||
|  | ||||
|             Row row = new Row(updateColumns); | ||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||
|  | ||||
|             CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); | ||||
|             OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); | ||||
|  | ||||
|             LOG.debug("Updated {}:", wifiStatsConfigDbTable); | ||||
|  | ||||
|             for (OperationResult res : result) { | ||||
|                 LOG.debug("updateEventReportingInterval Result {}", res); | ||||
|                 if (res instanceof InsertResult) { | ||||
|                     LOG.info("updateEventReportingInterval insert new row result {}", (res)); | ||||
|                     // for insert, make sure it is actually in the table | ||||
|                     confirmRowExistsInTable(ovsdbClient, ((InsertResult) res).getUuid(), wifiStatsConfigDbTable); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|         } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { | ||||
|             throw new RuntimeException(e); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     void configureWanInterfacesForDhcpSniffing(OvsdbClient ovsdbClient) { | ||||
|         List<Operation> operations = new ArrayList<>(); | ||||
|         Map<String, Value> updateColumns = new HashMap<>(); | ||||
|   | ||||
| @@ -1,4 +1,3 @@ | ||||
|  | ||||
| package com.telecominfraproject.wlan.opensync.ovsdb.dao; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| @@ -19,8 +18,6 @@ import org.springframework.stereotype.Component; | ||||
| import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig; | ||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiRadioConfigInfo; | ||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiStatsConfigInfo; | ||||
| import com.telecominfraproject.wlan.profile.models.Profile; | ||||
| import com.telecominfraproject.wlan.profile.rf.models.RfConfiguration; | ||||
| import com.vmware.ovsdb.exception.OvsdbClientException; | ||||
| import com.vmware.ovsdb.protocol.operation.Delete; | ||||
| import com.vmware.ovsdb.protocol.operation.Insert; | ||||
| @@ -53,17 +50,19 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|             thresholdMap.put("util", 25); | ||||
|  | ||||
|             @SuppressWarnings("unchecked") | ||||
|             com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map.of(thresholdMap); | ||||
|             com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map | ||||
|                     .of(thresholdMap); | ||||
|  | ||||
|             Map<String, WifiRadioConfigInfo> radioConfigs = ovsdbGet.getProvisionedWifiRadioConfigs(ovsdbClient); | ||||
|  | ||||
|             provisionWifiStatsConfigSurvey(ovsdbGet.getAllowedChannels(ovsdbClient), radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), | ||||
|                     operations, thresholds); | ||||
|             provisionWifiStatsConfigSurvey(ovsdbGet.getAllowedChannels(ovsdbClient), radioConfigs, | ||||
|                     ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), operations, thresholds); | ||||
|  | ||||
|             provisionWifiStatsConfigNeighbor(ovsdbGet.getAllowedChannels(ovsdbClient), radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), | ||||
|             provisionWifiStatsConfigNeighbor(ovsdbGet.getAllowedChannels(ovsdbClient), radioConfigs, | ||||
|                     ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), operations); | ||||
|  | ||||
|             provisionWifiStatsConfigClient(radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), | ||||
|                     operations); | ||||
|  | ||||
|             provisionWifiStatsConfigClient(radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), operations); | ||||
|             if (!operations.isEmpty()) { | ||||
|                 LOG.debug("Sending batch of operations : {} ", operations); | ||||
|  | ||||
| @@ -85,43 +84,10 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|     } | ||||
|  | ||||
|     void configureStatsFromProfile(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) { | ||||
|  | ||||
|         Profile rfProfile = opensyncApConfig.getRfProfile(); | ||||
|         if (rfProfile != null) { | ||||
|  | ||||
|             RfConfiguration rfConfiguration = (RfConfiguration) rfProfile.getDetails(); | ||||
|  | ||||
|             if (rfConfiguration != null) { | ||||
|  | ||||
|                 rfConfiguration.getRfConfigMap().entrySet().stream().forEach(rfElementCfg -> { | ||||
|                     if (rfElementCfg.getValue().getActiveScanSettings().isEnabled()) { | ||||
|                         switch (rfElementCfg.getKey()) { | ||||
|                             case is2dot4GHz: | ||||
|                                 is2dot4GHzScanDurationMillis = rfElementCfg.getValue().getActiveScanSettings().getScanDurationMillis(); | ||||
|                                 is2dot4GHzSampleIntervalSec = rfElementCfg.getValue().getActiveScanSettings().getScanFrequencySeconds(); | ||||
|                                 break; | ||||
|                             case is5GHz: | ||||
|                                 is5GHzScanDurationMillis = rfElementCfg.getValue().getActiveScanSettings().getScanDurationMillis(); | ||||
|                                 is5GHzSampleIntervalSec = rfElementCfg.getValue().getActiveScanSettings().getScanFrequencySeconds(); | ||||
|                                 break; | ||||
|                             case is5GHzU: | ||||
|                                 is5GHzUScanDurationMillis = rfElementCfg.getValue().getActiveScanSettings().getScanDurationMillis(); | ||||
|                                 is5GHzUSampleIntervalSec = rfElementCfg.getValue().getActiveScanSettings().getScanFrequencySeconds(); | ||||
|                                 break; | ||||
|                             case is5GHzL: | ||||
|                                 is5GHzLScanDurationMillis = rfElementCfg.getValue().getActiveScanSettings().getScanDurationMillis(); | ||||
|                                 is5GHzLSampleIntervalSec = rfElementCfg.getValue().getActiveScanSettings().getScanFrequencySeconds(); | ||||
|                                 break; | ||||
|                             default: | ||||
|                         } | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         // TODO: this will be refactored when the opensync profile for stats is | ||||
|         // re-worked | ||||
|         configureStats(ovsdbClient); | ||||
|  | ||||
|  | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -138,7 +104,6 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|             updateColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||
|             updateColumns.put("radio_type", new Atom<>("2.4G")); | ||||
|             updateColumns.put("stats_type", new Atom<>("network_probe")); | ||||
|             updateColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); | ||||
|  | ||||
|             Row row = new Row(updateColumns); | ||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||
| @@ -155,7 +120,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                         confirmRowExistsInTable(ovsdbClient, ((InsertResult) res).getUuid(), wifiStatsConfigDbTable); | ||||
|                     } else if (res instanceof ErrorResult) { | ||||
|                         LOG.error("Could not update {}:", wifiStatsConfigDbTable); | ||||
|                         LOG.error("Error: {} Details: {}", ((ErrorResult) res).getError(), ((ErrorResult) res).getDetails()); | ||||
|                         LOG.error("Error: {} Details: {}", ((ErrorResult) res).getError(), | ||||
|                                 ((ErrorResult) res).getDetails()); | ||||
|                     } else { | ||||
|                         LOG.debug("Updated {}:", wifiStatsConfigDbTable); | ||||
|                         LOG.debug("Op Result {}", res); | ||||
| @@ -204,7 +170,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|             if ((result != null) && (result.length > 0) && !((SelectResult) result[0]).getRows().isEmpty()) { | ||||
|                 row = ((SelectResult) result[0]).getRows().iterator().next(); | ||||
|                 ret = row.getIntegerColumn("reporting_interval"); | ||||
|                 LOG.info("Stats collection for stats_type=device is already configured with reporting_interval = {}", ret); | ||||
|                 LOG.info("Stats collection for stats_type=device is already configured with reporting_interval = {}", | ||||
|                         ret); | ||||
|             } | ||||
|  | ||||
|         } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { | ||||
| @@ -227,10 +194,9 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|             rowColumns.put("radio_type", new Atom<>("2.4G")); | ||||
|             rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||
|             rowColumns.put("report_type", new Atom<>("raw")); | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); | ||||
|             rowColumns.put("survey_interval_ms", new Atom<>(is2dot4GHzScanDurationMillis)); | ||||
|             rowColumns.put("sampling_interval", new Atom<>(10)); | ||||
|             rowColumns.put("stats_type", new Atom<>("video_voice")); | ||||
|              | ||||
|             rowColumns.put("survey_interval_ms", new Atom<>(65)); | ||||
|             Row row = new Row(rowColumns); | ||||
|  | ||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||
| @@ -248,7 +214,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|                 } else if (res instanceof ErrorResult) { | ||||
|                     LOG.error("Could not update {}:", wifiStatsConfigDbTable); | ||||
|                     LOG.error("Error: {} Details: {}", ((ErrorResult) res).getError(), ((ErrorResult) res).getDetails()); | ||||
|                     LOG.error("Error: {} Details: {}", ((ErrorResult) res).getError(), | ||||
|                             ((ErrorResult) res).getDetails()); | ||||
|                 } else { | ||||
|                     LOG.debug("Updated {}:", wifiStatsConfigDbTable); | ||||
|                     LOG.debug("Op Result {}", res); | ||||
| @@ -261,8 +228,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     void provisionWifiStatsConfigClient(Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, | ||||
|             List<Operation> operations) { | ||||
|     void provisionWifiStatsConfigClient(Map<String, WifiRadioConfigInfo> radioConfigs, | ||||
|             Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) { | ||||
|  | ||||
|         radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() { | ||||
|  | ||||
| @@ -274,8 +241,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||
|                     rowColumns.put("report_type", new Atom<>("raw")); | ||||
|                     rowColumns.put("sampling_interval", new Atom<>(10)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("client")); | ||||
|                     configSampleTime(rc, rowColumns); | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|  | ||||
| @@ -285,8 +252,10 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     void provisionWifiStatsConfigNeighbor(Map<String, Set<Integer>> allowedChannels, Map<String, WifiRadioConfigInfo> radioConfigs, | ||||
|             Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) { | ||||
|  | ||||
|     void provisionWifiStatsConfigNeighbor(Map<String, Set<Integer>> allowedChannels, | ||||
|             Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, | ||||
|             List<Operation> operations) { | ||||
|  | ||||
|         radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() { | ||||
|  | ||||
| @@ -295,16 +264,19 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                 if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_off-chan")) { | ||||
|                     // | ||||
|                     Map<String, Value> rowColumns = new HashMap<>(); | ||||
|                     com.vmware.ovsdb.protocol.operation.notation.Set channels = | ||||
|                             com.vmware.ovsdb.protocol.operation.notation.Set.of(allowedChannels.get(rc.freqBand)); | ||||
|                     com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set | ||||
|                             .of(allowedChannels.get(rc.freqBand)); | ||||
|                     if (channels == null) { | ||||
|                         channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(Collections.emptySet()); | ||||
|                     } | ||||
|                     rowColumns.put("channel_list", channels); | ||||
|  | ||||
|                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("neighbor")); | ||||
|                     configScanAndSurveyTime(rc, rowColumns); | ||||
|                     rowColumns.put("survey_type", new Atom<>("off-chan")); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(10)); | ||||
|  | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|  | ||||
| @@ -323,7 +295,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("neighbor")); | ||||
|                     rowColumns.put("survey_type", new Atom<>("on-chan")); | ||||
|                     configScanAndSurveyTime(rc, rowColumns); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(0)); | ||||
|  | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|  | ||||
| @@ -333,9 +306,9 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     void provisionWifiStatsConfigSurvey(Map<String, Set<Integer>> allowedChannels, Map<String, WifiRadioConfigInfo> radioConfigs, | ||||
|             Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations, | ||||
|             com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) { | ||||
|     void provisionWifiStatsConfigSurvey(Map<String, Set<Integer>> allowedChannels, | ||||
|             Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, | ||||
|             List<Operation> operations, com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) { | ||||
|  | ||||
|         radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() { | ||||
|  | ||||
| @@ -347,11 +320,14 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||
|                     rowColumns.put("report_type", new Atom<>("raw")); | ||||
|                     configScanAndSurveyTime(rc, rowColumns); | ||||
|                     rowColumns.put("sampling_interval", new Atom<>(10)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("survey")); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(0)); | ||||
|                     rowColumns.put("survey_type", new Atom<>("on-chan")); | ||||
|  | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| @@ -363,21 +339,24 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                 if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_off-chan")) { | ||||
|                     // | ||||
|                     Map<String, Value> rowColumns = new HashMap<>(); | ||||
|                     com.vmware.ovsdb.protocol.operation.notation.Set channels = | ||||
|                             com.vmware.ovsdb.protocol.operation.notation.Set.of(allowedChannels.get(rc.freqBand)); | ||||
|                     com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set | ||||
|                             .of(allowedChannels.get(rc.freqBand)); | ||||
|                     if (channels == null) { | ||||
|                         channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(Collections.emptySet()); | ||||
|                     } | ||||
|                     rowColumns.put("channel_list", channels); | ||||
|  | ||||
|                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); | ||||
|                     rowColumns.put("report_type", new Atom<>("raw")); | ||||
|                     rowColumns.put("stats_type", new Atom<>("survey")); | ||||
|                     rowColumns.put("survey_type", new Atom<>("off-chan")); | ||||
|                     configScanAndSurveyTime(rc, rowColumns); | ||||
|                     rowColumns.put("sampling_interval", new Atom<>(0)); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(10)); | ||||
|                     rowColumns.put("threshold", thresholds); | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|  | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| @@ -428,7 +407,7 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|             updateColumns.put("reporting_interval", new Atom<>(newValue)); | ||||
|             updateColumns.put("radio_type", new Atom<>("2.4G")); | ||||
|             updateColumns.put("stats_type", new Atom<>("device")); | ||||
|             updateColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); | ||||
|  | ||||
|             Row row = new Row(updateColumns); | ||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||
|  | ||||
| @@ -452,73 +431,4 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     void updateEventReportingInterval(OvsdbClient ovsdbClient, long eventReportingIntervalSeconds) { | ||||
|  | ||||
|         try { | ||||
|             List<Operation> operations = new ArrayList<>(); | ||||
|             Map<String, Value> updateColumns = new HashMap<>(); | ||||
|  | ||||
|             // turn on stats collection over MQTT: (reporting_interval is in | ||||
|             // seconds) | ||||
|             // $ ovsh i Wifi_Stats_Config reporting_interval:=10 | ||||
|             // radio_type:="2.4G" stats_type:="device" | ||||
|  | ||||
|             updateColumns.put("reporting_interval", new Atom<>(eventReportingIntervalSeconds)); | ||||
|             updateColumns.put("radio_type", new Atom<>("2.4G")); | ||||
|             updateColumns.put("stats_type", new Atom<>("event")); | ||||
|             updateColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); | ||||
|              | ||||
|             Row row = new Row(updateColumns); | ||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||
|  | ||||
|             CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); | ||||
|             OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); | ||||
|  | ||||
|             LOG.debug("Updated {}:", wifiStatsConfigDbTable); | ||||
|  | ||||
|             for (OperationResult res : result) { | ||||
|                 LOG.debug("updateEventReportingInterval Result {}", res); | ||||
|                 if (res instanceof InsertResult) { | ||||
|                     LOG.info("updateEventReportingInterval insert new row result {}", (res)); | ||||
|                     // for insert, make sure it is actually in the table | ||||
|                     confirmRowExistsInTable(ovsdbClient, ((InsertResult) res).getUuid(), wifiStatsConfigDbTable); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|         } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { | ||||
|             throw new RuntimeException(e); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private void configSampleTime(WifiRadioConfigInfo rc, Map<String, Value> rowColumns) { | ||||
|         // "2.4G","5G","5GL","5GU" | ||||
|         if (rc.freqBand.equals("2.4G")) { | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); | ||||
|         } else if (rc.freqBand.equals("5G")) { | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is5GHzSampleIntervalSec)); | ||||
|         } else if (rc.freqBand.equals("5GL")) { | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is5GHzLSampleIntervalSec)); | ||||
|         } else if (rc.freqBand.equals("5GU")) { | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is5GHzUSampleIntervalSec)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void configScanAndSurveyTime(WifiRadioConfigInfo rc, Map<String, Value> rowColumns) { | ||||
|         // "2.4G","5G","5GL","5GU" | ||||
|         if (rc.freqBand.equals("2.4G")) { | ||||
|             rowColumns.put("survey_interval_ms", new Atom<>(is2dot4GHzScanDurationMillis)); | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); | ||||
|         } else if (rc.freqBand.equals("5G")) { | ||||
|             rowColumns.put("survey_interval_ms", new Atom<>(is5GHzScanDurationMillis)); | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is5GHzSampleIntervalSec)); | ||||
|         } else if (rc.freqBand.equals("5GL")) { | ||||
|             rowColumns.put("survey_interval_ms", new Atom<>(is5GHzLScanDurationMillis)); | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is5GHzLSampleIntervalSec)); | ||||
|         } else if (rc.freqBand.equals("5GU")) { | ||||
|             rowColumns.put("survey_interval_ms", new Atom<>(is5GHzUScanDurationMillis)); | ||||
|             rowColumns.put("sampling_interval", new Atom<>(is5GHzUSampleIntervalSec)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Mike Hansen
					Mike Hansen