The number of connected AP displayed on Client Devices page and Dashboard page are not in sync.

This commit is contained in:
Mike Hansen
2020-12-12 15:01:00 -05:00
parent 67c0ae9ffc
commit aeb949a884

View File

@@ -303,6 +303,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
EquipmentRoutingRecord equipmentRoutingRecord = gatewayController.registerCustomerEquipment(ce.getName(), EquipmentRoutingRecord equipmentRoutingRecord = gatewayController.registerCustomerEquipment(ce.getName(),
ce.getCustomerId(), ce.getId()); ce.getCustomerId(), ce.getId());
LOG.info("Clear existing status {} for AP {}",
statusServiceInterface.delete(ce.getCustomerId(), ce.getId()), apId);
updateApStatus(ce, connectNodeInfo); updateApStatus(ce, connectNodeInfo);
removeNonWifiClients(ce, connectNodeInfo); removeNonWifiClients(ce, connectNodeInfo);
@@ -742,7 +745,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} else { } else {
LOG.warn("Cannot find ap {} in inventory", apId); LOG.warn("Cannot find ap {} in inventory", apId);
} }
Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId);
if (ce != null) {
LOG.info("AP {} disconnected, delete status records {}", apId,
statusServiceInterface.delete(ce.getCustomerId(), ce.getId()));
}
updateApDisconnectedStatus(apId); updateApDisconnectedStatus(apId);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Exception when registering ap routing {}", apId, e); LOG.error("Exception when registering ap routing {}", apId, e);
@@ -753,6 +760,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
private void updateApDisconnectedStatus(String apId) { private void updateApDisconnectedStatus(String apId) {
try { try {
Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId);
if (ce == null) { if (ce == null) {
LOG.debug("updateDisconnectedApStatus::Cannot get Equipment for AP {}", apId); LOG.debug("updateDisconnectedApStatus::Cannot get Equipment for AP {}", apId);
return; return;
@@ -761,7 +769,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
Status statusRecord = statusServiceInterface.getOrNull(ce.getCustomerId(), ce.getId(), Status statusRecord = statusServiceInterface.getOrNull(ce.getCustomerId(), ce.getId(),
StatusDataType.EQUIPMENT_ADMIN); StatusDataType.EQUIPMENT_ADMIN);
if (statusRecord == null) { if (statusRecord == null) {
LOG.debug("updateApDisconnectedStatus::Cannot get EQUIPMENT_ADMIN status for CustomerId {} or EquipmentId {} for AP {}", LOG.debug(
"updateApDisconnectedStatus::Cannot get EQUIPMENT_ADMIN status for CustomerId {} or EquipmentId {} for AP {}",
ce.getCustomerId(), ce.getId(), apId); ce.getCustomerId(), ce.getId(), apId);
return; return;
} }
@@ -769,6 +778,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
((EquipmentAdminStatusData) statusRecord.getDetails()).setStatusCode(StatusCode.error); ((EquipmentAdminStatusData) statusRecord.getDetails()).setStatusCode(StatusCode.error);
// Update the equipment admin status // Update the equipment admin status
statusRecord = statusServiceInterface.update(statusRecord); statusRecord = statusServiceInterface.update(statusRecord);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Exception in updateApDisconnectedStatus", e); LOG.error("Exception in updateApDisconnectedStatus", e);
throw e; throw e;
@@ -808,8 +818,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
ret.setRfProfile(profileContainer.getChildOfTypeOrNull(equipmentConfig.getProfileId(), ProfileType.rf)); ret.setRfProfile(profileContainer.getChildOfTypeOrNull(equipmentConfig.getProfileId(), ProfileType.rf));
ret.setSsidProfile( ret.setSsidProfile(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid));
profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid));
ret.setMetricsProfiles(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ret.setMetricsProfiles(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(),
ProfileType.service_metrics_collection_config)); ProfileType.service_metrics_collection_config));
@@ -830,8 +839,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
hotspot20ProfileSet hotspot20ProfileSet
.addAll(profileContainer.getChildrenOfType(ssidProfile.getId(), ProfileType.passpoint)); .addAll(profileContainer.getChildrenOfType(ssidProfile.getId(), ProfileType.passpoint));
radiusSet radiusSet.addAll(profileContainer.getChildrenOfType(ret.getApProfile().getId(), ProfileType.radius));
.addAll(profileContainer.getChildrenOfType(ret.getApProfile().getId(), ProfileType.radius));
if (ssidProfile.getDetails() != null) { if (ssidProfile.getDetails() != null) {
Long captivePortId = ((SsidConfiguration) ssidProfile.getDetails()).getCaptivePortalId(); Long captivePortId = ((SsidConfiguration) ssidProfile.getDetails()).getCaptivePortalId();
if (captivePortId != null) { if (captivePortId != null) {
@@ -849,8 +857,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
for (Profile hotspot20Profile : hotspot20ProfileSet) { for (Profile hotspot20Profile : hotspot20ProfileSet) {
hotspot20OperatorSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(), hotspot20OperatorSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
ProfileType.passpoint_operator)); ProfileType.passpoint_operator));
hotspot20VenueSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(), hotspot20VenueSet.addAll(
ProfileType.passpoint_venue)); profileContainer.getChildrenOfType(hotspot20Profile.getId(), ProfileType.passpoint_venue));
hotspot20ProviderSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(), hotspot20ProviderSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
ProfileType.passpoint_osu_id_provider)); ProfileType.passpoint_osu_id_provider));
} }
@@ -876,7 +884,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
LOG.debug("ApConfig {}", ret); LOG.debug("ApConfig {}", ret);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Cannot read config for AP {}", apId, e); LOG.error("Cannot read config for AP {}", apId, e);
} }
@@ -1117,8 +1124,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
protocolStatusData = (EquipmentProtocolStatusData) protocolStatus.getDetails(); protocolStatusData = (EquipmentProtocolStatusData) protocolStatus.getDetails();
if (!protocolStatusData.getReportedCC().equals(CountryCode.getByName((radioState.getCountry())))) { if (!protocolStatusData.getReportedCC().equals(CountryCode.getByName((radioState.getCountry())))) {
LOG.debug("Protocol Status reportedCC {} radioStatus.getCountry {} radioStatus CountryCode fromName {}", protocolStatusData.getReportedCC(), radioState.getCountry(), CountryCode.getByName((radioState.getCountry()))); LOG.debug(
protocolStatusData.setReportedCC(CountryCode.getByName((radioState. getCountry()))); "Protocol Status reportedCC {} radioStatus.getCountry {} radioStatus CountryCode fromName {}",
protocolStatusData.getReportedCC(), radioState.getCountry(),
CountryCode.getByName((radioState.getCountry())));
protocolStatusData.setReportedCC(CountryCode.getByName((radioState.getCountry())));
protocolStatus.setDetails(protocolStatusData); protocolStatus.setDetails(protocolStatusData);
} else { } else {
@@ -1165,8 +1175,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
Status activeBssidsStatus = statusServiceInterface.getOrNull(customerId, equipmentId, Status activeBssidsStatus = statusServiceInterface.getOrNull(customerId, equipmentId,
StatusDataType.ACTIVE_BSSIDS); StatusDataType.ACTIVE_BSSIDS);
statusServiceInterface.getForCustomer(customerId, null, ImmutableSet.of(StatusDataType.ACTIVE_BSSIDS), null,
null);
if (activeBssidsStatus == null) { if (activeBssidsStatus == null) {
activeBssidsStatus = new Status(); activeBssidsStatus = new Status();
activeBssidsStatus.setCustomerId(customerId); activeBssidsStatus.setCustomerId(customerId);
@@ -1356,6 +1364,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
public void wifiAssociatedClientsDbTableUpdate(List<OpensyncWifiAssociatedClients> wifiAssociatedClients, public void wifiAssociatedClientsDbTableUpdate(List<OpensyncWifiAssociatedClients> wifiAssociatedClients,
String apId) { String apId) {
LOG.info("Received wifiAssociatedClientsDbTableUpdate monitor notification for Client(s) {} on AP {}",
wifiAssociatedClients, apId);
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
if (ovsdbSession == null) { if (ovsdbSession == null) {
@@ -1515,12 +1526,18 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
String reportedSwImageName, String reportedAltSwImageName) { String reportedSwImageName, String reportedAltSwImageName) {
Status protocolStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL); Status protocolStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL);
if (protocolStatus != null) { if (protocolStatus != null) {
EquipmentProtocolStatusData protocolStatusData = ((EquipmentProtocolStatusData) protocolStatus.getDetails()); EquipmentProtocolStatusData protocolStatusData = ((EquipmentProtocolStatusData) protocolStatus
if (protocolStatusData.getReportedSku() != null && protocolStatusData.getReportedSku().equals(opensyncAPState.getSkuNumber()) .getDetails());
&& protocolStatusData.getReportedSwVersion() != null && protocolStatusData.getReportedSwVersion().equals(reportedSwImageName) if (protocolStatusData.getReportedSku() != null
&& protocolStatusData.getReportedSwAltVersion() != null && protocolStatusData.getReportedSwAltVersion().equals(reportedAltSwImageName) && protocolStatusData.getReportedSku().equals(opensyncAPState.getSkuNumber())
&& protocolStatusData.getReportedHwVersion() != null && protocolStatusData.getReportedHwVersion().equals(opensyncAPState.getPlatformVersion()) && protocolStatusData.getReportedSwVersion() != null
&& protocolStatusData.getSystemName() != null && protocolStatusData.getSystemName().equals(opensyncAPState.getModel())) { && protocolStatusData.getReportedSwVersion().equals(reportedSwImageName)
&& protocolStatusData.getReportedSwAltVersion() != null
&& protocolStatusData.getReportedSwAltVersion().equals(reportedAltSwImageName)
&& protocolStatusData.getReportedHwVersion() != null
&& protocolStatusData.getReportedHwVersion().equals(opensyncAPState.getPlatformVersion())
&& protocolStatusData.getSystemName() != null
&& protocolStatusData.getSystemName().equals(opensyncAPState.getModel())) {
// no changes // no changes
return null; return null;
} }
@@ -1535,20 +1552,24 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} else { } else {
protocolStatusData.setReportedSwAltVersion("Unknown"); protocolStatusData.setReportedSwAltVersion("Unknown");
} }
protocolStatusData protocolStatusData.setReportedHwVersion(opensyncAPState.getPlatformVersion());
.setReportedHwVersion(opensyncAPState.getPlatformVersion());
protocolStatusData.setSystemName(opensyncAPState.getModel()); protocolStatusData.setSystemName(opensyncAPState.getModel());
} }
return protocolStatus; return protocolStatus;
} }
private Status configureFirmwareStatus(int customerId, long equipmentId,EquipmentUpgradeState fwUpgradeState, private Status configureFirmwareStatus(int customerId, long equipmentId, EquipmentUpgradeState fwUpgradeState,
FailureReason fwUpgradeFailureReason, String reportedFwImageName, String reportedAltFwImageName) { FailureReason fwUpgradeFailureReason, String reportedFwImageName, String reportedAltFwImageName) {
Status firmwareStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.FIRMWARE); Status firmwareStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.FIRMWARE);
if (firmwareStatus != null) { if (firmwareStatus != null) {
EquipmentUpgradeStatusData upgradeStatusData = (EquipmentUpgradeStatusData)firmwareStatus.getDetails(); EquipmentUpgradeStatusData upgradeStatusData = (EquipmentUpgradeStatusData) firmwareStatus.getDetails();
if (upgradeStatusData.getActiveSwVersion() != null && upgradeStatusData.getActiveSwVersion().equals(reportedFwImageName) && upgradeStatusData.getAlternateSwVersion() != null &&upgradeStatusData.getAlternateSwVersion().equals(reportedAltFwImageName) && upgradeStatusData.getUpgradeState() != null && upgradeStatusData.getUpgradeState().equals(fwUpgradeState)) { if (upgradeStatusData.getActiveSwVersion() != null
&& upgradeStatusData.getActiveSwVersion().equals(reportedFwImageName)
&& upgradeStatusData.getAlternateSwVersion() != null
&& upgradeStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)
&& upgradeStatusData.getUpgradeState() != null
&& upgradeStatusData.getUpgradeState().equals(fwUpgradeState)) {
return null; // no changes return null; // no changes
} }
if (reportedFwImageName != null) { if (reportedFwImageName != null) {
@@ -1560,11 +1581,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
if (reportedAltFwImageName != null) { if (reportedAltFwImageName != null) {
upgradeStatusData.setAlternateSwVersion(reportedAltFwImageName); upgradeStatusData.setAlternateSwVersion(reportedAltFwImageName);
} else { } else {
((EquipmentUpgradeStatusData) firmwareStatus.getDetails()) ((EquipmentUpgradeStatusData) firmwareStatus.getDetails()).setAlternateSwVersion("Unknown");
.setAlternateSwVersion("Unknown");
} }
if (fwUpgradeState == null) fwUpgradeState = EquipmentUpgradeState.undefined; if (fwUpgradeState == null)
fwUpgradeState = EquipmentUpgradeState.undefined;
if (fwUpgradeState.equals(EquipmentUpgradeState.up_to_date)) { if (fwUpgradeState.equals(EquipmentUpgradeState.up_to_date)) {
LOG.info("Firmware load is up to date."); LOG.info("Firmware load is up to date.");
@@ -1600,8 +1621,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
((EquipmentUpgradeStatusData) firmwareStatus.getDetails()) ((EquipmentUpgradeStatusData) firmwareStatus.getDetails())
.setUpgradeState(EquipmentUpgradeState.undefined); .setUpgradeState(EquipmentUpgradeState.undefined);
((EquipmentUpgradeStatusData) firmwareStatus.getDetails()) ((EquipmentUpgradeStatusData) firmwareStatus.getDetails()).setUpgradeStartTime(null);
.setUpgradeStartTime(null);
} }
} }
return firmwareStatus; return firmwareStatus;
@@ -1661,7 +1681,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} }
if (bssidList != null) bssidList.removeAll(toBeDeleted); if (bssidList != null)
bssidList.removeAll(toBeDeleted);
statusDetails.setActiveBSSIDs(bssidList); statusDetails.setActiveBSSIDs(bssidList);
@@ -1676,6 +1697,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
@Override @Override
public void wifiAssociatedClientsDbTableDelete(String deletedClientMac, String apId) { public void wifiAssociatedClientsDbTableDelete(String deletedClientMac, String apId) {
LOG.info("Received wifiAssociatedClientsDbTableDelete monitor notification for MAC {} on AP {}",
deletedClientMac, apId);
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
if (ovsdbSession == null) { if (ovsdbSession == null) {
@@ -1698,7 +1721,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
new MacAddress(deletedClientMac)); new MacAddress(deletedClientMac));
if (client != null) { if (client != null) {
if (clientSession != null && clientSession.getDetails() != null && clientSession.getDetails().getAssociationState() != null) { if (clientSession != null && clientSession.getDetails() != null
&& clientSession.getDetails().getAssociationState() != null) {
if (!clientSession.getDetails().getAssociationState().equals(AssociationState.Disconnected)) { if (!clientSession.getDetails().getAssociationState().equals(AssociationState.Disconnected)) {
clientSession.getDetails().setAssociationState(AssociationState.Disconnected); clientSession.getDetails().setAssociationState(AssociationState.Disconnected);
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
@@ -2083,5 +2107,4 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
// TODO: will handle changes from Command_State table // TODO: will handle changes from Command_State table
} }
} }