mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 19:47:52 +00:00
OVSDB State Table Changes. Ensure BSSIDs captured from new/changed Wifi_VIF_State
This commit is contained in:
@@ -142,24 +142,26 @@ 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 {
|
try {
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + key).join();
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_delete_" + key).join();
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + key).join();
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + key).join();
|
||||||
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key);
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key).join();
|
||||||
|
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_delete_" + key).join();
|
||||||
|
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + key).join();
|
||||||
} catch (OvsdbClientException e) {
|
} catch (OvsdbClientException e) {
|
||||||
LOG.warn("Could not cancel Monitor {}", e.getMessage());
|
LOG.debug("Unable to cancel monitor for state table. {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
extIntegrationInterface.apDisconnected(key);
|
extIntegrationInterface.apDisconnected(key);
|
||||||
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key);
|
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key);
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
LOG.debug("Unable to process ap disconnect. {}", e.getMessage());
|
||||||
|
} finally {
|
||||||
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,
|
||||||
clientCn, key);
|
clientCn, key);
|
||||||
@@ -171,7 +173,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
|
|
||||||
listener.startListeningWithSsl(ovsdbListenPort, sslContext, connectionCallback).join();
|
listener.startListeningWithSsl(ovsdbListenPort, sslContext, connectionCallback).join();
|
||||||
|
|
||||||
LOG.info("manager waiting for connection on port {}...", ovsdbListenPort);
|
LOG.info("Manager waiting for connection on port {}...", ovsdbListenPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConnectNodeInfo processConnectRequest(OvsdbClient ovsdbClient, String clientCn,
|
private ConnectNodeInfo processConnectRequest(OvsdbClient ovsdbClient, String clientCn,
|
||||||
@@ -182,7 +184,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
|
|
||||||
String apId = clientCn + "_" + connectNodeInfo.serialNumber;
|
String apId = clientCn + "_" + connectNodeInfo.serialNumber;
|
||||||
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
||||||
if (opensyncAPConfig != null) {
|
|
||||||
try {
|
try {
|
||||||
ovsdbDao.provisionBridgePortInterface(ovsdbClient);
|
ovsdbDao.provisionBridgePortInterface(ovsdbClient);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -190,10 +192,13 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
|
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ovsdbDao.removeAllSsids(ovsdbClient);
|
ovsdbDao.removeAllSsids(ovsdbClient); // always
|
||||||
|
|
||||||
|
if (opensyncAPConfig != null) {
|
||||||
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
||||||
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
||||||
|
}
|
||||||
|
|
||||||
ovsdbDao.configureStats(ovsdbClient);
|
ovsdbDao.configureStats(ovsdbClient);
|
||||||
|
|
||||||
// Check if device stats is configured in Wifi_Stats_Config table,
|
// Check if device stats is configured in Wifi_Stats_Config table,
|
||||||
@@ -203,8 +208,6 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ovsdbDao.configureWifiInet(ovsdbClient);
|
// ovsdbDao.configureWifiInet(ovsdbClient);
|
||||||
|
|
||||||
LOG.debug("Client connect Done");
|
LOG.debug("Client connect Done");
|
||||||
@@ -243,10 +246,12 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient();
|
OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient();
|
||||||
|
|
||||||
|
ovsdbDao.removeAllSsids(ovsdbClient);
|
||||||
|
|
||||||
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
|
||||||
|
|
||||||
if (opensyncAPConfig != null) {
|
if (opensyncAPConfig != null) {
|
||||||
ovsdbDao.removeAllSsids(ovsdbClient);
|
|
||||||
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
||||||
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
|
||||||
}
|
}
|
||||||
@@ -268,10 +273,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
rsCf.join();
|
||||||
extIntegrationInterface
|
|
||||||
.wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
|
|
||||||
|
|
||||||
CompletableFuture<TableUpdates> isCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
CompletableFuture<TableUpdates> isCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||||
OvsdbDao.wifiInetStateDbTable + "_" + key,
|
OvsdbDao.wifiInetStateDbTable + "_" + key,
|
||||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable,
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiInetStateDbTable,
|
||||||
@@ -287,14 +289,12 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
isCf.join();
|
||||||
|
|
||||||
extIntegrationInterface
|
CompletableFuture<TableUpdates> vsdCf = ovsdbClient
|
||||||
.wifiInetStateDbTableUpdate(ovsdbDao.getOpensyncAPInetState(isCf.join(), key, ovsdbClient), key);
|
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiVifStateDbTable + "_delete_" + key,
|
||||||
|
|
||||||
CompletableFuture<TableUpdates> vsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
|
||||||
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, false, true, false)))),
|
||||||
new MonitorCallback() {
|
new MonitorCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void update(TableUpdates tableUpdates) {
|
public void update(TableUpdates tableUpdates) {
|
||||||
@@ -302,20 +302,24 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
// ovsdbDao.getOpensyncAPVIFState(tableUpdates,
|
// ovsdbDao.getOpensyncAPVIFState(tableUpdates,
|
||||||
// key, ovsdbClient), key);
|
// key, ovsdbClient), key);
|
||||||
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<>();
|
List<OpensyncAPVIFState> vifsToDelete = new ArrayList<>();
|
||||||
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates().entrySet()) {
|
for (Entry<String, TableUpdate> tableUpdate : tableUpdates.getTableUpdates()
|
||||||
|
.entrySet()) {
|
||||||
|
|
||||||
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates().entrySet()) {
|
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates()
|
||||||
if (rowUpdate.getValue().getOld() != null && rowUpdate.getValue().getNew() == null) {
|
.entrySet()) {
|
||||||
|
if (rowUpdate.getValue().getOld() != null
|
||||||
|
&& rowUpdate.getValue().getNew() == null) {
|
||||||
Row row = rowUpdate.getValue().getOld();
|
Row row = rowUpdate.getValue().getOld();
|
||||||
String ifName = null;
|
String ifName = null;
|
||||||
String ssid = null;
|
String ssid = null;
|
||||||
if (row.getColumns().get("ssid") != null && row.getColumns().get("ssid").getClass()
|
if (row.getColumns().get("ssid") != null
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
&& row.getColumns().get("ssid").getClass().equals(
|
||||||
|
com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
ssid = row.getStringColumn("ssid");
|
ssid = row.getStringColumn("ssid");
|
||||||
}
|
}
|
||||||
if (row.getColumns().get("if_name") != null
|
if (row.getColumns().get("if_name") != null
|
||||||
&& row.getColumns().get("if_name").getClass()
|
&& row.getColumns().get("if_name").getClass().equals(
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
ifName = row.getStringColumn("if_name");
|
ifName = row.getStringColumn("if_name");
|
||||||
}
|
}
|
||||||
if (ifName != null && ssid != null) {
|
if (ifName != null && ssid != null) {
|
||||||
@@ -338,33 +342,43 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
if (!vifsToDelete.isEmpty()) {
|
if (!vifsToDelete.isEmpty()) {
|
||||||
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
||||||
}
|
}
|
||||||
if (tableUpdates.getTableUpdates().entrySet().isEmpty()) {
|
|
||||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
|
||||||
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(ovsdbDao.getOpensyncAPVIFState(vsCf.join(), key, ovsdbClient),
|
vsdCf.join();
|
||||||
key);
|
|
||||||
|
|
||||||
CompletableFuture<TableUpdates> acCf = ovsdbClient
|
CompletableFuture<TableUpdates> vsCf = ovsdbClient
|
||||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiAssociatedClientsDbTable + "_" + key,
|
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiVifStateDbTable + "_" + key,
|
||||||
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable,
|
||||||
|
new MonitorRequest(new MonitorSelect(true, true, false, true)))),
|
||||||
|
new MonitorCallback() {
|
||||||
|
@Override
|
||||||
|
public void update(TableUpdates tableUpdates) {
|
||||||
|
|
||||||
|
extIntegrationInterface.wifiVIFStateDbTableUpdate(
|
||||||
|
ovsdbDao.getOpensyncAPVIFState(tableUpdates, key, ovsdbClient), key);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
vsCf.join();
|
||||||
|
|
||||||
|
CompletableFuture<TableUpdates> acdCf = ovsdbClient
|
||||||
|
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiAssociatedClientsDbTable + "_delete_" + key,
|
||||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable,
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable,
|
||||||
new MonitorRequest(new MonitorSelect(false, true, true, true)))),
|
new MonitorRequest(new MonitorSelect(true, false, true, false)))),
|
||||||
new MonitorCallback() {
|
new MonitorCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(TableUpdates tableUpdates) {
|
public void update(TableUpdates tableUpdates) {
|
||||||
|
|
||||||
boolean insertOrModify = false;
|
|
||||||
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
||||||
|
|
||||||
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
|
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
|
||||||
if (rowUpdate.getOld() != null && rowUpdate.getNew() == null) {
|
if (rowUpdate.getOld() != null && rowUpdate.getNew() == null) {
|
||||||
insertOrModify = false;
|
|
||||||
Row row = rowUpdate.getOld();
|
Row row = rowUpdate.getOld();
|
||||||
String deletedClientMac = row.getStringColumn("mac");
|
String deletedClientMac = row.getStringColumn("mac");
|
||||||
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac,
|
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac,
|
||||||
@@ -374,7 +388,22 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insertOrModify) {
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
acdCf.join();
|
||||||
|
|
||||||
|
CompletableFuture<TableUpdates> acCf = ovsdbClient
|
||||||
|
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiAssociatedClientsDbTable + "_" + key,
|
||||||
|
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiAssociatedClientsDbTable,
|
||||||
|
new MonitorRequest(new MonitorSelect(true, true, false, true)))),
|
||||||
|
new MonitorCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(TableUpdates tableUpdates) {
|
||||||
|
|
||||||
|
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
|
||||||
|
|
||||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
||||||
ovsdbDao.getOpensyncWifiAssociatedClients(tableUpdates, key, ovsdbClient),
|
ovsdbDao.getOpensyncWifiAssociatedClients(tableUpdates, key, ovsdbClient),
|
||||||
key);
|
key);
|
||||||
@@ -382,8 +411,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
acCf.join();
|
||||||
ovsdbDao.getOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
|
|
||||||
|
|
||||||
CompletableFuture<TableUpdates> awCf = ovsdbClient
|
CompletableFuture<TableUpdates> awCf = ovsdbClient
|
||||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key,
|
.monitor(OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key,
|
||||||
@@ -398,8 +426,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
extIntegrationInterface.awlanNodeDbTableUpdate(ovsdbDao.getOpensyncAWLANNode(awCf.join(), key, ovsdbClient),
|
awCf.join();
|
||||||
key);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user