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 5b0cdd4..43c6a6f 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 @@ -20,10 +20,10 @@ import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.stereotype.Component; +import com.telecominfraproject.wlan.alarm.AlarmServiceInterface; import com.telecominfraproject.wlan.client.ClientServiceInterface; import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface; import com.telecominfraproject.wlan.core.model.entity.CountryCode; -import com.telecominfraproject.wlan.core.model.equipment.AutoOrManualValue; import com.telecominfraproject.wlan.core.model.equipment.EquipmentType; import com.telecominfraproject.wlan.core.model.equipment.MacAddress; import com.telecominfraproject.wlan.core.model.equipment.RadioType; @@ -45,6 +45,7 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients; import com.telecominfraproject.wlan.profile.ProfileServiceInterface; import com.telecominfraproject.wlan.profile.models.Profile; +import com.telecominfraproject.wlan.profile.models.ProfileContainer; import com.telecominfraproject.wlan.profile.models.ProfileType; import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration; import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration; @@ -70,7 +71,6 @@ import com.telecominfraproject.wlan.status.models.StatusCode; import com.telecominfraproject.wlan.status.models.StatusDataType; import com.telecominfraproject.wlan.status.network.models.NetworkAdminStatusData; import com.telecominfraproject.wlan.status.network.models.NetworkAggregateStatusData; -import com.telecominfraproject.wlan.status.network.models.UserDetails; import sts.PlumeStats.Client; import sts.PlumeStats.ClientReport; @@ -89,6 +89,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra private static final Logger LOG = LoggerFactory.getLogger(OpensyncExternalIntegrationCloud.class); + @Autowired + private AlarmServiceInterface alarmServiceInterface; @Autowired private CustomerServiceInterface customerServiceInterface; @Autowired @@ -105,14 +107,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra private ProfileServiceInterface profileServiceInterface; @Autowired private StatusServiceInterface statusServiceInterface; - @Autowired private ClientServiceInterface clientServiceInterface; @Autowired private OpensyncCloudGatewayController gatewayController; - @Value("${connectus.ovsdb.autoProvisionedCustomerId:2}") + @Value("${connectus.ovsdb.autoProvisionedCustomerId:1970}") private int autoProvisionedCustomerId; @Value("${connectus.ovsdb.autoProvisionedLocationId:8}") private int autoProvisionedLocationId; @@ -163,82 +164,89 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra try { if (ce == null) { - ce = new Equipment(); - ce.setCustomerId(autoProvisionedCustomerId); ce.setEquipmentType(EquipmentType.AP); ce.setInventoryId(apId); - ce.setLocationId(autoProvisionedLocationId); - - ce.setProfileId(autoProvisionedProfileId); - ce.setName(apId); ce.setSerial(connectNodeInfo.serialNumber); ce.setDetails(ApElementConfiguration.createWithDefaults()); - ce = equipmentServiceInterface.create(ce); - // - // ce = new Equipment(); - // ce.setCustomerId(autoProvisionedCustomerId); - // ce.setInventoryId(apId); - // ce.setEquipmentType(EquipmentType.AP); - // ce.setName(apId); - // - // ce.setSerial(connectNodeInfo.serialNumber); - // ApElementConfiguration apElementConfig = - // ApElementConfiguration.createWithDefaults(); - // apElementConfig.setDeviceName(apId); - // ce.setDetails(apElementConfig); - // ce.setLocationId(autoProvisionedLocationId); - // ce.setProfileId(autoProvisionedProfileId); - // ce = equipmentServiceInterface.create(ce); - } + ce.setCustomerId(autoProvisionedCustomerId); + ce.setName(apId); + ce.setLocationId(autoProvisionedLocationId); + ApElementConfiguration apElementConfig = (ApElementConfiguration) ce.getDetails(); + apElementConfig.setEquipmentModel(connectNodeInfo.model); + apElementConfig.getAdvancedRadioMap().get(RadioType.is2dot4GHz) + .setAutoChannelSelection(StateSetting.disabled); + apElementConfig.getAdvancedRadioMap().get(RadioType.is5GHzL) + .setAutoChannelSelection(StateSetting.disabled); + apElementConfig.getAdvancedRadioMap().get(RadioType.is5GHzU) + .setAutoChannelSelection(StateSetting.disabled); - Profile apProfile = profileServiceInterface.getOrNull(ce.getProfileId()); + apElementConfig.getRadioMap().get(RadioType.is2dot4GHz).setAutoChannelSelection(false); + apElementConfig.getRadioMap().get(RadioType.is5GHzL).setAutoChannelSelection(false); + apElementConfig.getRadioMap().get(RadioType.is5GHzU).setAutoChannelSelection(false); - if (apProfile == null || !apProfile.getProfileType().equals(ProfileType.equipment_ap)) { - apProfile = new Profile(); + ce.setDetails(apElementConfig); + ce = equipmentServiceInterface.update(ce); + + Profile apProfile = new Profile(); apProfile.setCustomerId(ce.getCustomerId()); - apProfile.setName("autoprovisionedApProfile"); + apProfile.setName("DefaultApProfile"); apProfile.setDetails(ApNetworkConfiguration.createWithDefaults()); apProfile = profileServiceInterface.create(apProfile); Profile ssidProfile = new Profile(); ssidProfile.setCustomerId(ce.getCustomerId()); - ssidProfile.setName(autoProvisionedSsid); + ssidProfile.setName("DefaultSsid"); SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults(); + ssidConfig.setSecureMode(SecureMode.wpa2PSK); + ssidConfig.setKeyStr("12345678"); Set appliedRadios = new HashSet<>(); - appliedRadios.addAll(((ApElementConfiguration) ce.getDetails()).getRadioMap().keySet()); + appliedRadios.add(RadioType.is2dot4GHz); ssidConfig.setAppliedRadios(appliedRadios); ssidProfile.setDetails(ssidConfig); ssidProfile = profileServiceInterface.create(ssidProfile); + Profile ssidProfile5g = new Profile(); + ssidProfile5g.setCustomerId(ce.getCustomerId()); + ssidProfile5g.setName("DefaultSsid-5"); + SsidConfiguration ssidConfig5g = SsidConfiguration.createWithDefaults(); + ssidConfig5g.setSecureMode(SecureMode.wpa2PSK); + ssidConfig5g.setKeyStr("12345678"); + Set appliedRadios5g = new HashSet<>(); + appliedRadios5g.add(RadioType.is5GHzL); + appliedRadios5g.add(RadioType.is5GHzU); + ssidConfig5g.setAppliedRadios(appliedRadios5g); + ssidProfile5g.setDetails(ssidConfig5g); + ssidProfile5g = profileServiceInterface.create(ssidProfile5g); + Set childProfileIds = new HashSet<>(); childProfileIds.add(ssidProfile.getId()); + childProfileIds.add(ssidProfile5g.getId()); apProfile.setChildProfileIds(childProfileIds); apProfile = profileServiceInterface.update(apProfile); - - // update AP only if the apProfile was missing ce.setProfileId(apProfile.getId()); + ce = equipmentServiceInterface.update(ce); - } - Customer customer = customerServiceInterface.getOrNull(ce.getCustomerId()); - if (customer == null) { - customer = new Customer(); - customer.setId(autoProvisionedCustomerId); - customerServiceInterface.create(customer); - ce.setCustomerId(customer.getId()); - equipmentServiceInterface.update(ce); + Customer customer = customerServiceInterface.getOrNull(ce.getCustomerId()); + if (customer == null) { + customer = new Customer(); + customer.setId(autoProvisionedCustomerId); + customerServiceInterface.create(customer); + ce.setCustomerId(customer.getId()); + equipmentServiceInterface.update(ce); + } } - updateApStatus(ce, connectNodeInfo); - EquipmentRoutingRecord equipmentRoutingRecord = gatewayController.registerCustomerEquipment(ce.getName(), ce.getCustomerId(), ce.getId()); + updateApStatus(ce, connectNodeInfo); + OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); ovsdbSession.setRoutingId(equipmentRoutingRecord.getId()); ovsdbSession.setEquipmentId(ce.getId()); @@ -266,7 +274,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra statusRecord = new Status(); statusRecord.setCustomerId(ce.getCustomerId()); statusRecord.setEquipmentId(ce.getId()); - EquipmentAdminStatusData statusData = new EquipmentAdminStatusData(); statusRecord.setDetails(statusData); } @@ -353,7 +360,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra // main dashboard // from APDemoMetric properties getPeriodLengthSec, getRxBytes2G, // getTxBytes2G, getRxBytes5G, getTxBytes5G - Status networkAdminStatusRec = statusServiceInterface.getOrNull(ce.getCustomerId(), 0, + Status networkAdminStatusRec = statusServiceInterface.getOrNull(ce.getCustomerId(), ce.getId(), StatusDataType.NETWORK_ADMIN); if (networkAdminStatusRec == null) { networkAdminStatusRec = new Status(); @@ -372,22 +379,20 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra statusServiceInterface.update(networkAdminStatusRec); - Status networkAggStatusRec = statusServiceInterface.getOrNull(ce.getCustomerId(), 0, + Status networkAggStatusRec = statusServiceInterface.getOrNull(ce.getCustomerId(), ce.getId(), StatusDataType.NETWORK_AGGREGATE); if (networkAggStatusRec == null) { networkAggStatusRec = new Status(); networkAggStatusRec.setCustomerId(ce.getCustomerId()); + networkAggStatusRec.setEquipmentId(ce.getId()); NetworkAggregateStatusData naStatusData = new NetworkAggregateStatusData(); networkAggStatusRec.setDetails(naStatusData); } - networkAggStatusRec.setEquipmentId(ce.getId()); - statusServiceInterface.update(networkAggStatusRec); } catch (Exception e) { - // do nothing LOG.debug("Exception in updateApStatus", e); } @@ -397,14 +402,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra public void apDisconnected(String apId) { LOG.info("AP {} got disconnected from the gateway", apId); try { - // removed the 'in-memory' cached node - // synchronized (opensyncNodeMap) { - // if (opensyncNodeMap.containsKey(apId)) { - // opensyncNodeMap.remove(apId); - // LOG.info("AP {} and table state data removed from memory cache", - // apId); - // } - // } OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); @@ -455,71 +452,14 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra ret.setEquipmentLocation(eqLocation); - // CountryCode countryCode = Location.getCountryCode(eqLocation); - // if (countryCode != null && countryCode != - // CountryCode.UNSUPPORTED) { - // countryCode.toString().toUpperCase(); - // } - // - // ApElementConfiguration apElementConfiguration = - // (ApElementConfiguration) equipmentConfig.getDetails(); + ProfileContainer profileContainer = new ProfileContainer( + profileServiceInterface.getProfileWithChildren(equipmentConfig.getProfileId())); - // Map erc = - // apElementConfiguration.getRadioMap(); - // if (erc != null) { - // - // ElementRadioConfiguration erc24 = erc.get(RadioType.is2dot4GHz); - // ElementRadioConfiguration erc5gl = erc.get(RadioType.is5GHzL); - // ElementRadioConfiguration erc5gh = erc.get(RadioType.is5GHzU); - // - // if (erc24 != null) { - // erc24.getChannelNumber(); - // } - // - // if (erc5gl != null) { - // erc5gl.getChannelNumber(); - // } - // - // if (erc5gh != null) { - // erc5gh.getChannelNumber(); - // } - // - // } + ret.setApProfile(profileContainer.getOrNull(equipmentConfig.getProfileId())); - com.telecominfraproject.wlan.profile.models.Profile apProfile = profileServiceInterface - .getOrNull(equipmentConfig.getProfileId()); + ret.setSsidProfile(profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid)); - ret.setApProfile(apProfile); - - if (apProfile != null) { - 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)) { - - SsidConfiguration ssidConfig = ((SsidConfiguration) profile.getDetails()); - ssidConfig.setSsid(autoProvisionedSsid); - if (ssidConfig.getSecureMode().equals(SecureMode.open)) { - ssidConfig.setSecureMode(SecureMode.wpa2PSK); - ssidConfig.setKeyStr("12345678"); - } - profile.setDetails(ssidConfig); - profile = profileServiceInterface.update(profile); - - ssidProfiles.add(profile); - - } - } - ret.setSsidProfile(ssidProfiles); - - } - - LOG.debug("Config content : Equipment {}", ret.getCustomerEquipment()); - LOG.debug("Config content : APProfile {}", ret.getApProfile()); - ret.getSsidProfile().stream().forEach(ssid -> LOG.debug("Config content : SSIDProfile {}", ssid)); - LOG.debug("Config content : Location {}", ret.getEquipmentLocation()); + LOG.debug("ApConfig {}", ret.toString()); } catch (Exception e) { @@ -794,7 +734,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } } - LOG.debug("ApNodeMetrics Report {}", apNodeMetrics); + if (LOG.isDebugEnabled()) { + LOG.debug("ApNodeMetrics Report {}", apNodeMetrics.toPrettyString()); + } } @@ -905,7 +847,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } - LOG.debug("APClientMetrics Report {}", cMetrics); + if (LOG.isDebugEnabled()) { + LOG.debug("ApClientMetrics Report {}", cMetrics.toPrettyString()); + } } @@ -996,7 +940,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra return; } - // TODO: update Equipment and Profiles related to VIF_State table update + for (OpensyncAPVIFState vifState : vifStateTables) { + // TODO: implement me + } } @@ -1016,49 +962,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra return; } + statusServiceInterface.get(ce.getCustomerId(), ce.getId()).stream().forEach(s -> LOG.debug("Status {}", s)); + for (OpensyncAPRadioState radioState : radioStateTables) { - if (radioState.getFreqBand().equals(RadioType.UNSUPPORTED)) { - LOG.debug("Could not get radio configuration for AP {}", apId); - continue; - } - - if (radioState.getAllowedChannels() != null && !radioState.getAllowedChannels().isEmpty()) { - ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) ce.getDetails()); - apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) - .setAllowedChannels(new ArrayList<>(radioState.getAllowedChannels())); - ce.setDetails(apElementConfiguration); - ce = equipmentServiceInterface.update(ce); - LOG.debug("Updated AllowedChannels from Wifi_Radio_State table change {}", ce); - - } - - if (radioState.getTxPower() > 0) { - ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) ce.getDetails()); - apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) - .setEirpTxPower(AutoOrManualValue.createManualInstance(radioState.getTxPower())); - ce.setDetails(apElementConfiguration); - ce = equipmentServiceInterface.update(ce); - LOG.debug("Updated TxPower from Wifi_Radio_State table change {}", ce); - - } - - StateSetting state = StateSetting.disabled; - if (radioState.isEnabled()) { - state = StateSetting.enabled; - } - ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) ce.getDetails()); - if (!apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand()).getRadioAdminState() - .equals(state)) { - // only update if changed - apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand()).setRadioAdminState(state); - ce.setDetails(apElementConfiguration); - ce = equipmentServiceInterface.update(ce); - - LOG.debug("Updated RadioAdminState from Wifi_Radio_State table change {}", ce); - - } - + // TODO: implement me } } @@ -1082,8 +990,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra return; } - // TODO: update Config/Status for Network from Wifi_Inet_State where - // applicable + for (OpensyncAPInetState inetState : inetStateTables) { + // TODO: implement me + } } diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java index ecd2372..4ab8ea2 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/models/ConnectNodeInfo.java @@ -13,6 +13,7 @@ public class ConnectNodeInfo implements Cloneable{ public String ipV4Address; public String platformVersion; public String firmwareVersion; + public String revision; public String model; @@ -34,9 +35,9 @@ public class ConnectNodeInfo implements Cloneable{ public String toString() { return String.format( "ConnectNodeInfo [mqttSettings=%s, redirectorAddr=%s, managerAddr=%s, skuNumber=%s, serialNumber=%s, " - + "macAddress=%s, ipV4Address=%s, platformVersion=%s, firmwareVersion=%s, model=%s]", + + "macAddress=%s, ipV4Address=%s, platformVersion=%s, firmwareVersion=%s, revision=%s, model=%s]", mqttSettings, redirectorAddr, managerAddr, skuNumber, serialNumber, macAddress, ipV4Address, - platformVersion, firmwareVersion, model); + platformVersion, firmwareVersion, revision, model); } } \ No newline at end of file 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 1a1976e..70eab7d 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 @@ -24,163 +24,177 @@ 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 ssidProfile; - private Location equipmentLocation; - private EquipmentRoutingRecord equipmentRouting; - private EquipmentGatewayRecord equipmentGateway; + private Equipment customerEquipment; + private Profile apProfile; + private List ssidProfile; + 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 ssidConfigs) { + // 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()); - } + 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 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 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++; + 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()); - } + 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 getSsidProfile() { - return ssidProfile; - } + public List getSsidProfile() { + return ssidProfile; + } - public void setSsidProfile(List ssidProfile) { - this.ssidProfile = ssidProfile; - } + public void setSsidProfile(List 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 ssidList = new ArrayList(); - 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 ssidList = new ArrayList(); + 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()); + + return sb.toString(); + + } } 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 d4edb12..68477cf 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 @@ -133,6 +133,7 @@ public class OvsdbDao { columns.add("model"); columns.add("firmware_version"); columns.add("platform_version"); + columns.add("revision"); operations.add(new Select(awlanNodeDbTable, conditions, columns)); CompletableFuture fResult = ovsdbClient.transact(ovsdbName, operations); @@ -158,6 +159,8 @@ public class OvsdbDao { ret.platformVersion = row != null ? row.getStringColumn("platform_version") : null; ret.firmwareVersion = row != null ? row.getStringColumn("firmware_version") : null; + ret.revision = row != null ? row.getStringColumn("revision") : null; + ret.skuNumber = getSingleValueFromSet(row, "sku_number"); ret.serialNumber = getSingleValueFromSet(row, "serial_number"); ret.model = getSingleValueFromSet(row, "model"); @@ -872,6 +875,7 @@ public class OvsdbDao { else { ret.put(wifiStatsConfigInfo.radioType + "_" + wifiStatsConfigInfo.statsType + "_" + wifiStatsConfigInfo.surveyType, wifiStatsConfigInfo); + } } @@ -2291,7 +2295,7 @@ public class OvsdbDao { com.vmware.ovsdb.protocol.operation.notation.Map thresholds = com.vmware.ovsdb.protocol.operation.notation.Map .of(thresholdMap); - provisionWifiStatsConfigDevice(getProvisionedWifiStatsConfigs(ovsdbClient), operations, updateColumns); +// provisionWifiStatsConfigDevice(getProvisionedWifiStatsConfigs(ovsdbClient), operations, updateColumns); provisionWifiStatsConfigSurvey(getProvisionedWifiStatsConfigs(ovsdbClient), operations, thresholds); @@ -2591,38 +2595,19 @@ public class OvsdbDao { } - private void provisionWifiStatsConfigDevice(Map provisionedWifiStatsConfigs, - List operations, Map updateColumns) { - Row row; - if (!provisionedWifiStatsConfigs.containsKey("2.4G_device")) { - updateColumns.put("radio_type", new Atom<>("2.4G")); - updateColumns.put("reporting_interval", new Atom<>(900)); - updateColumns.put("sampling_interval", new Atom<>(0)); - updateColumns.put("stats_type", new Atom<>("device")); - row = new Row(updateColumns); - operations.add(new Insert(wifiStatsConfigDbTable, row)); - } - - if (!provisionedWifiStatsConfigs.containsKey("5GL_device")) { - // updateColumns.put("channel_list", channels ); - updateColumns.put("radio_type", new Atom<>("5GL")); - updateColumns.put("reporting_interval", new Atom<>(900)); - updateColumns.put("sampling_interval", new Atom<>(0)); - updateColumns.put("stats_type", new Atom<>("device")); - row = new Row(updateColumns); - operations.add(new Insert(wifiStatsConfigDbTable, row)); - } - - if (!provisionedWifiStatsConfigs.containsKey("5GU_device")) { - // updateColumns.put("channel_list", channels ); - updateColumns.put("radio_type", new Atom<>("5GU")); - updateColumns.put("reporting_interval", new Atom<>(900)); - updateColumns.put("sampling_interval", new Atom<>(0)); - updateColumns.put("stats_type", new Atom<>("device")); - row = new Row(updateColumns); - operations.add(new Insert(wifiStatsConfigDbTable, row)); - } - } +// private void provisionWifiStatsConfigDevice(Map provisionedWifiStatsConfigs, +// List operations, Map updateColumns) { +// Row row; +// if (!provisionedWifiStatsConfigs.containsKey("2.4G_device")) { +// updateColumns.put("radio_type", new Atom<>("2.4G")); +// updateColumns.put("reporting_interval", new Atom<>(900)); +// updateColumns.put("sampling_interval", new Atom<>(0)); +// updateColumns.put("stats_type", new Atom<>("device")); +// row = new Row(updateColumns); +// operations.add(new Insert(wifiStatsConfigDbTable, row)); +// } +// +// } private void provisionWifiStatsConfigClient(Map provisionedWifiStatsConfigs, List operations) {