From 8cfb4e93b020f73e4348dae8822a09f3945954d3 Mon Sep 17 00:00:00 2001 From: Dmitry Toptygin Date: Thu, 11 Jun 2020 17:43:34 -0400 Subject: [PATCH] populate location Id on client sessions --- .../integration/OpensyncExternalIntegrationCloud.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java index d08c72e..8a3a9b3 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java @@ -920,7 +920,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } } - private void handleClientSessionUpdate(int customerId, long equipmentId, String apId, int channel, + private void handleClientSessionUpdate(int customerId, long equipmentId, String apId, long locationId, int channel, RadioBandType band, long timestamp, sts.PlumeStats.Client client) { com.telecominfraproject.wlan.client.models.Client clientInstance = clientServiceInterface.getOrNull(customerId, @@ -944,6 +944,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra clientSession = new ClientSession(); clientSession.setCustomerId(customerId); clientSession.setEquipmentId(equipmentId); + clientSession.setLocationId(locationId); clientSession.setMacAddress(new MacAddress(client.getMacAddress())); clientSession.setDetails(new ClientSessionDetails()); @@ -1009,6 +1010,10 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra ServiceMetric smr = new ServiceMetric(customerId, equipmentId); ApSsidMetrics apSsidMetrics = new ApSsidMetrics(); + //we need to populate location Id on the client sessions, that's why we're getting equipment object in here (from the cache) + Equipment equipment = getCustomerEquipment(apId); + long locationId = (equipment != null) ? equipment.getLocationId() : 0 ; + smr.setDetails(apSsidMetrics); LOG.debug("ApSsidMetrics Keys {}: ", apSsidMetrics.getSsidStats().keySet()); metricRecordList.add(smr); @@ -1036,7 +1041,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra rxRetries += client.getStats().getRxRetries(); lastRssi = client.getStats().getRssi(); try { - handleClientSessionUpdate(customerId, equipmentId, apId, clientReport.getChannel(), + handleClientSessionUpdate(customerId, equipmentId, apId, locationId, clientReport.getChannel(), clientReport.getBand(), clientReport.getTimestampMs(), client); } catch (Exception e) { LOG.debug("Unabled to update client {} session {}", client, e);