mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 19:17:52 +00:00
WIFI-1170: Need to support Auto-Provisioning in disabled mode (#19)
This commit is contained in:
@@ -782,106 +782,100 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||||
if (ovsdbSession == null) {
|
if (ovsdbSession == null) {
|
||||||
throw new IllegalStateException("AP is not connected " + apId);
|
throw new IllegalStateException("AP is not connected " + apId);
|
||||||
}
|
}
|
||||||
int customerId = ovsdbSession.getCustomerId();
|
int customerId = ovsdbSession.getCustomerId();
|
||||||
Customer customer = customerServiceInterface.getOrNull(customerId);
|
|
||||||
if ((customer != null) && (customer.getDetails() != null)
|
Equipment equipmentConfig = equipmentServiceInterface.getByInventoryIdOrNull(apId);
|
||||||
&& (customer.getDetails().getAutoProvisioning() != null)
|
if (equipmentConfig == null) {
|
||||||
&& customer.getDetails().getAutoProvisioning().isEnabled()) {
|
throw new IllegalStateException("Cannot retrieve configuration for " + apId);
|
||||||
Equipment equipmentConfig = equipmentServiceInterface.getByInventoryIdOrNull(apId);
|
}
|
||||||
|
|
||||||
if (equipmentConfig == null) {
|
ret = new OpensyncAPConfig();
|
||||||
throw new IllegalStateException("Cannot retrieve configuration for " + apId);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = new OpensyncAPConfig();
|
ret.setCustomerEquipment(equipmentConfig);
|
||||||
|
|
||||||
ret.setCustomerEquipment(equipmentConfig);
|
Location eqLocation = locationServiceInterface.get(equipmentConfig.getLocationId());
|
||||||
|
|
||||||
Location eqLocation = locationServiceInterface.get(equipmentConfig.getLocationId());
|
ret.setEquipmentLocation(eqLocation);
|
||||||
|
|
||||||
ret.setEquipmentLocation(eqLocation);
|
ProfileContainer profileContainer = new ProfileContainer(
|
||||||
|
profileServiceInterface.getProfileWithChildren(equipmentConfig.getProfileId()));
|
||||||
|
|
||||||
ProfileContainer profileContainer = new ProfileContainer(
|
ret.setApProfile(profileContainer.getOrNull(equipmentConfig.getProfileId()));
|
||||||
profileServiceInterface.getProfileWithChildren(equipmentConfig.getProfileId()));
|
|
||||||
|
|
||||||
ret.setApProfile(profileContainer.getOrNull(equipmentConfig.getProfileId()));
|
ret.setRfProfile(profileContainer.getChildOfTypeOrNull(equipmentConfig.getProfileId(), ProfileType.rf));
|
||||||
|
|
||||||
ret.setRfProfile(profileContainer.getChildOfTypeOrNull(equipmentConfig.getProfileId(), ProfileType.rf));
|
ret.setSsidProfile(
|
||||||
|
profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid));
|
||||||
|
|
||||||
ret.setSsidProfile(
|
ret.setMetricsProfiles(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(),
|
||||||
profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid));
|
ProfileType.service_metrics_collection_config));
|
||||||
|
|
||||||
ret.setMetricsProfiles(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(),
|
Set<Profile> radiusSet = new HashSet<>();
|
||||||
ProfileType.service_metrics_collection_config));
|
Set<Long> captiveProfileIds = new HashSet<>();
|
||||||
|
Set<Long> bonjourGatewayProfileIds = new HashSet<>();
|
||||||
|
|
||||||
Set<Profile> radiusSet = new HashSet<>();
|
OpensyncAPHotspot20Config hotspotConfig = new OpensyncAPHotspot20Config();
|
||||||
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<>();
|
||||||
|
|
||||||
Set<Profile> hotspot20ProfileSet = new HashSet<>();
|
for (Profile ssidProfile : ret.getSsidProfile()) {
|
||||||
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.passpoint));
|
||||||
|
|
||||||
hotspot20ProfileSet
|
radiusSet
|
||||||
.addAll(profileContainer.getChildrenOfType(ssidProfile.getId(), ProfileType.passpoint));
|
.addAll(profileContainer.getChildrenOfType(ret.getApProfile().getId(), ProfileType.radius));
|
||||||
|
if (ssidProfile.getDetails() != null) {
|
||||||
|
Long captivePortId = ((SsidConfiguration) ssidProfile.getDetails()).getCaptivePortalId();
|
||||||
|
if (captivePortId != null) {
|
||||||
|
captiveProfileIds.add(captivePortId);
|
||||||
|
}
|
||||||
|
Long bonjourGatewayProfileId = ((SsidConfiguration) ssidProfile.getDetails())
|
||||||
|
.getBonjourGatewayProfileId();
|
||||||
|
if (bonjourGatewayProfileId != null) {
|
||||||
|
bonjourGatewayProfileIds.add(bonjourGatewayProfileId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
radiusSet
|
if (hotspot20ProfileSet.size() > 0) {
|
||||||
.addAll(profileContainer.getChildrenOfType(ret.getApProfile().getId(), ProfileType.radius));
|
for (Profile hotspot20Profile : hotspot20ProfileSet) {
|
||||||
if (ssidProfile.getDetails() != null) {
|
hotspot20OperatorSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
|
||||||
Long captivePortId = ((SsidConfiguration) ssidProfile.getDetails()).getCaptivePortalId();
|
ProfileType.passpoint_operator));
|
||||||
if (captivePortId != null) {
|
hotspot20VenueSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
|
||||||
captiveProfileIds.add(captivePortId);
|
ProfileType.passpoint_venue));
|
||||||
}
|
hotspot20ProviderSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
|
||||||
Long bonjourGatewayProfileId = ((SsidConfiguration) ssidProfile.getDetails())
|
ProfileType.passpoint_osu_id_provider));
|
||||||
.getBonjourGatewayProfileId();
|
}
|
||||||
if (bonjourGatewayProfileId != null) {
|
hotspotConfig.setHotspot20OperatorSet(hotspot20OperatorSet);
|
||||||
bonjourGatewayProfileIds.add(bonjourGatewayProfileId);
|
hotspotConfig.setHotspot20ProfileSet(hotspot20ProfileSet);
|
||||||
}
|
hotspotConfig.setHotspot20ProviderSet(hotspot20ProviderSet);
|
||||||
}
|
hotspotConfig.setHotspot20VenueSet(hotspot20VenueSet);
|
||||||
}
|
|
||||||
|
|
||||||
if (hotspot20ProfileSet.size() > 0) {
|
ret.setHotspotConfig(hotspotConfig);
|
||||||
for (Profile hotspot20Profile : hotspot20ProfileSet) {
|
}
|
||||||
hotspot20OperatorSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
|
|
||||||
ProfileType.passpoint_operator));
|
|
||||||
hotspot20VenueSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
|
|
||||||
ProfileType.passpoint_venue));
|
|
||||||
hotspot20ProviderSet.addAll(profileContainer.getChildrenOfType(hotspot20Profile.getId(),
|
|
||||||
ProfileType.passpoint_osu_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));
|
||||||
|
|
||||||
ret.setRadiusProfiles(new ArrayList<>(radiusSet));
|
List<com.telecominfraproject.wlan.client.models.Client> blockedClients = clientServiceInterface
|
||||||
ret.setCaptiveProfiles(profileServiceInterface.get(captiveProfileIds));
|
.getBlockedClients(customerId);
|
||||||
ret.setBonjourGatewayProfiles(profileServiceInterface.get(bonjourGatewayProfileIds));
|
List<MacAddress> blockList = Lists.newArrayList();
|
||||||
|
if ((blockedClients != null) && !blockedClients.isEmpty()) {
|
||||||
|
blockedClients.forEach(client -> blockList.add(client.getMacAddress()));
|
||||||
|
}
|
||||||
|
ret.setBlockedClients(blockList);
|
||||||
|
|
||||||
List<com.telecominfraproject.wlan.client.models.Client> blockedClients = clientServiceInterface
|
LOG.debug("ApConfig {}", ret);
|
||||||
.getBlockedClients(customerId);
|
|
||||||
List<MacAddress> blockList = Lists.newArrayList();
|
|
||||||
if ((blockedClients != null) && !blockedClients.isEmpty()) {
|
|
||||||
blockedClients.forEach(client -> blockList.add(client.getMacAddress()));
|
|
||||||
}
|
|
||||||
ret.setBlockedClients(blockList);
|
|
||||||
|
|
||||||
LOG.debug("ApConfig {}", ret);
|
|
||||||
} else {
|
|
||||||
LOG.info("Autoconfig is not enabled for this AP {}", apId);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Cannot read config for AP {}", apId, e);
|
LOG.error("Cannot read config for AP {}", apId, e);
|
||||||
@@ -1544,7 +1538,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
|||||||
protocolStatusData
|
protocolStatusData
|
||||||
.setReportedHwVersion(opensyncAPState.getPlatformVersion());
|
.setReportedHwVersion(opensyncAPState.getPlatformVersion());
|
||||||
protocolStatusData.setSystemName(opensyncAPState.getModel());
|
protocolStatusData.setSystemName(opensyncAPState.getModel());
|
||||||
}
|
}
|
||||||
return protocolStatus;
|
return protocolStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user