diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java index f841428..7db8f14 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java @@ -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 appliedRadios = new HashSet(); - 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 appliedRadios = new HashSet(); + 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(); + 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(); + appliedRadios.add(RadioType.is5GHzU); + ssidConfig.setAppliedRadios(appliedRadios); + profileSsid5GHzU.setDetails(ssidConfig); + profileSsid5GHzU = profileServiceInterface.create(profileSsid5GHzU); + + Set childProfileIds = new HashSet(); + 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 childProfileIds = apProfile.getChildProfileIds(); + List ssidProfiles = new ArrayList(); + Set 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) { diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java index e27dd0d..1a1976e 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPConfig.java @@ -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 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 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 appliedRadios = new HashSet(); + 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(); + 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 getSsidProfile() { return ssidProfile; } - public void setSsidProfile(Profile ssidProfile) { + public void setSsidProfile(List 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 ssidList = new ArrayList(); + for (Profile profile : ssidProfile) { + ssidList.add(profile.clone()); + } + ret.ssidProfile = ssidList; + } if (apProfile != null) ret.apProfile = apProfile.clone(); if (equipmentRouting != null) diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java new file mode 100644 index 0000000..9f72580 --- /dev/null +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPRadioConfig.java @@ -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(); + } +} \ No newline at end of file diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java new file mode 100644 index 0000000..c28d384 --- /dev/null +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/OpensyncAPSsidConfig.java @@ -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(); + } + +} \ No newline at end of file diff --git a/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java b/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java index 5913dd1..94eef33 100644 --- a/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java +++ b/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java @@ -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; @@ -39,7 +40,7 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr @Value("${connectus.ovsdb.ssidProfileFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/ProfileSsid.json}") private String ssidProfileFileName; - + @Value("${connectus.ovsdb.locationFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/LocationBuildingExample.json}") private String locationFileName; @@ -67,16 +68,20 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr Equipment equipment = Equipment.fromFile(customerEquipmentFileName, Equipment.class); 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 ssidProfiles = new ArrayList(); + ssidProfiles.add(ssidProfile); + ret.setSsidProfile(ssidProfiles); ret.setEquipmentLocation(location); } catch (IOException e) { diff --git a/opensync-ext-static/src/main/resources/EquipmentExample.json b/opensync-ext-static/src/main/resources/EquipmentExample.json index f504252..c205ea1 100644 --- a/opensync-ext-static/src/main/resources/EquipmentExample.json +++ b/opensync-ext-static/src/main/resources/EquipmentExample.json @@ -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" : { diff --git a/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/EquipmentExample.json b/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/EquipmentExample.json index f504252..c205ea1 100644 --- a/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/EquipmentExample.json +++ b/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/opensync/EquipmentExample.json @@ -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" : { diff --git a/opensync-gateway-static-docker/src/main/docker/app/opensync/EquipmentExample.json b/opensync-gateway-static-docker/src/main/docker/app/opensync/EquipmentExample.json index f504252..c205ea1 100644 --- a/opensync-gateway-static-docker/src/main/docker/app/opensync/EquipmentExample.json +++ b/opensync-gateway-static-docker/src/main/docker/app/opensync/EquipmentExample.json @@ -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" : { diff --git a/opensync-gateway-static-process/src/main/resources/app/opensync/EquipmentExample.json b/opensync-gateway-static-process/src/main/resources/app/opensync/EquipmentExample.json index f504252..c205ea1 100644 --- a/opensync-gateway-static-process/src/main/resources/app/opensync/EquipmentExample.json +++ b/opensync-gateway-static-process/src/main/resources/app/opensync/EquipmentExample.json @@ -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" : { 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 bc0f0f4..5affc39 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 @@ -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"; @@ -1101,7 +1101,7 @@ public class OvsdbDao { ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) opensyncAPConfig .getCustomerEquipment().getDetails()); - + for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) { Map hwConfig = new HashMap<>(); @@ -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 provisionedWifiRadios, int channel, Map 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(beaconInterval)); updateColumns.put("ht_mode", new Atom<>(ht_mode)); - + updateColumns.put("tx_power", new Atom(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,51 +1762,52 @@ public class OvsdbDao { Map 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 security = new HashMap<>(); - for (RadioType radioType : ssidConfig.getAppliedRadios()) { + security.put("encryption", ssidConfig.getSecureMode().name()); + security.put("key", ssidConfig.getKeyStr()); + security.put("mode", Long.toString(ssidConfig.getSecureMode().getId())); + String bridge = brHome; - boolean ssidBroadcast = ssidConfig.getBroadcastSsid() == StateSetting.enabled; - Map security = new HashMap<>(); + String ifName = null; + String radioIfName = null; + int vifRadioIdx = -1; - security.put("encryption", ssidConfig.getSecureMode().name()); - security.put("key", ssidConfig.getKeyStr()); - security.put("mode", Long.toString(ssidConfig.getSecureMode().getId())); - String bridge = brHome; - - String ifName = null; - String radioIfName = null; - int vifRadioIdx = -1; - - if (radioType == RadioType.is2dot4GHz) { - ifName = homeAp24; - radioIfName = "wifi0"; - vifRadioIdx = 0; - } else if (radioType == RadioType.is5GHzL) { - ifName = homeApL50; - radioIfName = "wifi1"; - vifRadioIdx = 1; - } else if (radioType == RadioType.is5GHzU) { - ifName = homeApU50; - radioIfName = "wifi2"; - vifRadioIdx = 2; - } - - if (vifRadioIdx == -1) { - LOG.debug("Cannot determine vif radio idx radioType {} skipping", radioType); - continue; - } - - if (!provisionedWifiVifConfigs.containsKey(ifName + "_" + ssidConfig.getSsid())) { - try { - configureSingleSsid(ovsdbClient, bridge, ifName, ssidConfig.getSsid(), ssidBroadcast, security, - provisionedWifiRadioConfigs, radioIfName, ssidConfig.getVlanId(), vifRadioIdx); - } catch (IllegalStateException e) { - // could not provision this SSID, but still can go on - LOG.warn("could not provision SSID {} on {}", ssidConfig.getSsid(), radioIfName); + if (radioType == RadioType.is2dot4GHz) { + ifName = homeAp24; + radioIfName = "wifi0"; + vifRadioIdx = 1; + } else if (radioType == RadioType.is5GHzL) { + ifName = homeApL50; + radioIfName = "wifi1"; + vifRadioIdx = 2; + } else if (radioType == RadioType.is5GHzU) { + ifName = homeApU50; + radioIfName = "wifi2"; + vifRadioIdx = 3; } - } + if (vifRadioIdx == -1) { + LOG.debug("Cannot determine vif radio idx radioType {} skipping", radioType); + continue; + } + + if (!provisionedWifiVifConfigs.containsKey(ifName + "_" + ssidConfig.getSsid())) { + try { + configureSingleSsid(ovsdbClient, bridge, ifName, ssidConfig.getSsid(), ssidBroadcast, security, + provisionedWifiRadioConfigs, radioIfName, ssidConfig.getVlanId(), vifRadioIdx); + } catch (IllegalStateException e) { + // could not provision this SSID, but still can go on + LOG.warn("could not provision SSID {} on {}", ssidConfig.getSsid(), radioIfName); + } + } + + } } } @@ -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); } }