mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 02:57:49 +00:00
Integrate RF survey reportwith cloud backend, OSGW: Support RADIUS and WPA Enterprise pre-work
This commit is contained in:
@@ -24,177 +24,186 @@ import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
|
||||
|
||||
public class OpensyncAPConfig extends BaseJsonModel {
|
||||
|
||||
private static final long serialVersionUID = 3917975477206236668L;
|
||||
private static final long serialVersionUID = 3917975477206236668L;
|
||||
|
||||
private Equipment customerEquipment;
|
||||
private Profile apProfile;
|
||||
private List<Profile> ssidProfile;
|
||||
private Location equipmentLocation;
|
||||
private EquipmentRoutingRecord equipmentRouting;
|
||||
private EquipmentGatewayRecord equipmentGateway;
|
||||
private Equipment customerEquipment;
|
||||
private Profile apProfile;
|
||||
private List<Profile> ssidProfile;
|
||||
private List<Profile> radiusProfiles;
|
||||
private Location equipmentLocation;
|
||||
private EquipmentRoutingRecord equipmentRouting;
|
||||
private EquipmentGatewayRecord equipmentGateway;
|
||||
|
||||
// Handle Legacy Config Support
|
||||
public void setRadioConfig(OpensyncAPRadioConfig radioConfig) {
|
||||
// Handle Legacy Config Support
|
||||
public void setRadioConfig(OpensyncAPRadioConfig radioConfig) {
|
||||
|
||||
if (customerEquipment == null) {
|
||||
customerEquipment = new Equipment();
|
||||
customerEquipment.setId(0);
|
||||
customerEquipment.setEquipmentType(EquipmentType.AP);
|
||||
customerEquipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
ApElementConfiguration apConfig = (ApElementConfiguration) customerEquipment.getDetails();
|
||||
apConfig.getRadioMap().get(RadioType.is2dot4GHz).setChannelNumber(radioConfig.getRadioChannel24G());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzL).setChannelNumber(radioConfig.getRadioChannel5LG());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzU).setChannelNumber(radioConfig.getRadioChannel5HG());
|
||||
customerEquipment.setDetails(apConfig);
|
||||
}
|
||||
if (customerEquipment == null) {
|
||||
customerEquipment = new Equipment();
|
||||
customerEquipment.setId(0);
|
||||
customerEquipment.setEquipmentType(EquipmentType.AP);
|
||||
customerEquipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
ApElementConfiguration apConfig = (ApElementConfiguration) customerEquipment.getDetails();
|
||||
apConfig.getRadioMap().get(RadioType.is2dot4GHz).setChannelNumber(radioConfig.getRadioChannel24G());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzL).setChannelNumber(radioConfig.getRadioChannel5LG());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzU).setChannelNumber(radioConfig.getRadioChannel5HG());
|
||||
customerEquipment.setDetails(apConfig);
|
||||
}
|
||||
|
||||
if (equipmentLocation == null) {
|
||||
equipmentLocation = new Location();
|
||||
equipmentLocation.setId(1);
|
||||
equipmentLocation.setDetails(LocationDetails.createWithDefaults());
|
||||
((LocationDetails) equipmentLocation.getDetails())
|
||||
.setCountryCode(CountryCode.getByName(radioConfig.getCountry().toLowerCase()));
|
||||
customerEquipment.setLocationId(equipmentLocation.getId());
|
||||
}
|
||||
if (equipmentLocation == null) {
|
||||
equipmentLocation = new Location();
|
||||
equipmentLocation.setId(1);
|
||||
equipmentLocation.setDetails(LocationDetails.createWithDefaults());
|
||||
((LocationDetails) equipmentLocation.getDetails())
|
||||
.setCountryCode(CountryCode.getByName(radioConfig.getCountry().toLowerCase()));
|
||||
customerEquipment.setLocationId(equipmentLocation.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Legacy Config Support
|
||||
public void setSsidConfigs(List<OpensyncAPSsidConfig> ssidConfigs) {
|
||||
// Handle Legacy Config Support
|
||||
public void setSsidConfigs(List<OpensyncAPSsidConfig> ssidConfigs) {
|
||||
|
||||
if (apProfile == null) {
|
||||
apProfile = new Profile();
|
||||
apProfile.setName("GeneratedApProfile");
|
||||
apProfile.setId(2);
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
}
|
||||
if (apProfile == null) {
|
||||
apProfile = new Profile();
|
||||
apProfile.setName("GeneratedApProfile");
|
||||
apProfile.setId(2);
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
}
|
||||
|
||||
long ssidProfileId = 3;
|
||||
for (OpensyncAPSsidConfig ssidConfig : ssidConfigs) {
|
||||
long ssidProfileId = 3;
|
||||
for (OpensyncAPSsidConfig ssidConfig : ssidConfigs) {
|
||||
|
||||
Profile profile = new Profile();
|
||||
profile.setProfileType(ProfileType.ssid);
|
||||
profile.setName(ssidConfig.getSsid());
|
||||
SsidConfiguration cfg = SsidConfiguration.createWithDefaults();
|
||||
Set<RadioType> appliedRadios = new HashSet<RadioType>();
|
||||
appliedRadios.add(ssidConfig.getRadioType());
|
||||
cfg.setAppliedRadios(appliedRadios);
|
||||
cfg.setSsid(ssidConfig.getSsid());
|
||||
if (ssidConfig.getEncryption().equals("WPA-PSK") && ssidConfig.getMode().equals("1"))
|
||||
cfg.setSecureMode(SecureMode.wpaPSK);
|
||||
else
|
||||
cfg.setSecureMode(SecureMode.wpa2PSK);
|
||||
cfg.setBroadcastSsid(ssidConfig.isBroadcast() ? StateSetting.enabled : StateSetting.disabled);
|
||||
Profile profile = new Profile();
|
||||
profile.setProfileType(ProfileType.ssid);
|
||||
profile.setName(ssidConfig.getSsid());
|
||||
SsidConfiguration cfg = SsidConfiguration.createWithDefaults();
|
||||
Set<RadioType> appliedRadios = new HashSet<RadioType>();
|
||||
appliedRadios.add(ssidConfig.getRadioType());
|
||||
cfg.setAppliedRadios(appliedRadios);
|
||||
cfg.setSsid(ssidConfig.getSsid());
|
||||
if (ssidConfig.getEncryption().equals("WPA-PSK") && ssidConfig.getMode().equals("1"))
|
||||
cfg.setSecureMode(SecureMode.wpaPSK);
|
||||
else
|
||||
cfg.setSecureMode(SecureMode.wpa2PSK);
|
||||
cfg.setBroadcastSsid(ssidConfig.isBroadcast() ? StateSetting.enabled : StateSetting.disabled);
|
||||
|
||||
profile.setDetails(cfg);
|
||||
profile.setId(ssidProfileId);
|
||||
if (this.ssidProfile == null)
|
||||
this.ssidProfile = new ArrayList<Profile>();
|
||||
this.ssidProfile.add(profile);
|
||||
apProfile.getChildProfileIds().add(ssidProfileId);
|
||||
ssidProfileId++;
|
||||
profile.setDetails(cfg);
|
||||
profile.setId(ssidProfileId);
|
||||
if (this.ssidProfile == null)
|
||||
this.ssidProfile = new ArrayList<Profile>();
|
||||
this.ssidProfile.add(profile);
|
||||
apProfile.getChildProfileIds().add(ssidProfileId);
|
||||
ssidProfileId++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (customerEquipment != null) {
|
||||
customerEquipment.setProfileId(apProfile.getId());
|
||||
}
|
||||
if (customerEquipment != null) {
|
||||
customerEquipment.setProfileId(apProfile.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public EquipmentGatewayRecord getEquipmentGateway() {
|
||||
return equipmentGateway;
|
||||
}
|
||||
public EquipmentGatewayRecord getEquipmentGateway() {
|
||||
return equipmentGateway;
|
||||
}
|
||||
|
||||
public void setEquipmentGateway(EquipmentGatewayRecord equipmentGateway) {
|
||||
this.equipmentGateway = equipmentGateway;
|
||||
}
|
||||
public void setEquipmentGateway(EquipmentGatewayRecord equipmentGateway) {
|
||||
this.equipmentGateway = equipmentGateway;
|
||||
}
|
||||
|
||||
public EquipmentRoutingRecord getEquipmentRouting() {
|
||||
return equipmentRouting;
|
||||
}
|
||||
public EquipmentRoutingRecord getEquipmentRouting() {
|
||||
return equipmentRouting;
|
||||
}
|
||||
|
||||
public void setEquipmentRouting(EquipmentRoutingRecord equipmentRouting) {
|
||||
this.equipmentRouting = equipmentRouting;
|
||||
}
|
||||
public void setEquipmentRouting(EquipmentRoutingRecord equipmentRouting) {
|
||||
this.equipmentRouting = equipmentRouting;
|
||||
}
|
||||
|
||||
public Equipment getCustomerEquipment() {
|
||||
return customerEquipment;
|
||||
}
|
||||
public Equipment getCustomerEquipment() {
|
||||
return customerEquipment;
|
||||
}
|
||||
|
||||
public void setCustomerEquipment(Equipment customerEquipment) {
|
||||
this.customerEquipment = customerEquipment;
|
||||
}
|
||||
public void setCustomerEquipment(Equipment customerEquipment) {
|
||||
this.customerEquipment = customerEquipment;
|
||||
}
|
||||
|
||||
public Profile getApProfile() {
|
||||
return apProfile;
|
||||
}
|
||||
public Profile getApProfile() {
|
||||
return apProfile;
|
||||
}
|
||||
|
||||
public void setApProfile(Profile apProfile) {
|
||||
this.apProfile = apProfile;
|
||||
}
|
||||
public void setApProfile(Profile apProfile) {
|
||||
this.apProfile = apProfile;
|
||||
}
|
||||
|
||||
public List<Profile> getSsidProfile() {
|
||||
return ssidProfile;
|
||||
}
|
||||
public List<Profile> getSsidProfile() {
|
||||
return ssidProfile;
|
||||
}
|
||||
|
||||
public void setSsidProfile(List<Profile> ssidProfile) {
|
||||
this.ssidProfile = ssidProfile;
|
||||
}
|
||||
public void setSsidProfile(List<Profile> ssidProfile) {
|
||||
this.ssidProfile = ssidProfile;
|
||||
}
|
||||
|
||||
public Location getEquipmentLocation() {
|
||||
return equipmentLocation;
|
||||
}
|
||||
public Location getEquipmentLocation() {
|
||||
return equipmentLocation;
|
||||
}
|
||||
|
||||
public void setEquipmentLocation(Location equipmentLocation) {
|
||||
this.equipmentLocation = equipmentLocation;
|
||||
}
|
||||
public void setEquipmentLocation(Location equipmentLocation) {
|
||||
this.equipmentLocation = equipmentLocation;
|
||||
}
|
||||
|
||||
public String getCountryCode() {
|
||||
return Location.getCountryCode(this.equipmentLocation).toString();
|
||||
}
|
||||
public String getCountryCode() {
|
||||
return Location.getCountryCode(this.equipmentLocation).toString();
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpensyncAPConfig clone() {
|
||||
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
|
||||
@Override
|
||||
public OpensyncAPConfig clone() {
|
||||
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
|
||||
|
||||
if (customerEquipment != null)
|
||||
ret.customerEquipment = customerEquipment.clone();
|
||||
if (equipmentLocation != null)
|
||||
ret.equipmentLocation = equipmentLocation.clone();
|
||||
if (ssidProfile != null) {
|
||||
List<Profile> ssidList = new ArrayList<Profile>();
|
||||
for (Profile profile : ssidProfile) {
|
||||
ssidList.add(profile.clone());
|
||||
}
|
||||
ret.ssidProfile = ssidList;
|
||||
}
|
||||
if (apProfile != null)
|
||||
ret.apProfile = apProfile.clone();
|
||||
if (equipmentRouting != null)
|
||||
ret.equipmentRouting = equipmentRouting.clone();
|
||||
if (equipmentGateway != null)
|
||||
ret.equipmentGateway = equipmentGateway.clone();
|
||||
if (customerEquipment != null)
|
||||
ret.customerEquipment = customerEquipment.clone();
|
||||
if (equipmentLocation != null)
|
||||
ret.equipmentLocation = equipmentLocation.clone();
|
||||
if (ssidProfile != null) {
|
||||
List<Profile> ssidList = new ArrayList<Profile>();
|
||||
for (Profile profile : ssidProfile) {
|
||||
ssidList.add(profile.clone());
|
||||
}
|
||||
ret.ssidProfile = ssidList;
|
||||
}
|
||||
if (apProfile != null)
|
||||
ret.apProfile = apProfile.clone();
|
||||
if (equipmentRouting != null)
|
||||
ret.equipmentRouting = equipmentRouting.clone();
|
||||
if (equipmentGateway != null)
|
||||
ret.equipmentGateway = equipmentGateway.clone();
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(customerEquipment.toString());
|
||||
sb.append(apProfile.toString());
|
||||
for (Profile ssid : ssidProfile) {
|
||||
sb.append(ssid.toString());
|
||||
}
|
||||
sb.append(equipmentLocation.toString());
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(customerEquipment.toString());
|
||||
sb.append(apProfile.toString());
|
||||
for (Profile ssid : ssidProfile) {
|
||||
sb.append(ssid.toString());
|
||||
}
|
||||
sb.append(equipmentLocation.toString());
|
||||
|
||||
return sb.toString();
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public List<Profile> getRadiusProfiles() {
|
||||
return radiusProfiles;
|
||||
}
|
||||
|
||||
public void setRadiusProfiles(List<Profile> radiusProfiles) {
|
||||
this.radiusProfiles = radiusProfiles;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user