WIFI-863: Add Table R/W to OvsdbDao to support Configuration and Status

WIFI-862: Opensync Gateway: Add Table Models to OvsdbDao

Update table models based on AP Schema changes.
Insert into Hotspot20_Config table based on profile. Still in progress.
This commit is contained in:
Mike Hansen
2020-10-01 19:15:09 -04:00
parent d0c126fbf8
commit 3e2b20ddc5
8 changed files with 635 additions and 145 deletions

View File

@@ -62,6 +62,7 @@ import com.telecominfraproject.wlan.opensync.external.integration.controller.Ope
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController.ListOfEquipmentCommandResponses;
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPHotspot20Config;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPInetState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState;
@@ -402,27 +403,27 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
ssidProfile = profileServiceInterface.create(ssidProfile);
apProfile.getChildProfileIds().add(ssidProfile.getId());
}
}
// RF Profile Init
Profile rfProfile = new Profile();
rfProfile.setCustomerId(ce.getCustomerId());
rfProfile.setName("DefaultRf for " + ce.getName());
RfConfiguration rfConfig = RfConfiguration.createWithDefaults();
// RF Profile Init
Profile rfProfile = new Profile();
rfProfile.setCustomerId(ce.getCustomerId());
rfProfile.setName("DefaultRf for " + ce.getName());
RfConfiguration rfConfig = RfConfiguration.createWithDefaults();
// Override default values
for (RadioType radioType : radioTypes) {
rfConfig.getRfConfig(radioType).setRf(rfProfile.getName());
}
// Override default values
for (RadioType radioType : radioTypes) {
rfConfig.getRfConfig(radioType).setRf(rfProfile.getName());
}
rfProfile.setDetails(rfConfig);
rfProfile = profileServiceInterface.create(rfProfile);
rfProfile.setDetails(rfConfig);
rfProfile = profileServiceInterface.create(rfProfile);
apProfile.getChildProfileIds().add(rfProfile.getId());
apProfile.getChildProfileIds().add(rfProfile.getId());
// Update AP profile with SSID and RF child profiles
apProfile = profileServiceInterface.update(apProfile);
// Update AP profile with SSID and RF child profiles
apProfile = profileServiceInterface.update(apProfile);
return apProfile;
}
@@ -786,14 +787,26 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
ret.setSsidProfile(
profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid));
ret.setMetricsProfiles(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.metrics));
ret.setMetricsProfiles(
profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.metrics));
Set<Profile> radiusSet = new HashSet<>();
Set<Long> captiveProfileIds = new HashSet<>();
Set<Long> bonjourGatewayProfileIds = new HashSet<>();
OpensyncAPHotspot20Config hotspotConfig = new OpensyncAPHotspot20Config();
Set<Profile> hotspot20ProfileSet = new HashSet<>();
Set<Profile> hotspot20OperatorSet = new HashSet<>();
Set<Profile> hotspot20VenueSet = new HashSet<>();
Set<Profile> hotspot20ProviderSet = new HashSet<>();
for (Profile ssidProfile : ret.getSsidProfile()) {
hotspot20ProfileSet
.addAll(profileContainer.getChildrenOfType(ssidProfile.getId(), ProfileType.hotspot_2pt0));
radiusSet.addAll(profileContainer.getChildrenOfType(ssidProfile.getId(), ProfileType.radius));
if (ssidProfile.getDetails() != null) {
Long captivePortId = ((SsidConfiguration) ssidProfile.getDetails()).getCaptivePortalId();
@@ -807,6 +820,23 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
}
}
}
if (hotspot20ProfileSet.size() > 0) {
for (Profile hotspot20Profile : hotspot20ProfileSet) {
hotspot20OperatorSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(), ProfileType.operator));
hotspot20VenueSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(), ProfileType.venue));
hotspot20ProviderSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(), ProfileType.id_provider));
}
hotspotConfig.setHotspot20OperatorSet(hotspot20OperatorSet);
hotspotConfig.setHotspot20ProfileSet(hotspot20ProfileSet);
hotspotConfig.setHotspot20ProviderSet(hotspot20ProviderSet);
hotspotConfig.setHotspot20VenueSet(hotspot20VenueSet);
ret.setHotspotConfig(hotspotConfig);
}
ret.setRadiusProfiles(new ArrayList<>(radiusSet));
ret.setCaptiveProfiles(profileServiceInterface.get(captiveProfileIds));
ret.setBonjourGatewayProfiles(profileServiceInterface.get(bonjourGatewayProfileIds));

View File

@@ -28,6 +28,7 @@ public class OpensyncAPConfig extends BaseJsonModel {
private static final long serialVersionUID = 3917975477206236668L;
private Equipment customerEquipment;
private OpensyncAPHotspot20Config hotspotConfig;
private Profile apProfile;
private Profile rfProfile;
private List<Profile> ssidProfile;
@@ -133,6 +134,14 @@ public class OpensyncAPConfig extends BaseJsonModel {
this.customerEquipment = customerEquipment;
}
public OpensyncAPHotspot20Config getHotspotConfig() {
return hotspotConfig;
}
public void setHotspotConfig(OpensyncAPHotspot20Config hotspotConfig) {
this.hotspotConfig = hotspotConfig;
}
public Profile getApProfile() {
return apProfile;
}
@@ -187,6 +196,8 @@ public class OpensyncAPConfig extends BaseJsonModel {
if (customerEquipment != null)
ret.customerEquipment = customerEquipment.clone();
if (hotspotConfig != null)
ret.hotspotConfig = hotspotConfig.clone();
if (equipmentLocation != null)
ret.equipmentLocation = equipmentLocation.clone();
if (ssidProfile != null) {

View File

@@ -0,0 +1,100 @@
package com.telecominfraproject.wlan.opensync.external.integration.models;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.profile.models.Profile;
public class OpensyncAPHotspot20Config extends BaseJsonModel {
private static final long serialVersionUID = -8495473152523219578L;
public static long getSerialversionuid() {
return serialVersionUID;
}
private Set<Profile> hotspot20ProfileSet;
private Set<Profile> hotspot20OperatorSet;
private Set<Profile> hotspot20VenueSet;
private Set<Profile> hotspot20ProviderSet;
public Set<Profile> getHotspot20ProfileSet() {
return hotspot20ProfileSet;
}
public void setHotspot20ProfileSet(Set<Profile> hotspot20ProfileSet) {
this.hotspot20ProfileSet = hotspot20ProfileSet;
}
public Set<Profile> getHotspot20OperatorSet() {
return hotspot20OperatorSet;
}
public void setHotspot20OperatorSet(Set<Profile> hotspot20OperatorSet) {
this.hotspot20OperatorSet = hotspot20OperatorSet;
}
public Set<Profile> getHotspot20VenueSet() {
return hotspot20VenueSet;
}
public void setHotspot20VenueSet(Set<Profile> hotspot20VenueSet) {
this.hotspot20VenueSet = hotspot20VenueSet;
}
public Set<Profile> getHotspot20ProviderSet() {
return hotspot20ProviderSet;
}
public void setHotspot20ProviderSet(Set<Profile> hotspot20ProviderSet) {
this.hotspot20ProviderSet = hotspot20ProviderSet;
}
@Override
public OpensyncAPHotspot20Config clone() {
OpensyncAPHotspot20Config ret = (OpensyncAPHotspot20Config) super.clone();
if (hotspot20OperatorSet != null) {
ret.hotspot20OperatorSet = new HashSet<Profile>(hotspot20OperatorSet);
}
if (hotspot20ProfileSet != null) {
ret.hotspot20ProfileSet = new HashSet<Profile>(hotspot20ProfileSet);
}
if (hotspot20VenueSet != null) {
ret.hotspot20VenueSet = new HashSet<Profile>(hotspot20VenueSet);
}
if (hotspot20ProviderSet != null) {
ret.hotspot20ProviderSet = new HashSet<Profile>(hotspot20ProviderSet);
}
return ret;
}
@Override
public int hashCode() {
return Objects.hash(hotspot20OperatorSet, hotspot20ProfileSet, hotspot20ProviderSet, hotspot20VenueSet);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof OpensyncAPHotspot20Config)) {
return false;
}
OpensyncAPHotspot20Config other = (OpensyncAPHotspot20Config) obj;
return Objects.equals(hotspot20OperatorSet, other.hotspot20OperatorSet)
&& Objects.equals(hotspot20ProfileSet, other.hotspot20ProfileSet)
&& Objects.equals(hotspot20ProviderSet, other.hotspot20ProviderSet)
&& Objects.equals(hotspot20VenueSet, other.hotspot20VenueSet);
}
}

View File

@@ -196,9 +196,6 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
} catch (Exception e) {
LOG.warn("Could not provision Bridge->Port->Interface mapping.", e);
}
ovsdbDao.removeAllWifiPasspointConfigs(ovsdbClient);
ovsdbDao.removeAllWifiOsuProviders(ovsdbClient);
ovsdbDao.removeAllSsids(ovsdbClient); // always
ovsdbDao.removeWifiRrm(ovsdbClient);
@@ -207,9 +204,6 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
ovsdbDao.configureInterfaces(ovsdbClient);
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiRrm(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiOsuProviders(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiPasspoints(ovsdbClient, opensyncAPConfig);
}
ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always
@@ -271,8 +265,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
LOG.warn("AP with id " + apId + " does not have a config to apply.");
return;
}
ovsdbDao.removeAllWifiPasspointConfigs(ovsdbClient);
ovsdbDao.removeAllWifiOsuProviders(ovsdbClient);
ovsdbDao.removeAllSsids(ovsdbClient); // always
ovsdbDao.removeWifiRrm(ovsdbClient);
ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always
@@ -281,8 +274,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
ovsdbDao.configureInterfaces(ovsdbClient);
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiRrm(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiOsuProviders(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiPasspoints(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureStatsFromProfile(ovsdbClient, opensyncAPConfig);
// Check if device stats is configured in Wifi_Stats_Config table,

View File

@@ -40,6 +40,7 @@ import com.telecominfraproject.wlan.equipment.models.RadioMode;
import com.telecominfraproject.wlan.equipment.models.StateSetting;
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPHotspot20Config;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPInetState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPRadioState;
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState;
@@ -47,11 +48,12 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.BridgeInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.CommandConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.Hotspot20Config;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.Hotspot20IconConfig;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.Hotspot20OsuProviders;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.InterfaceInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.PortInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiInetConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiOsuProvider;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiPasspointConfig;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiRadioConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiStatsConfigInfo;
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiVifConfigInfo;
@@ -73,6 +75,11 @@ import com.telecominfraproject.wlan.profile.metrics.StatsReportFormat;
import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.models.common.ManagedFileInfo;
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
import com.telecominfraproject.wlan.profile.passpoint.hotspot.models.Hotspot2Profile;
import com.telecominfraproject.wlan.profile.passpoint.operator.models.OperatorProfile;
import com.telecominfraproject.wlan.profile.passpoint.venue.models.VenueName;
import com.telecominfraproject.wlan.profile.passpoint.venue.models.VenueProfile;
import com.telecominfraproject.wlan.profile.passpoint.venue.models.VenueTypeAssignment;
import com.telecominfraproject.wlan.profile.radius.models.RadiusProfile;
import com.telecominfraproject.wlan.profile.radius.models.RadiusServer;
import com.telecominfraproject.wlan.profile.radius.models.RadiusServiceRegion;
@@ -201,14 +208,15 @@ public class OvsdbDao {
public static final String commandConfigDbTable = "Command_Config";
public static final String commandStateDbTable = "Command_State";
public static final String hotspot20IconConfigDbTable = "Hotspot20_Icon_Config";
public static final String wifiOsuProviderDbTable = "Wifi_OSU_Provider";
public static final String hotspot20OsuProvidersDbTable = "Hotspot20_OSU_Providers";
public static final String wifiPasspointConfigDbTable = "Wifi_Passpoint_Config";
public static final String hotspot20ConfigDbTable = "Hotspot20_Config";
public static final String StartDebugEngineApCommand = "startPortForwardingSession.sh";
public static final String StartDebugEngineApCommand = "startPortForwardingSession";
public static final String StopDebugEngineApCommand = "stopSession.sh";
public static final String StopDebugEngineApCommand = "stopSession";
public static void translateDhcpFpValueToString(Entry<String, Value> c, Map<String, String> rowMap) {
@@ -1375,19 +1383,19 @@ public class OvsdbDao {
return ret;
}
public Map<String, WifiPasspointConfig> getProvisionedWifiPasspointConfigs(OvsdbClient ovsdbClient) {
Map<String, WifiPasspointConfig> ret = new HashMap<>();
public Map<String, Hotspot20Config> getProvisionedHotspot20Configs(OvsdbClient ovsdbClient) {
Map<String, Hotspot20Config> ret = new HashMap<>();
List<Operation> operations = new ArrayList<>();
List<Condition> conditions = new ArrayList<>();
List<String> columns = new ArrayList<>();
columns.addAll(Arrays.asList(WifiPasspointConfig.ovsdbColumns));
columns.addAll(Arrays.asList(Hotspot20Config.ovsdbColumns));
try {
LOG.debug("Retrieving WifiPasspointConfig:");
LOG.debug("Retrieving Hotspot20Config:");
operations.add(new Select(wifiPasspointConfigDbTable, conditions, columns));
operations.add(new Select(hotspot20ConfigDbTable, conditions, columns));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
@@ -1396,11 +1404,11 @@ public class OvsdbDao {
}
for (Row row : ((SelectResult) result[0]).getRows()) {
WifiPasspointConfig wifiPasspointConfig = new WifiPasspointConfig(row);
ret.put(wifiPasspointConfig.osuSsid, wifiPasspointConfig);
Hotspot20Config hotspot20Config = new Hotspot20Config(row);
ret.put(hotspot20Config.osuSsid, hotspot20Config);
}
LOG.debug("Retrieved WifiPasspointConfig: {}", ret);
LOG.debug("Retrieved Hotspot20Config: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getWifiPasspointConfigs", e);
@@ -1410,17 +1418,17 @@ public class OvsdbDao {
}
public Map<Uuid, WifiOsuProvider> getProvisionedWifiOsuProviders(OvsdbClient ovsdbClient) {
Map<Uuid, WifiOsuProvider> ret = new HashMap<>();
public Map<Uuid, Hotspot20OsuProviders> getProvisionedHotspot20OsuProviders(OvsdbClient ovsdbClient) {
Map<Uuid, Hotspot20OsuProviders> ret = new HashMap<>();
List<Operation> operations = new ArrayList<>();
List<Condition> conditions = new ArrayList<>();
List<String> columns = new ArrayList<>();
columns.addAll(Arrays.asList(WifiOsuProvider.ovsdbColumns));
columns.addAll(Arrays.asList(Hotspot20OsuProviders.ovsdbColumns));
try {
LOG.debug("Retrieving WifiOsuProvider:");
LOG.debug("Retrieving Hotspot20_OSU_Providers:");
operations.add(new Select(wifiOsuProviderDbTable, conditions, columns));
operations.add(new Select(hotspot20OsuProvidersDbTable, conditions, columns));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
@@ -1429,11 +1437,11 @@ public class OvsdbDao {
}
for (Row row : ((SelectResult) result[0]).getRows()) {
WifiOsuProvider wifiOsuProvider = new WifiOsuProvider(row);
ret.put(wifiOsuProvider.uuid, wifiOsuProvider);
Hotspot20OsuProviders hotspot20OsuProviders = new Hotspot20OsuProviders(row);
ret.put(hotspot20OsuProviders.uuid, hotspot20OsuProviders);
}
LOG.debug("Retrieved WifiOsuProvider: {}", ret);
LOG.debug("Retrieved Hotspot20_OSU_Providers: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getWifiOsuProviders", e);
@@ -1443,6 +1451,39 @@ public class OvsdbDao {
return ret;
}
public Map<String, Hotspot20IconConfig> getProvisionedHotspot20IconConfig(OvsdbClient ovsdbClient) {
Map<String, Hotspot20IconConfig> ret = new HashMap<>();
List<Operation> operations = new ArrayList<>();
List<Condition> conditions = new ArrayList<>();
List<String> columns = new ArrayList<>();
columns.addAll(Arrays.asList(Hotspot20IconConfig.ovsdbColumns));
try {
LOG.debug("Retrieving Hotspot20_Icon_Config:");
operations.add(new Select(hotspot20IconConfigDbTable, conditions, columns));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
for (Row row : ((SelectResult) result[0]).getRows()) {
Hotspot20IconConfig hotspot20IconConfig = new Hotspot20IconConfig(row);
ret.put(hotspot20IconConfig.name, hotspot20IconConfig);
}
LOG.debug("Retrieved Hotspot20_Icon_Config: {}", ret);
} catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) {
LOG.error("Error in getProvisionedHotspot20IconConfig", e);
throw new RuntimeException(e);
}
return ret;
}
public Map<String, WifiStatsConfigInfo> getProvisionedWifiStatsConfigs(OvsdbClient ovsdbClient) {
Map<String, WifiStatsConfigInfo> ret = new HashMap<>();
@@ -1732,6 +1773,11 @@ public class OvsdbDao {
public void removeAllSsids(OvsdbClient ovsdbClient) {
try {
removeAllHotspot20Config(ovsdbClient);
removeAllHotspot20OsuProviders(ovsdbClient);
removeAllHotspot20IconConfig(ovsdbClient);
List<Operation> operations = new ArrayList<>();
operations.add(new Delete(wifiVifConfigDbTable));
@@ -1807,7 +1853,8 @@ public class OvsdbDao {
RfElementConfiguration rfElementConfig = rfConfig.getRfConfig(radioType);
int channel = elementRadioConfig.getChannelNumber();
ChannelBandwidth bandwidth = elementRadioConfig.getChannelBandwidth();
// ChannelBandwidth bandwidth = rfElementConfig.getChannelBandwidth();
// ChannelBandwidth bandwidth =
// rfElementConfig.getChannelBandwidth();
String ht_mode = null;
switch (bandwidth) {
case is20MHz:
@@ -3006,6 +3053,11 @@ public class OvsdbDao {
}
}
if (opensyncApConfig.getHotspotConfig() != null) {
provisionHotspot2IconConfig(ovsdbClient, opensyncApConfig);
provisionHotspot20OsuProviders(ovsdbClient, opensyncApConfig);
provisionHotspot20Config(ovsdbClient, opensyncApConfig);
}
}
}
@@ -3322,85 +3374,273 @@ public class OvsdbDao {
}
public void configureWifiPasspoints(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
public void provisionHotspot20Config(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
try {
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (schema.getTables().containsKey(wifiPasspointConfigDbTable)
&& schema.getTables().get(wifiPasspointConfigDbTable) != null) {
Map<Uuid, WifiOsuProvider> osuProviders = getProvisionedWifiOsuProviders(ovsdbClient);
LOG.info("Current WifiPasspointConfigs {}", osuProviders);
if (schema.getTables().containsKey(hotspot20ConfigDbTable)
&& schema.getTables().get(hotspot20ConfigDbTable) != null) {
Map<String, Hotspot20Config> hotspot20ConfigMap = getProvisionedHotspot20Configs(ovsdbClient);
OpensyncAPHotspot20Config hs20cfg = opensyncApConfig.getHotspotConfig();
if (hs20cfg.getHotspot20ProfileSet() != null) {
List<Operation> operations = new ArrayList<>();
for (Profile hotspotProfile : hs20cfg.getHotspot20ProfileSet()) {
OperatorProfile operatorProfile = null;
if (hs20cfg.getHotspot20OperatorSet() != null) {
List<Profile> operator = hs20cfg.getHotspot20OperatorSet().stream()
.filter(new Predicate<Profile>() {
@Override
public boolean test(Profile t) {
return hotspotProfile.getChildProfileIds().contains(t.getId());
}
}).collect(Collectors.toList());
operatorProfile = (OperatorProfile) operator.get(0).getDetails();
}
VenueProfile venueProfile = null;
if (hs20cfg.getHotspot20VenueSet() != null) {
List<Profile> venue = hs20cfg.getHotspot20VenueSet().stream()
.filter(new Predicate<Profile>() {
@Override
public boolean test(Profile t) {
return hotspotProfile.getChildProfileIds().contains(t.getId());
}
}).collect(Collectors.toList());
venueProfile = (VenueProfile) venue.get(0).getDetails();
}
// for (Profile hotspot20 : hotspot20ProfileList) {
Hotspot2Profile hs2Profile = (Hotspot2Profile) hotspotProfile.getDetails();
Map<String, Value> rowColumns = new HashMap<>();
rowColumns.put("deauth_request_timeout", new Atom<>(hs2Profile.getDeauthRequestTimeout()));
rowColumns.put("osen",
new Atom<>(operatorProfile.isServerOnlyAuthenticatedL2EncryptionNetwork()));
Set<Atom<String>> operatorFriendlyName = new HashSet<>();
operatorProfile.getOperatorFriendlyName().stream()
.forEach(c -> operatorFriendlyName.add(new Atom<>(c.getFormattedFriendlyName())));
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()));
Set<Atom<String>> connectionCapabilities = new HashSet<>();
hs2Profile.getConnectionCapabilitySet().stream().forEach(
c -> connectionCapabilities.add(new Atom<>(c.getConnectionCapabilitiesIpProtocol() + ":"
+ c.getConnectionCapabilitiesPortNumber() + ":"
+ c.getConnectionCapabilitiesStatus())));
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 (VenueName venueName : venueProfile.getVenueNameSet()) {
venueNames.add(new Atom<String>(venueName.getFormattedVenueName()));
String url = String.valueOf(index) + ":" + venueName.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);
VenueTypeAssignment venueTypeAssignment = venueProfile.getVenueTypeAssignment();
String groupType = String.valueOf(venueTypeAssignment.getVenueGroupId()) + ":"
+ venueTypeAssignment.getVenueTypeId();
rowColumns.put("venue_group_type", new Atom<>(groupType));
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);
}
}
LOG.info("Current Hotspot20_Config {}", hotspot20ConfigMap);
} else {
LOG.info("Table {} not present in {}. Cannot perform configureWifiPasspoints", wifiPasspointConfigDbTable,
LOG.info("Table {} not present in {}. Cannot provision Hotspot20_Config", hotspot20ConfigDbTable,
ovsdbName);
}
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
LOG.error("Error in configureWifiPasspoints", e);
LOG.error("Error in provisionHotspot20Config", e);
throw new RuntimeException(e);
}
}
public void provisionHotspot20OsuProviders(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
try {
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (schema.getTables().containsKey(hotspot20OsuProvidersDbTable)
&& schema.getTables().get(hotspot20OsuProvidersDbTable) != null) {
Map<Uuid, Hotspot20OsuProviders> hotspot20OsuProvidersMap = getProvisionedHotspot20OsuProviders(
ovsdbClient);
OpensyncAPHotspot20Config hs20cfg = opensyncApConfig.getHotspotConfig();
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
}
LOG.info("Current Hotspot20_OSU_Providers {}", hotspot20OsuProvidersMap);
} else {
LOG.info("Table {} not present in {}. Cannot provision Hotspot20_OSU_Providers",
hotspot20OsuProvidersDbTable, ovsdbName);
}
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
LOG.error("Error in provisionHotspot20OsuProviders", e);
throw new RuntimeException(e);
}
}
public void configureWifiOsuProviders(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
public void provisionHotspot2IconConfig(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {
try {
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (schema.getTables().containsKey(wifiOsuProviderDbTable)
&& schema.getTables().get(wifiOsuProviderDbTable) != null) {
Map<Uuid, WifiOsuProvider> osuProviders = getProvisionedWifiOsuProviders(ovsdbClient);
LOG.info("Current WifiOsuProviders {}", osuProviders);
if (schema.getTables().containsKey(hotspot20IconConfigDbTable)
&& schema.getTables().get(hotspot20IconConfigDbTable) != null) {
Map<String, Hotspot20IconConfig> osuProviders = getProvisionedHotspot20IconConfig(ovsdbClient);
OpensyncAPHotspot20Config hs20cfg = opensyncApConfig.getHotspotConfig();
if (hs20cfg.getHotspot20ProviderSet() != null && hs20cfg.getHotspot20ProviderSet().size() > 0) {
}
LOG.info("Current Hotspot20_Icon_Config {}", osuProviders);
} else {
LOG.info("Table {} not present in {}. Cannot configure Wifi Osu Providers", wifiOsuProviderDbTable,
ovsdbName);
LOG.info("Table {} not present in {}. Cannot provision Hotspot20_Icon_Config",
hotspot20IconConfigDbTable, ovsdbName);
}
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
LOG.error("Error in configureWifiOsuProviders", e);
LOG.error("Error in provisionHotspot2IconConfig", e);
throw new RuntimeException(e);
}
}
public void removeAllWifiPasspointConfigs(OvsdbClient ovsdbClient) {
public void removeAllHotspot20Config(OvsdbClient ovsdbClient) {
try {
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (schema.getTables().containsKey(wifiPasspointConfigDbTable)
&& schema.getTables().get(wifiPasspointConfigDbTable) != null) {
Map<Uuid, WifiOsuProvider> osuProviders = getProvisionedWifiOsuProviders(ovsdbClient);
LOG.info("Current WifiPasspointConfigs {}", osuProviders);
} else {
LOG.info("Table {} not present in {}. Cannot remove Wifi Passpoint Configs", wifiPasspointConfigDbTable,
ovsdbName);
if (schema.getTables().containsKey(hotspot20ConfigDbTable)
&& schema.getTables().get(hotspot20ConfigDbTable) != null) {
List<Operation> operations = new ArrayList<>();
operations.add(new Delete(hotspot20ConfigDbTable));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing hotspot configs from {}:", hotspot20ConfigDbTable);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
}
}
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
LOG.error("Error in removeAllWifiPasspointConfigs", e);
LOG.error("Error in removeAllHotspot20Config", e);
throw new RuntimeException(e);
}
}
public void removeAllWifiOsuProviders(OvsdbClient ovsdbClient) {
public void removeAllHotspot20OsuProviders(OvsdbClient ovsdbClient) {
try {
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (schema.getTables().containsKey(wifiOsuProviderDbTable)
&& schema.getTables().get(wifiOsuProviderDbTable) != null) {
Map<Uuid, WifiOsuProvider> osuProviders = getProvisionedWifiOsuProviders(ovsdbClient);
LOG.info("Current WifiOsuProviders {}", osuProviders);
} else {
LOG.info("Table {} not present in {}. Cannot remove Wifi Osu Providers", wifiOsuProviderDbTable,
ovsdbName);
if (schema.getTables().containsKey(hotspot20OsuProvidersDbTable)
&& schema.getTables().get(hotspot20OsuProvidersDbTable) != null) {
List<Operation> operations = new ArrayList<>();
operations.add(new Delete(hotspot20OsuProvidersDbTable));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing hotspot osu providers from {}:", hotspot20OsuProvidersDbTable);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
}
}
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
LOG.error("Error in removeAllWifiOsuProviders", e);
LOG.error("Error in removeAllHotspot20OsuProviders", e);
throw new RuntimeException(e);
}
}
public void removeAllHotspot20IconConfig(OvsdbClient ovsdbClient) {
try {
DatabaseSchema schema = ovsdbClient.getSchema(ovsdbName).get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (schema.getTables().containsKey(hotspot20IconConfigDbTable)
&& schema.getTables().get(hotspot20IconConfigDbTable) != null) {
List<Operation> operations = new ArrayList<>();
operations.add(new Delete(hotspot20IconConfigDbTable));
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
if (LOG.isDebugEnabled()) {
LOG.debug("Removed all existing hotspot icon configs from {}:", hotspot20IconConfigDbTable);
for (OperationResult res : result) {
LOG.debug("Op Result {}", res);
}
}
}
} catch (InterruptedException | ExecutionException | TimeoutException | OvsdbClientException e) {
LOG.error("Error in removeAllHotspot20IconConfig", e);
throw new RuntimeException(e);
}
}
public void configureStatsFromProfile(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncApConfig) {

View File

@@ -7,14 +7,15 @@ import java.util.Set;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
public class WifiPasspointConfig implements Cloneable {
public class Hotspot20Config implements Cloneable {
public static String[] ovsdbColumns = {
"osu_ssid", "network_auth_type", "osu_providers", "hessid", "deauth_request_timeout", "venue_url",
"ipaddr_type", "venue_group_type", "_uuid", "venue_name", "domain_name", "anqp_domain_id", "osu_icons",
"nai_realm", "osen", "mcc_mnc", "enable", "vif_config", "roaming_oi", "_version", "connection_capability",
"operating_class", "operator_icons", "gas_addr3_behavior", "tos", "operator_friendly_name"
"ipaddr_type_availability", "venue_group_type", "_uuid", "venue_name", "domain_name", "anqp_domain_id",
"nai_realm", "osen", "mcc_mnc", "enable", "vif_config", "roaming_oi", "_version",
"connection_capability", "operating_class", "operator_icons", "gas_addr3_behavior", "tos",
"operator_friendly_name"
};
@@ -25,7 +26,7 @@ public class WifiPasspointConfig implements Cloneable {
public String hessid;
public int deauthRequestTimeout;
public Set<String> venueUrl;
public String ipAddrType;
public String ipAddrTypeAvailability;
public String venueGroupType;
public Uuid uuid;
public Set<String> venueName;
@@ -33,22 +34,22 @@ public class WifiPasspointConfig implements Cloneable {
public int anqpDomainId;
public Set<String> naiRealm;
public boolean osen;
public Set<String> mccMnc;
public String mccMnc;
public boolean enable;
public Set<Uuid> vifConfig;
public Set<String> roamingOi;
public Uuid version;
public Set<String> connectionCapability;
public int operatingClass;
public Set<String> operatorIcons;
public Set<Uuid> operatorIcons;
public int gasAddr3Behaviour;
public String tos;
public Set<String> operatorFriendlyName;
@Override
public WifiPasspointConfig clone() {
public Hotspot20Config clone() {
try {
WifiPasspointConfig ret = (WifiPasspointConfig) super.clone();
Hotspot20Config ret = (Hotspot20Config) super.clone();
if (osuProviders != null) {
ret.osuProviders = new HashSet<>(this.osuProviders);
}
@@ -64,9 +65,6 @@ public class WifiPasspointConfig implements Cloneable {
if (naiRealm != null) {
ret.naiRealm = new HashSet<>(this.naiRealm);
}
if (mccMnc != null) {
ret.mccMnc = new HashSet<>(this.mccMnc);
}
if (roamingOi != null) {
ret.roamingOi = new HashSet<>(this.roamingOi);
}
@@ -93,7 +91,7 @@ public class WifiPasspointConfig implements Cloneable {
}
public WifiPasspointConfig(Row row) {
public Hotspot20Config(Row row) {
this.osuSsid = row.getStringColumn("osu_ssid");
if ((row.getColumns().get("network_auth_type") != null) && row.getColumns().get("network_auth_type").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
@@ -111,7 +109,7 @@ public class WifiPasspointConfig implements Cloneable {
this.venueUrl = row.getSetColumn("venue_url");
if ((row.getColumns().get("ip_addr_type") != null) && row.getColumns().get("ip_addr_type").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.ipAddrType = row.getStringColumn("ip_addr_type");
this.ipAddrTypeAvailability = row.getStringColumn("ip_addr_type");
}
if ((row.getColumns().get("venue_group_type") != null) && row.getColumns().get("venue_group_type").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
@@ -129,7 +127,10 @@ public class WifiPasspointConfig implements Cloneable {
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.osen = row.getBooleanColumn("osen");
}
this.mccMnc = row.getSetColumn("mcc_mnc");
if ((row.getColumns().get("mcc_mnc") != null) && row.getColumns().get("mcc_mnc").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.mccMnc = row.getStringColumn("mcc_mnc");
}
if ((row.getColumns().get("enable") != null) && row.getColumns().get("enable").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.enable = row.getBooleanColumn("enable");
@@ -151,26 +152,15 @@ public class WifiPasspointConfig implements Cloneable {
this.operatorFriendlyName = row.getSetColumn("operator_friendly_name");
}
public WifiPasspointConfig() {
public Hotspot20Config() {
// TODO Auto-generated constructor stub
}
@Override
public String toString() {
return String.format(
"WifiPasspointConfig [osuSsid=%s, networkAuthType=%s, osuProviders=%s, hessid=%s, deauthRequestTimeout=%s, venueUrl=%s, ipAddrType=%s, venueGroupType=%s, uuid=%s, venueName=%s, domainName=%s, anqpDomainId=%s, naiRealm=%s, osen=%s, mccMnc=%s, enable=%s, vifConfig=%s, roamingOi=%s, version=%s, connectionCapability=%s, operatingClass=%s, operatorIcons=%s, gasAddr3Behaviour=%s, tos=%s, operatorFriendlyName=%s]",
osuSsid, networkAuthType, osuProviders, hessid, deauthRequestTimeout, venueUrl, ipAddrType,
venueGroupType, uuid, venueName, domainName, anqpDomainId, naiRealm, osen, mccMnc, enable, vifConfig,
roamingOi, version, connectionCapability, operatingClass, operatorIcons, gasAddr3Behaviour, tos,
operatorFriendlyName);
}
@Override
public int hashCode() {
return Objects.hash(anqpDomainId, connectionCapability, deauthRequestTimeout, domainName, enable,
gasAddr3Behaviour, hessid, ipAddrType, mccMnc, naiRealm, networkAuthType, operatingClass,
gasAddr3Behaviour, hessid, ipAddrTypeAvailability, mccMnc, naiRealm, networkAuthType, operatingClass,
operatorFriendlyName, operatorIcons, osen, osuProviders, osuSsid, roamingOi, tos, uuid, venueGroupType,
venueName, venueUrl, version, vifConfig);
}
@@ -181,14 +171,15 @@ public class WifiPasspointConfig implements Cloneable {
if (this == obj) {
return true;
}
if (!(obj instanceof WifiPasspointConfig)) {
if (!(obj instanceof Hotspot20Config)) {
return false;
}
WifiPasspointConfig other = (WifiPasspointConfig) obj;
Hotspot20Config other = (Hotspot20Config) obj;
return anqpDomainId == other.anqpDomainId && Objects.equals(connectionCapability, other.connectionCapability)
&& deauthRequestTimeout == other.deauthRequestTimeout && Objects.equals(domainName, other.domainName)
&& enable == other.enable && gasAddr3Behaviour == other.gasAddr3Behaviour
&& Objects.equals(hessid, other.hessid) && Objects.equals(ipAddrType, other.ipAddrType)
&& Objects.equals(hessid, other.hessid)
&& Objects.equals(ipAddrTypeAvailability, other.ipAddrTypeAvailability)
&& Objects.equals(mccMnc, other.mccMnc) && Objects.equals(naiRealm, other.naiRealm)
&& Objects.equals(networkAuthType, other.networkAuthType) && operatingClass == other.operatingClass
&& Objects.equals(operatorFriendlyName, other.operatorFriendlyName)
@@ -201,4 +192,18 @@ public class WifiPasspointConfig implements Cloneable {
}
@Override
public String toString() {
return "Hotspot20Config [osuSsid=" + osuSsid + ", networkAuthType=" + networkAuthType + ", osuProviders="
+ osuProviders + ", hessid=" + hessid + ", deauthRequestTimeout=" + deauthRequestTimeout + ", venueUrl="
+ venueUrl + ", ipAddrTypeAvailability=" + ipAddrTypeAvailability + ", venueGroupType=" + venueGroupType
+ ", uuid=" + uuid + ", venueName=" + venueName + ", domainName=" + domainName + ", anqpDomainId="
+ anqpDomainId + ", naiRealm=" + naiRealm + ", osen=" + osen + ", mccMnc=" + mccMnc + ", enable="
+ enable + ", vifConfig=" + vifConfig + ", roamingOi=" + roamingOi + ", version=" + version
+ ", connectionCapability=" + connectionCapability + ", operatingClass=" + operatingClass
+ ", operatorIcons=" + operatorIcons + ", gasAddr3Behaviour=" + gasAddr3Behaviour + ", tos=" + tos
+ ", operatorFriendlyName=" + operatorFriendlyName + "]";
}
}

View File

@@ -0,0 +1,111 @@
package com.telecominfraproject.wlan.opensync.ovsdb.dao.models;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
public class Hotspot20IconConfig implements Cloneable {
public static String[] ovsdbColumns = { "_version", "name", "path", "url", "lang_code", "height", "img_type",
"_uuid", "width" };
// _version "uuid"
// name {"key":{"maxLength":128,"minLength":1,"type":"string"}}
// path {"key":{"maxLength":32,"minLength":1,"type":"string"}}
// url {"key":{"maxLength":256,"minLength":1,"type":"string"}}
// lang_code {"key":{"maxLength":8,"minLength":1,"type":"string"}}
// height {"key":"integer","min":0}
// img_type {"key":{"maxLength":32,"minLength":1,"type":"string"}}
// _uuid "uuid"
// width {"key":"integer","min":0}
public String name;
public String path;
public String url;
public String langCode;
public Integer height;
public String imgType;
public Integer width;
public Uuid uuid;
public Uuid version;
public Hotspot20IconConfig() {
}
public Hotspot20IconConfig(Row row) {
this.version = row.getUuidColumn("_version");
this.uuid = row.getUuidColumn("_uuid");
if ((row.getColumns().get("path") != null) && row.getColumns().get("path").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.path = row.getStringColumn("path");
}
if ((row.getColumns().get("url") != null) && row.getColumns().get("url").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.url = row.getStringColumn("url");
}
if ((row.getColumns().get("lang_code") != null) && row.getColumns().get("lang_code").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.langCode = row.getStringColumn("lang_code");
}
if ((row.getColumns().get("height") != null) && row.getColumns().get("height").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.height = row.getIntegerColumn("height").intValue();
}
if ((row.getColumns().get("width") != null) && row.getColumns().get("width").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.width = row.getIntegerColumn("width").intValue();
}
if ((row.getColumns().get("img_type") != null) && row.getColumns().get("img_type").getClass()
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
this.imgType = row.getStringColumn("img_type");
}
}
@Override
public Hotspot20IconConfig clone() {
try {
Hotspot20IconConfig ret = (Hotspot20IconConfig) super.clone();
return ret;
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Cannot clone ", e);
}
}
@Override
public String toString() {
return "Hotspot20IconConfig [name=" + name + ", path=" + path + ", url=" + url + ", langCode=" + langCode
+ ", height=" + height + ", imgType=" + imgType + ", width=" + width + ", uuid=" + uuid + ", version="
+ version + "]";
}
@Override
public int hashCode() {
return Objects.hash(height, imgType, langCode, name, path, url, uuid, version, width);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Hotspot20IconConfig)) {
return false;
}
Hotspot20IconConfig other = (Hotspot20IconConfig) obj;
return Objects.equals(height, other.height) && Objects.equals(imgType, other.imgType)
&& Objects.equals(langCode, other.langCode) && Objects.equals(name, other.name)
&& Objects.equals(path, other.path) && Objects.equals(url, other.url)
&& Objects.equals(uuid, other.uuid) && Objects.equals(version, other.version)
&& Objects.equals(width, other.width);
}
}

View File

@@ -7,28 +7,27 @@ import java.util.Set;
import com.vmware.ovsdb.protocol.operation.notation.Row;
import com.vmware.ovsdb.protocol.operation.notation.Uuid;
public class WifiOsuProvider implements Cloneable {
public class Hotspot20OsuProviders implements Cloneable {
public static String[] ovsdbColumns = { "_version", "osu_nai", "icon", "server_uri", "method_list", "_uuid",
public static String[] ovsdbColumns = { "_version", "osu_nai", "osu_icons", "server_uri", "method_list", "_uuid",
"osu_friendly_name", "service_description" };
public Uuid version;
public Set<String> osuNai;
public Set<String> icon;
public Set<String> osuIcons;
public String serverUri;
public Set<Integer> methodList;
public Uuid uuid;
public Set<String> osuFriendlyName;
public Set<String> serviceDescription;
public WifiOsuProvider() {
public Hotspot20OsuProviders() {
}
public WifiOsuProvider(Row row) {
public Hotspot20OsuProviders(Row row) {
this.version = row.getUuidColumn("_version");
this.uuid = row.getUuidColumn("_uuid");
this.osuNai = row.getSetColumn("osu_nai");
this.icon = row.getSetColumn("icon");
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)) {
this.serverUri = row.getStringColumn("server_uri");
@@ -40,15 +39,15 @@ public class WifiOsuProvider implements Cloneable {
@Override
public WifiOsuProvider clone() {
public Hotspot20OsuProviders clone() {
try {
WifiOsuProvider ret = (WifiOsuProvider) super.clone();
Hotspot20OsuProviders ret = (Hotspot20OsuProviders) super.clone();
if (osuNai != null) {
ret.osuNai = new HashSet<>(this.osuNai);
}
if (icon != null) {
ret.icon = new HashSet<>(this.icon);
if (osuIcons != null) {
ret.osuIcons = new HashSet<>(this.osuIcons);
}
if (methodList != null) {
ret.methodList = new HashSet<>(this.methodList);
@@ -68,14 +67,15 @@ public class WifiOsuProvider implements Cloneable {
@Override
public String toString() {
return String.format(
"WifiOsuProvider [version=%s, osuNai=%s, icon=%s, serverUri=%s, methodList=%s, uuid=%s, osuFriendlyName=%s, serviceDescription=%s]",
version, osuNai, icon, serverUri, methodList, uuid, osuFriendlyName, serviceDescription);
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(icon, methodList, osuFriendlyName, osuNai, serverUri, serviceDescription, uuid, version);
return Objects.hash(methodList, osuFriendlyName, osuIcons, osuNai, serverUri, serviceDescription, uuid,
version);
}
@Override
@@ -83,16 +83,17 @@ public class WifiOsuProvider implements Cloneable {
if (this == obj) {
return true;
}
if (!(obj instanceof WifiOsuProvider)) {
if (!(obj instanceof Hotspot20OsuProviders)) {
return false;
}
WifiOsuProvider other = (WifiOsuProvider) obj;
return Objects.equals(icon, other.icon) && Objects.equals(methodList, other.methodList)
&& Objects.equals(osuFriendlyName, other.osuFriendlyName) && Objects.equals(osuNai, other.osuNai)
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(serviceDescription, other.serviceDescription) && Objects.equals(uuid, other.uuid)
&& Objects.equals(version, other.version);
}
}