set createTimestamp in status

This commit is contained in:
Thomas-Leung2021
2021-07-22 18:46:11 -04:00
parent 45642464fc
commit b15dbc61af

View File

@@ -1224,11 +1224,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
Status protocolStatus = null; Status protocolStatus = null;
Status channelStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.RADIO_CHANNEL); Status currentChannelStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.RADIO_CHANNEL);
Status channelStatusClone = null; Status newChannelStatus = null;
if (channelStatus != null) {
channelStatusClone = channelStatus.clone();
}
for (OpensyncAPRadioState radioState : radioStateTables) { for (OpensyncAPRadioState radioState : radioStateTables) {
LOG.debug("Processing Wifi_Radio_State table update for AP {} Radio {}", apId, radioState.freqBand); 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); protocolStatus = updateProtocolStatus(customerId, equipmentId, radioState);
channelStatus = updateChannelStatus(customerId, equipmentId, channelStatus, radioState); newChannelStatus = updateChannelStatus(customerId, equipmentId, currentChannelStatus, radioState);
} }
if (protocolStatus != null) { if (protocolStatus != null) {
statusServiceInterface.update(protocolStatus); statusServiceInterface.update(protocolStatus);
} }
if (channelStatus != null && !Objects.equals(channelStatus, channelStatusClone)) { if (newChannelStatus != null && !Objects.equals(newChannelStatus, currentChannelStatus)) {
LOG.debug("wifiRadioStatusDbTableUpdate update Channel Status before {} after {}", channelStatusClone, channelStatus); LOG.info("wifiRadioStatusDbTableUpdate update Channel Status before {} after {}", currentChannelStatus, newChannelStatus);
statusServiceInterface.update(channelStatus); statusServiceInterface.update(newChannelStatus);
} }
if (configStateMismatch) { if (configStateMismatch) {
@@ -1310,9 +1307,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
channelStatus.setStatusDataType(StatusDataType.RADIO_CHANNEL); channelStatus.setStatusDataType(StatusDataType.RADIO_CHANNEL);
EquipmentChannelStatusData channelStatusData = new EquipmentChannelStatusData(); EquipmentChannelStatusData channelStatusData = new EquipmentChannelStatusData();
channelStatus.setDetails(channelStatusData); channelStatus.setDetails(channelStatusData);
channelStatus.setCreatedTimestamp(System.currentTimeMillis());
} }
((EquipmentChannelStatusData) channelStatus.getDetails()).getChannelNumberStatusDataMap().put(radioState.getFreqBand(), radioState.getChannel()); ((EquipmentChannelStatusData) channelStatus.getDetails()).getChannelNumberStatusDataMap().put(radioState.getFreqBand(), radioState.getChannel());
((EquipmentChannelStatusData) channelStatus.getDetails()).getTxPowerDataMap().put(radioState.getFreqBand(), radioState.getTxPower()); ((EquipmentChannelStatusData) channelStatus.getDetails()).getTxPowerDataMap().put(radioState.getFreqBand(), radioState.getTxPower());
return channelStatus; return channelStatus;
} }