mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 18:47:57 +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:
		| @@ -62,7 +62,7 @@ public class OvsdbDao extends OvsdbDaoBase { | |||||||
|  |  | ||||||
|     public void configureCommands(OvsdbClient ovsdbClient, String startdebugengineapcommand, |     public void configureCommands(OvsdbClient ovsdbClient, String startdebugengineapcommand, | ||||||
|             Map<String, String> payload, long l, long defaultCommandDurationSec) { |             Map<String, String> payload, long l, long defaultCommandDurationSec) { | ||||||
| 	    ovsdbCommand.configureCommands(ovsdbClient, startdebugengineapcommand, payload, l, defaultCommandDurationSec); |         ovsdbCommand.configureCommands(ovsdbClient, startdebugengineapcommand, payload, l, defaultCommandDurationSec); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void configureFirmwareDownload(OvsdbClient ovsdbClient, String apId, String firmwareUrl, |     public void configureFirmwareDownload(OvsdbClient ovsdbClient, String apId, String firmwareUrl, | ||||||
| @@ -236,6 +236,7 @@ public class OvsdbDao extends OvsdbDaoBase { | |||||||
|         ovsdbStats.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); |         ovsdbStats.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|     public void updateEventReportingInterval(OvsdbClient ovsdbClient, long collectionIntervalSecEvent) { |     public void updateEventReportingInterval(OvsdbClient ovsdbClient, long collectionIntervalSecEvent) { | ||||||
|         ovsdbStats.updateEventReportingInterval(ovsdbClient, 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.DhcpFpDeviceType; | ||||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpManufId; | import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpManufId; | ||||||
| import com.vmware.ovsdb.exception.OvsdbClientException; | 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.Operation; | ||||||
| import com.vmware.ovsdb.protocol.operation.Select; | import com.vmware.ovsdb.protocol.operation.Select; | ||||||
| import com.vmware.ovsdb.protocol.operation.Update; | 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.Uuid; | ||||||
| import com.vmware.ovsdb.protocol.operation.notation.Value; | import com.vmware.ovsdb.protocol.operation.notation.Value; | ||||||
| import com.vmware.ovsdb.protocol.operation.result.ErrorResult; | 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.OperationResult; | ||||||
| import com.vmware.ovsdb.protocol.operation.result.SelectResult; | import com.vmware.ovsdb.protocol.operation.result.SelectResult; | ||||||
| import com.vmware.ovsdb.protocol.operation.result.UpdateResult; | 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}") |     @org.springframework.beans.factory.annotation.Value("${tip.wlan.defaultOffChannelReportingIntervalSeconds:120}") | ||||||
|     public int defaultOffChannelReportingIntervalSeconds; |     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() { |     public OvsdbDaoBase() { | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -168,6 +161,44 @@ public class OvsdbDaoBase { | |||||||
|         return set; |         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) { |     void configureWanInterfacesForDhcpSniffing(OvsdbClient ovsdbClient) { | ||||||
|         List<Operation> operations = new ArrayList<>(); |         List<Operation> operations = new ArrayList<>(); | ||||||
|         Map<String, Value> updateColumns = new HashMap<>(); |         Map<String, Value> updateColumns = new HashMap<>(); | ||||||
|   | |||||||
| @@ -1,4 +1,3 @@ | |||||||
|  |  | ||||||
| package com.telecominfraproject.wlan.opensync.ovsdb.dao; | package com.telecominfraproject.wlan.opensync.ovsdb.dao; | ||||||
|  |  | ||||||
| import java.util.ArrayList; | 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.external.integration.models.OpensyncAPConfig; | ||||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiRadioConfigInfo; | import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiRadioConfigInfo; | ||||||
| import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiStatsConfigInfo; | 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.exception.OvsdbClientException; | ||||||
| import com.vmware.ovsdb.protocol.operation.Delete; | import com.vmware.ovsdb.protocol.operation.Delete; | ||||||
| import com.vmware.ovsdb.protocol.operation.Insert; | import com.vmware.ovsdb.protocol.operation.Insert; | ||||||
| @@ -53,17 +50,19 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|             thresholdMap.put("util", 25); |             thresholdMap.put("util", 25); | ||||||
|  |  | ||||||
|             @SuppressWarnings("unchecked") |             @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); |             Map<String, WifiRadioConfigInfo> radioConfigs = ovsdbGet.getProvisionedWifiRadioConfigs(ovsdbClient); | ||||||
|  |  | ||||||
|             provisionWifiStatsConfigSurvey(ovsdbGet.getAllowedChannels(ovsdbClient), radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), |             provisionWifiStatsConfigSurvey(ovsdbGet.getAllowedChannels(ovsdbClient), radioConfigs, | ||||||
|                     operations, thresholds); |                     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); |                     operations); | ||||||
|  |  | ||||||
|             provisionWifiStatsConfigClient(radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), operations); |  | ||||||
|             if (!operations.isEmpty()) { |             if (!operations.isEmpty()) { | ||||||
|                 LOG.debug("Sending batch of operations : {} ", operations); |                 LOG.debug("Sending batch of operations : {} ", operations); | ||||||
|  |  | ||||||
| @@ -85,43 +84,10 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     void configureStatsFromProfile(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) { |     void configureStatsFromProfile(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) { | ||||||
|  |         // TODO: this will be refactored when the opensync profile for stats is | ||||||
|         Profile rfProfile = opensyncApConfig.getRfProfile(); |         // re-worked | ||||||
|         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: |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 }); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         configureStats(ovsdbClient); |         configureStats(ovsdbClient); | ||||||
|  |  | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -138,7 +104,6 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|             updateColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); |             updateColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||||
|             updateColumns.put("radio_type", new Atom<>("2.4G")); |             updateColumns.put("radio_type", new Atom<>("2.4G")); | ||||||
|             updateColumns.put("stats_type", new Atom<>("network_probe")); |             updateColumns.put("stats_type", new Atom<>("network_probe")); | ||||||
|             updateColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); |  | ||||||
|  |  | ||||||
|             Row row = new Row(updateColumns); |             Row row = new Row(updateColumns); | ||||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); |             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||||
| @@ -155,7 +120,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|                         confirmRowExistsInTable(ovsdbClient, ((InsertResult) res).getUuid(), wifiStatsConfigDbTable); |                         confirmRowExistsInTable(ovsdbClient, ((InsertResult) res).getUuid(), wifiStatsConfigDbTable); | ||||||
|                     } else if (res instanceof ErrorResult) { |                     } else if (res instanceof ErrorResult) { | ||||||
|                         LOG.error("Could not update {}:", wifiStatsConfigDbTable); |                         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 { |                     } else { | ||||||
|                         LOG.debug("Updated {}:", wifiStatsConfigDbTable); |                         LOG.debug("Updated {}:", wifiStatsConfigDbTable); | ||||||
|                         LOG.debug("Op Result {}", res); |                         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()) { |             if ((result != null) && (result.length > 0) && !((SelectResult) result[0]).getRows().isEmpty()) { | ||||||
|                 row = ((SelectResult) result[0]).getRows().iterator().next(); |                 row = ((SelectResult) result[0]).getRows().iterator().next(); | ||||||
|                 ret = row.getIntegerColumn("reporting_interval"); |                 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) { |         } 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("radio_type", new Atom<>("2.4G")); | ||||||
|             rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); |             rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||||
|             rowColumns.put("report_type", new Atom<>("raw")); |             rowColumns.put("report_type", new Atom<>("raw")); | ||||||
|             rowColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); |             rowColumns.put("sampling_interval", new Atom<>(10)); | ||||||
|             rowColumns.put("survey_interval_ms", new Atom<>(is2dot4GHzScanDurationMillis)); |  | ||||||
|             rowColumns.put("stats_type", new Atom<>("video_voice")); |             rowColumns.put("stats_type", new Atom<>("video_voice")); | ||||||
|              |             rowColumns.put("survey_interval_ms", new Atom<>(65)); | ||||||
|             Row row = new Row(rowColumns); |             Row row = new Row(rowColumns); | ||||||
|  |  | ||||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); |             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||||
| @@ -248,7 +214,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|  |  | ||||||
|                 } else if (res instanceof ErrorResult) { |                 } else if (res instanceof ErrorResult) { | ||||||
|                     LOG.error("Could not update {}:", wifiStatsConfigDbTable); |                     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 { |                 } else { | ||||||
|                     LOG.debug("Updated {}:", wifiStatsConfigDbTable); |                     LOG.debug("Updated {}:", wifiStatsConfigDbTable); | ||||||
|                     LOG.debug("Op Result {}", res); |                     LOG.debug("Op Result {}", res); | ||||||
| @@ -261,8 +228,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     void provisionWifiStatsConfigClient(Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, |     void provisionWifiStatsConfigClient(Map<String, WifiRadioConfigInfo> radioConfigs, | ||||||
|             List<Operation> operations) { |             Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) { | ||||||
|  |  | ||||||
|         radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() { |         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("radio_type", new Atom<>(rc.freqBand)); | ||||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); |                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||||
|                     rowColumns.put("report_type", new Atom<>("raw")); |                     rowColumns.put("report_type", new Atom<>("raw")); | ||||||
|  |                     rowColumns.put("sampling_interval", new Atom<>(10)); | ||||||
|                     rowColumns.put("stats_type", new Atom<>("client")); |                     rowColumns.put("stats_type", new Atom<>("client")); | ||||||
|                     configSampleTime(rc, rowColumns); |  | ||||||
|                     Row updateRow = new Row(rowColumns); |                     Row updateRow = new Row(rowColumns); | ||||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); |                     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>() { |         radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() { | ||||||
|  |  | ||||||
| @@ -295,16 +264,19 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|                 if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_off-chan")) { |                 if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_neighbor_off-chan")) { | ||||||
|                     // |                     // | ||||||
|                     Map<String, Value> rowColumns = new HashMap<>(); |                     Map<String, Value> rowColumns = new HashMap<>(); | ||||||
|                     com.vmware.ovsdb.protocol.operation.notation.Set channels = |                     com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set | ||||||
|                             com.vmware.ovsdb.protocol.operation.notation.Set.of(allowedChannels.get(rc.freqBand)); |                             .of(allowedChannels.get(rc.freqBand)); | ||||||
|                     if (channels == null) { |                     if (channels == null) { | ||||||
|                         channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(Collections.emptySet()); |                         channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(Collections.emptySet()); | ||||||
|                     } |                     } | ||||||
|                     rowColumns.put("channel_list", channels); |                     rowColumns.put("channel_list", channels); | ||||||
|  |  | ||||||
|                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); |                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); | ||||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); |                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); | ||||||
|                     rowColumns.put("stats_type", new Atom<>("neighbor")); |                     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); |                     Row updateRow = new Row(rowColumns); | ||||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); |                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||||
|  |  | ||||||
| @@ -323,7 +295,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); |                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||||
|                     rowColumns.put("stats_type", new Atom<>("neighbor")); |                     rowColumns.put("stats_type", new Atom<>("neighbor")); | ||||||
|                     rowColumns.put("survey_type", new Atom<>("on-chan")); |                     rowColumns.put("survey_type", new Atom<>("on-chan")); | ||||||
|                     configScanAndSurveyTime(rc, rowColumns); |                     rowColumns.put("survey_interval_ms", new Atom<>(0)); | ||||||
|  |  | ||||||
|                     Row updateRow = new Row(rowColumns); |                     Row updateRow = new Row(rowColumns); | ||||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); |                     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, |     void provisionWifiStatsConfigSurvey(Map<String, Set<Integer>> allowedChannels, | ||||||
|             Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations, |             Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, | ||||||
|             com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) { |             List<Operation> operations, com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) { | ||||||
|  |  | ||||||
|         radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() { |         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("radio_type", new Atom<>(rc.freqBand)); | ||||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); |                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||||
|                     rowColumns.put("report_type", new Atom<>("raw")); |                     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("stats_type", new Atom<>("survey")); | ||||||
|  |                     rowColumns.put("survey_interval_ms", new Atom<>(0)); | ||||||
|                     rowColumns.put("survey_type", new Atom<>("on-chan")); |                     rowColumns.put("survey_type", new Atom<>("on-chan")); | ||||||
|  |  | ||||||
|                     Row updateRow = new Row(rowColumns); |                     Row updateRow = new Row(rowColumns); | ||||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); |                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||||
|  |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| @@ -363,21 +339,24 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|                 if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_off-chan")) { |                 if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_survey_off-chan")) { | ||||||
|                     // |                     // | ||||||
|                     Map<String, Value> rowColumns = new HashMap<>(); |                     Map<String, Value> rowColumns = new HashMap<>(); | ||||||
|                     com.vmware.ovsdb.protocol.operation.notation.Set channels = |                     com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set | ||||||
|                             com.vmware.ovsdb.protocol.operation.notation.Set.of(allowedChannels.get(rc.freqBand)); |                             .of(allowedChannels.get(rc.freqBand)); | ||||||
|                     if (channels == null) { |                     if (channels == null) { | ||||||
|                         channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(Collections.emptySet()); |                         channels = com.vmware.ovsdb.protocol.operation.notation.Set.of(Collections.emptySet()); | ||||||
|                     } |                     } | ||||||
|                     rowColumns.put("channel_list", channels); |                     rowColumns.put("channel_list", channels); | ||||||
|  |  | ||||||
|                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); |                     rowColumns.put("radio_type", new Atom<>(rc.freqBand)); | ||||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); |                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); | ||||||
|                     rowColumns.put("report_type", new Atom<>("raw")); |                     rowColumns.put("report_type", new Atom<>("raw")); | ||||||
|                     rowColumns.put("stats_type", new Atom<>("survey")); |                     rowColumns.put("stats_type", new Atom<>("survey")); | ||||||
|                     rowColumns.put("survey_type", new Atom<>("off-chan")); |                     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); |                     rowColumns.put("threshold", thresholds); | ||||||
|                     Row updateRow = new Row(rowColumns); |                     Row updateRow = new Row(rowColumns); | ||||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); |                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||||
|  |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| @@ -411,9 +390,9 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|     /** |     /** | ||||||
|      * @param ovsdbClient |      * @param ovsdbClient | ||||||
|      * @param value |      * @param value | ||||||
|      *        of reporting_interval column for the stats_type=device from |      *            of reporting_interval column for the stats_type=device from | ||||||
|      *        the Wifi_Stats_Config table. If value is not provisioned then |      *            the Wifi_Stats_Config table. If value is not provisioned then | ||||||
|      *        return -1. |      *            return -1. | ||||||
|      */ |      */ | ||||||
|     void updateDeviceStatsReportingInterval(OvsdbClient ovsdbClient, long newValue) { |     void updateDeviceStatsReportingInterval(OvsdbClient ovsdbClient, long newValue) { | ||||||
|         try { |         try { | ||||||
| @@ -428,7 +407,7 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | |||||||
|             updateColumns.put("reporting_interval", new Atom<>(newValue)); |             updateColumns.put("reporting_interval", new Atom<>(newValue)); | ||||||
|             updateColumns.put("radio_type", new Atom<>("2.4G")); |             updateColumns.put("radio_type", new Atom<>("2.4G")); | ||||||
|             updateColumns.put("stats_type", new Atom<>("device")); |             updateColumns.put("stats_type", new Atom<>("device")); | ||||||
|             updateColumns.put("sampling_interval", new Atom<>(is2dot4GHzSampleIntervalSec)); |  | ||||||
|             Row row = new Row(updateColumns); |             Row row = new Row(updateColumns); | ||||||
|             operations.add(new Insert(wifiStatsConfigDbTable, row)); |             operations.add(new Insert(wifiStatsConfigDbTable, row)); | ||||||
|  |  | ||||||
| @@ -451,74 +430,5 @@ 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