diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java index 5a2443e..d168bee 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java @@ -140,7 +140,7 @@ public class OvsdbDao { @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.listenPort:6640}") private int ovsdbListenPort; - + @org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.externalPort:6640}") private int ovsdbExternalPort; @@ -149,7 +149,7 @@ public class OvsdbDao { @org.springframework.beans.factory.annotation.Value("${tip.wlan.mqttBroker.listenPort:1883}") private int mqttBrokerListenPort; - + @org.springframework.beans.factory.annotation.Value("${tip.wlan.mqttBroker.externalPort:1883}") private int mqttBrokerExternalPort; @@ -755,10 +755,6 @@ public class OvsdbDao { LOG.debug("Select from AWLAN_Node:"); - for (OperationResult res : result) { - LOG.debug("Op Result {}", res); - } - String skuNumber = null; String serialNumber = null; String model = null; @@ -769,6 +765,10 @@ public class OvsdbDao { row = ((SelectResult) result[0]).getRows().iterator().next(); } + for (OperationResult res : result) { + LOG.debug("Op Result {}", res); + } + firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null; skuNumber = getSingleValueFromSet(row, "sku_number"); @@ -3185,7 +3185,7 @@ public class OvsdbDao { LOG.info("Update pre-existing Wifi_VIF_Config for ssid {} with if_name {}", ssidConfig.getSsid(), ifName); } - + if (!isUpdate) { provisionedVifs = getProvisionedWifiVifConfigs(ovsdbClient); @@ -3406,10 +3406,10 @@ public class OvsdbDao { } - private void getRadiusAccountingConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig, + void getRadiusAccountingConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig, Map security) { - LOG.debug("getRadiusAccountingConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig, + LOG.info("getRadiusAccountingConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig, opensyncApConfig.getRadiusProfiles()); List radiusServiceList = opensyncApConfig.getRadiusProfiles().stream() @@ -3438,26 +3438,42 @@ public class OvsdbDao { security.put("radius_acct_port", rServer.getAuthPort() != null ? String.valueOf(rServer.getAuthPort()) : null); security.put("radius_acct_secret", rServer.getSecret()); + if (ssidConfig.getRadiusAcountingServiceInterval() != null) { + // if the value is present, use the + // radius_acct_interval + security.put("radius_acct_interval", + ssidConfig.getRadiusAcountingServiceInterval().toString()); + LOG.info( + "set Radius Accounting server attributes radius_acct_ip {} radius_acct_port {} radius_acct_secret {} radius_acct_interval {}", + security.get("radius_acct_ip"), security.get("radius_acct_port"), + security.get("radius_acct_secret"), security.get("radius_acct_interval")); + } else { + LOG.info( + "No radius_acct_interval defined for ssid {}, assume the RadiusServer {} to be providing Acct-Interim-Interval attribute in it's Access-Accept message", + ssidConfig.getSsid(), rServer); + LOG.info( + "set Radius Accounting server attributes radius_acct_ip {} radius_acct_port {} radius_acct_secret {}", + security.get("radius_acct_ip"), security.get("radius_acct_port"), + security.get("radius_acct_secret")); + } + } - LOG.info( - "set Radius Accounting server attributes radius_acct_ip {} radius_acct_port {} radius_acct_secret {}", - security.get("radius_acct_ip"), security.get("radius_acct_port"), - security.get("radius_acct_secret")); + } else { LOG.warn("Could not get RadiusServerConfiguration for {} from RadiusProfile {}", - ssidConfig.getRadiusServiceName(), profileRadius); + ssidConfig.getRadiusAccountingServiceName(), profileRadius); } } else { LOG.warn("Could not get RadiusServiceRegion {} from RadiusProfile {}", region, profileRadius); } } else { - LOG.warn("Could not find radius profile {} in {}", ssidConfig.getRadiusServiceName(), + LOG.warn("Could not find radius profile {} in {}", ssidConfig.getRadiusAccountingServiceName(), opensyncApConfig.getRadiusProfiles()); } } - private void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig, + void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig, Map security) { LOG.debug("getRadiusConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig, diff --git a/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTest.java b/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTest.java index d2c62a7..a3af481 100644 --- a/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTest.java +++ b/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTest.java @@ -1,5 +1,6 @@ package com.telecominfraproject.wlan.opensync.ovsdb.dao; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -7,6 +8,7 @@ import java.net.InetAddress; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -32,13 +34,15 @@ import org.springframework.test.context.junit4.SpringRunner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.telecominfraproject.wlan.customer.models.Customer; +import com.telecominfraproject.wlan.location.models.Location; 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.profile.models.Profile; import com.telecominfraproject.wlan.profile.models.ProfileType; import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration; +import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration; +import com.telecominfraproject.wlan.status.network.models.RadiusDetails; import com.vmware.ovsdb.exception.OvsdbClientException; import com.vmware.ovsdb.protocol.operation.notation.Atom; import com.vmware.ovsdb.protocol.operation.notation.Row; @@ -62,6 +66,8 @@ import com.vmware.ovsdb.service.OvsdbClient; }) public class OvsdbDaoTest { + static final int DEFAULT_CUSTOMER_ID = 1; + private static final long HOTSPOT_CONFIG_ID = 1; private static final long HOTSPOT_PROVIDER_ID_1 = 2; private static final long HOTSPOT_PROVIDER_ID_2 = 3; @@ -207,8 +213,60 @@ public class OvsdbDaoTest { } + @Test + public void testGetRadiusConfiguration() throws Exception { + OpensyncAPConfig apConfig = new OpensyncAPConfig(); + Profile profileRadius = OvsdbDaoTestUtilities.createRadiusProfile(DEFAULT_CUSTOMER_ID); + apConfig.setRadiusProfiles(List.of(profileRadius)); + SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults(); + ssidConfig.setRadiusServiceName("Radius-Profile"); + Map security = new HashMap<>(); + Location location = new Location(); + location.setName("Ottawa"); + apConfig.setEquipmentLocation(location); + ovsdbDao.getRadiusConfiguration(apConfig, ssidConfig, security); + assert (security.get("radius_server_ip").equals("192.168.0.1")); + assert (security.get("radius_server_port").equals("1812")); + assert (security.get("radius_server_secret").equals("testing123")); + } + + @Test + public void testGetRadiusAccountingConfiguration() throws Exception { + OpensyncAPConfig apConfig = new OpensyncAPConfig(); + Profile profileRadius = OvsdbDaoTestUtilities.createRadiusProfile(DEFAULT_CUSTOMER_ID); + apConfig.setRadiusProfiles(List.of(profileRadius)); + SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults(); + ssidConfig.setRadiusAccountingServiceName("Radius-Profile"); + ssidConfig.setRadiusAcountingServiceInterval(60); + Map security = new HashMap<>(); + Location location = new Location(); + location.setName("Ottawa"); + apConfig.setEquipmentLocation(location); + ovsdbDao.getRadiusAccountingConfiguration(apConfig, ssidConfig, security); + assert (Integer.valueOf(security.get("radius_acct_interval")) + .equals(ssidConfig.getRadiusAcountingServiceInterval())); + assert (security.get("radius_acct_ip").equals("192.168.0.1")); + assert (security.get("radius_acct_port").equals("1812")); + assert (security.get("radius_acct_secret").equals("testing123")); + } - + @Test + public void testGetRadiusAccountingConfigurationNoAcctInterval() throws Exception { + OpensyncAPConfig apConfig = new OpensyncAPConfig(); + Profile profileRadius = OvsdbDaoTestUtilities.createRadiusProfile(DEFAULT_CUSTOMER_ID); + apConfig.setRadiusProfiles(List.of(profileRadius)); + SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults(); + ssidConfig.setRadiusAccountingServiceName("Radius-Profile"); + Map security = new HashMap<>(); + Location location = new Location(); + location.setName("Ottawa"); + apConfig.setEquipmentLocation(location); + ovsdbDao.getRadiusAccountingConfiguration(apConfig, ssidConfig, security); + assert (security.containsKey("radius_acct_interval") == false); + assert (security.get("radius_acct_ip").equals("192.168.0.1")); + assert (security.get("radius_acct_port").equals("1812")); + assert (security.get("radius_acct_secret").equals("testing123")); + } @Test public void testConfigureHotspots() throws Exception { @@ -225,36 +283,35 @@ public class OvsdbDaoTest { OpensyncAPConfig apConfig = new OpensyncAPConfig(); OpensyncAPHotspot20Config hsConfig = new OpensyncAPHotspot20Config(); - Customer customer = new Customer(); - Profile profileSsidPsk = OvsdbDaoTestUtilities.createPasspointAccessSsid(customer); + Profile profileSsidPsk = OvsdbDaoTestUtilities.createPasspointAccessSsid(DEFAULT_CUSTOMER_ID); profileSsidPsk.setId(SSID_PSK_ID); - Profile profileSsidOsu = OvsdbDaoTestUtilities.createPasspointOsuSsid(customer); + Profile profileSsidOsu = OvsdbDaoTestUtilities.createPasspointOsuSsid(DEFAULT_CUSTOMER_ID); profileSsidOsu.setId(SSID_OSU_ID); - Profile passpointOperatorProfile = OvsdbDaoTestUtilities.createPasspointOperatorProfile(customer); + Profile passpointOperatorProfile = OvsdbDaoTestUtilities.createPasspointOperatorProfile(DEFAULT_CUSTOMER_ID); passpointOperatorProfile.setId(OPERATOR_ID); - Profile passpointVenueProfile = OvsdbDaoTestUtilities.createPasspointVenueProfile(customer); + Profile passpointVenueProfile = OvsdbDaoTestUtilities.createPasspointVenueProfile(DEFAULT_CUSTOMER_ID); passpointVenueProfile.setId(VENUE_ID); Profile hotspot20IdProviderProfile = new Profile(); hotspot20IdProviderProfile.setId(HOTSPOT_PROVIDER_ID_1); - hotspot20IdProviderProfile = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(customer, + hotspot20IdProviderProfile = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(DEFAULT_CUSTOMER_ID, hotspot20IdProviderProfile, "TipWlan-Hotspot20-OSU-Provider", "Rogers AT&T Wireless", "Canada", "ca", 302, 720, "rogers.com", 1); Profile hotspot20IdProviderProfile2 = new Profile(); hotspot20IdProviderProfile2.setId(HOTSPOT_PROVIDER_ID_2); - hotspot20IdProviderProfile2 = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(customer, + hotspot20IdProviderProfile2 = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(DEFAULT_CUSTOMER_ID, hotspot20IdProviderProfile2, "TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302, 220, "telus.com", 1); profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId()); profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId()); - Profile passpointHotspotConfig = OvsdbDaoTestUtilities.createPasspointHotspotConfig(customer, + Profile passpointHotspotConfig = OvsdbDaoTestUtilities.createPasspointHotspotConfig(DEFAULT_CUSTOMER_ID, hotspot20IdProviderProfile2, hotspot20IdProviderProfile, passpointOperatorProfile, passpointVenueProfile, profileSsidPsk, profileSsidOsu); passpointHotspotConfig.setId(HOTSPOT_CONFIG_ID); - Profile hotspotProfileAp = OvsdbDaoTestUtilities.createPasspointApProfile(customer, profileSsidPsk, + Profile hotspotProfileAp = OvsdbDaoTestUtilities.createPasspointApProfile(DEFAULT_CUSTOMER_ID, profileSsidPsk, profileSsidOsu); hotspotProfileAp.setId(EQUIPMENT_AP_ID); @@ -269,10 +326,13 @@ public class OvsdbDaoTest { apConfig.setSsidProfile(List.of(profileSsidOsu, profileSsidPsk)); - Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(OvsdbDaoTestUtilities.hs20IconRows()) - .thenReturn(OvsdbDaoTestUtilities.hs20InsertIconRows()).thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.hs20IconRows()) - .thenReturn(OvsdbDaoTestUtilities.hs20IconRows()).thenReturn(OvsdbDaoTestUtilities.hs20InsertProviderRows()).thenReturn(OvsdbDaoTestUtilities.hs20Config()) - .thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows()) + Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))) + .thenReturn(OvsdbDaoTestUtilities.hs20IconRows()).thenReturn(OvsdbDaoTestUtilities.hs20InsertIconRows()) + .thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.hs20IconRows()) + .thenReturn(OvsdbDaoTestUtilities.hs20IconRows()) + .thenReturn(OvsdbDaoTestUtilities.hs20InsertProviderRows()) + .thenReturn(OvsdbDaoTestUtilities.hs20Config()).thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()) + .thenReturn(OvsdbDaoTestUtilities.vifConfigRows()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows()) .thenReturn(OvsdbDaoTestUtilities.hs20Config()); Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult); @@ -283,7 +343,6 @@ public class OvsdbDaoTest { } - @Test public void testConfigureGreTunnelsWithNoLocalAddress() throws Exception { List rows = new ArrayList<>(); @@ -692,9 +751,7 @@ public class OvsdbDaoTest { } - static Row[] hs20Icons = { - }; } diff --git a/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTestUtilities.java b/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTestUtilities.java index e5daed6..d8564c8 100644 --- a/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTestUtilities.java +++ b/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDaoTestUtilities.java @@ -1,5 +1,7 @@ package com.telecominfraproject.wlan.opensync.ovsdb.dao; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -22,6 +24,9 @@ import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointN import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuIcon; import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuProviderProfile; import com.telecominfraproject.wlan.profile.passpoint.models.venue.PasspointVenueProfile; +import com.telecominfraproject.wlan.profile.radius.models.RadiusProfile; +import com.telecominfraproject.wlan.profile.radius.models.RadiusServer; +import com.telecominfraproject.wlan.profile.radius.models.RadiusServiceRegion; import com.telecominfraproject.wlan.profile.rf.models.RfConfiguration; import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration; import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration.SecureMode; @@ -38,42 +43,41 @@ public class OvsdbDaoTestUtilities { // Static creation of Profiles and Results to use with the OvsdbDao JUnit tests. - - static void createPasspointHotspot(Customer customer, Profile passpointHotspotConfig, + static void createPasspointHotspot(int customerId, Profile passpointHotspotConfig, Profile passpointOperatorProfile, Profile passpointVenueProfile, Profile hotspot20IdProviderProfile, Profile hotspot20IdProviderProfile2, Profile profileSsidPsk, Profile profileSsidOsu, Profile hotspotProfileAp) { - profileSsidPsk = createPasspointAccessSsid(customer); - profileSsidOsu = createPasspointOsuSsid(customer); + profileSsidPsk = createPasspointAccessSsid(customerId); + profileSsidOsu = createPasspointOsuSsid(customerId); - passpointOperatorProfile = createPasspointOperatorProfile(customer); + passpointOperatorProfile = createPasspointOperatorProfile(customerId); - passpointVenueProfile = createPasspointVenueProfile(customer); + passpointVenueProfile = createPasspointVenueProfile(customerId); - hotspot20IdProviderProfile = createPasspointIdProviderProfile(customer, hotspot20IdProviderProfile, + hotspot20IdProviderProfile = createPasspointIdProviderProfile(customerId, hotspot20IdProviderProfile, "TipWlan-Hotspot20-OSU-Provider", "Rogers AT&T Wireless", "Canada", "ca", 302, 720, "rogers.com", 1); - hotspot20IdProviderProfile2 = createPasspointIdProviderProfile(customer, hotspot20IdProviderProfile2, + hotspot20IdProviderProfile2 = createPasspointIdProviderProfile(customerId, hotspot20IdProviderProfile2, "TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302, 220, "telus.com", 1); profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId()); profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId()); - passpointHotspotConfig = createPasspointHotspotConfig(customer, hotspot20IdProviderProfile2, + passpointHotspotConfig = createPasspointHotspotConfig(customerId, hotspot20IdProviderProfile2, hotspot20IdProviderProfile, passpointOperatorProfile, passpointVenueProfile, profileSsidPsk, profileSsidOsu); - hotspotProfileAp = createPasspointApProfile(customer, profileSsidPsk, profileSsidOsu); + hotspotProfileAp = createPasspointApProfile(customerId, profileSsidPsk, profileSsidOsu); } - static Profile createPasspointHotspotConfig(Customer customer, Profile hotspot20IdProviderProfile2, + static Profile createPasspointHotspotConfig(int customerId, Profile hotspot20IdProviderProfile2, Profile hotspot20IdProviderProfile, Profile passpointOperatorProfile, Profile passpointVenueProfile, Profile profileSsidPsk, Profile profileSsidOpen) { Profile passpointHotspotConfig; passpointHotspotConfig = new Profile(); - passpointHotspotConfig.setCustomerId(customer.getId()); + passpointHotspotConfig.setCustomerId(customerId); passpointHotspotConfig.setName("TipWlan-Hotspot20-Config"); passpointHotspotConfig.setProfileType(ProfileType.passpoint); Set passpointHotspotConfigChildIds = new HashSet<>(); @@ -95,11 +99,11 @@ public class OvsdbDaoTestUtilities { return passpointHotspotConfig; } - static Profile createPasspointIdProviderProfile(Customer customer, Profile providerProfile, String providerName, + static Profile createPasspointIdProviderProfile(int customerId, Profile providerProfile, String providerName, String network, String country, String iso, int mcc, int mnc, String naiRealm, int countryCode) { Profile hotspot20IdProviderProfile; hotspot20IdProviderProfile = new Profile(); - hotspot20IdProviderProfile.setCustomerId(customer.getId()); + hotspot20IdProviderProfile.setCustomerId(customerId); hotspot20IdProviderProfile.setName(providerName); hotspot20IdProviderProfile.setProfileType(ProfileType.passpoint_osu_id_provider); PasspointMccMnc passpointMccMnc = PasspointMccMnc.createWithDefaults(); @@ -119,36 +123,36 @@ public class OvsdbDaoTestUtilities { roamingOi.add(Byte.valueOf("2")); roamingOi.add(Byte.valueOf("3")); roamingOi.add(Byte.valueOf("4")); - hotspot20IdProviderProfile = createOsuProviderProfile(customer, hotspot20IdProviderProfile, mccMncList, + hotspot20IdProviderProfile = createOsuProviderProfile(customerId, hotspot20IdProviderProfile, mccMncList, naiRealms, "https://example.com/osu/" + naiRealm.split(".com")[0], naiRealm.split(".com")[0], naiRealm, roamingOi); return hotspot20IdProviderProfile; } - static Profile createPasspointVenueProfile(Customer customer) { + static Profile createPasspointVenueProfile(int customerId) { Profile passpointVenueProfile; passpointVenueProfile = new Profile(); - passpointVenueProfile.setCustomerId(customer.getId()); + passpointVenueProfile.setCustomerId(customerId); passpointVenueProfile.setName("TipWlan-Hotspot20-Venue"); passpointVenueProfile.setProfileType(ProfileType.passpoint_venue); passpointVenueProfile.setDetails(PasspointVenueProfile.createWithDefaults()); return passpointVenueProfile; } - static Profile createPasspointOperatorProfile(Customer customer) { + static Profile createPasspointOperatorProfile(int customerId) { Profile passpointOperatorProfile; passpointOperatorProfile = new Profile(); - passpointOperatorProfile.setCustomerId(customer.getId()); + passpointOperatorProfile.setCustomerId(customerId); passpointOperatorProfile.setName("TipWlan-Hotspot20-Operator"); passpointOperatorProfile.setProfileType(ProfileType.passpoint_operator); passpointOperatorProfile.setDetails(PasspointOperatorProfile.createWithDefaults()); return passpointOperatorProfile; } - static Profile createPasspointAccessSsid(Customer customer) { + static Profile createPasspointAccessSsid(int customerId) { Profile profileSsidPsk; profileSsidPsk = new Profile(); - profileSsidPsk.setCustomerId(customer.getId()); + profileSsidPsk.setCustomerId(customerId); profileSsidPsk.setName("TipWlan-cloud-hotspot-access"); SsidConfiguration ssidConfigPsk = SsidConfiguration.createWithDefaults(); Set appliedRadiosPsk = new HashSet(); @@ -162,10 +166,10 @@ public class OvsdbDaoTestUtilities { return profileSsidPsk; } - static Profile createPasspointOsuSsid(Customer customer) { + static Profile createPasspointOsuSsid(int customerId) { Profile profileSsidPsk; profileSsidPsk = new Profile(); - profileSsidPsk.setCustomerId(customer.getId()); + profileSsidPsk.setCustomerId(customerId); profileSsidPsk.setName("TipWlan-cloud-hotspot-osu"); SsidConfiguration ssidConfigPsk = SsidConfiguration.createWithDefaults(); Set appliedRadiosPsk = new HashSet(); @@ -177,23 +181,23 @@ public class OvsdbDaoTestUtilities { return profileSsidPsk; } - static Profile createPasspointApProfile(Customer customer, Profile profileSsidPsk, Profile profileSsidOpen) { + static Profile createPasspointApProfile(int customerId, Profile profileSsidPsk, Profile profileSsidOpen) { Profile hotspotProfileAp = new Profile(); - hotspotProfileAp.setCustomerId(customer.getId()); + hotspotProfileAp.setCustomerId(customerId); hotspotProfileAp.setName("HotspotProfileAp"); hotspotProfileAp.setDetails(ApNetworkConfiguration.createWithDefaults()); hotspotProfileAp.getChildProfileIds().add(profileSsidPsk.getId()); hotspotProfileAp.getChildProfileIds().add(profileSsidOpen.getId()); - hotspotProfileAp.getChildProfileIds().add(createPasspointRfProfile(customer).getId()); + hotspotProfileAp.getChildProfileIds().add(createPasspointRfProfile(customerId).getId()); return hotspotProfileAp; } - static Profile createPasspointRfProfile(Customer customer) { + static Profile createPasspointRfProfile(int customerId) { Profile profileRf = new Profile(); - profileRf.setCustomerId(customer.getId()); + profileRf.setCustomerId(customerId); profileRf.setName("TipWlan-rf-passpoint"); RfConfiguration rfConfig = RfConfiguration.createWithDefaults(); rfConfig.getRfConfigMap().forEach((x, y) -> y.setRf("TipWlan-rf-passpoint")); @@ -202,7 +206,7 @@ public class OvsdbDaoTestUtilities { return profileRf; } - static Profile createOsuProviderProfile(Customer customer, Profile hotspot20IdProviderProfile, + static Profile createOsuProviderProfile(int customerId, Profile hotspot20IdProviderProfile, List mccMncList, Set realms, String serverUri, String suffix, String domainName, List roamingOi) { @@ -516,6 +520,28 @@ public class OvsdbDaoTestUtilities { return operationResult; } + static Profile createRadiusProfile(int customerId) { + Profile profileRadius = new Profile(); + profileRadius.setCustomerId(customerId); + profileRadius.setProfileType(ProfileType.radius); + profileRadius.setName("Radius-Profile"); + + RadiusProfile radiusDetails = new RadiusProfile(); + RadiusServiceRegion radiusServiceRegion = new RadiusServiceRegion(); + RadiusServer radiusServer = new RadiusServer(); + radiusServer.setAuthPort(1812); + try { + radiusServer.setIpAddress(InetAddress.getByName("192.168.0.1")); + } catch (UnknownHostException e) { + throw new IllegalArgumentException(e); + } + radiusServer.setSecret("testing123"); + radiusServiceRegion.addRadiusServer("Radius-Profile", radiusServer); + radiusServiceRegion.setRegionName("Ottawa"); + radiusDetails.addRadiusServiceRegion(radiusServiceRegion); + profileRadius.setDetails(radiusDetails); + return profileRadius; + } }