mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-11-03 20:17:53 +00:00 
			
		
		
		
	OVSDB AP Configuration: Profiles, Legacy Config Support
This commit is contained in:
		@@ -114,9 +114,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
 | 
			
		||||
	private int autoProvisionedCustomerId;
 | 
			
		||||
	@Value("${connectus.ovsdb.autoProvisionedLocationId:8}")
 | 
			
		||||
	private int autoProvisionedLocationId;
 | 
			
		||||
	@Value("${connectus.ovsdb.autoProvisionedProfileId:2}")
 | 
			
		||||
	@Value("${connectus.ovsdb.autoProvisionedProfileId:1}")
 | 
			
		||||
	private int autoProvisionedProfileId;
 | 
			
		||||
	@Value("${connectus.ovsdb.autoProvisionedSsid:Connectus-cloud}")
 | 
			
		||||
	@Value("${connectus.ovsdb.autoProvisionedSsid:autoProvisionedSsid}")
 | 
			
		||||
	private String autoProvisionedSsid;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
@@ -184,28 +184,51 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
 | 
			
		||||
 | 
			
		||||
			Profile apProfile = profileServiceInterface.getOrNull(ce.getProfileId());
 | 
			
		||||
 | 
			
		||||
			if (apProfile == null) {
 | 
			
		||||
 | 
			
		||||
				Profile profileSsid = new Profile();
 | 
			
		||||
				profileSsid.setCustomerId(ce.getCustomerId());
 | 
			
		||||
				profileSsid.setName(autoProvisionedSsid);
 | 
			
		||||
				SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults();
 | 
			
		||||
				Set<RadioType> appliedRadios = new HashSet<RadioType>();
 | 
			
		||||
				appliedRadios.add(RadioType.is2dot4GHz);
 | 
			
		||||
				appliedRadios.add(RadioType.is5GHzL);
 | 
			
		||||
				appliedRadios.add(RadioType.is5GHzU);
 | 
			
		||||
				ssidConfig.setAppliedRadios(appliedRadios);
 | 
			
		||||
				profileSsid.setDetails(ssidConfig);
 | 
			
		||||
				profileSsid = profileServiceInterface.create(profileSsid);
 | 
			
		||||
 | 
			
		||||
			if (apProfile == null || !apProfile.getProfileType().equals(ProfileType.equipment_ap)) {
 | 
			
		||||
				apProfile = new Profile();
 | 
			
		||||
				apProfile.setCustomerId(ce.getCustomerId());
 | 
			
		||||
				apProfile.setName("autoprovisionedApProfile");
 | 
			
		||||
				apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
 | 
			
		||||
				apProfile.getChildProfileIds().add(apProfile.getId());
 | 
			
		||||
 | 
			
		||||
				apProfile = profileServiceInterface.create(apProfile);
 | 
			
		||||
 | 
			
		||||
				Profile profileSsid2do4GHz = new Profile();
 | 
			
		||||
				profileSsid2do4GHz.setCustomerId(ce.getCustomerId());
 | 
			
		||||
				profileSsid2do4GHz.setName("autoProvisionedSsid");
 | 
			
		||||
				SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults();
 | 
			
		||||
				Set<RadioType> appliedRadios = new HashSet<RadioType>();
 | 
			
		||||
				appliedRadios.add(RadioType.is2dot4GHz);
 | 
			
		||||
				ssidConfig.setAppliedRadios(appliedRadios);
 | 
			
		||||
				profileSsid2do4GHz.setDetails(ssidConfig);
 | 
			
		||||
				profileSsid2do4GHz = profileServiceInterface.create(profileSsid2do4GHz);
 | 
			
		||||
 | 
			
		||||
				Profile profileSsid5GHzL = new Profile();
 | 
			
		||||
				profileSsid5GHzL.setCustomerId(ce.getCustomerId());
 | 
			
		||||
				profileSsid5GHzL.setName("autoProvisionedSsid-5l");
 | 
			
		||||
				ssidConfig = SsidConfiguration.createWithDefaults();
 | 
			
		||||
				appliedRadios = new HashSet<RadioType>();
 | 
			
		||||
				appliedRadios.add(RadioType.is5GHzL);
 | 
			
		||||
				ssidConfig.setAppliedRadios(appliedRadios);
 | 
			
		||||
				profileSsid5GHzL.setDetails(ssidConfig);
 | 
			
		||||
				profileSsid5GHzL = profileServiceInterface.create(profileSsid5GHzL);
 | 
			
		||||
 | 
			
		||||
				Profile profileSsid5GHzU = new Profile();
 | 
			
		||||
				profileSsid5GHzU.setCustomerId(ce.getCustomerId());
 | 
			
		||||
				profileSsid5GHzU.setName("autoProvisionedSsid-5u");
 | 
			
		||||
				ssidConfig = SsidConfiguration.createWithDefaults();
 | 
			
		||||
				appliedRadios = new HashSet<RadioType>();
 | 
			
		||||
				appliedRadios.add(RadioType.is5GHzU);
 | 
			
		||||
				ssidConfig.setAppliedRadios(appliedRadios);
 | 
			
		||||
				profileSsid5GHzU.setDetails(ssidConfig);
 | 
			
		||||
				profileSsid5GHzU = profileServiceInterface.create(profileSsid5GHzU);
 | 
			
		||||
 | 
			
		||||
				Set<Long> childProfileIds = new HashSet<Long>();
 | 
			
		||||
				childProfileIds.add(profileSsid2do4GHz.getId());
 | 
			
		||||
				childProfileIds.add(profileSsid5GHzL.getId());
 | 
			
		||||
				childProfileIds.add(profileSsid5GHzU.getId());
 | 
			
		||||
				apProfile.setChildProfileIds(childProfileIds);
 | 
			
		||||
 | 
			
		||||
				apProfile = profileServiceInterface.update(apProfile);
 | 
			
		||||
 | 
			
		||||
				// update AP only if the apProfile was missing
 | 
			
		||||
				ce.setProfileId(apProfile.getId());
 | 
			
		||||
				ce = equipmentServiceInterface.update(ce);
 | 
			
		||||
@@ -459,8 +482,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
 | 
			
		||||
			ret.setApProfile(apProfile);
 | 
			
		||||
 | 
			
		||||
			if (apProfile != null) {
 | 
			
		||||
				Set<Long> childProfileIds = apProfile.getChildProfileIds();
 | 
			
		||||
				List<com.telecominfraproject.wlan.profile.models.Profile> ssidProfiles = new ArrayList<com.telecominfraproject.wlan.profile.models.Profile>();
 | 
			
		||||
 | 
			
		||||
				Set<Long> childProfileIds = apProfile.getChildProfileIds();
 | 
			
		||||
				for (Long id : childProfileIds) {
 | 
			
		||||
					com.telecominfraproject.wlan.profile.models.Profile profile = profileServiceInterface.get(id);
 | 
			
		||||
					if (profile.getProfileType().equals(ProfileType.ssid)) {
 | 
			
		||||
@@ -490,10 +514,14 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
 | 
			
		||||
 | 
			
		||||
						}
 | 
			
		||||
						profile.setDetails(ssidCfg);
 | 
			
		||||
						ret.setSsidProfile(profile);
 | 
			
		||||
						ssidProfiles.add(profile);
 | 
			
		||||
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				ret.setSsidProfile(ssidProfiles);
 | 
			
		||||
 | 
			
		||||
				ret.getSsidProfile().stream().forEach(p -> LOG.debug("SSID Profile {}", p.toPrettyString()));
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,24 @@
 | 
			
		||||
package com.telecominfraproject.wlan.opensync.external.integration.models;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.entity.CountryCode;
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.StateSetting;
 | 
			
		||||
import com.telecominfraproject.wlan.location.models.Location;
 | 
			
		||||
import com.telecominfraproject.wlan.location.models.LocationDetails;
 | 
			
		||||
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.profile.ssid.models.SsidConfiguration.SecureMode;
 | 
			
		||||
import com.telecominfraproject.wlan.routing.models.EquipmentGatewayRecord;
 | 
			
		||||
import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
 | 
			
		||||
 | 
			
		||||
@@ -13,11 +28,80 @@ public class OpensyncAPConfig extends BaseJsonModel {
 | 
			
		||||
 | 
			
		||||
	private Equipment customerEquipment;
 | 
			
		||||
	private Profile apProfile;
 | 
			
		||||
	private Profile ssidProfile;
 | 
			
		||||
	private List<Profile> ssidProfile;
 | 
			
		||||
	private Location equipmentLocation;
 | 
			
		||||
	private EquipmentRoutingRecord equipmentRouting;
 | 
			
		||||
	private EquipmentGatewayRecord equipmentGateway;
 | 
			
		||||
 | 
			
		||||
	// 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 (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) {
 | 
			
		||||
 | 
			
		||||
		if (apProfile == null) {
 | 
			
		||||
			apProfile = new Profile();
 | 
			
		||||
			apProfile.setName("GeneratedApProfile");
 | 
			
		||||
			apProfile.setId(2);
 | 
			
		||||
			apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		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.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());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public EquipmentGatewayRecord getEquipmentGateway() {
 | 
			
		||||
		return equipmentGateway;
 | 
			
		||||
	}
 | 
			
		||||
@@ -50,11 +134,11 @@ public class OpensyncAPConfig extends BaseJsonModel {
 | 
			
		||||
		this.apProfile = apProfile;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Profile getSsidProfile() {
 | 
			
		||||
	public List<Profile> getSsidProfile() {
 | 
			
		||||
		return ssidProfile;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setSsidProfile(Profile ssidProfile) {
 | 
			
		||||
	public void setSsidProfile(List<Profile> ssidProfile) {
 | 
			
		||||
		this.ssidProfile = ssidProfile;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -82,8 +166,13 @@ public class OpensyncAPConfig extends BaseJsonModel {
 | 
			
		||||
			ret.customerEquipment = customerEquipment.clone();
 | 
			
		||||
		if (equipmentLocation != null)
 | 
			
		||||
			ret.equipmentLocation = equipmentLocation.clone();
 | 
			
		||||
		if (ssidProfile != null)
 | 
			
		||||
			ret.ssidProfile = ssidProfile.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)
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,50 @@
 | 
			
		||||
package com.telecominfraproject.wlan.opensync.external.integration.models;
 | 
			
		||||
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
 | 
			
		||||
 | 
			
		||||
public class OpensyncAPRadioConfig extends BaseJsonModel {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 5683558403622855381L;
 | 
			
		||||
 | 
			
		||||
    private String country;
 | 
			
		||||
    private int radioChannel24G;
 | 
			
		||||
    private int radioChannel5LG;
 | 
			
		||||
    private int radioChannel5HG;
 | 
			
		||||
    
 | 
			
		||||
    public int getRadioChannel24G() {
 | 
			
		||||
        return radioChannel24G;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRadioChannel24G(int radioChannel24G) {
 | 
			
		||||
        this.radioChannel24G = radioChannel24G;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getRadioChannel5LG() {
 | 
			
		||||
        return radioChannel5LG;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRadioChannel5LG(int radioChannel5LG) {
 | 
			
		||||
        this.radioChannel5LG = radioChannel5LG;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getRadioChannel5HG() {
 | 
			
		||||
        return radioChannel5HG;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRadioChannel5HG(int radioChannel5HG) {
 | 
			
		||||
        this.radioChannel5HG = radioChannel5HG;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCountry() {
 | 
			
		||||
        return country;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCountry(String country) {
 | 
			
		||||
        this.country = country;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public OpensyncAPRadioConfig clone() {
 | 
			
		||||
        return (OpensyncAPRadioConfig)super.clone();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,70 @@
 | 
			
		||||
package com.telecominfraproject.wlan.opensync.external.integration.models;
 | 
			
		||||
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
 | 
			
		||||
 | 
			
		||||
public class OpensyncAPSsidConfig extends BaseJsonModel {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = -8540144450360788799L;
 | 
			
		||||
 | 
			
		||||
    private RadioType radioType;
 | 
			
		||||
    private String ssid;
 | 
			
		||||
    private String encryption;
 | 
			
		||||
    private String key;
 | 
			
		||||
    private String mode;
 | 
			
		||||
    private boolean broadcast;
 | 
			
		||||
    
 | 
			
		||||
    public RadioType getRadioType() {
 | 
			
		||||
        return radioType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRadioType(RadioType radioType) {
 | 
			
		||||
        this.radioType = radioType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSsid() {
 | 
			
		||||
        return ssid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSsid(String ssid) {
 | 
			
		||||
        this.ssid = ssid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getEncryption() {
 | 
			
		||||
        return encryption;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setEncryption(String encryption) {
 | 
			
		||||
        this.encryption = encryption;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getKey() {
 | 
			
		||||
        return key;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setKey(String key) {
 | 
			
		||||
        this.key = key;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getMode() {
 | 
			
		||||
        return mode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMode(String mode) {
 | 
			
		||||
        this.mode = mode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isBroadcast() {
 | 
			
		||||
        return broadcast;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setBroadcast(boolean broadcast) {
 | 
			
		||||
        this.broadcast = broadcast;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public OpensyncAPSsidConfig clone() {
 | 
			
		||||
        return (OpensyncAPSsidConfig)super.clone();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package com.telecominfraproject.wlan.opensync.external.integration;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.PostConstruct;
 | 
			
		||||
@@ -68,15 +69,19 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr
 | 
			
		||||
			equipment.setInventoryId(apId);
 | 
			
		||||
			equipment.setName(apId);
 | 
			
		||||
 | 
			
		||||
			com.telecominfraproject.wlan.profile.models.Profile apProfile = com.telecominfraproject.wlan.profile.models.Profile.fromFile(apProfileFileName,  com.telecominfraproject.wlan.profile.models.Profile.class);
 | 
			
		||||
			com.telecominfraproject.wlan.profile.models.Profile ssidProfile = com.telecominfraproject.wlan.profile.models.Profile.fromFile(ssidProfileFileName,  com.telecominfraproject.wlan.profile.models.Profile.class);
 | 
			
		||||
			com.telecominfraproject.wlan.profile.models.Profile apProfile = com.telecominfraproject.wlan.profile.models.Profile
 | 
			
		||||
					.fromFile(apProfileFileName, com.telecominfraproject.wlan.profile.models.Profile.class);
 | 
			
		||||
			com.telecominfraproject.wlan.profile.models.Profile ssidProfile = com.telecominfraproject.wlan.profile.models.Profile
 | 
			
		||||
					.fromFile(ssidProfileFileName, com.telecominfraproject.wlan.profile.models.Profile.class);
 | 
			
		||||
 | 
			
		||||
			Location location = Location.fromFile(locationFileName, Location.class);
 | 
			
		||||
 | 
			
		||||
			ret = new OpensyncAPConfig();
 | 
			
		||||
			ret.setCustomerEquipment(equipment);
 | 
			
		||||
			ret.setApProfile(apProfile);
 | 
			
		||||
			ret.setSsidProfile(ssidProfile);
 | 
			
		||||
			List<com.telecominfraproject.wlan.profile.models.Profile> ssidProfiles = new ArrayList<com.telecominfraproject.wlan.profile.models.Profile>();
 | 
			
		||||
			ssidProfiles.add(ssidProfile);
 | 
			
		||||
			ret.setSsidProfile(ssidProfiles);
 | 
			
		||||
			ret.setEquipmentLocation(location);
 | 
			
		||||
 | 
			
		||||
		} catch (IOException e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -119,8 +119,8 @@
 | 
			
		||||
      "is5GHzU" : {
 | 
			
		||||
        "model_type" : "ElementRadioConfiguration",
 | 
			
		||||
        "radioType" : "is5GHzU",
 | 
			
		||||
        "channelNumber" : 108,
 | 
			
		||||
        "manualChannelNumber" : 108,
 | 
			
		||||
        "channelNumber" : 149,
 | 
			
		||||
        "manualChannelNumber" : 149,
 | 
			
		||||
        "backupChannelNumber" : 116,
 | 
			
		||||
        "autoChannelSelection" : true,
 | 
			
		||||
        "channelBandwidth" : "is80MHz",
 | 
			
		||||
@@ -156,7 +156,7 @@
 | 
			
		||||
        "bestAPSteerType" : "both",
 | 
			
		||||
        "deauthAttackDetection" : null,
 | 
			
		||||
        "allowedChannelsPowerLevels" : [ ],
 | 
			
		||||
        "activeChannel" : 108
 | 
			
		||||
        "activeChannel" : 149
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "advancedRadioMap" : {
 | 
			
		||||
 
 | 
			
		||||
@@ -119,8 +119,8 @@
 | 
			
		||||
      "is5GHzU" : {
 | 
			
		||||
        "model_type" : "ElementRadioConfiguration",
 | 
			
		||||
        "radioType" : "is5GHzU",
 | 
			
		||||
        "channelNumber" : 108,
 | 
			
		||||
        "manualChannelNumber" : 108,
 | 
			
		||||
        "channelNumber" : 149,
 | 
			
		||||
        "manualChannelNumber" : 149,
 | 
			
		||||
        "backupChannelNumber" : 116,
 | 
			
		||||
        "autoChannelSelection" : true,
 | 
			
		||||
        "channelBandwidth" : "is80MHz",
 | 
			
		||||
@@ -156,7 +156,7 @@
 | 
			
		||||
        "bestAPSteerType" : "both",
 | 
			
		||||
        "deauthAttackDetection" : null,
 | 
			
		||||
        "allowedChannelsPowerLevels" : [ ],
 | 
			
		||||
        "activeChannel" : 108
 | 
			
		||||
        "activeChannel" : 149
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "advancedRadioMap" : {
 | 
			
		||||
 
 | 
			
		||||
@@ -119,8 +119,8 @@
 | 
			
		||||
      "is5GHzU" : {
 | 
			
		||||
        "model_type" : "ElementRadioConfiguration",
 | 
			
		||||
        "radioType" : "is5GHzU",
 | 
			
		||||
        "channelNumber" : 108,
 | 
			
		||||
        "manualChannelNumber" : 108,
 | 
			
		||||
        "channelNumber" : 149,
 | 
			
		||||
        "manualChannelNumber" : 149,
 | 
			
		||||
        "backupChannelNumber" : 116,
 | 
			
		||||
        "autoChannelSelection" : true,
 | 
			
		||||
        "channelBandwidth" : "is80MHz",
 | 
			
		||||
@@ -156,7 +156,7 @@
 | 
			
		||||
        "bestAPSteerType" : "both",
 | 
			
		||||
        "deauthAttackDetection" : null,
 | 
			
		||||
        "allowedChannelsPowerLevels" : [ ],
 | 
			
		||||
        "activeChannel" : 108
 | 
			
		||||
        "activeChannel" : 149
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "advancedRadioMap" : {
 | 
			
		||||
 
 | 
			
		||||
@@ -119,8 +119,8 @@
 | 
			
		||||
      "is5GHzU" : {
 | 
			
		||||
        "model_type" : "ElementRadioConfiguration",
 | 
			
		||||
        "radioType" : "is5GHzU",
 | 
			
		||||
        "channelNumber" : 108,
 | 
			
		||||
        "manualChannelNumber" : 108,
 | 
			
		||||
        "channelNumber" : 149,
 | 
			
		||||
        "manualChannelNumber" : 149,
 | 
			
		||||
        "backupChannelNumber" : 116,
 | 
			
		||||
        "autoChannelSelection" : true,
 | 
			
		||||
        "channelBandwidth" : "is80MHz",
 | 
			
		||||
@@ -156,7 +156,7 @@
 | 
			
		||||
        "bestAPSteerType" : "both",
 | 
			
		||||
        "deauthAttackDetection" : null,
 | 
			
		||||
        "allowedChannelsPowerLevels" : [ ],
 | 
			
		||||
        "activeChannel" : 108
 | 
			
		||||
        "activeChannel" : 149
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "advancedRadioMap" : {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,10 +18,8 @@ import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.equipment.ChannelBandwidth;
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.equipment.DeploymentType;
 | 
			
		||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.DeviceMode;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.RadioConfiguration;
 | 
			
		||||
import com.telecominfraproject.wlan.equipment.models.StateSetting;
 | 
			
		||||
@@ -39,6 +37,7 @@ import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.WifiInetConfigInfo
 | 
			
		||||
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;
 | 
			
		||||
import com.telecominfraproject.wlan.profile.models.Profile;
 | 
			
		||||
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
 | 
			
		||||
import com.vmware.ovsdb.exception.OvsdbClientException;
 | 
			
		||||
import com.vmware.ovsdb.protocol.methods.RowUpdate;
 | 
			
		||||
@@ -976,6 +975,7 @@ public class OvsdbDao {
 | 
			
		||||
 | 
			
		||||
	public static final String brHome = "br-home";
 | 
			
		||||
	public static final String brWan = "br-wan";
 | 
			
		||||
	public static final String brLan = "br-lan";
 | 
			
		||||
 | 
			
		||||
	public static final String patchW2h = "patch-w2h";
 | 
			
		||||
	public static final String patchH2w = "patch-h2w";
 | 
			
		||||
@@ -1129,6 +1129,9 @@ public class OvsdbDao {
 | 
			
		||||
 | 
			
		||||
			RadioConfiguration radioConfig = apElementConfiguration.getAdvancedRadioMap().get(radioType);
 | 
			
		||||
			int beaconInterval = radioConfig.getBeaconInterval();
 | 
			
		||||
			int txPower = 0;
 | 
			
		||||
			if (elementRadioConfig.getEirpTxPower().isAuto())
 | 
			
		||||
				txPower = elementRadioConfig.getEirpTxPower().getValue();
 | 
			
		||||
			String configName = null;
 | 
			
		||||
			switch (radioType) {
 | 
			
		||||
			case is2dot4GHz:
 | 
			
		||||
@@ -1162,7 +1165,7 @@ public class OvsdbDao {
 | 
			
		||||
			if (configName != null) {
 | 
			
		||||
				try {
 | 
			
		||||
					configureWifiRadios(ovsdbClient, configName, provisionedWifiRadios, channel, hwConfig, country,
 | 
			
		||||
							beaconInterval, ht_mode);
 | 
			
		||||
							beaconInterval, ht_mode, txPower);
 | 
			
		||||
				} catch (OvsdbClientException e) {
 | 
			
		||||
					// TODO Auto-generated catch block
 | 
			
		||||
					e.printStackTrace();
 | 
			
		||||
@@ -1626,7 +1629,7 @@ public class OvsdbDao {
 | 
			
		||||
 | 
			
		||||
	public void configureWifiRadios(OvsdbClient ovsdbClient, String configName,
 | 
			
		||||
			Map<String, WifiRadioConfigInfo> provisionedWifiRadios, int channel, Map<String, String> hwConfig,
 | 
			
		||||
			String country, int beaconInterval, String ht_mode)
 | 
			
		||||
			String country, int beaconInterval, String ht_mode, int txPower)
 | 
			
		||||
			throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException {
 | 
			
		||||
 | 
			
		||||
		WifiRadioConfigInfo existingConfig = provisionedWifiRadios.get(configName);
 | 
			
		||||
@@ -1649,7 +1652,7 @@ public class OvsdbDao {
 | 
			
		||||
		updateColumns.put("hw_config", hwConfigMap);
 | 
			
		||||
		updateColumns.put("bcn_int", new Atom<Integer>(beaconInterval));
 | 
			
		||||
		updateColumns.put("ht_mode", new Atom<>(ht_mode));
 | 
			
		||||
 | 
			
		||||
		updateColumns.put("tx_power", new Atom<Integer>(txPower));
 | 
			
		||||
		Row row = new Row(updateColumns);
 | 
			
		||||
		operations.add(new Update(wifiRadioConfigDbTable, conditions, row));
 | 
			
		||||
 | 
			
		||||
@@ -1659,7 +1662,7 @@ public class OvsdbDao {
 | 
			
		||||
		LOG.debug("Provisioned channel {} for {}", channel, configName);
 | 
			
		||||
 | 
			
		||||
		for (OperationResult res : result) {
 | 
			
		||||
			LOG.debug("Op Result {}", res);
 | 
			
		||||
			LOG.debug("MJH Op Result {}", res);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1759,10 +1762,10 @@ public class OvsdbDao {
 | 
			
		||||
		Map<String, WifiRadioConfigInfo> provisionedWifiRadioConfigs = getProvisionedWifiRadioConfigs(ovsdbClient);
 | 
			
		||||
		LOG.debug("Existing WifiVifConfigs: {}", provisionedWifiVifConfigs.keySet());
 | 
			
		||||
 | 
			
		||||
		SsidConfiguration ssidConfig = (SsidConfiguration) opensyncApConfig.getSsidProfile().getDetails();
 | 
			
		||||
		for (Profile ssidProfile : opensyncApConfig.getSsidProfile()) {
 | 
			
		||||
			
 | 
			
		||||
			SsidConfiguration ssidConfig = (SsidConfiguration) ssidProfile.getDetails();
 | 
			
		||||
			for (RadioType radioType : ssidConfig.getAppliedRadios()) {
 | 
			
		||||
 | 
			
		||||
				boolean ssidBroadcast = ssidConfig.getBroadcastSsid() == StateSetting.enabled;
 | 
			
		||||
				Map<String, String> security = new HashMap<>();
 | 
			
		||||
 | 
			
		||||
@@ -1778,15 +1781,15 @@ public class OvsdbDao {
 | 
			
		||||
				if (radioType == RadioType.is2dot4GHz) {
 | 
			
		||||
					ifName = homeAp24;
 | 
			
		||||
					radioIfName = "wifi0";
 | 
			
		||||
				vifRadioIdx = 0;
 | 
			
		||||
					vifRadioIdx = 1;
 | 
			
		||||
				} else if (radioType == RadioType.is5GHzL) {
 | 
			
		||||
					ifName = homeApL50;
 | 
			
		||||
					radioIfName = "wifi1";
 | 
			
		||||
				vifRadioIdx = 1;
 | 
			
		||||
					vifRadioIdx = 2;
 | 
			
		||||
				} else if (radioType == RadioType.is5GHzU) {
 | 
			
		||||
					ifName = homeApU50;
 | 
			
		||||
					radioIfName = "wifi2";
 | 
			
		||||
				vifRadioIdx = 2;
 | 
			
		||||
					vifRadioIdx = 3;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if (vifRadioIdx == -1) {
 | 
			
		||||
@@ -1805,6 +1808,7 @@ public class OvsdbDao {
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1894,9 +1898,9 @@ public class OvsdbDao {
 | 
			
		||||
			configureWifiInet(ovsdbClient, provisionedWifiInetConfigs, ifName);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!provisionedWifiInetConfigs.containsKey(brHome) || !provisionedWifiInetConfigs.get(brHome).network) {
 | 
			
		||||
		if (!provisionedWifiInetConfigs.containsKey(brLan) || !provisionedWifiInetConfigs.get(brLan).network) {
 | 
			
		||||
			// set network flag on brHome in wifiInetConfig table
 | 
			
		||||
			configureWifiInetSetNetwork(ovsdbClient, brHome);
 | 
			
		||||
			configureWifiInetSetNetwork(ovsdbClient, brLan);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user