mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-22 12:55:02 +00:00
Radius Accounting Interval set on AP when using EAP or Radius security
This commit is contained in:
@@ -755,10 +755,6 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
LOG.debug("Select from AWLAN_Node:");
|
LOG.debug("Select from AWLAN_Node:");
|
||||||
|
|
||||||
for (OperationResult res : result) {
|
|
||||||
LOG.debug("Op Result {}", res);
|
|
||||||
}
|
|
||||||
|
|
||||||
String skuNumber = null;
|
String skuNumber = null;
|
||||||
String serialNumber = null;
|
String serialNumber = null;
|
||||||
String model = null;
|
String model = null;
|
||||||
@@ -769,6 +765,10 @@ public class OvsdbDao {
|
|||||||
row = ((SelectResult) result[0]).getRows().iterator().next();
|
row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (OperationResult res : result) {
|
||||||
|
LOG.debug("Op Result {}", res);
|
||||||
|
}
|
||||||
|
|
||||||
firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null;
|
firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null;
|
||||||
|
|
||||||
skuNumber = getSingleValueFromSet(row, "sku_number");
|
skuNumber = getSingleValueFromSet(row, "sku_number");
|
||||||
@@ -3406,10 +3406,10 @@ public class OvsdbDao {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getRadiusAccountingConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
void getRadiusAccountingConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
||||||
Map<String, String> security) {
|
Map<String, String> security) {
|
||||||
|
|
||||||
LOG.debug("getRadiusAccountingConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig,
|
LOG.info("getRadiusAccountingConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig,
|
||||||
opensyncApConfig.getRadiusProfiles());
|
opensyncApConfig.getRadiusProfiles());
|
||||||
|
|
||||||
List<Profile> radiusServiceList = opensyncApConfig.getRadiusProfiles().stream()
|
List<Profile> radiusServiceList = opensyncApConfig.getRadiusProfiles().stream()
|
||||||
@@ -3438,26 +3438,42 @@ public class OvsdbDao {
|
|||||||
security.put("radius_acct_port",
|
security.put("radius_acct_port",
|
||||||
rServer.getAuthPort() != null ? String.valueOf(rServer.getAuthPort()) : null);
|
rServer.getAuthPort() != null ? String.valueOf(rServer.getAuthPort()) : null);
|
||||||
security.put("radius_acct_secret", rServer.getSecret());
|
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(
|
LOG.info(
|
||||||
"set Radius Accounting server attributes radius_acct_ip {} radius_acct_port {} radius_acct_secret {}",
|
"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_ip"), security.get("radius_acct_port"),
|
||||||
security.get("radius_acct_secret"));
|
security.get("radius_acct_secret"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Could not get RadiusServerConfiguration for {} from RadiusProfile {}",
|
LOG.warn("Could not get RadiusServerConfiguration for {} from RadiusProfile {}",
|
||||||
ssidConfig.getRadiusServiceName(), profileRadius);
|
ssidConfig.getRadiusAccountingServiceName(), profileRadius);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Could not get RadiusServiceRegion {} from RadiusProfile {}", region, profileRadius);
|
LOG.warn("Could not get RadiusServiceRegion {} from RadiusProfile {}", region, profileRadius);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.warn("Could not find radius profile {} in {}", ssidConfig.getRadiusServiceName(),
|
LOG.warn("Could not find radius profile {} in {}", ssidConfig.getRadiusAccountingServiceName(),
|
||||||
opensyncApConfig.getRadiusProfiles());
|
opensyncApConfig.getRadiusProfiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
void getRadiusConfiguration(OpensyncAPConfig opensyncApConfig, SsidConfiguration ssidConfig,
|
||||||
Map<String, String> security) {
|
Map<String, String> security) {
|
||||||
|
|
||||||
LOG.debug("getRadiusConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig,
|
LOG.debug("getRadiusConfiguration for ssidConfig {} from radiusProfiles {}", ssidConfig,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@ import java.net.InetAddress;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
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.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
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.ConnectNodeInfo;
|
||||||
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPConfig;
|
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.OpensyncAPHotspot20Config;
|
||||||
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;
|
||||||
|
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.exception.OvsdbClientException;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Atom;
|
import com.vmware.ovsdb.protocol.operation.notation.Atom;
|
||||||
import com.vmware.ovsdb.protocol.operation.notation.Row;
|
import com.vmware.ovsdb.protocol.operation.notation.Row;
|
||||||
@@ -62,6 +66,8 @@ import com.vmware.ovsdb.service.OvsdbClient;
|
|||||||
})
|
})
|
||||||
public class OvsdbDaoTest {
|
public class OvsdbDaoTest {
|
||||||
|
|
||||||
|
static final int DEFAULT_CUSTOMER_ID = 1;
|
||||||
|
|
||||||
private static final long HOTSPOT_CONFIG_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_1 = 2;
|
||||||
private static final long HOTSPOT_PROVIDER_ID_2 = 3;
|
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<String, String> 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<String, String> 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<String, String> 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
|
@Test
|
||||||
public void testConfigureHotspots() throws Exception {
|
public void testConfigureHotspots() throws Exception {
|
||||||
@@ -225,36 +283,35 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
OpensyncAPConfig apConfig = new OpensyncAPConfig();
|
OpensyncAPConfig apConfig = new OpensyncAPConfig();
|
||||||
OpensyncAPHotspot20Config hsConfig = new OpensyncAPHotspot20Config();
|
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);
|
profileSsidPsk.setId(SSID_PSK_ID);
|
||||||
Profile profileSsidOsu = OvsdbDaoTestUtilities.createPasspointOsuSsid(customer);
|
Profile profileSsidOsu = OvsdbDaoTestUtilities.createPasspointOsuSsid(DEFAULT_CUSTOMER_ID);
|
||||||
profileSsidOsu.setId(SSID_OSU_ID);
|
profileSsidOsu.setId(SSID_OSU_ID);
|
||||||
Profile passpointOperatorProfile = OvsdbDaoTestUtilities.createPasspointOperatorProfile(customer);
|
Profile passpointOperatorProfile = OvsdbDaoTestUtilities.createPasspointOperatorProfile(DEFAULT_CUSTOMER_ID);
|
||||||
passpointOperatorProfile.setId(OPERATOR_ID);
|
passpointOperatorProfile.setId(OPERATOR_ID);
|
||||||
Profile passpointVenueProfile = OvsdbDaoTestUtilities.createPasspointVenueProfile(customer);
|
Profile passpointVenueProfile = OvsdbDaoTestUtilities.createPasspointVenueProfile(DEFAULT_CUSTOMER_ID);
|
||||||
passpointVenueProfile.setId(VENUE_ID);
|
passpointVenueProfile.setId(VENUE_ID);
|
||||||
Profile hotspot20IdProviderProfile = new Profile();
|
Profile hotspot20IdProviderProfile = new Profile();
|
||||||
hotspot20IdProviderProfile.setId(HOTSPOT_PROVIDER_ID_1);
|
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",
|
hotspot20IdProviderProfile, "TipWlan-Hotspot20-OSU-Provider", "Rogers AT&T Wireless", "Canada", "ca",
|
||||||
302, 720, "rogers.com", 1);
|
302, 720, "rogers.com", 1);
|
||||||
Profile hotspot20IdProviderProfile2 = new Profile();
|
Profile hotspot20IdProviderProfile2 = new Profile();
|
||||||
hotspot20IdProviderProfile2.setId(HOTSPOT_PROVIDER_ID_2);
|
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,
|
hotspot20IdProviderProfile2, "TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302,
|
||||||
220, "telus.com", 1);
|
220, "telus.com", 1);
|
||||||
|
|
||||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
||||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
||||||
|
|
||||||
Profile passpointHotspotConfig = OvsdbDaoTestUtilities.createPasspointHotspotConfig(customer,
|
Profile passpointHotspotConfig = OvsdbDaoTestUtilities.createPasspointHotspotConfig(DEFAULT_CUSTOMER_ID,
|
||||||
hotspot20IdProviderProfile2, hotspot20IdProviderProfile, passpointOperatorProfile,
|
hotspot20IdProviderProfile2, hotspot20IdProviderProfile, passpointOperatorProfile,
|
||||||
passpointVenueProfile, profileSsidPsk, profileSsidOsu);
|
passpointVenueProfile, profileSsidPsk, profileSsidOsu);
|
||||||
passpointHotspotConfig.setId(HOTSPOT_CONFIG_ID);
|
passpointHotspotConfig.setId(HOTSPOT_CONFIG_ID);
|
||||||
|
|
||||||
Profile hotspotProfileAp = OvsdbDaoTestUtilities.createPasspointApProfile(customer, profileSsidPsk,
|
Profile hotspotProfileAp = OvsdbDaoTestUtilities.createPasspointApProfile(DEFAULT_CUSTOMER_ID, profileSsidPsk,
|
||||||
profileSsidOsu);
|
profileSsidOsu);
|
||||||
hotspotProfileAp.setId(EQUIPMENT_AP_ID);
|
hotspotProfileAp.setId(EQUIPMENT_AP_ID);
|
||||||
|
|
||||||
@@ -269,10 +326,13 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
apConfig.setSsidProfile(List.of(profileSsidOsu, profileSsidPsk));
|
apConfig.setSsidProfile(List.of(profileSsidOsu, profileSsidPsk));
|
||||||
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS)))
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20InsertIconRows()).thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
.thenReturn(OvsdbDaoTestUtilities.hs20IconRows()).thenReturn(OvsdbDaoTestUtilities.hs20InsertIconRows())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20IconRows()).thenReturn(OvsdbDaoTestUtilities.hs20InsertProviderRows()).thenReturn(OvsdbDaoTestUtilities.hs20Config())
|
.thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows())
|
.thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
||||||
|
.thenReturn(OvsdbDaoTestUtilities.hs20InsertProviderRows())
|
||||||
|
.thenReturn(OvsdbDaoTestUtilities.hs20Config()).thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders())
|
||||||
|
.thenReturn(OvsdbDaoTestUtilities.vifConfigRows()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20Config());
|
.thenReturn(OvsdbDaoTestUtilities.hs20Config());
|
||||||
|
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
||||||
@@ -283,7 +343,6 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConfigureGreTunnelsWithNoLocalAddress() throws Exception {
|
public void testConfigureGreTunnelsWithNoLocalAddress() throws Exception {
|
||||||
List<Row> rows = new ArrayList<>();
|
List<Row> rows = new ArrayList<>();
|
||||||
@@ -692,9 +751,7 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Row[] hs20Icons = {
|
static Row[] hs20Icons = {
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
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.PasspointOsuIcon;
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuProviderProfile;
|
import com.telecominfraproject.wlan.profile.passpoint.models.provider.PasspointOsuProviderProfile;
|
||||||
import com.telecominfraproject.wlan.profile.passpoint.models.venue.PasspointVenueProfile;
|
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.rf.models.RfConfiguration;
|
||||||
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
|
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
|
||||||
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration.SecureMode;
|
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 creation of Profiles and Results to use with the OvsdbDao JUnit tests.
|
||||||
|
static void createPasspointHotspot(int customerId, Profile passpointHotspotConfig,
|
||||||
static void createPasspointHotspot(Customer customer, Profile passpointHotspotConfig,
|
|
||||||
Profile passpointOperatorProfile, Profile passpointVenueProfile, Profile hotspot20IdProviderProfile,
|
Profile passpointOperatorProfile, Profile passpointVenueProfile, Profile hotspot20IdProviderProfile,
|
||||||
Profile hotspot20IdProviderProfile2, Profile profileSsidPsk, Profile profileSsidOsu,
|
Profile hotspot20IdProviderProfile2, Profile profileSsidPsk, Profile profileSsidOsu,
|
||||||
Profile hotspotProfileAp) {
|
Profile hotspotProfileAp) {
|
||||||
|
|
||||||
profileSsidPsk = createPasspointAccessSsid(customer);
|
profileSsidPsk = createPasspointAccessSsid(customerId);
|
||||||
profileSsidOsu = createPasspointOsuSsid(customer);
|
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);
|
"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);
|
"TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302, 220, "telus.com", 1);
|
||||||
|
|
||||||
|
|
||||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
||||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
||||||
|
|
||||||
passpointHotspotConfig = createPasspointHotspotConfig(customer, hotspot20IdProviderProfile2,
|
passpointHotspotConfig = createPasspointHotspotConfig(customerId, hotspot20IdProviderProfile2,
|
||||||
hotspot20IdProviderProfile, passpointOperatorProfile, passpointVenueProfile, profileSsidPsk,
|
hotspot20IdProviderProfile, passpointOperatorProfile, passpointVenueProfile, profileSsidPsk,
|
||||||
profileSsidOsu);
|
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 hotspot20IdProviderProfile, Profile passpointOperatorProfile, Profile passpointVenueProfile,
|
||||||
Profile profileSsidPsk, Profile profileSsidOpen) {
|
Profile profileSsidPsk, Profile profileSsidOpen) {
|
||||||
Profile passpointHotspotConfig;
|
Profile passpointHotspotConfig;
|
||||||
passpointHotspotConfig = new Profile();
|
passpointHotspotConfig = new Profile();
|
||||||
passpointHotspotConfig.setCustomerId(customer.getId());
|
passpointHotspotConfig.setCustomerId(customerId);
|
||||||
passpointHotspotConfig.setName("TipWlan-Hotspot20-Config");
|
passpointHotspotConfig.setName("TipWlan-Hotspot20-Config");
|
||||||
passpointHotspotConfig.setProfileType(ProfileType.passpoint);
|
passpointHotspotConfig.setProfileType(ProfileType.passpoint);
|
||||||
Set<Long> passpointHotspotConfigChildIds = new HashSet<>();
|
Set<Long> passpointHotspotConfigChildIds = new HashSet<>();
|
||||||
@@ -95,11 +99,11 @@ public class OvsdbDaoTestUtilities {
|
|||||||
return passpointHotspotConfig;
|
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) {
|
String network, String country, String iso, int mcc, int mnc, String naiRealm, int countryCode) {
|
||||||
Profile hotspot20IdProviderProfile;
|
Profile hotspot20IdProviderProfile;
|
||||||
hotspot20IdProviderProfile = new Profile();
|
hotspot20IdProviderProfile = new Profile();
|
||||||
hotspot20IdProviderProfile.setCustomerId(customer.getId());
|
hotspot20IdProviderProfile.setCustomerId(customerId);
|
||||||
hotspot20IdProviderProfile.setName(providerName);
|
hotspot20IdProviderProfile.setName(providerName);
|
||||||
hotspot20IdProviderProfile.setProfileType(ProfileType.passpoint_osu_id_provider);
|
hotspot20IdProviderProfile.setProfileType(ProfileType.passpoint_osu_id_provider);
|
||||||
PasspointMccMnc passpointMccMnc = PasspointMccMnc.createWithDefaults();
|
PasspointMccMnc passpointMccMnc = PasspointMccMnc.createWithDefaults();
|
||||||
@@ -119,36 +123,36 @@ public class OvsdbDaoTestUtilities {
|
|||||||
roamingOi.add(Byte.valueOf("2"));
|
roamingOi.add(Byte.valueOf("2"));
|
||||||
roamingOi.add(Byte.valueOf("3"));
|
roamingOi.add(Byte.valueOf("3"));
|
||||||
roamingOi.add(Byte.valueOf("4"));
|
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,
|
naiRealms, "https://example.com/osu/" + naiRealm.split(".com")[0], naiRealm.split(".com")[0], naiRealm,
|
||||||
roamingOi);
|
roamingOi);
|
||||||
return hotspot20IdProviderProfile;
|
return hotspot20IdProviderProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createPasspointVenueProfile(Customer customer) {
|
static Profile createPasspointVenueProfile(int customerId) {
|
||||||
Profile passpointVenueProfile;
|
Profile passpointVenueProfile;
|
||||||
passpointVenueProfile = new Profile();
|
passpointVenueProfile = new Profile();
|
||||||
passpointVenueProfile.setCustomerId(customer.getId());
|
passpointVenueProfile.setCustomerId(customerId);
|
||||||
passpointVenueProfile.setName("TipWlan-Hotspot20-Venue");
|
passpointVenueProfile.setName("TipWlan-Hotspot20-Venue");
|
||||||
passpointVenueProfile.setProfileType(ProfileType.passpoint_venue);
|
passpointVenueProfile.setProfileType(ProfileType.passpoint_venue);
|
||||||
passpointVenueProfile.setDetails(PasspointVenueProfile.createWithDefaults());
|
passpointVenueProfile.setDetails(PasspointVenueProfile.createWithDefaults());
|
||||||
return passpointVenueProfile;
|
return passpointVenueProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createPasspointOperatorProfile(Customer customer) {
|
static Profile createPasspointOperatorProfile(int customerId) {
|
||||||
Profile passpointOperatorProfile;
|
Profile passpointOperatorProfile;
|
||||||
passpointOperatorProfile = new Profile();
|
passpointOperatorProfile = new Profile();
|
||||||
passpointOperatorProfile.setCustomerId(customer.getId());
|
passpointOperatorProfile.setCustomerId(customerId);
|
||||||
passpointOperatorProfile.setName("TipWlan-Hotspot20-Operator");
|
passpointOperatorProfile.setName("TipWlan-Hotspot20-Operator");
|
||||||
passpointOperatorProfile.setProfileType(ProfileType.passpoint_operator);
|
passpointOperatorProfile.setProfileType(ProfileType.passpoint_operator);
|
||||||
passpointOperatorProfile.setDetails(PasspointOperatorProfile.createWithDefaults());
|
passpointOperatorProfile.setDetails(PasspointOperatorProfile.createWithDefaults());
|
||||||
return passpointOperatorProfile;
|
return passpointOperatorProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createPasspointAccessSsid(Customer customer) {
|
static Profile createPasspointAccessSsid(int customerId) {
|
||||||
Profile profileSsidPsk;
|
Profile profileSsidPsk;
|
||||||
profileSsidPsk = new Profile();
|
profileSsidPsk = new Profile();
|
||||||
profileSsidPsk.setCustomerId(customer.getId());
|
profileSsidPsk.setCustomerId(customerId);
|
||||||
profileSsidPsk.setName("TipWlan-cloud-hotspot-access");
|
profileSsidPsk.setName("TipWlan-cloud-hotspot-access");
|
||||||
SsidConfiguration ssidConfigPsk = SsidConfiguration.createWithDefaults();
|
SsidConfiguration ssidConfigPsk = SsidConfiguration.createWithDefaults();
|
||||||
Set<RadioType> appliedRadiosPsk = new HashSet<RadioType>();
|
Set<RadioType> appliedRadiosPsk = new HashSet<RadioType>();
|
||||||
@@ -162,10 +166,10 @@ public class OvsdbDaoTestUtilities {
|
|||||||
return profileSsidPsk;
|
return profileSsidPsk;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createPasspointOsuSsid(Customer customer) {
|
static Profile createPasspointOsuSsid(int customerId) {
|
||||||
Profile profileSsidPsk;
|
Profile profileSsidPsk;
|
||||||
profileSsidPsk = new Profile();
|
profileSsidPsk = new Profile();
|
||||||
profileSsidPsk.setCustomerId(customer.getId());
|
profileSsidPsk.setCustomerId(customerId);
|
||||||
profileSsidPsk.setName("TipWlan-cloud-hotspot-osu");
|
profileSsidPsk.setName("TipWlan-cloud-hotspot-osu");
|
||||||
SsidConfiguration ssidConfigPsk = SsidConfiguration.createWithDefaults();
|
SsidConfiguration ssidConfigPsk = SsidConfiguration.createWithDefaults();
|
||||||
Set<RadioType> appliedRadiosPsk = new HashSet<RadioType>();
|
Set<RadioType> appliedRadiosPsk = new HashSet<RadioType>();
|
||||||
@@ -177,23 +181,23 @@ public class OvsdbDaoTestUtilities {
|
|||||||
return profileSsidPsk;
|
return profileSsidPsk;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createPasspointApProfile(Customer customer, Profile profileSsidPsk, Profile profileSsidOpen) {
|
static Profile createPasspointApProfile(int customerId, Profile profileSsidPsk, Profile profileSsidOpen) {
|
||||||
|
|
||||||
Profile hotspotProfileAp = new Profile();
|
Profile hotspotProfileAp = new Profile();
|
||||||
hotspotProfileAp.setCustomerId(customer.getId());
|
hotspotProfileAp.setCustomerId(customerId);
|
||||||
hotspotProfileAp.setName("HotspotProfileAp");
|
hotspotProfileAp.setName("HotspotProfileAp");
|
||||||
hotspotProfileAp.setDetails(ApNetworkConfiguration.createWithDefaults());
|
hotspotProfileAp.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||||
hotspotProfileAp.getChildProfileIds().add(profileSsidPsk.getId());
|
hotspotProfileAp.getChildProfileIds().add(profileSsidPsk.getId());
|
||||||
hotspotProfileAp.getChildProfileIds().add(profileSsidOpen.getId());
|
hotspotProfileAp.getChildProfileIds().add(profileSsidOpen.getId());
|
||||||
hotspotProfileAp.getChildProfileIds().add(createPasspointRfProfile(customer).getId());
|
hotspotProfileAp.getChildProfileIds().add(createPasspointRfProfile(customerId).getId());
|
||||||
return hotspotProfileAp;
|
return hotspotProfileAp;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createPasspointRfProfile(Customer customer) {
|
static Profile createPasspointRfProfile(int customerId) {
|
||||||
|
|
||||||
Profile profileRf = new Profile();
|
Profile profileRf = new Profile();
|
||||||
profileRf.setCustomerId(customer.getId());
|
profileRf.setCustomerId(customerId);
|
||||||
profileRf.setName("TipWlan-rf-passpoint");
|
profileRf.setName("TipWlan-rf-passpoint");
|
||||||
RfConfiguration rfConfig = RfConfiguration.createWithDefaults();
|
RfConfiguration rfConfig = RfConfiguration.createWithDefaults();
|
||||||
rfConfig.getRfConfigMap().forEach((x, y) -> y.setRf("TipWlan-rf-passpoint"));
|
rfConfig.getRfConfigMap().forEach((x, y) -> y.setRf("TipWlan-rf-passpoint"));
|
||||||
@@ -202,7 +206,7 @@ public class OvsdbDaoTestUtilities {
|
|||||||
return profileRf;
|
return profileRf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Profile createOsuProviderProfile(Customer customer, Profile hotspot20IdProviderProfile,
|
static Profile createOsuProviderProfile(int customerId, Profile hotspot20IdProviderProfile,
|
||||||
List<PasspointMccMnc> mccMncList, Set<String> realms, String serverUri, String suffix, String domainName,
|
List<PasspointMccMnc> mccMncList, Set<String> realms, String serverUri, String suffix, String domainName,
|
||||||
List<Byte> roamingOi) {
|
List<Byte> roamingOi) {
|
||||||
|
|
||||||
@@ -516,6 +520,28 @@ public class OvsdbDaoTestUtilities {
|
|||||||
return operationResult;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user