Opensync AP State Tables row parsing delete handling fix.

This commit is contained in:
Mike Hansen
2020-04-24 14:45:35 -04:00
parent e477205328
commit 0f43b1f726

View File

@@ -281,8 +281,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
extIntegrationInterface extIntegrationInterface
.wifiInetStateDbTableUpdate(ovsdbDao.getOpensyncAPInetState(isCf.join(), key, ovsdbClient), key); .wifiInetStateDbTableUpdate(ovsdbDao.getOpensyncAPInetState(isCf.join(), key, ovsdbClient), key);
CompletableFuture<TableUpdates> vsCf = ovsdbClient CompletableFuture<TableUpdates> vsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiVifStateDbTable + "_" + key, OvsdbDao.wifiVifStateDbTable + "_" + key,
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable, new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable,
new MonitorRequest(new MonitorSelect(true, true, true, true)))), new MonitorRequest(new MonitorSelect(true, true, true, true)))),
new MonitorCallback() { new MonitorCallback() {
@@ -292,13 +292,10 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
// ovsdbDao.getOpensyncAPVIFState(tableUpdates, // ovsdbDao.getOpensyncAPVIFState(tableUpdates,
// key, ovsdbClient), key); // key, ovsdbClient), key);
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<OpensyncAPVIFState>(); List<OpensyncAPVIFState> vifsToDelete = new ArrayList<OpensyncAPVIFState>();
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates() for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
.entrySet()) {
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates() for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
.entrySet()) { if (rowUpdate.getValue().getOld() != null && rowUpdate.getValue().getNew() == null) {
if (rowUpdate.getValue().getOld() != null
&& rowUpdate.getValue().getNew() == null) {
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");
@@ -306,14 +303,21 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
toBeDeleted.setSsid(ssid); toBeDeleted.setSsid(ssid);
toBeDeleted.setIfName(ifName); toBeDeleted.setIfName(ifName);
vifsToDelete.add(toBeDeleted); vifsToDelete.add(toBeDeleted);
tableUpdate.getValue().getRowUpdates().entrySet().remove(rowUpdate); tableUpdate.getValue().getRowUpdates().remove(rowUpdate.getKey());
} }
} }
if (tableUpdate.getValue().getRowUpdates().values().isEmpty()) {
tableUpdates.getTableUpdates().remove(tableUpdate.getKey());
}
} }
if (!vifsToDelete.isEmpty()) { if (!vifsToDelete.isEmpty()) {
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key); extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
} }
if (tableUpdates.getTableUpdates().entrySet().isEmpty())
extIntegrationInterface.wifiVIFStateDbTableUpdate( extIntegrationInterface.wifiVIFStateDbTableUpdate(
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key); ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);