mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 11:37:49 +00:00
OSGW - populate ovsdb Wifi_Stats_Config table on AP for default event
reporting thresholds.
This commit is contained in:
@@ -77,6 +77,9 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||||
|
|
||||||
|
@org.springframework.beans.factory.annotation.Value("${tip.wlan.manager.collectionIntervalSec.event:60}")
|
||||||
|
private long collectionIntervalSecEvent;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void postCreate() {
|
private void postCreate() {
|
||||||
listenForConnections();
|
listenForConnections();
|
||||||
@@ -231,6 +234,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
||||||
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
||||||
}
|
}
|
||||||
|
ovsdbDao.updateEventReportingInterval(ovsdbClient, collectionIntervalSecEvent);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LOG.info("No Configuration available for {}", apId);
|
LOG.info("No Configuration available for {}", apId);
|
||||||
@@ -301,8 +306,9 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
|||||||
|
|
||||||
ovsdbDao.configureStatsFromProfile(ovsdbClient, opensyncAPConfig);
|
ovsdbDao.configureStatsFromProfile(ovsdbClient, opensyncAPConfig);
|
||||||
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) {
|
||||||
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
||||||
}
|
}
|
||||||
|
ovsdbDao.updateEventReportingInterval(ovsdbClient, collectionIntervalSecEvent);
|
||||||
LOG.debug("Finished processConfigChanged for {}", apId);
|
LOG.debug("Finished processConfigChanged for {}", apId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4886,9 +4886,6 @@ public class OvsdbDao {
|
|||||||
provisionWifiStatsConfigFromProfile("client", radioType, reportingInterval,
|
provisionWifiStatsConfigFromProfile("client", radioType, reportingInterval,
|
||||||
samplingInterval, operations);
|
samplingInterval, operations);
|
||||||
|
|
||||||
provisionWifiStatsConfigFromProfile("event", radioType, reportingInterval, samplingInterval,
|
|
||||||
operations);
|
|
||||||
|
|
||||||
provisionWifiStatsConfigFromProfile("video_voice", reportingInterval, samplingInterval,
|
provisionWifiStatsConfigFromProfile("video_voice", reportingInterval, samplingInterval,
|
||||||
operations);
|
operations);
|
||||||
LOG.debug("{}", BaseJsonModel.toPrettyJsonString(parameters));
|
LOG.debug("{}", BaseJsonModel.toPrettyJsonString(parameters));
|
||||||
@@ -5073,7 +5070,6 @@ public class OvsdbDao {
|
|||||||
// TODO: when schema support is added, these should be part of the
|
// TODO: when schema support is added, these should be part of the
|
||||||
// bulk provisioning operation above.
|
// bulk provisioning operation above.
|
||||||
provisionVideoVoiceStats(ovsdbClient);
|
provisionVideoVoiceStats(ovsdbClient);
|
||||||
provisionEventReporting(radioConfigs, ovsdbClient);
|
|
||||||
|
|
||||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -5260,61 +5256,6 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ovsdbClient
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void provisionEventReporting(Map<String, WifiRadioConfigInfo> radioConfigs, OvsdbClient ovsdbClient) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
List<Operation> operations = new ArrayList<>();
|
|
||||||
|
|
||||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void accept(WifiRadioConfigInfo rc) {
|
|
||||||
|
|
||||||
//
|
|
||||||
Map<String, Value> rowColumns = new HashMap<>();
|
|
||||||
rowColumns.put("radio_type", new Atom<>(rc.freqBand));
|
|
||||||
rowColumns.put("reporting_interval", new Atom<>(5));
|
|
||||||
rowColumns.put("report_type", new Atom<>("raw"));
|
|
||||||
rowColumns.put("stats_type", new Atom<>("event"));
|
|
||||||
Row updateRow = new Row(rowColumns);
|
|
||||||
operations.add(new Insert(wifiStatsConfigDbTable, updateRow));
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
|
||||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
|
||||||
|
|
||||||
for (OperationResult res : result) {
|
|
||||||
if (res instanceof InsertResult) {
|
|
||||||
LOG.info("provisionEventReporting insert new row result {}", ((InsertResult) res));
|
|
||||||
// for insert, make sure it is actually in the table
|
|
||||||
confirmRowExistsInTable(ovsdbClient, ((InsertResult) res).getUuid(), wifiStatsConfigDbTable);
|
|
||||||
} else if (res instanceof UpdateResult) {
|
|
||||||
LOG.info("provisionEventReporting update row result {}", ((UpdateResult) res));
|
|
||||||
} else if (res instanceof ErrorResult) {
|
|
||||||
LOG.error("Could not update {}:", wifiStatsConfigDbTable);
|
|
||||||
LOG.error("Error: {} Details: {}", ((ErrorResult) res).getError(),
|
|
||||||
((ErrorResult) res).getDetails());
|
|
||||||
} else {
|
|
||||||
LOG.debug("Updated {}:", wifiStatsConfigDbTable);
|
|
||||||
LOG.debug("Op Result {}", res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
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<>();
|
||||||
@@ -5713,4 +5654,43 @@ public class OvsdbDao {
|
|||||||
return AutoOrManualValue.createManualInstance(equipmentValue);
|
return AutoOrManualValue.createManualInstance(equipmentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {}", ((InsertResult) 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user