WIFI-909: Provision Hotspot20_Icon_Config in opensync database via opensync gateway, using new Hotspot/passpoint profiles

WIFI-910: Provision Hotspot20_OSU_Providers in opensync database via opensync gateway, using new Hotspot/passpoint profiles
WIFI-947: Add opensync gateway support for CEGWNewChannelRequest to change back-up channel in Wifi_RRM_Config

Updated with handling of new schema, support osu_nai2 (shared), and osu
provider name. Remove path from OSU Icons.

Add support for Wifi_RRM_Config new backup channels
This commit is contained in:
Mike Hansen
2020-10-09 12:54:02 -04:00
parent 0840795bd5
commit e3da2db9ab
5 changed files with 120 additions and 31 deletions

View File

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import com.google.common.collect.ImmutableMap;
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.opensync.external.integration.OpensyncExternalIntegrationInterface;
import com.telecominfraproject.wlan.opensync.external.integration.OpensyncExternalIntegrationInterface.RowUpdateOperation;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbClientInterface;
@@ -856,4 +857,20 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
}
return key;
}
public String processNewChannelsRequest(String apId, Map<RadioType,Integer> channelMap) {
LOG.debug("TipWlanOvsdbClient::processNewChannelsRequest for AP {}", apId);
try {
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
OvsdbClient ovsdbClient = session.getOvsdbClient();
ovsdbDao.processNewChannelsRequest(ovsdbClient,channelMap);
LOG.debug("TipWlanOvsdbClient::processNewChannelsRequest change backup channels for AP {}", apId);
return "Triggered a factory reset of AP " + apId;
} catch (Exception e) {
LOG.error("TipWlanOvsdbClient::processNewChannelsRequest failed to change backup channels for AP {}", apId, e);
return " failed to change backup channels for AP " + apId;
}
}
}

View File

@@ -3506,10 +3506,10 @@ public class OvsdbDao {
mccMncBuffer.append(mccMnc.getMccMncPairing());
mccMncBuffer.append(";");
}
}
}
String mccMncString = mccMncBuffer.toString();
if (mccMncString.endsWith(";")) {
mccMncString = mccMncString.substring(0, mccMncString.lastIndexOf(";"));
@@ -3520,7 +3520,7 @@ public class OvsdbDao {
com.vmware.ovsdb.protocol.operation.notation.Set naiRealmsSet = com.vmware.ovsdb.protocol.operation.notation.Set
.of(naiRealms);
rowColumns.put("nai_realm", naiRealmsSet);
if (osuProvidersUuids.size() > 0) {
com.vmware.ovsdb.protocol.operation.notation.Set providerUuids = com.vmware.ovsdb.protocol.operation.notation.Set
.of(osuProvidersUuids);
@@ -3538,7 +3538,7 @@ public class OvsdbDao {
.of(domainNames);
rowColumns.put("domain_name", domainNameSet);
}
hs2Profile.getIpAddressTypeAvailability();
rowColumns.put("deauth_request_timeout", new Atom<>(hs2Profile.getDeauthRequestTimeout()));
rowColumns.put("osen",
@@ -3697,9 +3697,15 @@ public class OvsdbDao {
Hotspot20IdProviderProfile providerProfile = (Hotspot20IdProviderProfile) provider.getDetails();
Map<String, Value> rowColumns = new HashMap<>();
rowColumns.put("osu_nai", new Atom<>(providerProfile.getOsuNaiStandalone()));
// rowColumns.put("osu_nai2", new
// Atom<>(providerProfile.getOsuNaiShared()));
// TODO: temporary check schema until AP has delivered
// changes.
if (schema.getTables().get(hotspot20OsuProvidersDbTable).getColumns().containsKey("osu_nai2")) {
rowColumns.put("osu_nai2", new Atom<>(providerProfile.getOsuNaiShared()));
}
if (schema.getTables().get(hotspot20OsuProvidersDbTable).getColumns()
.containsKey("osu_provider_name")) {
rowColumns.put("osu_provider_name", new Atom<>(provider.getName()));
}
getOsuIconUuidsForOsuProvider(ovsdbClient, providerProfile, rowColumns);
getOsuProviderFriendlyNames(providerProfile, rowColumns);
getOsuProviderMethodList(providerProfile, rowColumns);
@@ -3889,7 +3895,7 @@ public class OvsdbDao {
});
}
public void provisionHotspot2IconConfig(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
@@ -3911,7 +3917,9 @@ public class OvsdbDao {
// "lang_code", "height", "img_type", "width" };
Map<String, Value> rowColumns = new HashMap<>();
rowColumns.put("name", new Atom<>(osuIcon.getIconName()));
rowColumns.put("path", new Atom<>(osuIcon.getFilePath()));
if (schema.getTables().get(hotspot20IconConfigDbTable).getColumns().containsKey("path")) {
rowColumns.put("path", new Atom<>(osuIcon.getFilePath()));
}
rowColumns.put("url", new Atom<>(osuIcon.getImageUrl()));
rowColumns.put("lang_code", new Atom<>(osuIcon.getLanguageCode()));
rowColumns.put("height", new Atom<>(osuIcon.getIconHeight()));
@@ -4833,4 +4841,46 @@ public class OvsdbDao {
}
public void processNewChannelsRequest(OvsdbClient ovsdbClient, Map<RadioType, Integer> channelMap) {
LOG.info("OvsdbDao::processNewChannelsRequest {}", channelMap);
try {
List<Operation> operations = new ArrayList<>();
channelMap.entrySet().stream().forEach(c -> {
String freqBand = OvsdbToWlanCloudTypeMappingUtility.getOvsdbRadioFreqBandForRadioType(c.getKey());
List<Condition> conditions = new ArrayList<>();
conditions.add(new Condition("freq_band", Function.EQUALS, new Atom<>(freqBand)));
Map<String, Value> updateColumns = new HashMap<>();
updateColumns.put("backup_channel", new Atom<>(c.getValue()));
Row row = new Row(updateColumns);
operations.add(new Update(wifiRrmConfigDbTable, conditions, row));
});
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) {
LOG.debug("processNewChannelsRequest::Update backup channel(s) for {}:", wifiRrmConfigDbTable);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
}
LOG.info("Updated Wifi_RRM_Config");
} catch (ExecutionException e) {
LOG.error("Error in processNewChannelsRequest", e);
} catch (OvsdbClientException | TimeoutException | InterruptedException e) {
LOG.error("Error in processNewChannelsRequest", e);
throw new RuntimeException(e);
}
}
}

View File

@@ -9,10 +9,11 @@ import com.vmware.ovsdb.protocol.operation.notation.Uuid;
public class Hotspot20OsuProviders implements Cloneable {
public static String[] ovsdbColumns = { "_version", "osu_nai", "osu_icons", "server_uri", "method_list", "_uuid",
"osu_friendly_name", "service_description" };
public static String[] ovsdbColumns = { "_version", "osu_nai", "osu_nai2", "osu_icons", "osu_provider_name",
"server_uri", "method_list", "_uuid", "osu_friendly_name", "service_description" };
public Uuid version;
public Set<String> osuNai;
public String osuNai;
public String osuNai2;
public Set<Uuid> osuIcons;
public String serverUri;
public Set<Integer> methodList;
@@ -26,7 +27,14 @@ public class Hotspot20OsuProviders implements Cloneable {
public Hotspot20OsuProviders(Row row) {
this.version = row.getUuidColumn("_version");
this.uuid = row.getUuidColumn("_uuid");
this.osuNai = row.getSetColumn("osu_nai");
if ((row.getColumns().get("osu_nai") != null) && row.getColumns().get("osu_nai").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.osuNai = row.getStringColumn("osu_nai");
}
if ((row.getColumns().get("osu_nai2") != null) && row.getColumns().get("osu_nai2").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.osuNai2 = row.getStringColumn("osu_nai2");
}
this.osuIcons = row.getSetColumn("osu_icons");
if ((row.getColumns().get("server_uri") != null) && row.getColumns().get("server_uri").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
@@ -43,9 +51,6 @@ public class Hotspot20OsuProviders implements Cloneable {
try {
Hotspot20OsuProviders ret = (Hotspot20OsuProviders) super.clone();
if (osuNai != null) {
ret.osuNai = new HashSet<>(this.osuNai);
}
if (osuIcons != null) {
ret.osuIcons = new HashSet<>(this.osuIcons);
}
@@ -65,16 +70,9 @@ public class Hotspot20OsuProviders implements Cloneable {
}
}
@Override
public String toString() {
return "Hotspot20OsuProviders [version=" + version + ", osuNai=" + osuNai + ", osuIcons=" + osuIcons
+ ", serverUri=" + serverUri + ", methodList=" + methodList + ", uuid=" + uuid + ", osuFriendlyName="
+ osuFriendlyName + ", serviceDescription=" + serviceDescription + "]";
}
@Override
public int hashCode() {
return Objects.hash(methodList, osuFriendlyName, osuIcons, osuNai, serverUri, serviceDescription, uuid,
return Objects.hash(methodList, osuFriendlyName, osuIcons, osuNai, osuNai2, serverUri, serviceDescription, uuid,
version);
}
@@ -89,11 +87,17 @@ public class Hotspot20OsuProviders implements Cloneable {
Hotspot20OsuProviders other = (Hotspot20OsuProviders) obj;
return Objects.equals(methodList, other.methodList) && Objects.equals(osuFriendlyName, other.osuFriendlyName)
&& Objects.equals(osuIcons, other.osuIcons) && Objects.equals(osuNai, other.osuNai)
&& Objects.equals(serverUri, other.serverUri)
&& Objects.equals(osuNai2, other.osuNai2) && Objects.equals(serverUri, other.serverUri)
&& Objects.equals(serviceDescription, other.serviceDescription) && Objects.equals(uuid, other.uuid)
&& Objects.equals(version, other.version);
}
@Override
public String toString() {
return "Hotspot20OsuProviders [version=" + version + ", osuNai=" + osuNai + ", osuNai2=" + osuNai2
+ ", osuIcons=" + osuIcons + ", serverUri=" + serverUri + ", methodList=" + methodList + ", uuid="
+ uuid + ", osuFriendlyName=" + osuFriendlyName + ", serviceDescription=" + serviceDescription + "]";
}
}