Adding locationId for ClientSessions. Throttling table state changes for FW Flash

This commit is contained in:
Mike Hansen
2020-07-24 18:47:16 -04:00
parent 1d6f980c30
commit 57a87d345e
3 changed files with 28 additions and 7 deletions

View File

@@ -2312,8 +2312,15 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
customerId, equipmentId, apId); customerId, equipmentId, apId);
return; return;
} }
Equipment ce = getCustomerEquipment(apId);
if (ce == null) {
LOG.debug("Cannot get customer Equipment for {}", apId);
return;
}
if ((wifiAssociatedClients == null) || wifiAssociatedClients.isEmpty() || (apId == null)) { if ((wifiAssociatedClients == null) || wifiAssociatedClients.isEmpty()) {
return; return;
} }
@@ -2353,12 +2360,15 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
clientSession = new ClientSession(); clientSession = new ClientSession();
clientSession.setCustomerId(customerId); clientSession.setCustomerId(customerId);
clientSession.setEquipmentId(equipmentId); clientSession.setEquipmentId(equipmentId);
clientSession.setLocationId(ce.getLocationId());
clientSession.setMacAddress(new MacAddress(opensyncWifiAssociatedClients.getMac())); clientSession.setMacAddress(new MacAddress(opensyncWifiAssociatedClients.getMac()));
ClientSessionDetails clientSessionDetails = new ClientSessionDetails(); ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
clientSession.setDetails(clientSessionDetails); clientSession.setDetails(clientSessionDetails);
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
} }
clientSession.setLocationId(ce.getLocationId());
ClientSessionDetails clientSessionDetails = clientSession.getDetails(); ClientSessionDetails clientSessionDetails = clientSession.getDetails();
clientSessionDetails.setHostname(clientDetails.getHostName()); clientSessionDetails.setHostname(clientDetails.getHostName());
clientSessionDetails.setIsReassociation(isReassociation); clientSessionDetails.setIsReassociation(isReassociation);

View File

@@ -602,17 +602,28 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
@Override @Override
public String processFirmwareFlash(String apId, String firmwareVersion, String username) { public String processFirmwareFlash(String apId, String firmwareVersion, String username) {
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
OvsdbClient ovsdbClient = session.getOvsdbClient();
try { try {
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
ovsdbClient.cancelMonitor(OvsdbDao.awlanNodeDbTable + "_" + apId).join();
ovsdbClient.cancelMonitor(OvsdbDao.wifiRadioStateDbTable + "_" + apId).join();
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_" + apId).join();
ovsdbClient.cancelMonitor(OvsdbDao.wifiVifStateDbTable + "_delete_" + apId).join();
ovsdbClient.cancelMonitor(OvsdbDao.wifiInetStateDbTable + "_" + apId).join();
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_" + apId).join();
ovsdbClient.cancelMonitor(OvsdbDao.wifiAssociatedClientsDbTable + "_delete_" + apId).join();
ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username); ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Failed to initialize firmware download to " + apId + " " + e.getLocalizedMessage()); LOG.error("Failed to flash firmware for " + apId + " " + e.getLocalizedMessage());
return "Failed to initialize firmware download to " + apId + " " + e.getLocalizedMessage(); return "Failed to flash firmware for " + apId + " " + e.getLocalizedMessage();
} finally {
monitorOvsdbStateTables(ovsdbClient, apId);
} }
LOG.debug("Initialized firmware download to " + apId); LOG.debug("Flashed Firmware for AP {} to {} ", apId, firmwareVersion);
return "Initialized firmware download to " + apId; return "Flashed Firmware for AP " + apId + " to " + firmwareVersion;
} }
} }

View File

@@ -3074,7 +3074,7 @@ public class OvsdbDao {
operations.add(new Delete(wifiStatsConfigDbTable)); operations.add(new Delete(wifiStatsConfigDbTable));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); OperationResult[] result = fResult.get(240, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing config from {}:", wifiStatsConfigDbTable); LOG.debug("Removed all existing config from {}:", wifiStatsConfigDbTable);