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