Opensync AP Stats refactoring, fix error in Row parsing for VIF delete

This commit is contained in:
Mike Hansen
2020-04-27 14:54:18 -04:00
parent 0f43b1f726
commit 38c1b003f1
2 changed files with 383 additions and 262 deletions

View File

@@ -141,20 +141,23 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient); String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient);
if (key != null) { if (key != null) {
// turn off monitor
try {
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
} catch (OvsdbClientException e) {
LOG.warn("Could not cancel Monitor {}", e);
}
extIntegrationInterface.apDisconnected(key); extIntegrationInterface.apDisconnected(key);
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key); ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key);
} }
// turn off monitor
try {
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
} catch (OvsdbClientException e) {
LOG.warn("Could not cancel Monitor {}", e);
}
ovsdbClient.shutdown(); ovsdbClient.shutdown();
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort, LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort,
@@ -299,10 +302,20 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
Row row = rowUpdate.getValue().getOld(); Row row = rowUpdate.getValue().getOld();
String ifName = row.getStringColumn("if_name"); String ifName = row.getStringColumn("if_name");
String ssid = row.getStringColumn("ssid"); String ssid = row.getStringColumn("ssid");
OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState(); if (row.getColumns().get("ssid") != null && row.getColumns().get("ssid").getClass()
toBeDeleted.setSsid(ssid); .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
toBeDeleted.setIfName(ifName); ssid = row.getStringColumn("ssid");
vifsToDelete.add(toBeDeleted); }
if (row.getColumns().get("if_name") != null && row.getColumns().get("if_name").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
ifName = row.getStringColumn("if_name");
}
if (ifName != null && ssid != null) {
OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState();
toBeDeleted.setSsid(ssid);
toBeDeleted.setIfName(ifName);
vifsToDelete.add(toBeDeleted);
}
tableUpdate.getValue().getRowUpdates().remove(rowUpdate.getKey()); tableUpdate.getValue().getRowUpdates().remove(rowUpdate.getKey());
} }

View File

@@ -777,8 +777,12 @@ public class OvsdbDao {
wifiStatsConfigInfo.threshold = row.getMapColumn("threshold"); wifiStatsConfigInfo.threshold = row.getMapColumn("threshold");
wifiStatsConfigInfo.uuid = row.getUuidColumn("_uuid"); wifiStatsConfigInfo.uuid = row.getUuidColumn("_uuid");
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_" if (wifiStatsConfigInfo.surveyType == null) {
+ wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo); ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType, wifiStatsConfigInfo);
} else {
ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_"
+ wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo);
}
} }
LOG.debug("Retrieved WifiStatsConfigs: {}", ret); LOG.debug("Retrieved WifiStatsConfigs: {}", ret);
@@ -1814,15 +1818,6 @@ public class OvsdbDao {
try { try {
List<Operation> operations = new ArrayList<>(); List<Operation> operations = new ArrayList<>();
Map<String, Value> updateColumns = new HashMap<>(); Map<String, Value> updateColumns = new HashMap<>();
Row row;
Set<Integer> channelSet = new HashSet<>();
channelSet.add(1);
channelSet.add(6);
channelSet.add(11);
com.vmware.ovsdb.protocol.operation.notation.Set channels = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet);
Map<String, Integer> thresholdMap = new HashMap<>(); Map<String, Integer> thresholdMap = new HashMap<>();
thresholdMap.put("max_delay", 600); thresholdMap.put("max_delay", 600);
thresholdMap.put("util", 10); thresholdMap.put("util", 10);
@@ -1831,247 +1826,15 @@ public class OvsdbDao {
com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds = com.vmware.ovsdb.protocol.operation.notation.Map
.of(thresholdMap); .of(thresholdMap);
if (!provisionedWifiStatsConfigs.containsKey("2.4G_device_on-chan")) { provisionWifiStatsConfigDevice(provisionedWifiStatsConfigs, operations, updateColumns);
//
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("device"));
// updateColumns.put("survey_interval_ms", new Atom<>(10) );
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns); provisionWifiStatsConfigSurvey(provisionedWifiStatsConfigs, operations, thresholds);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_device_on-chan")) { provisionWifiStatsConfigNeighbor(provisionedWifiStatsConfigs, operations);
//
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("device"));
// updateColumns.put("survey_interval_ms", new Atom<>(10) );
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns); provisionWifiStatsConfigClient(provisionedWifiStatsConfigs, operations);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_survey_on-chan")) { provisionWifiStatsRssi(provisionedWifiStatsConfigs, operations);
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_survey_off-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels);
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(120));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(50));
updateColumns.put("survey_type", new Atom<>("off-chan"));
updateColumns.put("threshold", thresholds);
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_neighbor_off-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels);
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(120));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("off-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_neighbor_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_client_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("report_type", new Atom<>("raw"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("client"));
// updateColumns.put("survey_interval_ms", new Atom<>(0) );
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_client_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("report_type", new Atom<>("raw"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("client"));
// updateColumns.put("survey_interval_ms", new Atom<>(0) );
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_survey_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_client_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("report_type", new Atom<>("raw"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("client"));
// updateColumns.put("survey_interval_ms", new Atom<>(0) );
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_neighbor_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_survey_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_neighbor_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
for (String band : new String[] { "2.4G", "5GL" }) {
if (!provisionedWifiStatsConfigs.containsKey(band + "_rssi_on-chan")) {
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>(band));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("report_type", new Atom<>("raw"));
updateColumns.put("stats_type", new Atom<>("rssi"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
}
if (!operations.isEmpty()) { if (!operations.isEmpty()) {
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
@@ -2091,6 +1854,351 @@ public class OvsdbDao {
} }
} }
private void provisionWifiStatsRssi(Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs,
List<Operation> operations) {
Map<String, Value> updateColumns;
Row row;
for (String band : new String[] { "2.4G", "5GL","5GU" }) {
if (!provisionedWifiStatsConfigs.containsKey(band + "_rssi_on-chan")) {
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>(band));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("rssi"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
}
}
private void provisionWifiStatsConfigNeighbor(Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs,
List<Operation> operations) {
Map<String, Value> updateColumns;
Row row;
Set<Integer> channelSet2g = new HashSet<>();
channelSet2g.add(1);
channelSet2g.add(6);
channelSet2g.add(11);
com.vmware.ovsdb.protocol.operation.notation.Set channels2g = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet2g);
Set<Integer> channelSet5gl = new HashSet<>();
channelSet5gl.add(36);
channelSet5gl.add(44);
channelSet5gl.add(52);
com.vmware.ovsdb.protocol.operation.notation.Set channels5gl = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet5gl);
Set<Integer> channelSet5gu = new HashSet<>();
channelSet5gu.add(100);
channelSet5gu.add(108);
channelSet5gu.add(116);
com.vmware.ovsdb.protocol.operation.notation.Set channels5gu = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet5gu);
if (!provisionedWifiStatsConfigs.containsKey("2.4G_neighbor_off-chan")) {
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels2g);
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(120));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("off-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_neighbor_off-chan")) {
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels5gl);
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(120));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("off-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_neighbor_off-chan")) {
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels5gu);
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_interval", new Atom<>(120));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("off-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_neighbor_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_neighbor_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_neighbor_on-chan")) {
//
updateColumns = new HashMap<>();
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("neighbor"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
// updateColumns.put("threshold", thresholds );
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
}
private void provisionWifiStatsConfigSurvey(Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs,
List<Operation> operations, com.vmware.ovsdb.protocol.operation.notation.Map<String, Integer> thresholds) {
Set<Integer> channelSet2g = new HashSet<>();
channelSet2g.add(1);
channelSet2g.add(6);
channelSet2g.add(11);
com.vmware.ovsdb.protocol.operation.notation.Set channels2g = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet2g);
Set<Integer> channelSet5gl = new HashSet<>();
channelSet5gl.add(36);
channelSet5gl.add(44);
channelSet5gl.add(52);
com.vmware.ovsdb.protocol.operation.notation.Set channels5gl = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet5gl);
Set<Integer> channelSet5gu = new HashSet<>();
channelSet5gu.add(100);
channelSet5gu.add(108);
channelSet5gu.add(116);
com.vmware.ovsdb.protocol.operation.notation.Set channels5gu = com.vmware.ovsdb.protocol.operation.notation.Set
.of(channelSet5gu);
Map<String, Value> updateColumns;
Row row;
if (!provisionedWifiStatsConfigs.containsKey("2.4G_survey_on-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_survey_on-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_survey_on-chan")) {
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(0));
updateColumns.put("survey_type", new Atom<>("on-chan"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("2.4G_survey_off-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels2g);
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(0));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(10));
updateColumns.put("survey_type", new Atom<>("off-chan"));
updateColumns.put("threshold", thresholds);
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_survey_off-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels5gl);
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(0));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(10));
updateColumns.put("survey_type", new Atom<>("off-chan"));
updateColumns.put("threshold", thresholds);
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_survey_off-chan")) {
//
updateColumns = new HashMap<>();
updateColumns.put("channel_list", channels5gu);
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_interval", new Atom<>(0));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("survey"));
updateColumns.put("survey_interval_ms", new Atom<>(10));
updateColumns.put("survey_type", new Atom<>("off-chan"));
updateColumns.put("threshold", thresholds);
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
//
}
}
private void provisionWifiStatsConfigDevice(Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs,
List<Operation> operations, Map<String, Value> updateColumns) {
Row row;
if (!provisionedWifiStatsConfigs.containsKey("2.4G_device")) {
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_interval", new Atom<>(900));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("device"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_device")) {
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_interval", new Atom<>(900));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("device"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_device")) {
// updateColumns.put("channel_list", channels );
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_interval", new Atom<>(900));
updateColumns.put("sampling_interval", new Atom<>(0));
updateColumns.put("stats_type", new Atom<>("device"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
}
private void provisionWifiStatsConfigClient(Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs,
List<Operation> operations) {
Map<String, Value> updateColumns;
Row row;
if (!provisionedWifiStatsConfigs.containsKey("2.4G_client")) {
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>("2.4G"));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("client"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GL_client")) {
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>("5GL"));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("client"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
if (!provisionedWifiStatsConfigs.containsKey("5GU_client")) {
updateColumns = new HashMap<>();
updateColumns.put("radio_type", new Atom<>("5GU"));
updateColumns.put("reporting_count", new Atom<>(0));
updateColumns.put("reporting_interval", new Atom<>(60));
updateColumns.put("sampling_interval", new Atom<>(10));
updateColumns.put("stats_type", new Atom<>("client"));
row = new Row(updateColumns);
operations.add(new Insert(wifiStatsConfigDbTable, row));
}
}
public String changeRedirectorAddress(OvsdbClient ovsdbClient, String apId, String newRedirectorAddress) { public String changeRedirectorAddress(OvsdbClient ovsdbClient, String apId, String newRedirectorAddress) {
try { try {
List<Operation> operations = new ArrayList<>(); List<Operation> operations = new ArrayList<>();