mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 02:57:49 +00:00
WIFI-1130: Cloud osgw dao changes
WIFI-1131: Cloud osgw junit
This commit is contained in:
@@ -3529,259 +3529,267 @@ public class OvsdbDao {
|
||||
}
|
||||
|
||||
public void provisionHotspot20Config(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
|
||||
try {
|
||||
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
if (schema.getTables().containsKey(hotspot20ConfigDbTable)
|
||||
&& schema.getTables().get(hotspot20ConfigDbTable) != null) {
|
||||
Map<String, Hotspot20Config> hotspot20ConfigMap = getProvisionedHotspot20Configs(ovsdbClient);
|
||||
try {
|
||||
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
if (schema.getTables().containsKey(hotspot20ConfigDbTable)
|
||||
&& schema.getTables().get(hotspot20ConfigDbTable) != null) {
|
||||
Map<String, Hotspot20Config> hotspot20ConfigMap = getProvisionedHotspot20Configs(ovsdbClient);
|
||||
|
||||
OpensyncAPHotspot20Config hs20cfg = opensyncApConfig.getHotspotConfig();
|
||||
OpensyncAPHotspot20Config hs20cfg = opensyncApConfig.getHotspotConfig();
|
||||
|
||||
if (hs20cfg.getHotspot20ProfileSet() != null) {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
for (Profile hotspotProfile : hs20cfg.getHotspot20ProfileSet()) {
|
||||
if (hs20cfg.getHotspot20ProfileSet() != null) {
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
for (Profile hotspotProfile : hs20cfg.getHotspot20ProfileSet()) {
|
||||
|
||||
PasspointProfile hs2Profile = (PasspointProfile) hotspotProfile.getDetails();
|
||||
PasspointProfile hs2Profile = (PasspointProfile) hotspotProfile.getDetails();
|
||||
|
||||
Profile operator = hs20cfg.getHotspot20OperatorSet().stream().filter(new Predicate<Profile>() {
|
||||
Profile operator = hs20cfg.getHotspot20OperatorSet().stream().filter(new Predicate<Profile>() {
|
||||
|
||||
@Override
|
||||
public boolean test(Profile t) {
|
||||
return t.getName().equals(hs2Profile.getOperatorProfileName());
|
||||
}
|
||||
@Override
|
||||
public boolean test(Profile t) {
|
||||
return t.getId() == hs2Profile.getPasspointOperatorProfileId();
|
||||
}
|
||||
|
||||
}).findFirst().get();
|
||||
}).findFirst().get();
|
||||
|
||||
PasspointOperatorProfile passpointOperatorProfile = (PasspointOperatorProfile) operator
|
||||
.getDetails();
|
||||
PasspointOperatorProfile passpointOperatorProfile = (PasspointOperatorProfile) operator
|
||||
.getDetails();
|
||||
|
||||
Profile venue = hs20cfg.getHotspot20VenueSet().stream().filter(new Predicate<Profile>() {
|
||||
Profile venue = hs20cfg.getHotspot20VenueSet().stream().filter(new Predicate<Profile>() {
|
||||
|
||||
@Override
|
||||
public boolean test(Profile t) {
|
||||
return t.getName().equals(hs2Profile.getVenueProfileName());
|
||||
}
|
||||
@Override
|
||||
public boolean test(Profile t) {
|
||||
return t.getId() == hs2Profile.getPasspointVenueProfileId();
|
||||
}
|
||||
|
||||
}).findFirst().get();
|
||||
}).findFirst().get();
|
||||
|
||||
PasspointVenueProfile passpointVenueProfile = (PasspointVenueProfile) venue.getDetails();
|
||||
PasspointVenueProfile passpointVenueProfile = (PasspointVenueProfile) venue.getDetails();
|
||||
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
|
||||
Map<String, Hotspot20OsuProviders> osuProviders = getProvisionedHotspot20OsuProviders(
|
||||
ovsdbClient);
|
||||
List<Profile> providerList = new ArrayList<>();
|
||||
if (hs20cfg.getHotspot20ProviderSet() != null) {
|
||||
providerList = hs20cfg.getHotspot20ProviderSet().stream().filter(new Predicate<Profile>() {
|
||||
Map<String, Hotspot20OsuProviders> osuProviders = getProvisionedHotspot20OsuProviders(
|
||||
ovsdbClient);
|
||||
List<Profile> providerList = new ArrayList<>();
|
||||
if (hs20cfg.getHotspot20ProviderSet() != null) {
|
||||
providerList = hs20cfg.getHotspot20ProviderSet().stream().filter(new Predicate<Profile>() {
|
||||
|
||||
@Override
|
||||
public boolean test(Profile t) {
|
||||
return hotspotProfile.getChildProfileIds().contains(t.getId());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
@Override
|
||||
public boolean test(Profile t) {
|
||||
return hotspotProfile.getChildProfileIds().contains(t.getId());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Set<Uuid> osuProvidersUuids = new HashSet<>();
|
||||
Set<Uuid> osuIconUuids = new HashSet<>();
|
||||
Set<Atom<String>> domainNames = new HashSet<>();
|
||||
StringBuffer mccMncBuffer = new StringBuffer();
|
||||
Set<Atom<String>> naiRealms = new HashSet<>();
|
||||
Set<Atom<String>> roamingOis = new HashSet<>();
|
||||
for (Profile provider : providerList) {
|
||||
PasspointOsuProviderProfile providerProfile = (PasspointOsuProviderProfile) provider
|
||||
.getDetails();
|
||||
if (osuProviders.containsKey(providerProfile.getOsuServerUri())) {
|
||||
Hotspot20OsuProviders hotspot2OsuProviders = osuProviders
|
||||
.get(providerProfile.getOsuServerUri());
|
||||
Set<Uuid> osuProvidersUuids = new HashSet<>();
|
||||
Set<Uuid> osuIconUuids = new HashSet<>();
|
||||
Set<Atom<String>> domainNames = new HashSet<>();
|
||||
StringBuffer mccMncBuffer = new StringBuffer();
|
||||
Set<Atom<String>> naiRealms = new HashSet<>();
|
||||
Set<Atom<String>> roamingOis = new HashSet<>();
|
||||
for (Profile provider : providerList) {
|
||||
PasspointOsuProviderProfile providerProfile = (PasspointOsuProviderProfile) provider
|
||||
.getDetails();
|
||||
if (osuProviders.containsKey(providerProfile.getOsuServerUri())) {
|
||||
Hotspot20OsuProviders hotspot2OsuProviders = osuProviders
|
||||
.get(providerProfile.getOsuServerUri());
|
||||
|
||||
StringBuffer roamingOiOctets = new StringBuffer();
|
||||
providerProfile.getRoamingOi().stream().forEach(o -> {
|
||||
roamingOiOctets.append(Byte.toString(o));
|
||||
});
|
||||
roamingOis.add(new Atom<>(roamingOiOctets.toString()));
|
||||
osuProvidersUuids.add(hotspot2OsuProviders.uuid);
|
||||
osuIconUuids.addAll(hotspot2OsuProviders.osuIcons);
|
||||
domainNames.add(new Atom<>(providerProfile.getDomainName()));
|
||||
getNaiRealms(providerProfile, naiRealms);
|
||||
StringBuffer roamingOiOctets = new StringBuffer();
|
||||
providerProfile.getRoamingOi().stream().forEach(o -> {
|
||||
roamingOiOctets.append(Byte.toString(o));
|
||||
});
|
||||
roamingOis.add(new Atom<>(roamingOiOctets.toString()));
|
||||
osuProvidersUuids.add(hotspot2OsuProviders.uuid);
|
||||
osuIconUuids.addAll(hotspot2OsuProviders.osuIcons);
|
||||
domainNames.add(new Atom<>(providerProfile.getDomainName()));
|
||||
getNaiRealms(providerProfile, naiRealms);
|
||||
|
||||
for (PasspointMccMnc passpointMccMnc : providerProfile.getMccMncList()) {
|
||||
mccMncBuffer.append(passpointMccMnc.getMccMncPairing());
|
||||
mccMncBuffer.append(";");
|
||||
}
|
||||
for (PasspointMccMnc passpointMccMnc : providerProfile.getMccMncList()) {
|
||||
mccMncBuffer.append(passpointMccMnc.getMccMncPairing());
|
||||
mccMncBuffer.append(";");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String mccMncString = mccMncBuffer.toString();
|
||||
if (mccMncString.endsWith(";")) {
|
||||
mccMncString = mccMncString.substring(0, mccMncString.lastIndexOf(";"));
|
||||
}
|
||||
String mccMncString = mccMncBuffer.toString();
|
||||
if (mccMncString.endsWith(";")) {
|
||||
mccMncString = mccMncString.substring(0, mccMncString.lastIndexOf(";"));
|
||||
}
|
||||
|
||||
rowColumns.put("mcc_mnc", new Atom<>(mccMncString));
|
||||
rowColumns.put("mcc_mnc", new Atom<>(mccMncString));
|
||||
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set roamingOiSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(roamingOis);
|
||||
rowColumns.put("roaming_oi", roamingOiSet);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set roamingOiSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(roamingOis);
|
||||
rowColumns.put("roaming_oi", roamingOiSet);
|
||||
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set naiRealmsSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(naiRealms);
|
||||
rowColumns.put("nai_realm", naiRealmsSet);
|
||||
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);
|
||||
rowColumns.put("osu_providers", providerUuids);
|
||||
}
|
||||
if (osuProvidersUuids.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set providerUuids = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(osuProvidersUuids);
|
||||
rowColumns.put("osu_providers", providerUuids);
|
||||
}
|
||||
|
||||
if (osuIconUuids.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set iconUuids = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(osuIconUuids);
|
||||
rowColumns.put("operator_icons", iconUuids);
|
||||
}
|
||||
if (osuIconUuids.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set iconUuids = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(osuIconUuids);
|
||||
rowColumns.put("operator_icons", iconUuids);
|
||||
}
|
||||
|
||||
if (domainNames.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set domainNameSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(domainNames);
|
||||
rowColumns.put("domain_name", domainNameSet);
|
||||
}
|
||||
if (domainNames.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set domainNameSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(domainNames);
|
||||
rowColumns.put("domain_name", domainNameSet);
|
||||
}
|
||||
|
||||
hs2Profile.getIpAddressTypeAvailability();
|
||||
rowColumns.put("deauth_request_timeout", new Atom<>(hs2Profile.getDeauthRequestTimeout()));
|
||||
rowColumns.put("osen",
|
||||
new Atom<>(passpointOperatorProfile.isServerOnlyAuthenticatedL2EncryptionNetwork()));
|
||||
hs2Profile.getIpAddressTypeAvailability();
|
||||
rowColumns.put("deauth_request_timeout", new Atom<>(hs2Profile.getDeauthRequestTimeout()));
|
||||
rowColumns.put("osen",
|
||||
new Atom<>(passpointOperatorProfile.isServerOnlyAuthenticatedL2EncryptionNetwork()));
|
||||
|
||||
rowColumns.put("tos", new Atom<>(hs2Profile.getTermsAndConditionsFile().getApExportUrl()));
|
||||
rowColumns.put("tos", new Atom<>(hs2Profile.getTermsAndConditionsFile().getApExportUrl()));
|
||||
|
||||
Set<Atom<String>> operatorFriendlyName = new HashSet<>();
|
||||
passpointOperatorProfile.getOperatorFriendlyName().stream()
|
||||
.forEach(c -> operatorFriendlyName.add(new Atom<>(c.getAsDuple())));
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set operatorFriendlyNameSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(operatorFriendlyName);
|
||||
rowColumns.put("operator_friendly_name", operatorFriendlyNameSet);
|
||||
Set<Atom<String>> operatorFriendlyName = new HashSet<>();
|
||||
passpointOperatorProfile.getOperatorFriendlyName().stream()
|
||||
.forEach(c -> operatorFriendlyName.add(new Atom<>(c.getAsDuple())));
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set operatorFriendlyNameSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(operatorFriendlyName);
|
||||
rowColumns.put("operator_friendly_name", operatorFriendlyNameSet);
|
||||
|
||||
rowColumns.put("enable", new Atom<>(hs2Profile.isEnableInterworkingAndHs20()));
|
||||
rowColumns.put("network_auth_type",
|
||||
new Atom<>("0" + hs2Profile.getNetworkAuthenticationType().getId()));
|
||||
rowColumns.put("gas_addr3_behavior", new Atom<>(hs2Profile.getGasAddr3Behaviour().getId()));
|
||||
rowColumns.put("operating_class", new Atom<>(hs2Profile.getOperatingClass()));
|
||||
rowColumns.put("anqp_domain_id", new Atom<>(hs2Profile.getAnqpDomainId()));
|
||||
rowColumns.put("enable", new Atom<>(hs2Profile.isEnableInterworkingAndHs20()));
|
||||
rowColumns.put("network_auth_type",
|
||||
new Atom<>("0" + hs2Profile.getNetworkAuthenticationType().getId()));
|
||||
rowColumns.put("gas_addr3_behavior", new Atom<>(hs2Profile.getGasAddr3Behaviour().getId()));
|
||||
rowColumns.put("operating_class", new Atom<>(hs2Profile.getOperatingClass()));
|
||||
rowColumns.put("anqp_domain_id", new Atom<>(hs2Profile.getAnqpDomainId()));
|
||||
|
||||
Set<Atom<String>> connectionCapabilities = new HashSet<>();
|
||||
hs2Profile.getConnectionCapabilitySet().stream()
|
||||
.forEach(c -> connectionCapabilities
|
||||
.add(new Atom<>(c.getConnectionCapabilitiesIpProtocol().getId() + ":"
|
||||
+ c.getConnectionCapabilitiesPortNumber() + ":"
|
||||
+ c.getConnectionCapabilitiesStatus().getId())));
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set connectionCapabilitySet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(connectionCapabilities);
|
||||
rowColumns.put("connection_capability", connectionCapabilitySet);
|
||||
Set<Atom<String>> connectionCapabilities = new HashSet<>();
|
||||
hs2Profile.getConnectionCapabilitySet().stream()
|
||||
.forEach(c -> connectionCapabilities
|
||||
.add(new Atom<>(c.getConnectionCapabilitiesIpProtocol().getId() + ":"
|
||||
+ c.getConnectionCapabilitiesPortNumber() + ":"
|
||||
+ c.getConnectionCapabilitiesStatus().getId())));
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set connectionCapabilitySet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(connectionCapabilities);
|
||||
rowColumns.put("connection_capability", connectionCapabilitySet);
|
||||
|
||||
Set<Atom<String>> venueNames = new HashSet<>();
|
||||
Set<Atom<String>> venueUrls = new HashSet<>();
|
||||
int index = 1;
|
||||
for (PasspointVenueName passpointVenueName : passpointVenueProfile.getVenueNameSet()) {
|
||||
venueNames.add(new Atom<String>(passpointVenueName.getAsDuple()));
|
||||
String url = String.valueOf(index) + ":" + passpointVenueName.getVenueUrl();
|
||||
venueUrls.add(new Atom<String>(url));
|
||||
index++;
|
||||
}
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set venueNameSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(venueNames);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set venueUrlSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(venueUrls);
|
||||
rowColumns.put("venue_name", venueNameSet);
|
||||
rowColumns.put("venue_url", venueUrlSet);
|
||||
Set<Atom<String>> venueNames = new HashSet<>();
|
||||
Set<Atom<String>> venueUrls = new HashSet<>();
|
||||
int index = 1;
|
||||
for (PasspointVenueName passpointVenueName : passpointVenueProfile.getVenueNameSet()) {
|
||||
venueNames.add(new Atom<String>(passpointVenueName.getAsDuple()));
|
||||
String url = String.valueOf(index) + ":" + passpointVenueName.getVenueUrl();
|
||||
venueUrls.add(new Atom<String>(url));
|
||||
index++;
|
||||
}
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set venueNameSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(venueNames);
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set venueUrlSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(venueUrls);
|
||||
rowColumns.put("venue_name", venueNameSet);
|
||||
rowColumns.put("venue_url", venueUrlSet);
|
||||
|
||||
PasspointVenueTypeAssignment passpointVenueTypeAssignment = passpointVenueProfile
|
||||
.getVenueTypeAssignment();
|
||||
String groupType = String.valueOf(passpointVenueTypeAssignment.getVenueGroupId()) + ":"
|
||||
+ passpointVenueTypeAssignment.getVenueTypeId();
|
||||
PasspointVenueTypeAssignment passpointVenueTypeAssignment = passpointVenueProfile
|
||||
.getVenueTypeAssignment();
|
||||
String groupType = String.valueOf(passpointVenueTypeAssignment.getVenueGroupId()) + ":"
|
||||
+ passpointVenueTypeAssignment.getVenueTypeId();
|
||||
|
||||
rowColumns.put("venue_group_type", new Atom<>(groupType));
|
||||
rowColumns.put("venue_group_type", new Atom<>(groupType));
|
||||
|
||||
// # format: <1-octet encoded value as hex str>
|
||||
// # (ipv4_type & 0x3f) << 2 | (ipv6_type & 0x3) << 2
|
||||
// 0x3f = 63 in decimal
|
||||
// 0x3 = 3 in decimal
|
||||
if (PasspointIPv6AddressType.getByName(
|
||||
hs2Profile.getIpAddressTypeAvailability()) != PasspointIPv6AddressType.UNSUPPORTED) {
|
||||
int availability = PasspointIPv6AddressType
|
||||
.getByName(hs2Profile.getIpAddressTypeAvailability()).getId();
|
||||
String hexString = Integer.toHexString((availability & 3) << 2);
|
||||
rowColumns.put("ipaddr_type_availability", new Atom<>(hexString));
|
||||
} else if (PasspointIPv4AddressType.getByName(
|
||||
hs2Profile.getIpAddressTypeAvailability()) != PasspointIPv4AddressType.UNSUPPORTED) {
|
||||
int availability = PasspointIPv4AddressType
|
||||
.getByName(hs2Profile.getIpAddressTypeAvailability()).getId();
|
||||
String hexString = Integer.toHexString((availability & 63) << 2);
|
||||
rowColumns.put("ipaddr_type_availability", new Atom<>(hexString));
|
||||
}
|
||||
// # format: <1-octet encoded value as hex str>
|
||||
// # (ipv4_type & 0x3f) << 2 | (ipv6_type & 0x3) << 2
|
||||
// 0x3f = 63 in decimal
|
||||
// 0x3 = 3 in decimal
|
||||
if (PasspointIPv6AddressType.getByName(
|
||||
hs2Profile.getIpAddressTypeAvailability()) != PasspointIPv6AddressType.UNSUPPORTED) {
|
||||
int availability = PasspointIPv6AddressType
|
||||
.getByName(hs2Profile.getIpAddressTypeAvailability()).getId();
|
||||
String hexString = Integer.toHexString((availability & 3) << 2);
|
||||
rowColumns.put("ipaddr_type_availability", new Atom<>(hexString));
|
||||
} else if (PasspointIPv4AddressType.getByName(
|
||||
hs2Profile.getIpAddressTypeAvailability()) != PasspointIPv4AddressType.UNSUPPORTED) {
|
||||
int availability = PasspointIPv4AddressType
|
||||
.getByName(hs2Profile.getIpAddressTypeAvailability()).getId();
|
||||
String hexString = Integer.toHexString((availability & 63) << 2);
|
||||
rowColumns.put("ipaddr_type_availability", new Atom<>(hexString));
|
||||
}
|
||||
|
||||
Map<String, WifiVifConfigInfo> vifConfigMap = getProvisionedWifiVifConfigs(ovsdbClient);
|
||||
Map<String, WifiVifConfigInfo> vifConfigMap = getProvisionedWifiVifConfigs(ovsdbClient);
|
||||
|
||||
Set<Uuid> vifConfigs = new HashSet<>();
|
||||
List<Atom<String>> hessids = new ArrayList<>();
|
||||
for (String ssid : hs2Profile.getAssociatedSsids()) {
|
||||
if (vifConfigMap != null) {
|
||||
vifConfigMap.keySet().stream().forEach(k -> {
|
||||
if (k.endsWith(ssid)) {
|
||||
WifiVifConfigInfo vifConfig = vifConfigMap.get(k);
|
||||
vifConfigs.add(vifConfig.uuid);
|
||||
}
|
||||
});
|
||||
}
|
||||
Set<Uuid> vifConfigs = new HashSet<>();
|
||||
List<Atom<String>> hessids = new ArrayList<>();
|
||||
|
||||
for (Profile ssidProfile : opensyncApConfig.getSsidProfile()) {
|
||||
if (hs2Profile.getAssociatedAccessSsidProfileIds().contains(ssidProfile.getId())) {
|
||||
|
||||
String accessSsidProfileName = ((SsidConfiguration) ssidProfile.getDetails()).getSsid();
|
||||
|
||||
for (WifiVifConfigInfo vifConfig : vifConfigMap.values()) {
|
||||
if (vifConfig.ssid.equals(accessSsidProfileName)) {
|
||||
vifConfigs.add(vifConfig.uuid);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> vifStates = getWifiVifStates(ovsdbClient, accessSsidProfileName);
|
||||
for (String mac : vifStates) {
|
||||
hessids.add(new Atom<>(mac));
|
||||
}
|
||||
|
||||
List<String> vifStates = getWifiVifStates(ovsdbClient, ssid);
|
||||
for (String mac : vifStates) {
|
||||
hessids.add(new Atom<>(mac));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (vifConfigs.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set vifConfigUuids = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(vifConfigs);
|
||||
rowColumns.put("vif_config", vifConfigUuids);
|
||||
}
|
||||
|
||||
if (vifConfigs.size() > 0) {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set vifConfigUuids = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(vifConfigs);
|
||||
rowColumns.put("vif_config", vifConfigUuids);
|
||||
}
|
||||
if (hessids.size() > 0) {
|
||||
rowColumns.put("hessid", new Atom<>(hessids.get(0)));
|
||||
}
|
||||
|
||||
for (Profile ssidProfile : opensyncApConfig.getSsidProfile()) {
|
||||
if (ssidProfile.getId() == hs2Profile.getOsuSsidProfileId()) {
|
||||
rowColumns.put("osu_ssid",
|
||||
new Atom<>(((SsidConfiguration) ssidProfile.getDetails()).getSsid()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hessids.size() > 0) {
|
||||
Row row = new Row(rowColumns);
|
||||
|
||||
rowColumns.put("hessid", new Atom<>(hessids.get(0)));
|
||||
}
|
||||
Insert newHs20Config = new Insert(hotspot20ConfigDbTable, row);
|
||||
|
||||
rowColumns.put("osu_ssid", new Atom<>(hs2Profile.getOsuSsidName()));
|
||||
operations.add(newHs20Config);
|
||||
|
||||
Row row = new Row(rowColumns);
|
||||
// }
|
||||
|
||||
Insert newHs20Config = new Insert(hotspot20ConfigDbTable, row);
|
||||
}
|
||||
|
||||
operations.add(newHs20Config);
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
|
||||
// }
|
||||
for (OperationResult res : result) {
|
||||
LOG.debug("provisionHotspot20Config Op Result {}", res);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
LOG.info("Current Hotspot20_Config {}", hotspot20ConfigMap);
|
||||
} else {
|
||||
LOG.info("Table {} not present in {}. Cannot provision Hotspot20_Config", hotspot20ConfigDbTable,
|
||||
ovsdbName);
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
|
||||
LOG.error("Error in provisionHotspot20Config", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
for (OperationResult res : result) {
|
||||
LOG.debug("provisionHotspot20Config Op Result {}", res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LOG.info("Current Hotspot20_Config {}", hotspot20ConfigMap);
|
||||
} else {
|
||||
LOG.info("Table {} not present in {}. Cannot provision Hotspot20_Config", hotspot20ConfigDbTable,
|
||||
ovsdbName);
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
|
||||
LOG.error("Error in provisionHotspot20Config", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void provisionHotspot20OsuProviders(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
|
||||
try {
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.customer.models.Customer;
|
||||
import com.telecominfraproject.wlan.profile.models.Profile;
|
||||
import com.telecominfraproject.wlan.profile.models.ProfileType;
|
||||
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
|
||||
@@ -41,35 +40,37 @@ import com.vmware.ovsdb.protocol.operation.result.UpdateResult;
|
||||
|
||||
public class OvsdbDaoTestUtilities {
|
||||
|
||||
|
||||
// Static creation of Profiles and Results to use with the OvsdbDao JUnit tests.
|
||||
static void createPasspointHotspot(int customerId, Profile passpointHotspotConfig,
|
||||
Profile passpointOperatorProfile, Profile passpointVenueProfile, Profile hotspot20IdProviderProfile,
|
||||
Profile hotspot20IdProviderProfile2, Profile profileSsidPsk, Profile profileSsidOsu,
|
||||
Profile hotspotProfileAp) {
|
||||
// Static creation of Profiles and Results to use with the OvsdbDao JUnit
|
||||
// tests.
|
||||
static void createPasspointHotspot(int customerId, Profile passpointHotspotConfig, Profile passpointOperatorProfile,
|
||||
Profile passpointVenueProfile, Profile hotspot20IdProviderProfile, Profile hotspot20IdProviderProfile2,
|
||||
Profile profileSsidPsk, Profile profileSsidOsu, Profile hotspotProfileAp) {
|
||||
|
||||
profileSsidPsk = createPasspointAccessSsid(customerId);
|
||||
profileSsidPsk.setId(1L);
|
||||
profileSsidOsu = createPasspointOsuSsid(customerId);
|
||||
profileSsidOsu.setId(2L);
|
||||
|
||||
passpointOperatorProfile = createPasspointOperatorProfile(customerId);
|
||||
|
||||
passpointOperatorProfile.setId(3L);
|
||||
passpointVenueProfile = createPasspointVenueProfile(customerId);
|
||||
|
||||
passpointVenueProfile.setId(4L);
|
||||
hotspot20IdProviderProfile = createPasspointIdProviderProfile(customerId, hotspot20IdProviderProfile,
|
||||
"TipWlan-Hotspot20-OSU-Provider", "Rogers AT&T Wireless", "Canada", "ca", 302, 720, "rogers.com", 1);
|
||||
|
||||
hotspot20IdProviderProfile.setId(5L);
|
||||
hotspot20IdProviderProfile2 = createPasspointIdProviderProfile(customerId, hotspot20IdProviderProfile2,
|
||||
"TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302, 220, "telus.com", 1);
|
||||
|
||||
|
||||
hotspot20IdProviderProfile2.setId(6L);
|
||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
||||
|
||||
passpointHotspotConfig = createPasspointHotspotConfig(customerId, hotspot20IdProviderProfile2,
|
||||
hotspot20IdProviderProfile, passpointOperatorProfile, passpointVenueProfile, profileSsidPsk,
|
||||
profileSsidOsu);
|
||||
passpointHotspotConfig.setId(7L);
|
||||
|
||||
hotspotProfileAp = createPasspointApProfile(customerId, profileSsidPsk, profileSsidOsu);
|
||||
hotspotProfileAp.setId(8L);
|
||||
}
|
||||
|
||||
static Profile createPasspointHotspotConfig(int customerId, Profile hotspot20IdProviderProfile2,
|
||||
@@ -87,15 +88,18 @@ public class OvsdbDaoTestUtilities {
|
||||
passpointHotspotConfigChildIds.add(hotspot20IdProviderProfile2.getId());
|
||||
passpointHotspotConfig.setChildProfileIds(passpointHotspotConfigChildIds);
|
||||
passpointHotspotConfig.setDetails(PasspointProfile.createWithDefaults());
|
||||
Set<String> providerNames = new HashSet<>();
|
||||
providerNames.add(hotspot20IdProviderProfile.getName());
|
||||
providerNames.add(hotspot20IdProviderProfile2.getName());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setIdProviderProfileNames(providerNames);
|
||||
Set<Long> providerIds = new HashSet<>();
|
||||
providerIds.add(hotspot20IdProviderProfile.getId());
|
||||
providerIds.add(hotspot20IdProviderProfile2.getId());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setPasspointOsuProviderProfileIds(providerIds);
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails())
|
||||
.setOperatorProfileName(passpointOperatorProfile.getName());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setVenueProfileName(passpointVenueProfile.getName());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setOsuSsidName(profileSsidOpen.getName());
|
||||
.setPasspointOperatorProfileId(passpointOperatorProfile.getId());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails())
|
||||
.setPasspointVenueProfileId(passpointVenueProfile.getId());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setOsuSsidProfileId(profileSsidOpen.getId());
|
||||
profileSsidPsk.getChildProfileIds().add(passpointHotspotConfig.getId());
|
||||
((PasspointProfile) passpointHotspotConfig.getDetails())
|
||||
.setAssociatedAccessSsidProfileIds(List.of(profileSsidPsk.getId()));
|
||||
return passpointHotspotConfig;
|
||||
}
|
||||
|
||||
@@ -305,7 +309,8 @@ public class OvsdbDaoTestUtilities {
|
||||
columns.put("network_auth_type", new Atom<>("00"));
|
||||
columns.put("operating_class", new Atom<>(0));
|
||||
columns.put("operator_friendly_name",
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set.of(new Atom<>("eng:Default friendly passpoint_operator name"),
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set.of(
|
||||
new Atom<>("eng:Default friendly passpoint_operator name"),
|
||||
new Atom<>("fra:Nom de l'opérateur convivial par défaut")));
|
||||
columns.put("operator_icons",
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set.of(
|
||||
@@ -322,8 +327,8 @@ public class OvsdbDaoTestUtilities {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set.of(new Atom<>("11223344"), new Atom<>("234433")));
|
||||
columns.put("tos", new Atom<>("https://localhost:9091/filestore/termsAndConditions"));
|
||||
columns.put("venue_group_type", new Atom<>("2:8"));
|
||||
columns.put("venue_name", com.vmware.ovsdb.protocol.operation.notation.Set.of(new Atom<>("eng:Example passpoint_venue"),
|
||||
new Atom<>("fra:Exemple de lieu")));
|
||||
columns.put("venue_name", com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(new Atom<>("eng:Example passpoint_venue"), new Atom<>("fra:Exemple de lieu")));
|
||||
columns.put("venue_url", com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(new Atom<>("1:http://www.example.com/info-fra"), new Atom<>("2:http://www.example.com/info-eng")));
|
||||
columns.put("vif_config",
|
||||
@@ -408,7 +413,6 @@ public class OvsdbDaoTestUtilities {
|
||||
return operationResult;
|
||||
}
|
||||
|
||||
|
||||
static OperationResult[] hs20IconRows() {
|
||||
List<Row> ret = new ArrayList<>();
|
||||
|
||||
@@ -514,12 +518,11 @@ public class OvsdbDaoTestUtilities {
|
||||
|
||||
SelectResult selectResult = new SelectResult(ret);
|
||||
|
||||
|
||||
OperationResult[] operationResult = new OperationResult[1];
|
||||
operationResult[0].equals(selectResult);
|
||||
return operationResult;
|
||||
}
|
||||
|
||||
|
||||
static Profile createRadiusProfile(int customerId) {
|
||||
Profile profileRadius = new Profile();
|
||||
profileRadius.setCustomerId(customerId);
|
||||
@@ -542,6 +545,5 @@ public class OvsdbDaoTestUtilities {
|
||||
profileRadius.setDetails(radiusDetails);
|
||||
return profileRadius;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user