mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-26 14:55:09 +00:00
Opensync AP State Tables row parsing
This commit is contained in:
@@ -3,7 +3,9 @@ package com.telecominfraproject.wlan.opensync.ovsdb;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -282,33 +284,39 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
CompletableFuture<TableUpdates> vsCf = ovsdbClient
|
||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiVifStateDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable,
|
||||
new MonitorRequest(new MonitorSelect(true, true, false, true)))),
|
||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorCallback() {
|
||||
@Override
|
||||
public void update(TableUpdates tableUpdates) {
|
||||
|
||||
// extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||
// ovsdbDao.getOpensyncAPVIFState(tableUpdates,
|
||||
// key, ovsdbClient), key);
|
||||
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<OpensyncAPVIFState>();
|
||||
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
||||
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates()
|
||||
.entrySet()) {
|
||||
|
||||
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
|
||||
if (rowUpdate.getOld() != null && rowUpdate.getNew() == null) {
|
||||
Row row = rowUpdate.getOld();
|
||||
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates()
|
||||
.entrySet()) {
|
||||
if (rowUpdate.getValue().getOld() != null
|
||||
&& rowUpdate.getValue().getNew() == null) {
|
||||
Row row = rowUpdate.getValue().getOld();
|
||||
String ifName = row.getStringColumn("if_name");
|
||||
String ssid = row.getStringColumn("ssid");
|
||||
OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState();
|
||||
toBeDeleted.setSsid(ssid);
|
||||
toBeDeleted.setIfName(ifName);
|
||||
vifsToDelete.add(toBeDeleted);
|
||||
tableUpdate.getValue().getRowUpdates().entrySet().remove(rowUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vifsToDelete.isEmpty()) {
|
||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
||||
} else {
|
||||
if (!vifsToDelete.isEmpty()) {
|
||||
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
||||
}
|
||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1257,11 +1257,11 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ret.stream().forEach(wrs -> {
|
||||
LOG.debug("Wifi_Inet_State row {}", wrs.toPrettyString());
|
||||
});
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not parse update for Wifi_Inet_State", e);
|
||||
}
|
||||
@@ -1360,15 +1360,17 @@ public class OvsdbDao {
|
||||
tableState.setVersion(row.getUuidColumn("_uuid"));
|
||||
}
|
||||
|
||||
ret.add(tableState);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ret.stream().forEach(wrs -> {
|
||||
LOG.debug("Wifi_VIF_State row {}", wrs.toPrettyString());
|
||||
});
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not parse update for Wifi_VIF_State", e);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user