mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-03 03:57:54 +00:00
[WIFI-7323] push new config to AP only if the cloud config is more recent than what was previouly pushed
This commit is contained in:
@@ -56,4 +56,8 @@ public interface OpensyncExternalIntegrationInterface {
|
||||
void clearEquipmentStatus(String apId);
|
||||
|
||||
void processMqttMessage(String topic, Report report);
|
||||
|
||||
long getConfigVersionFromStatus(String apId);
|
||||
|
||||
void updateConfigVersionInStatus(String apId, long configVersionFromProfiles);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.util.Objects;
|
||||
|
||||
public class ConnectNodeInfo implements Cloneable {
|
||||
|
||||
public static String CONFIG_VERSION_PROPERTY_NAME = "tip/reportedCfgDataVersion";
|
||||
|
||||
public Map<String, String> mqttSettings = new HashMap<>();
|
||||
public Map<String, String> versionMatrix = new HashMap<>();
|
||||
public Map<String, String> wifiRadioStates = new HashMap<>();
|
||||
@@ -35,6 +37,18 @@ public class ConnectNodeInfo implements Cloneable {
|
||||
public String manufacturerDate;
|
||||
public String certificationRegion;
|
||||
|
||||
public long getConfigVersion() {
|
||||
|
||||
long ret = 0;
|
||||
try {
|
||||
ret = Long.parseLong(versionMatrix.get(CONFIG_VERSION_PROPERTY_NAME));
|
||||
} catch(Exception e) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectNodeInfo clone() {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.telecominfraproject.wlan.opensync.external.integration.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -44,9 +45,67 @@ public class OpensyncAPConfig extends OpensyncAPBase {
|
||||
private EquipmentGatewayRecord equipmentGateway;
|
||||
private List<Profile> captiveProfiles;
|
||||
private List<Profile> bonjourGatewayProfiles;
|
||||
|
||||
private long configVersion;
|
||||
|
||||
private List<MacAddress> blockedClients;
|
||||
|
||||
public long getConfigVersion() {
|
||||
//go through all child objects and get the most recent lastModifiedTimestamp from them
|
||||
configVersion = 0;
|
||||
|
||||
if(customerEquipment!=null && customerEquipment.getLastModifiedTimestamp()> configVersion) {
|
||||
configVersion = customerEquipment.getLastModifiedTimestamp();
|
||||
}
|
||||
|
||||
if(hotspotConfig!=null) {
|
||||
configVersion = getLatestLastMod(configVersion, hotspotConfig.getHotspot20OperatorSet());
|
||||
configVersion = getLatestLastMod(configVersion, hotspotConfig.getHotspot20ProfileSet());
|
||||
configVersion = getLatestLastMod(configVersion, hotspotConfig.getHotspot20ProviderSet());
|
||||
configVersion = getLatestLastMod(configVersion, hotspotConfig.getHotspot20VenueSet());
|
||||
}
|
||||
|
||||
configVersion = getLatestLastMod(configVersion, apProfile);
|
||||
configVersion = getLatestLastMod(configVersion, rfProfile);
|
||||
configVersion = getLatestLastMod(configVersion, ssidProfile);
|
||||
configVersion = getLatestLastMod(configVersion, metricsProfile);
|
||||
configVersion = getLatestLastMod(configVersion, radiusProfiles);
|
||||
configVersion = getLatestLastMod(configVersion, wiredEthernetPortProfile);
|
||||
|
||||
if(equipmentLocation!=null && equipmentLocation.getLastModifiedTimestamp()> configVersion) {
|
||||
configVersion = equipmentLocation.getLastModifiedTimestamp();
|
||||
}
|
||||
|
||||
configVersion = getLatestLastMod(configVersion, captiveProfiles);
|
||||
configVersion = getLatestLastMod(configVersion, bonjourGatewayProfiles);
|
||||
|
||||
return configVersion;
|
||||
}
|
||||
|
||||
private long getLatestLastMod(long incomingLastMod, Collection<Profile> profiles) {
|
||||
|
||||
if(profiles!=null) {
|
||||
for(Profile p: profiles) {
|
||||
if(incomingLastMod < p.getLastModifiedTimestamp()) {
|
||||
incomingLastMod = p.getLastModifiedTimestamp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return incomingLastMod;
|
||||
}
|
||||
|
||||
private long getLatestLastMod(long incomingLastMod, Profile profile) {
|
||||
|
||||
if(profile!=null) {
|
||||
if(incomingLastMod < profile.getLastModifiedTimestamp()) {
|
||||
incomingLastMod = profile.getLastModifiedTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
return incomingLastMod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpensyncAPConfig clone() {
|
||||
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
|
||||
|
||||
Reference in New Issue
Block a user