From b15dbc61af3cc8ef6ad445c70b1495ee143f78aa Mon Sep 17 00:00:00 2001 From: Thomas-Leung2021 Date: Thu, 22 Jul 2021 18:46:11 -0400 Subject: [PATCH] set createTimestamp in status --- .../OpensyncExternalIntegrationCloud.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 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 f616013..5b58422 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 @@ -1224,12 +1224,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra Status protocolStatus = null; - Status channelStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.RADIO_CHANNEL); - Status channelStatusClone = null; - if (channelStatus != null) { - channelStatusClone = channelStatus.clone(); - } - + Status currentChannelStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.RADIO_CHANNEL); + Status newChannelStatus = null; + for (OpensyncAPRadioState radioState : radioStateTables) { LOG.debug("Processing Wifi_Radio_State table update for AP {} Radio {}", apId, radioState.freqBand); @@ -1241,16 +1238,16 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra protocolStatus = updateProtocolStatus(customerId, equipmentId, radioState); - channelStatus = updateChannelStatus(customerId, equipmentId, channelStatus, radioState); + newChannelStatus = updateChannelStatus(customerId, equipmentId, currentChannelStatus, radioState); } if (protocolStatus != null) { statusServiceInterface.update(protocolStatus); } - if (channelStatus != null && !Objects.equals(channelStatus, channelStatusClone)) { - LOG.debug("wifiRadioStatusDbTableUpdate update Channel Status before {} after {}", channelStatusClone, channelStatus); - statusServiceInterface.update(channelStatus); + if (newChannelStatus != null && !Objects.equals(newChannelStatus, currentChannelStatus)) { + LOG.info("wifiRadioStatusDbTableUpdate update Channel Status before {} after {}", currentChannelStatus, newChannelStatus); + statusServiceInterface.update(newChannelStatus); } if (configStateMismatch) { @@ -1310,9 +1307,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra channelStatus.setStatusDataType(StatusDataType.RADIO_CHANNEL); EquipmentChannelStatusData channelStatusData = new EquipmentChannelStatusData(); channelStatus.setDetails(channelStatusData); + channelStatus.setCreatedTimestamp(System.currentTimeMillis()); } ((EquipmentChannelStatusData) channelStatus.getDetails()).getChannelNumberStatusDataMap().put(radioState.getFreqBand(), radioState.getChannel()); ((EquipmentChannelStatusData) channelStatus.getDetails()).getTxPowerDataMap().put(radioState.getFreqBand(), radioState.getTxPower()); + return channelStatus; }