WIFI-437: CloudSDK Client DHCP attributes processing. -- session updates

This commit is contained in:
Mike Hansen
2020-08-28 16:12:17 -04:00
parent 03c8c15f53
commit 4b7bbaae6e

View File

@@ -954,6 +954,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
}
private void processEventReport(Report report, int customerId, long equipmentId, String apId, long locationId) {
LOG.debug("Processing EventReport List {}", report.getEventReportList());
report.getEventReportList().stream().forEach(e -> {
LOG.info("Received EventReport {}", e);
@@ -3356,7 +3359,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
ClientSessionDetails clientSessionDetails = session.getDetails();
if (clientSessionDetails.getAssociationState() != null && !clientSessionDetails.getAssociationState().equals(AssociationState.Disconnected)) {
if (clientSessionDetails.getAssociationState() != null
&& !clientSessionDetails.getAssociationState().equals(AssociationState.Disconnected)) {
clientSessionDetails.setDisconnectByClientTimestamp(System.currentTimeMillis());
clientSessionDetails.setAssociationState(AssociationState.Disconnected);
@@ -3410,6 +3414,15 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
}
Equipment ce = getCustomerEquipment(apId);
if (ce == null) {
LOG.debug("updateDhcpIpClientFingerprints::Cannot get Equipment for AP {}", apId);
return;
}
long locationId = ce.getLocationId();
if (rowUpdateOperation.equals(RowUpdateOperation.INSERT)) {
@@ -3449,7 +3462,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
// In this case, we might have a session, as the client
// already exists on the cloud, update if required
ClientSession session = updateClientSession(customerId, equipmentId, dhcpLeasedIps, clientMacAddress);
ClientSession session = updateClientSession(customerId, equipmentId, locationId, dhcpLeasedIps,
clientMacAddress);
if (session != null) {
clientSessionList.add(session);
@@ -3548,7 +3562,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
// check if there is a session for this client
ClientSession session = updateClientSession(customerId, equipmentId, dhcpLeasedIps, clientMacAddress);
ClientSession session = updateClientSession(customerId, equipmentId, locationId, dhcpLeasedIps,
clientMacAddress);
if (session != null) {
clientSessionList.add(session);
@@ -3570,14 +3585,16 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
}
protected ClientSession updateClientSession(int customerId, long equipmentId, Map<String, String> dhcpLeasedIps,
MacAddress clientMacAddress) {
protected ClientSession updateClientSession(int customerId, long equipmentId, long locationId,
Map<String, String> dhcpLeasedIps, MacAddress clientMacAddress) {
ClientSession session = clientServiceInterface.getSessionOrNull(customerId, equipmentId, clientMacAddress);
if (session == null) {
session = new ClientSession();
}
session.setCustomerId(customerId);
session.setEquipmentId(equipmentId);
session.setLocationId(locationId);
session.setMacAddress(clientMacAddress);
session.setDetails(new ClientSessionDetails());
@@ -3654,7 +3671,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
session.getDetails().mergeSession(clientSessionDetails);
}
return session;
}