mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 11:07:49 +00:00
WIFI-1848: Gateway: Support new AWLAN_Node columns for manufacturing identity data
WIFI-1849: Gateway: Update status with additional manufacturing data
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package com.telecominfraproject.wlan.opensync.external.integration.models;
|
package com.telecominfraproject.wlan.opensync.external.integration.models;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -26,6 +27,13 @@ public class ConnectNodeInfo implements Cloneable {
|
|||||||
public String lanIfName;
|
public String lanIfName;
|
||||||
public String lanIfType;
|
public String lanIfType;
|
||||||
public String lanMacAddress;
|
public String lanMacAddress;
|
||||||
|
public String referenceDesign;
|
||||||
|
public Map<String, String> qrCode;
|
||||||
|
public String modelDescription;
|
||||||
|
public String manufacturerUrl;
|
||||||
|
public String manufacturerName;
|
||||||
|
public String manufacturerDate;
|
||||||
|
public String certificationRegion;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConnectNodeInfo clone() {
|
public ConnectNodeInfo clone() {
|
||||||
@@ -40,6 +48,9 @@ public class ConnectNodeInfo implements Cloneable {
|
|||||||
if (this.versionMatrix != null) {
|
if (this.versionMatrix != null) {
|
||||||
ret.versionMatrix = new HashMap<>(this.versionMatrix);
|
ret.versionMatrix = new HashMap<>(this.versionMatrix);
|
||||||
}
|
}
|
||||||
|
if (this.qrCode != null) {
|
||||||
|
ret.qrCode = new HashMap<>(this.qrCode);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
throw new IllegalStateException("Cannot clone ", e);
|
throw new IllegalStateException("Cannot clone ", e);
|
||||||
@@ -47,44 +58,45 @@ public class ConnectNodeInfo implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public int hashCode() {
|
||||||
if (this == obj) {
|
return Objects.hash(certificationRegion, country, firmwareVersion, ifName, ifType, ipV4Address, lanIfName, lanIfType, lanIpV4Address, lanMacAddress,
|
||||||
return true;
|
macAddress, managerAddr, manufacturerDate, manufacturerName, manufacturerUrl, model, modelDescription, mqttSettings, platformVersion, qrCode,
|
||||||
}
|
redirectorAddr, referenceDesign, revision, serialNumber, skuNumber, versionMatrix, wifiRadioStates);
|
||||||
if (!(obj instanceof ConnectNodeInfo)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ConnectNodeInfo other = (ConnectNodeInfo) obj;
|
|
||||||
return Objects.equals(country, other.country) && Objects.equals(firmwareVersion, other.firmwareVersion)
|
|
||||||
&& Objects.equals(ifName, other.ifName) && Objects.equals(ifType, other.ifType)
|
|
||||||
&& Objects.equals(ipV4Address, other.ipV4Address) && Objects.equals(lanIfName, other.lanIfName)
|
|
||||||
&& Objects.equals(lanIfType, other.lanIfType) && Objects.equals(lanIpV4Address, other.lanIpV4Address)
|
|
||||||
&& Objects.equals(lanMacAddress, other.lanMacAddress) && Objects.equals(macAddress, other.macAddress)
|
|
||||||
&& Objects.equals(managerAddr, other.managerAddr) && Objects.equals(model, other.model)
|
|
||||||
&& Objects.equals(mqttSettings, other.mqttSettings)
|
|
||||||
&& Objects.equals(platformVersion, other.platformVersion)
|
|
||||||
&& Objects.equals(redirectorAddr, other.redirectorAddr) && Objects.equals(revision, other.revision)
|
|
||||||
&& Objects.equals(serialNumber, other.serialNumber) && Objects.equals(skuNumber, other.skuNumber)
|
|
||||||
&& Objects.equals(versionMatrix, other.versionMatrix)
|
|
||||||
&& Objects.equals(wifiRadioStates, other.wifiRadioStates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public boolean equals(Object obj) {
|
||||||
return Objects.hash(country, firmwareVersion, ifName, ifType, ipV4Address, lanIfName, lanIfType, lanIpV4Address,
|
if (this == obj)
|
||||||
lanMacAddress, macAddress, managerAddr, model, mqttSettings, platformVersion, redirectorAddr, revision,
|
return true;
|
||||||
serialNumber, skuNumber, versionMatrix, wifiRadioStates);
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ConnectNodeInfo other = (ConnectNodeInfo) obj;
|
||||||
|
return Objects.equals(certificationRegion, other.certificationRegion) && Objects.equals(country, other.country)
|
||||||
|
&& Objects.equals(firmwareVersion, other.firmwareVersion) && Objects.equals(ifName, other.ifName) && Objects.equals(ifType, other.ifType)
|
||||||
|
&& Objects.equals(ipV4Address, other.ipV4Address) && Objects.equals(lanIfName, other.lanIfName) && Objects.equals(lanIfType, other.lanIfType)
|
||||||
|
&& Objects.equals(lanIpV4Address, other.lanIpV4Address) && Objects.equals(lanMacAddress, other.lanMacAddress)
|
||||||
|
&& Objects.equals(macAddress, other.macAddress) && Objects.equals(managerAddr, other.managerAddr)
|
||||||
|
&& Objects.equals(manufacturerDate, other.manufacturerDate) && Objects.equals(manufacturerName, other.manufacturerName)
|
||||||
|
&& Objects.equals(manufacturerUrl, other.manufacturerUrl) && Objects.equals(model, other.model)
|
||||||
|
&& Objects.equals(modelDescription, other.modelDescription) && Objects.equals(mqttSettings, other.mqttSettings)
|
||||||
|
&& Objects.equals(platformVersion, other.platformVersion) && Objects.equals(qrCode, other.qrCode)
|
||||||
|
&& Objects.equals(redirectorAddr, other.redirectorAddr) && Objects.equals(referenceDesign, other.referenceDesign)
|
||||||
|
&& Objects.equals(revision, other.revision) && Objects.equals(serialNumber, other.serialNumber) && Objects.equals(skuNumber, other.skuNumber)
|
||||||
|
&& Objects.equals(versionMatrix, other.versionMatrix) && Objects.equals(wifiRadioStates, other.wifiRadioStates);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ConnectNodeInfo [mqttSettings=" + mqttSettings + ", versionMatrix=" + versionMatrix
|
return "ConnectNodeInfo [mqttSettings=" + mqttSettings + ", versionMatrix=" + versionMatrix + ", wifiRadioStates=" + wifiRadioStates
|
||||||
+ ", wifiRadioStates=" + wifiRadioStates + ", redirectorAddr=" + redirectorAddr + ", managerAddr="
|
+ ", redirectorAddr=" + redirectorAddr + ", managerAddr=" + managerAddr + ", skuNumber=" + skuNumber + ", serialNumber=" + serialNumber
|
||||||
+ managerAddr + ", skuNumber=" + skuNumber + ", serialNumber=" + serialNumber + ", macAddress="
|
+ ", macAddress=" + macAddress + ", ipV4Address=" + ipV4Address + ", platformVersion=" + platformVersion + ", firmwareVersion="
|
||||||
+ macAddress + ", ipV4Address=" + ipV4Address + ", platformVersion=" + platformVersion
|
+ firmwareVersion + ", revision=" + revision + ", model=" + model + ", ifName=" + ifName + ", ifType=" + ifType + ", country=" + country
|
||||||
+ ", firmwareVersion=" + firmwareVersion + ", revision=" + revision + ", model=" + model + ", ifName="
|
+ ", lanIpV4Address=" + lanIpV4Address + ", lanIfName=" + lanIfName + ", lanIfType=" + lanIfType + ", lanMacAddress=" + lanMacAddress
|
||||||
+ ifName + ", ifType=" + ifType + ", country=" + country + ", lanIpV4Address=" + lanIpV4Address
|
+ ", referenceDesign=" + referenceDesign + ", qrCode=" + qrCode + ", modelDescription=" + modelDescription + ", manufacturerUrl="
|
||||||
+ ", lanIfName=" + lanIfName + ", lanIfType=" + lanIfType + ", lanMacAddress=" + lanMacAddress + "]";
|
+ manufacturerUrl + ", manufacturerName=" + manufacturerName + ", manufacturerDate=" + manufacturerDate + ", certificationRegion="
|
||||||
|
+ certificationRegion + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.telecominfraproject.wlan.opensync.external.integration.models;
|
package com.telecominfraproject.wlan.opensync.external.integration.models;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -45,6 +46,14 @@ public class OpensyncAWLANNode extends OpensyncAPBase {
|
|||||||
public String revision;
|
public String revision;
|
||||||
public String managerAddr;
|
public String managerAddr;
|
||||||
public boolean factoryReset;
|
public boolean factoryReset;
|
||||||
|
public String referenceDesign;
|
||||||
|
public Map<String, String> qrCode;
|
||||||
|
public String modelDescription;
|
||||||
|
public String manufacturerUrl;
|
||||||
|
public String manufacturerName;
|
||||||
|
public String manufacturerDate;
|
||||||
|
public String certificationRegion;
|
||||||
|
|
||||||
public Uuid _uuid;
|
public Uuid _uuid;
|
||||||
|
|
||||||
public Uuid version;
|
public Uuid version;
|
||||||
@@ -60,7 +69,6 @@ public class OpensyncAWLANNode extends OpensyncAPBase {
|
|||||||
public OpensyncAWLANNode(Row row) {
|
public OpensyncAWLANNode(Row row) {
|
||||||
this();
|
this();
|
||||||
Map<String, Value> map = row.getColumns();
|
Map<String, Value> map = row.getColumns();
|
||||||
|
|
||||||
if (map.get("mqtt_settings") != null) {
|
if (map.get("mqtt_settings") != null) {
|
||||||
this.setMqttSettings(row.getMapColumn("mqtt_settings"));
|
this.setMqttSettings(row.getMapColumn("mqtt_settings"));
|
||||||
}
|
}
|
||||||
@@ -70,93 +78,89 @@ public class OpensyncAWLANNode extends OpensyncAPBase {
|
|||||||
if (map.get("mqtt_topics") != null) {
|
if (map.get("mqtt_topics") != null) {
|
||||||
this.setMqttHeaders(row.getMapColumn("mqtt_topics"));
|
this.setMqttHeaders(row.getMapColumn("mqtt_topics"));
|
||||||
}
|
}
|
||||||
|
if ((map.get("model") != null) && map.get("model").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
if ((map.get("model") != null)
|
|
||||||
&& map.get("model").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setModel(row.getStringColumn("model"));
|
this.setModel(row.getStringColumn("model"));
|
||||||
}
|
}
|
||||||
if ((map.get("sku_number") != null)
|
if ((map.get("sku_number") != null) && map.get("sku_number").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
&& map.get("sku_number").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setSkuNumber(row.getStringColumn("sku_number"));
|
this.setSkuNumber(row.getStringColumn("sku_number"));
|
||||||
}
|
}
|
||||||
if ((map.get("id") != null)
|
if (map.get("id") != null) {
|
||||||
&& map.get("id").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
this.setId(getSingleValueFromSet(row, "id"));
|
||||||
this.setId(row.getStringColumn("id"));
|
}
|
||||||
|
if (map.get("reference_design") != null) {
|
||||||
|
this.setReferenceDesign(getSingleValueFromSet(row, "reference_design"));
|
||||||
|
}
|
||||||
|
if (map.get("qr_code") != null) {
|
||||||
|
this.setQrCode(row.getMapColumn("qr_code"));
|
||||||
|
}
|
||||||
|
if ((map.get("model_description") != null)) {
|
||||||
|
this.setModelDescription(getSingleValueFromSet(row, "model_description"));
|
||||||
|
}
|
||||||
|
if ((map.get("manufacturer_url") != null)) {
|
||||||
|
this.setManufacturerUrl(getSingleValueFromSet(row, "manufacturer_url"));
|
||||||
|
}
|
||||||
|
if ((map.get("manufacturer_name") != null)) {
|
||||||
|
this.setManufacturerName(getSingleValueFromSet(row, "manufacturer_name"));
|
||||||
|
}
|
||||||
|
if ((map.get("manufacturer_date") != null)) {
|
||||||
|
this.setManufacturerDate(getSingleValueFromSet(row, "manufacturer_date"));
|
||||||
|
}
|
||||||
|
if (map.get("certification_region") != null) {
|
||||||
|
this.setCertificationRegion(getSingleValueFromSet(row, "certification_region"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map.get("version_matrix") != null) {
|
if (map.get("version_matrix") != null) {
|
||||||
this.setVersionMatrix(row.getMapColumn("version_matrix"));
|
this.setVersionMatrix(row.getMapColumn("version_matrix"));
|
||||||
}
|
}
|
||||||
if ((map.get("firmware_version") != null) && map.get("firmware_version").getClass()
|
if ((map.get("firmware_version") != null) && map.get("firmware_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setFirmwareVersion(row.getStringColumn("firmware_version"));
|
this.setFirmwareVersion(row.getStringColumn("firmware_version"));
|
||||||
}
|
}
|
||||||
if ((map.get("firmware_url") != null)
|
if ((map.get("firmware_url") != null) && map.get("firmware_url").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
&& map.get("firmware_url").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setFirmwareUrl(row.getStringColumn("firmware_url"));
|
this.setFirmwareUrl(row.getStringColumn("firmware_url"));
|
||||||
}
|
}
|
||||||
|
if ((map.get("_uuid") != null) && map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
if ((map.get("_uuid") != null)
|
|
||||||
&& map.get("_uuid").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setVersion(row.getUuidColumn("_uuid"));
|
this.setVersion(row.getUuidColumn("_uuid"));
|
||||||
}
|
}
|
||||||
if ((map.get("upgrade_dl_timer") != null) && map.get("upgrade_dl_timer").getClass()
|
if ((map.get("upgrade_dl_timer") != null) && map.get("upgrade_dl_timer").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setUpgradeDlTimer(row.getIntegerColumn("upgrade_dl_timer").intValue());
|
this.setUpgradeDlTimer(row.getIntegerColumn("upgrade_dl_timer").intValue());
|
||||||
}
|
}
|
||||||
if ((map.get("platform_version") != null) && map.get("platform_version").getClass()
|
if ((map.get("platform_version") != null) && map.get("platform_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setPlatformVersion(row.getStringColumn("platform_version"));
|
this.setPlatformVersion(row.getStringColumn("platform_version"));
|
||||||
}
|
}
|
||||||
if ((map.get("firmware_pass") != null) && map.get("firmware_pass").getClass()
|
if ((map.get("firmware_pass") != null) && map.get("firmware_pass").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setFirmwarePass(row.getStringColumn("firmware_pass"));
|
this.setFirmwarePass(row.getStringColumn("firmware_pass"));
|
||||||
}
|
}
|
||||||
if ((map.get("upgrade_timer") != null) && map.get("upgrade_timer").getClass()
|
if ((map.get("upgrade_timer") != null) && map.get("upgrade_timer").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setUpgradeTimer(row.getIntegerColumn("upgrade_timer").intValue());
|
this.setUpgradeTimer(row.getIntegerColumn("upgrade_timer").intValue());
|
||||||
}
|
}
|
||||||
if ((map.get("max_backoff") != null)
|
if ((map.get("max_backoff") != null) && map.get("max_backoff").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
&& map.get("max_backoff").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setMaxBackoff(row.getIntegerColumn("max_backoff").intValue());
|
this.setMaxBackoff(row.getIntegerColumn("max_backoff").intValue());
|
||||||
}
|
}
|
||||||
if (map.get("led_config") != null) {
|
if (map.get("led_config") != null) {
|
||||||
this.setLedConfig(row.getMapColumn("led_config"));
|
this.setLedConfig(row.getMapColumn("led_config"));
|
||||||
}
|
}
|
||||||
if ((map.get("redirector_addr") != null) && map.get("redirector_addr").getClass()
|
if ((map.get("redirector_addr") != null) && map.get("redirector_addr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setRedirectorAddr(row.getStringColumn("redirector_addr"));
|
this.setRedirectorAddr(row.getStringColumn("redirector_addr"));
|
||||||
}
|
}
|
||||||
if ((map.get("serial_number") != null) && map.get("serial_number").getClass()
|
if ((map.get("serial_number") != null) && map.get("serial_number").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setSerialNumber(row.getStringColumn("serial_number"));
|
this.setSerialNumber(row.getStringColumn("serial_number"));
|
||||||
}
|
}
|
||||||
if ((map.get("_version") != null)
|
if ((map.get("_version") != null) && map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
&& map.get("_version").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setVersion(row.getUuidColumn("_version"));
|
this.setVersion(row.getUuidColumn("_version"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setUpgradeStatus(row.getIntegerColumn("upgrade_status").intValue());
|
this.setUpgradeStatus(row.getIntegerColumn("upgrade_status").intValue());
|
||||||
|
if ((map.get("device_mode") != null) && map.get("device_mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
if ((map.get("device_mode") != null)
|
|
||||||
&& map.get("device_mode").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setDeviceMode(row.getStringColumn("device_mode"));
|
this.setDeviceMode(row.getStringColumn("device_mode"));
|
||||||
}
|
}
|
||||||
if ((map.get("min_backoff") != null)
|
if ((map.get("min_backoff") != null) && map.get("min_backoff").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
&& map.get("min_backoff").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setMinBackoff(row.getIntegerColumn("min_backoff").intValue());
|
this.setMinBackoff(row.getIntegerColumn("min_backoff").intValue());
|
||||||
}
|
}
|
||||||
|
if ((map.get("revision") != null) && map.get("revision").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
if ((map.get("revision") != null)
|
|
||||||
&& map.get("revision").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setRevision(row.getStringColumn("revision"));
|
this.setRevision(row.getStringColumn("revision"));
|
||||||
}
|
}
|
||||||
if ((map.get("manager_addr") != null)
|
if ((map.get("manager_addr") != null) && map.get("manager_addr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
&& map.get("manager_addr").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setManagerAddr(row.getStringColumn("manager_addr"));
|
this.setManagerAddr(row.getStringColumn("manager_addr"));
|
||||||
}
|
}
|
||||||
if ((map.get("factory_reset") != null) && map.get("factory_reset").getClass()
|
if ((map.get("factory_reset") != null) && map.get("factory_reset").getClass().equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
|
||||||
this.setFactoryReset(row.getBooleanColumn("factory_reset"));
|
this.setFactoryReset(row.getBooleanColumn("factory_reset"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,6 +265,62 @@ public class OpensyncAWLANNode extends OpensyncAPBase {
|
|||||||
return factoryReset;
|
return factoryReset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReferenceDesign() {
|
||||||
|
return referenceDesign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReferenceDesign(String referenceDesign) {
|
||||||
|
this.referenceDesign = referenceDesign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getQrCode() {
|
||||||
|
return qrCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrCode(Map<String, String> qrCode) {
|
||||||
|
this.qrCode = qrCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModelDescription() {
|
||||||
|
return modelDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModelDescription(String modelDescription) {
|
||||||
|
this.modelDescription = modelDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManufacturerUrl() {
|
||||||
|
return manufacturerUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManufacturerUrl(String manufacturerUrl) {
|
||||||
|
this.manufacturerUrl = manufacturerUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManufacturerName() {
|
||||||
|
return manufacturerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManufacturerName(String manufacturerName) {
|
||||||
|
this.manufacturerName = manufacturerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManufacturerDate() {
|
||||||
|
return manufacturerDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManufacturerDate(String manufacturerDate) {
|
||||||
|
this.manufacturerDate = manufacturerDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCertificationRegion() {
|
||||||
|
return certificationRegion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCertificationRegion(String certificationRegion) {
|
||||||
|
this.certificationRegion = certificationRegion;
|
||||||
|
}
|
||||||
|
|
||||||
public void set_uuid(Uuid _uuid) {
|
public void set_uuid(Uuid _uuid) {
|
||||||
this._uuid = _uuid;
|
this._uuid = _uuid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
|
||||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -25,6 +27,7 @@ import com.vmware.ovsdb.protocol.operation.notation.Value;
|
|||||||
import com.vmware.ovsdb.protocol.operation.result.ErrorResult;
|
import com.vmware.ovsdb.protocol.operation.result.ErrorResult;
|
||||||
import com.vmware.ovsdb.protocol.operation.result.OperationResult;
|
import com.vmware.ovsdb.protocol.operation.result.OperationResult;
|
||||||
import com.vmware.ovsdb.protocol.operation.result.SelectResult;
|
import com.vmware.ovsdb.protocol.operation.result.SelectResult;
|
||||||
|
import com.vmware.ovsdb.protocol.schema.DatabaseSchema;
|
||||||
import com.vmware.ovsdb.service.OvsdbClient;
|
import com.vmware.ovsdb.service.OvsdbClient;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@@ -85,8 +88,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row row = null;
|
Row row = null;
|
||||||
if ((result != null) && (result.length > 0) && (result[0] instanceof SelectResult)
|
if ((result != null) && (result.length > 0) && (result[0] instanceof SelectResult) && !((SelectResult) result[0]).getRows().isEmpty()) {
|
||||||
&& !((SelectResult) result[0]).getRows().isEmpty()) {
|
|
||||||
row = ((SelectResult) result[0]).getRows().iterator().next();
|
row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||||
connectNodeInfo.lanIpV4Address = getSingleValueFromSet(row, "inet_addr");
|
connectNodeInfo.lanIpV4Address = getSingleValueFromSet(row, "inet_addr");
|
||||||
connectNodeInfo.lanIfName = row.getStringColumn("if_name");
|
connectNodeInfo.lanIfName = row.getStringColumn("if_name");
|
||||||
@@ -103,8 +105,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fillInWanIpAddressAndMac(OvsdbClient ovsdbClient, ConnectNodeInfo connectNodeInfo, String ifType,
|
void fillInWanIpAddressAndMac(OvsdbClient ovsdbClient, ConnectNodeInfo connectNodeInfo, String ifType, String ifName) {
|
||||||
String ifName) {
|
|
||||||
try {
|
try {
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
List<Condition> conditions = new ArrayList<>();
|
List<Condition> conditions = new ArrayList<>();
|
||||||
@@ -132,8 +133,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row row = null;
|
Row row = null;
|
||||||
if ((result != null) && (result.length > 0) && (result[0] instanceof SelectResult)
|
if ((result != null) && (result.length > 0) && (result[0] instanceof SelectResult) && !((SelectResult) result[0]).getRows().isEmpty()) {
|
||||||
&& !((SelectResult) result[0]).getRows().isEmpty()) {
|
|
||||||
row = ((SelectResult) result[0]).getRows().iterator().next();
|
row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||||
connectNodeInfo.ipV4Address = getSingleValueFromSet(row, "inet_addr");
|
connectNodeInfo.ipV4Address = getSingleValueFromSet(row, "inet_addr");
|
||||||
connectNodeInfo.ifName = row.getStringColumn("if_name");
|
connectNodeInfo.ifName = row.getStringColumn("if_name");
|
||||||
@@ -166,6 +166,15 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
columns.add("platform_version");
|
columns.add("platform_version");
|
||||||
columns.add("revision");
|
columns.add("revision");
|
||||||
columns.add("version_matrix");
|
columns.add("version_matrix");
|
||||||
|
columns.add("id");
|
||||||
|
|
||||||
|
DatabaseSchema dbSchema = ovsdbClient.getSchema(ovsdbName).get();
|
||||||
|
Set<String> keys = dbSchema.getTables().get(awlanNodeDbTable).getColumns().keySet();
|
||||||
|
if (keys.containsAll(Set.of("reference_design", "qr_code", "model_description", "manufacturer_url", "manufacturer_name", "manufacturer_date",
|
||||||
|
"certification_region"))) {
|
||||||
|
columns.addAll(Set.of("reference_design", "qr_code", "model_description", "manufacturer_url", "manufacturer_name", "manufacturer_date",
|
||||||
|
"certification_region"));
|
||||||
|
}
|
||||||
|
|
||||||
operations.add(new Select(awlanNodeDbTable, conditions, columns));
|
operations.add(new Select(awlanNodeDbTable, conditions, columns));
|
||||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||||
@@ -180,8 +189,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row row = null;
|
Row row = null;
|
||||||
if ((result != null) && (result.length > 0) && (result[0] instanceof SelectResult)
|
if ((result != null) && (result.length > 0) && (result[0] instanceof SelectResult) && !((SelectResult) result[0]).getRows().isEmpty()) {
|
||||||
&& !((SelectResult) result[0]).getRows().isEmpty()) {
|
|
||||||
row = ((SelectResult) result[0]).getRows().iterator().next();
|
row = ((SelectResult) result[0]).getRows().iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +207,17 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
ret.serialNumber = getSingleValueFromSet(row, "serial_number");
|
ret.serialNumber = getSingleValueFromSet(row, "serial_number");
|
||||||
ret.model = getSingleValueFromSet(row, "model");
|
ret.model = getSingleValueFromSet(row, "model");
|
||||||
|
|
||||||
|
if (keys.containsAll(Set.of("reference_design", "qr_code", "model_description", "manufacturer_url", "manufacturer_name", "manufacturer_date",
|
||||||
|
"certification_region"))) {
|
||||||
|
ret.referenceDesign = getSingleValueFromSet(row, "reference_design");
|
||||||
|
ret.qrCode = row.getMapColumn("qr_code");
|
||||||
|
ret.modelDescription = getSingleValueFromSet(row, "model_description");
|
||||||
|
ret.manufacturerUrl = getSingleValueFromSet(row, "manufacturer_url");
|
||||||
|
ret.manufacturerName = getSingleValueFromSet(row, "manufacturer_name");
|
||||||
|
ret.manufacturerDate = getSingleValueFromSet(row, "manufacturer_date");
|
||||||
|
ret.certificationRegion = getSingleValueFromSet(row, "certification_region");
|
||||||
|
}
|
||||||
|
|
||||||
// now populate macAddress, ipV4Address from Wifi_Inet_State
|
// now populate macAddress, ipV4Address from Wifi_Inet_State
|
||||||
// first look them up for if_name = br-wan
|
// first look them up for if_name = br-wan
|
||||||
fillInWanIpAddressAndMac(ovsdbClient, ret, defaultWanInterfaceType, defaultWanInterfaceName);
|
fillInWanIpAddressAndMac(ovsdbClient, ret, defaultWanInterfaceType, defaultWanInterfaceName);
|
||||||
@@ -207,8 +226,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
fillInWanIpAddressAndMac(ovsdbClient, ret, defaultLanInterfaceType, defaultLanInterfaceName);
|
fillInWanIpAddressAndMac(ovsdbClient, ret, defaultLanInterfaceType, defaultLanInterfaceName);
|
||||||
|
|
||||||
if (ret.ipV4Address == null) {
|
if (ret.ipV4Address == null) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException("Could not get inet address for Lan and Wan network interfaces. Node is not ready to connect.");
|
||||||
"Could not get inet address for Lan and Wan network interfaces. Node is not ready to connect.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fillInLanIpAddressAndMac(ovsdbClient, ret, defaultLanInterfaceType);
|
fillInLanIpAddressAndMac(ovsdbClient, ret, defaultLanInterfaceType);
|
||||||
@@ -262,8 +280,8 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
serialNumber = getSingleValueFromSet(row, "serial_number");
|
serialNumber = getSingleValueFromSet(row, "serial_number");
|
||||||
model = getSingleValueFromSet(row, "model");
|
model = getSingleValueFromSet(row, "model");
|
||||||
|
|
||||||
LOG.info("Redirecting AP Node: clientCn {} serialNumber {} model {} firmwareVersion {} skuNumber {}",
|
LOG.info("Redirecting AP Node: clientCn {} serialNumber {} model {} firmwareVersion {} skuNumber {}", clientCn, serialNumber, model,
|
||||||
clientCn, serialNumber, model, firmwareVersion, skuNumber);
|
firmwareVersion, skuNumber);
|
||||||
|
|
||||||
// Update table AWLAN_Node - set manager_addr
|
// Update table AWLAN_Node - set manager_addr
|
||||||
operations.clear();
|
operations.clear();
|
||||||
@@ -293,8 +311,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
|
|
||||||
void rebootOrResetAp(OvsdbClient ovsdbClient, String desiredApAction) {
|
void rebootOrResetAp(OvsdbClient ovsdbClient, String desiredApAction) {
|
||||||
try {
|
try {
|
||||||
LOG.debug("rebootOrResetAp on AP perform {}, setting timer for {} seconds.", desiredApAction,
|
LOG.debug("rebootOrResetAp on AP perform {}, setting timer for {} seconds.", desiredApAction, rebootOrResetTimerSeconds);
|
||||||
rebootOrResetTimerSeconds);
|
|
||||||
List<Operation> operations = new ArrayList<>();
|
List<Operation> operations = new ArrayList<>();
|
||||||
Map<String, Value> updateColumns = new HashMap<>();
|
Map<String, Value> updateColumns = new HashMap<>();
|
||||||
updateColumns.put("firmware_url", new Atom<>(desiredApAction));
|
updateColumns.put("firmware_url", new Atom<>(desiredApAction));
|
||||||
@@ -315,8 +332,8 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectNodeInfo updateConnectNodeInfoOnConnect(OvsdbClient ovsdbClient, String clientCn,
|
ConnectNodeInfo updateConnectNodeInfoOnConnect(OvsdbClient ovsdbClient, String clientCn, ConnectNodeInfo incomingConnectNodeInfo,
|
||||||
ConnectNodeInfo incomingConnectNodeInfo, boolean preventCnAlteration) {
|
boolean preventCnAlteration) {
|
||||||
ConnectNodeInfo ret = incomingConnectNodeInfo.clone();
|
ConnectNodeInfo ret = incomingConnectNodeInfo.clone();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -337,8 +354,7 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
// mqtt_settings:ins:'["map",[["broker","testportal.123wlan.com"],["topics","/ap/dev-ap-0300/opensync"],["qos","0"],["port","1883"],["remote_log","1"]]]'
|
// mqtt_settings:ins:'["map",[["broker","testportal.123wlan.com"],["topics","/ap/dev-ap-0300/opensync"],["qos","0"],["port","1883"],["remote_log","1"]]]'
|
||||||
Map<String, String> newMqttSettings = new HashMap<>();
|
Map<String, String> newMqttSettings = new HashMap<>();
|
||||||
newMqttSettings.put("broker", mqttBrokerAddress);
|
newMqttSettings.put("broker", mqttBrokerAddress);
|
||||||
String mqttClientName = OvsdbToWlanCloudTypeMappingUtility.getAlteredClientCnIfRequired(clientCn,
|
String mqttClientName = OvsdbToWlanCloudTypeMappingUtility.getAlteredClientCnIfRequired(clientCn, incomingConnectNodeInfo, preventCnAlteration);
|
||||||
incomingConnectNodeInfo, preventCnAlteration);
|
|
||||||
newMqttSettings.put("topics", "/ap/" + mqttClientName + "/opensync");
|
newMqttSettings.put("topics", "/ap/" + mqttClientName + "/opensync");
|
||||||
newMqttSettings.put("port", "" + mqttBrokerExternalPort);
|
newMqttSettings.put("port", "" + mqttBrokerExternalPort);
|
||||||
newMqttSettings.put("compress", "zlib");
|
newMqttSettings.put("compress", "zlib");
|
||||||
@@ -347,8 +363,8 @@ public class OvsdbNode extends OvsdbDaoBase {
|
|||||||
|
|
||||||
if ((ret.mqttSettings == null) || !ret.mqttSettings.equals(newMqttSettings)) {
|
if ((ret.mqttSettings == null) || !ret.mqttSettings.equals(newMqttSettings)) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> mgttSettings = com.vmware.ovsdb.protocol.operation.notation.Map
|
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> mgttSettings =
|
||||||
.of(newMqttSettings);
|
com.vmware.ovsdb.protocol.operation.notation.Map.of(newMqttSettings);
|
||||||
ret.mqttSettings = newMqttSettings;
|
ret.mqttSettings = newMqttSettings;
|
||||||
updateColumns.put("mqtt_settings", mgttSettings);
|
updateColumns.put("mqtt_settings", mgttSettings);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@@ -60,16 +61,16 @@ import com.vmware.ovsdb.protocol.schema.TableSchema;
|
|||||||
import com.vmware.ovsdb.service.OvsdbClient;
|
import com.vmware.ovsdb.service.OvsdbClient;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@ActiveProfiles(profiles = { "integration_test", }) // NOTE: these profiles will
|
@ActiveProfiles(profiles = {"integration_test",}) // NOTE: these profiles will
|
||||||
// be ADDED to the list of
|
// be ADDED to the list of
|
||||||
// active profiles
|
// active profiles
|
||||||
@SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = OvsdbDaoTest.class)
|
@SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = OvsdbDaoTest.class)
|
||||||
@Import(value = { OvsdbDao.class, OvsdbDaoTest.Config.class, OvsdbNode.class, OvsdbRadioConfig.class,
|
@Import(
|
||||||
OvsdbHotspotConfig.class, OvsdbCommandConfig.class, OvsdbMonitor.class, OvsdbFirmwareConfig.class,
|
value = {OvsdbDao.class, OvsdbDaoTest.Config.class, OvsdbNode.class, OvsdbRadioConfig.class, OvsdbHotspotConfig.class, OvsdbCommandConfig.class,
|
||||||
OvsdbStatsConfig.class, OvsdbSsidConfig.class, OvsdbRrmConfig.class, OvsdbNetworkConfig.class,
|
OvsdbMonitor.class, OvsdbFirmwareConfig.class, OvsdbStatsConfig.class, OvsdbSsidConfig.class, OvsdbRrmConfig.class, OvsdbNetworkConfig.class,
|
||||||
OvsdbNodeConfig.class,OvsdbRadiusProxyConfig.class
|
OvsdbNodeConfig.class, OvsdbRadiusProxyConfig.class
|
||||||
|
|
||||||
})
|
})
|
||||||
public class OvsdbDaoTest {
|
public class OvsdbDaoTest {
|
||||||
|
|
||||||
static final int DEFAULT_CUSTOMER_ID = 1;
|
static final int DEFAULT_CUSTOMER_ID = 1;
|
||||||
@@ -178,9 +179,8 @@ public class OvsdbDaoTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testConfigureGreTunnels() throws Exception {
|
public void testConfigureGreTunnels() throws Exception {
|
||||||
List<Row> rows = new ArrayList<>();
|
List<Row> rows = new ArrayList<>();
|
||||||
OperationResult[] operationResult = new OperationResult[] { new SelectResult(rows) };
|
OperationResult[] operationResult = new OperationResult[] {new SelectResult(rows)};
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList()))
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(selectionFutureResult);
|
||||||
.thenReturn(selectionFutureResult);
|
|
||||||
Mockito.when(selectionFutureResult.get(30, TimeUnit.SECONDS)).thenReturn(operationResult);
|
Mockito.when(selectionFutureResult.get(30, TimeUnit.SECONDS)).thenReturn(operationResult);
|
||||||
Profile apProfile = new Profile();
|
Profile apProfile = new Profile();
|
||||||
apProfile.setCustomerId(2);
|
apProfile.setCustomerId(2);
|
||||||
@@ -251,25 +251,21 @@ public class OvsdbDaoTest {
|
|||||||
passpointVenueProfile.setId(VENUE_ID);
|
passpointVenueProfile.setId(VENUE_ID);
|
||||||
Profile hotspot20IdProviderProfile = new Profile();
|
Profile hotspot20IdProviderProfile = new Profile();
|
||||||
hotspot20IdProviderProfile.setId(HOTSPOT_PROVIDER_ID_1);
|
hotspot20IdProviderProfile.setId(HOTSPOT_PROVIDER_ID_1);
|
||||||
hotspot20IdProviderProfile = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(DEFAULT_CUSTOMER_ID,
|
hotspot20IdProviderProfile = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(DEFAULT_CUSTOMER_ID, hotspot20IdProviderProfile,
|
||||||
hotspot20IdProviderProfile, "TipWlan-Hotspot20-OSU-Provider", "Rogers AT&T Wireless", "Canada", "ca",
|
"TipWlan-Hotspot20-OSU-Provider", "Rogers AT&T Wireless", "Canada", "ca", 302, 720, "rogers.com", 1);
|
||||||
302, 720, "rogers.com", 1);
|
|
||||||
Profile hotspot20IdProviderProfile2 = new Profile();
|
Profile hotspot20IdProviderProfile2 = new Profile();
|
||||||
hotspot20IdProviderProfile2.setId(HOTSPOT_PROVIDER_ID_2);
|
hotspot20IdProviderProfile2.setId(HOTSPOT_PROVIDER_ID_2);
|
||||||
hotspot20IdProviderProfile2 = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(DEFAULT_CUSTOMER_ID,
|
hotspot20IdProviderProfile2 = OvsdbDaoTestUtilities.createPasspointIdProviderProfile(DEFAULT_CUSTOMER_ID, hotspot20IdProviderProfile2,
|
||||||
hotspot20IdProviderProfile2, "TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302,
|
"TipWlan-Hotspot20-OSU-Provider-2", "Telus Mobility", "Canada", "ca", 302, 220, "telus.com", 1);
|
||||||
220, "telus.com", 1);
|
|
||||||
|
|
||||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile.getId());
|
||||||
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
profileSsidOsu.getChildProfileIds().add(hotspot20IdProviderProfile2.getId());
|
||||||
|
|
||||||
Profile passpointHotspotConfig = OvsdbDaoTestUtilities.createPasspointHotspotConfig(DEFAULT_CUSTOMER_ID,
|
Profile passpointHotspotConfig = OvsdbDaoTestUtilities.createPasspointHotspotConfig(DEFAULT_CUSTOMER_ID, hotspot20IdProviderProfile2,
|
||||||
hotspot20IdProviderProfile2, hotspot20IdProviderProfile, passpointOperatorProfile,
|
hotspot20IdProviderProfile, passpointOperatorProfile, passpointVenueProfile, profileSsidPsk, profileSsidOsu);
|
||||||
passpointVenueProfile, profileSsidPsk, profileSsidOsu);
|
|
||||||
passpointHotspotConfig.setId(HOTSPOT_CONFIG_ID);
|
passpointHotspotConfig.setId(HOTSPOT_CONFIG_ID);
|
||||||
|
|
||||||
Profile hotspotProfileAp = OvsdbDaoTestUtilities.createPasspointApProfile(DEFAULT_CUSTOMER_ID, profileSsidPsk,
|
Profile hotspotProfileAp = OvsdbDaoTestUtilities.createPasspointApProfile(DEFAULT_CUSTOMER_ID, profileSsidPsk, profileSsidOsu);
|
||||||
profileSsidOsu);
|
|
||||||
hotspotProfileAp.setId(EQUIPMENT_AP_ID);
|
hotspotProfileAp.setId(EQUIPMENT_AP_ID);
|
||||||
|
|
||||||
hsConfig.setHotspot20OperatorSet(Set.of(passpointOperatorProfile));
|
hsConfig.setHotspot20OperatorSet(Set.of(passpointOperatorProfile));
|
||||||
@@ -283,14 +279,12 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
apConfig.setSsidProfile(List.of(profileSsidOsu, profileSsidPsk));
|
apConfig.setSsidProfile(List.of(profileSsidOsu, profileSsidPsk));
|
||||||
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS)))
|
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20IconRows()).thenReturn(OvsdbDaoTestUtilities.hs20InsertIconRows())
|
.thenReturn(OvsdbDaoTestUtilities.hs20InsertIconRows()).thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
.thenReturn(OvsdbDaoTestUtilities.hs20IconRows()).thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20IconRows())
|
.thenReturn(OvsdbDaoTestUtilities.hs20InsertProviderRows()).thenReturn(OvsdbDaoTestUtilities.hs20Config())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20InsertProviderRows())
|
.thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows())
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20Config()).thenReturn(OvsdbDaoTestUtilities.hs20OsuProviders())
|
.thenReturn(OvsdbDaoTestUtilities.vifConfigRows()).thenReturn(OvsdbDaoTestUtilities.hs20Config());
|
||||||
.thenReturn(OvsdbDaoTestUtilities.vifConfigRows()).thenReturn(OvsdbDaoTestUtilities.vifConfigRows())
|
|
||||||
.thenReturn(OvsdbDaoTestUtilities.hs20Config());
|
|
||||||
|
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
||||||
|
|
||||||
@@ -352,275 +346,12 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetConnectNodeInfo() throws Exception {
|
|
||||||
|
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
|
||||||
|
|
||||||
java.util.Map<String, Value> awlanColumns = new HashMap<>();
|
|
||||||
awlanColumns.put("mqtt_settings", com.vmware.ovsdb.protocol.operation.notation.Map
|
|
||||||
.of(ImmutableMap.of("broker", "192.168.1.101", "port", "1883")));
|
|
||||||
awlanColumns.put("redirector_addr", Atom.string(REDIRECT_ADDR));
|
|
||||||
awlanColumns.put("manager_addr", Atom.string(MGR_ADDR));
|
|
||||||
awlanColumns.put("platform_version", Atom.string(PLATFORM_VERSION));
|
|
||||||
awlanColumns.put("firmware_version", Atom.string(FW_VERSION));
|
|
||||||
awlanColumns.put("revision", Atom.string(REVISION));
|
|
||||||
awlanColumns.put("sku_number", Atom.string(SKU_NUMBER));
|
|
||||||
awlanColumns.put("serial_number", Atom.string(SERIAL_NUM));
|
|
||||||
awlanColumns.put("model", Atom.string(MODEL));
|
|
||||||
Row awlanRow = new Row(awlanColumns);
|
|
||||||
|
|
||||||
List<Row> awlanRows = ImmutableList.of(awlanRow);
|
|
||||||
|
|
||||||
OperationResult[] awlanResult = new OperationResult[] { new SelectResult(awlanRows) };
|
|
||||||
|
|
||||||
java.util.Map<String, Value> inetWanColumns = new HashMap<>();
|
|
||||||
inetWanColumns.put("inet_addr", Atom.string(WAN_IP));
|
|
||||||
inetWanColumns.put("hwaddr", Atom.string(WAN_MAC));
|
|
||||||
inetWanColumns.put("if_name", Atom.string(WAN_IF_NAME));
|
|
||||||
inetWanColumns.put("if_type", Atom.string(WAN_IF_TYPE));
|
|
||||||
|
|
||||||
Row inetWanRow = new Row(inetWanColumns);
|
|
||||||
|
|
||||||
List<Row> inetWanRows = ImmutableList.of(inetWanRow);
|
|
||||||
|
|
||||||
OperationResult[] inetWanResult = new OperationResult[] { new SelectResult(inetWanRows) };
|
|
||||||
|
|
||||||
java.util.Map<String, Value> inetLanColumns = new HashMap<>();
|
|
||||||
inetLanColumns.put("inet_addr", Atom.string(LAN_IP));
|
|
||||||
inetLanColumns.put("hwaddr", Atom.string(LAN_MAC));
|
|
||||||
inetLanColumns.put("if_name", Atom.string(LAN_IF_NAME));
|
|
||||||
inetLanColumns.put("if_type", Atom.string(LAN_IF_TYPE));
|
|
||||||
|
|
||||||
Row inetLanRow = new Row(inetLanColumns);
|
|
||||||
|
|
||||||
List<Row> inetLanRows = ImmutableList.of(inetLanRow);
|
|
||||||
|
|
||||||
OperationResult[] inetLanResult = new OperationResult[] { new SelectResult(inetLanRows) };
|
|
||||||
|
|
||||||
java.util.Map<String, Value> wifiRadioStateColumns = new HashMap<>();
|
|
||||||
wifiRadioStateColumns.put("freq_band", Atom.string("2.4G"));
|
|
||||||
wifiRadioStateColumns.put("if_name", Atom.string("home-ap-24"));
|
|
||||||
Row wifiRadioStateRow = new Row(wifiRadioStateColumns);
|
|
||||||
|
|
||||||
java.util.Map<String, Value> wifiRadioStateColumns2 = new HashMap<>();
|
|
||||||
wifiRadioStateColumns2.put("freq_band", Atom.string("5GL"));
|
|
||||||
wifiRadioStateColumns2.put("if_name", Atom.string("home-ap-l50"));
|
|
||||||
Row wifiRadioStateRow2 = new Row(wifiRadioStateColumns2);
|
|
||||||
|
|
||||||
java.util.Map<String, Value> wifiRadioStateColumns3 = new HashMap<>();
|
|
||||||
wifiRadioStateColumns3.put("freq_band", Atom.string("5GU"));
|
|
||||||
wifiRadioStateColumns3.put("if_name", Atom.string("home-ap-u50"));
|
|
||||||
Row wifiRadioStateRow3 = new Row(wifiRadioStateColumns3);
|
|
||||||
|
|
||||||
List<Row> wifiRadioStateRows = ImmutableList.of(wifiRadioStateRow, wifiRadioStateRow2, wifiRadioStateRow3);
|
|
||||||
|
|
||||||
OperationResult[] wifiRadioStateResult = new OperationResult[] { new SelectResult(wifiRadioStateRows) };
|
|
||||||
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(awlanResult)
|
|
||||||
.thenReturn(inetWanResult).thenReturn(inetLanResult).thenReturn(wifiRadioStateResult);
|
|
||||||
|
|
||||||
ConnectNodeInfo connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo);
|
|
||||||
assert (connectNodeInfo.wifiRadioStates.entrySet().size() == 3);
|
|
||||||
assert (connectNodeInfo.firmwareVersion.equals(FW_VERSION));
|
|
||||||
assert (connectNodeInfo.redirectorAddr.equals(REDIRECT_ADDR));
|
|
||||||
assert (connectNodeInfo.ipV4Address.equals(WAN_IP));
|
|
||||||
|
|
||||||
assert (connectNodeInfo.lanIfName.equals(LAN_IF_NAME));
|
|
||||||
assert (connectNodeInfo.ifName.equals(WAN_IF_NAME));
|
|
||||||
|
|
||||||
Mockito.verify(ovsdbClient, Mockito.times(4)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(expected = RuntimeException.class)
|
|
||||||
public void testFailGetConnectNodeInfo() throws Exception {
|
|
||||||
|
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
|
||||||
|
|
||||||
java.util.Map<String, Value> awlanColumns = new HashMap<>();
|
|
||||||
awlanColumns.put("mqtt_settings", com.vmware.ovsdb.protocol.operation.notation.Map
|
|
||||||
.of(ImmutableMap.of("broker", "192.168.1.101", "port", "1883")));
|
|
||||||
awlanColumns.put("redirector_addr", Atom.string(REDIRECT_ADDR));
|
|
||||||
awlanColumns.put("manager_addr", Atom.string(MGR_ADDR));
|
|
||||||
awlanColumns.put("platform_version", Atom.string(PLATFORM_VERSION));
|
|
||||||
awlanColumns.put("firmware_version", Atom.string(FW_VERSION));
|
|
||||||
awlanColumns.put("revision", Atom.string(REVISION));
|
|
||||||
awlanColumns.put("sku_number", Atom.string(SKU_NUMBER));
|
|
||||||
awlanColumns.put("serial_number", Atom.string(SERIAL_NUM));
|
|
||||||
awlanColumns.put("model", Atom.string(MODEL));
|
|
||||||
Row awlanRow = new Row(awlanColumns);
|
|
||||||
|
|
||||||
List<Row> awlanRows = ImmutableList.of(awlanRow);
|
|
||||||
|
|
||||||
OperationResult[] awlanResult = new OperationResult[] { new SelectResult(awlanRows) };
|
|
||||||
java.util.Map<String, Value> inetWanColumns = new HashMap<>();
|
|
||||||
inetWanColumns.put("inet_addr", Atom.string(WAN_IP));
|
|
||||||
inetWanColumns.put("hwaddr", Atom.string(WAN_MAC));
|
|
||||||
inetWanColumns.put("if_name", Atom.string(WAN_IF_NAME));
|
|
||||||
inetWanColumns.put("if_type", Atom.string(WAN_IF_TYPE));
|
|
||||||
|
|
||||||
Row inetWanRow = new Row(inetWanColumns);
|
|
||||||
|
|
||||||
List<Row> inetWanRows = ImmutableList.of(inetWanRow);
|
|
||||||
|
|
||||||
OperationResult[] inetWanResult = new OperationResult[] { new SelectResult(inetWanRows) };
|
|
||||||
|
|
||||||
OperationResult[] errorResult = new OperationResult[] { new ErrorResult("Error", "Error") };
|
|
||||||
|
|
||||||
java.util.Map<String, Value> inetLanColumns = new HashMap<>();
|
|
||||||
inetLanColumns.put("inet_addr", Atom.string(LAN_IP));
|
|
||||||
inetLanColumns.put("hwaddr", Atom.string(LAN_MAC));
|
|
||||||
inetLanColumns.put("if_name", Atom.string(LAN_IF_NAME));
|
|
||||||
inetLanColumns.put("if_type", Atom.string(LAN_IF_TYPE));
|
|
||||||
|
|
||||||
Row inetLanRow = new Row(inetLanColumns);
|
|
||||||
|
|
||||||
List<Row> inetLanRows = ImmutableList.of(inetLanRow);
|
|
||||||
|
|
||||||
OperationResult[] inetLanResult = new OperationResult[] { new SelectResult(inetLanRows) };
|
|
||||||
|
|
||||||
java.util.Map<String, Value> wifiRadioStateColumns = new HashMap<>();
|
|
||||||
wifiRadioStateColumns.put("freq_band", Atom.string("2.4G"));
|
|
||||||
wifiRadioStateColumns.put("if_name", Atom.string("home-ap-24"));
|
|
||||||
Row wifiRadioStateRow = new Row(wifiRadioStateColumns);
|
|
||||||
|
|
||||||
java.util.Map<String, Value> wifiRadioStateColumns2 = new HashMap<>();
|
|
||||||
wifiRadioStateColumns2.put("freq_band", Atom.string("5GL"));
|
|
||||||
wifiRadioStateColumns2.put("if_name", Atom.string("home-ap-l50"));
|
|
||||||
Row wifiRadioStateRow2 = new Row(wifiRadioStateColumns2);
|
|
||||||
|
|
||||||
java.util.Map<String, Value> wifiRadioStateColumns3 = new HashMap<>();
|
|
||||||
wifiRadioStateColumns3.put("freq_band", Atom.string("5GU"));
|
|
||||||
wifiRadioStateColumns3.put("if_name", Atom.string("home-ap-u50"));
|
|
||||||
Row wifiRadioStateRow3 = new Row(wifiRadioStateColumns3);
|
|
||||||
|
|
||||||
List<Row> wifiRadioStateRows = ImmutableList.of(wifiRadioStateRow, wifiRadioStateRow2, wifiRadioStateRow3);
|
|
||||||
|
|
||||||
OperationResult[] wifiRadioStateResult = new OperationResult[] { new SelectResult(wifiRadioStateRows) };
|
|
||||||
|
|
||||||
// No 'WAN' for this test, will have an ERROR
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(awlanResult)
|
|
||||||
.thenReturn(errorResult).thenReturn(errorResult).thenReturn(inetLanResult)
|
|
||||||
.thenReturn(wifiRadioStateResult);
|
|
||||||
ConnectNodeInfo connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
|
||||||
assertNotNull(connectNodeInfo.firmwareVersion);
|
|
||||||
assertNotNull(connectNodeInfo.model);
|
|
||||||
assertNotNull(connectNodeInfo.skuNumber);
|
|
||||||
assertNotNull(connectNodeInfo.platformVersion);
|
|
||||||
assertNotNull(connectNodeInfo.serialNumber);
|
|
||||||
assertNotNull(connectNodeInfo.mqttSettings);
|
|
||||||
assertNotNull(connectNodeInfo.redirectorAddr);
|
|
||||||
assertNotNull(connectNodeInfo.managerAddr);
|
|
||||||
|
|
||||||
assertNull(connectNodeInfo.ifName);
|
|
||||||
assertNull(connectNodeInfo.ifType);
|
|
||||||
assertNull(connectNodeInfo.ipV4Address);
|
|
||||||
assertNull(connectNodeInfo.macAddress);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.lanIfName);
|
|
||||||
assertNotNull(connectNodeInfo.lanIfType);
|
|
||||||
assertNotNull(connectNodeInfo.lanIpV4Address);
|
|
||||||
assertNotNull(connectNodeInfo.lanMacAddress);
|
|
||||||
|
|
||||||
assert (connectNodeInfo.wifiRadioStates.entrySet().size() == 3);
|
|
||||||
Mockito.verify(ovsdbClient, Mockito.times(5)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
|
||||||
Mockito.clearInvocations(ovsdbClient);
|
|
||||||
|
|
||||||
// No 'LAN' for this test, will have an ERROR
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(awlanResult)
|
|
||||||
.thenReturn(inetWanResult).thenReturn(errorResult).thenReturn(wifiRadioStateResult);
|
|
||||||
connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
|
||||||
assertNotNull(connectNodeInfo.firmwareVersion);
|
|
||||||
assertNotNull(connectNodeInfo.model);
|
|
||||||
assertNotNull(connectNodeInfo.skuNumber);
|
|
||||||
assertNotNull(connectNodeInfo.platformVersion);
|
|
||||||
assertNotNull(connectNodeInfo.serialNumber);
|
|
||||||
assertNotNull(connectNodeInfo.mqttSettings);
|
|
||||||
assertNotNull(connectNodeInfo.redirectorAddr);
|
|
||||||
assertNotNull(connectNodeInfo.managerAddr);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.ifName);
|
|
||||||
assertNotNull(connectNodeInfo.ifType);
|
|
||||||
assertNotNull(connectNodeInfo.ipV4Address);
|
|
||||||
assertNotNull(connectNodeInfo.macAddress);
|
|
||||||
|
|
||||||
assertNull(connectNodeInfo.lanIfName);
|
|
||||||
assertNull(connectNodeInfo.lanIfType);
|
|
||||||
assertNull(connectNodeInfo.lanIpV4Address);
|
|
||||||
assertNull(connectNodeInfo.lanMacAddress);
|
|
||||||
|
|
||||||
assert (connectNodeInfo.wifiRadioStates.entrySet().size() == 3);
|
|
||||||
Mockito.verify(ovsdbClient, Mockito.times(4)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
|
||||||
Mockito.clearInvocations(ovsdbClient);
|
|
||||||
|
|
||||||
// No 'Wifi_Radio_State data' for this test, will have an ERROR
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(awlanResult)
|
|
||||||
.thenReturn(inetWanResult).thenReturn(inetLanResult).thenReturn(errorResult);
|
|
||||||
connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.firmwareVersion);
|
|
||||||
assertNotNull(connectNodeInfo.model);
|
|
||||||
assertNotNull(connectNodeInfo.skuNumber);
|
|
||||||
assertNotNull(connectNodeInfo.platformVersion);
|
|
||||||
assertNotNull(connectNodeInfo.serialNumber);
|
|
||||||
assertNotNull(connectNodeInfo.mqttSettings);
|
|
||||||
assertNotNull(connectNodeInfo.redirectorAddr);
|
|
||||||
assertNotNull(connectNodeInfo.managerAddr);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.ifName);
|
|
||||||
assertNotNull(connectNodeInfo.ifType);
|
|
||||||
assertNotNull(connectNodeInfo.ipV4Address);
|
|
||||||
assertNotNull(connectNodeInfo.macAddress);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.lanIfName);
|
|
||||||
assertNotNull(connectNodeInfo.lanIfType);
|
|
||||||
assertNotNull(connectNodeInfo.lanIpV4Address);
|
|
||||||
assertNotNull(connectNodeInfo.lanMacAddress);
|
|
||||||
|
|
||||||
assert (connectNodeInfo.wifiRadioStates.isEmpty());
|
|
||||||
|
|
||||||
Mockito.verify(ovsdbClient, Mockito.times(4)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
|
||||||
Mockito.clearInvocations(ovsdbClient);
|
|
||||||
|
|
||||||
// No 'AWLAN_Node data' for this test, will have an ERROR
|
|
||||||
Mockito.when(futureResult.get(Mockito.anyLong(), Mockito.eq(TimeUnit.SECONDS))).thenReturn(errorResult)
|
|
||||||
.thenReturn(inetWanResult).thenReturn(inetLanResult).thenReturn(wifiRadioStateResult);
|
|
||||||
connectNodeInfo = ovsdbDao.getConnectNodeInfo(ovsdbClient);
|
|
||||||
assertNull(connectNodeInfo.firmwareVersion);
|
|
||||||
assertNull(connectNodeInfo.model);
|
|
||||||
assertNull(connectNodeInfo.skuNumber);
|
|
||||||
assertNull(connectNodeInfo.platformVersion);
|
|
||||||
assertNull(connectNodeInfo.serialNumber);
|
|
||||||
assertNull(connectNodeInfo.mqttSettings);
|
|
||||||
assertNull(connectNodeInfo.redirectorAddr);
|
|
||||||
assertNull(connectNodeInfo.managerAddr);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.ifName);
|
|
||||||
assertNotNull(connectNodeInfo.ifType);
|
|
||||||
assertNotNull(connectNodeInfo.ipV4Address);
|
|
||||||
assertNotNull(connectNodeInfo.macAddress);
|
|
||||||
|
|
||||||
assertNotNull(connectNodeInfo.lanIfName);
|
|
||||||
assertNotNull(connectNodeInfo.lanIfType);
|
|
||||||
assertNotNull(connectNodeInfo.lanIpV4Address);
|
|
||||||
assertNotNull(connectNodeInfo.lanMacAddress);
|
|
||||||
|
|
||||||
assert (connectNodeInfo.wifiRadioStates.entrySet().size() == 3);
|
|
||||||
|
|
||||||
Mockito.verify(ovsdbClient, Mockito.times(4)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
|
||||||
Mockito.clearInvocations(ovsdbClient);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testObsdbDaoEnableNetworkProbe() throws Exception {
|
public void testObsdbDaoEnableNetworkProbe() throws Exception {
|
||||||
|
|
||||||
Uuid rowUuid = Uuid.of(UUID.randomUUID());
|
Uuid rowUuid = Uuid.of(UUID.randomUUID());
|
||||||
|
|
||||||
OperationResult[] wifiStatsConfigEnableNetworkProbe = new OperationResult[] { new InsertResult(rowUuid) };
|
OperationResult[] wifiStatsConfigEnableNetworkProbe = new OperationResult[] {new InsertResult(rowUuid)};
|
||||||
|
|
||||||
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenReturn(wifiStatsConfigEnableNetworkProbe);
|
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenReturn(wifiStatsConfigEnableNetworkProbe);
|
||||||
|
|
||||||
@@ -635,9 +366,8 @@ public class OvsdbDaoTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testObsdbDaoEnableNetworkProbeError() throws Exception {
|
public void testObsdbDaoEnableNetworkProbeError() throws Exception {
|
||||||
|
|
||||||
OperationResult[] wifiStatsConfigEnableNetworkProbeFail = new OperationResult[] { new ErrorResult(
|
OperationResult[] wifiStatsConfigEnableNetworkProbeFail = new OperationResult[] {new ErrorResult("constraint violation",
|
||||||
"constraint violation",
|
"network_probe is not one of the allowed values ([capacity, client, device, essid, neighbor, quality, radio, rssi, steering, survey])")};
|
||||||
"network_probe is not one of the allowed values ([capacity, client, device, essid, neighbor, quality, radio, rssi, steering, survey])") };
|
|
||||||
|
|
||||||
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenReturn(wifiStatsConfigEnableNetworkProbeFail);
|
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenReturn(wifiStatsConfigEnableNetworkProbeFail);
|
||||||
|
|
||||||
@@ -652,19 +382,16 @@ public class OvsdbDaoTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testProcessNewChannelsRequest() throws Exception {
|
public void testProcessNewChannelsRequest() throws Exception {
|
||||||
|
|
||||||
OperationResult[] testProcessNewChannelsRequestResult = new OperationResult[] { new UpdateResult(1),
|
OperationResult[] testProcessNewChannelsRequestResult = new OperationResult[] {new UpdateResult(1), new UpdateResult(1), new UpdateResult(1),
|
||||||
new UpdateResult(1), new UpdateResult(1), new UpdateResult(1), new UpdateResult(1),
|
new UpdateResult(1), new UpdateResult(1), new UpdateResult(1)};
|
||||||
new UpdateResult(1) };
|
|
||||||
|
|
||||||
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenReturn(testProcessNewChannelsRequestResult);
|
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenReturn(testProcessNewChannelsRequestResult);
|
||||||
|
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
||||||
|
|
||||||
ovsdbDao.processNewChannelsRequest(ovsdbClient,
|
ovsdbDao.processNewChannelsRequest(ovsdbClient,
|
||||||
Map.of(RadioType.is2dot4GHz, Integer.valueOf(1), RadioType.is5GHzL, Integer.valueOf(40),
|
Map.of(RadioType.is2dot4GHz, Integer.valueOf(1), RadioType.is5GHzL, Integer.valueOf(40), RadioType.is5GHzU, Integer.valueOf(153)),
|
||||||
RadioType.is5GHzU, Integer.valueOf(153)),
|
Map.of(RadioType.is2dot4GHz, Integer.valueOf(6), RadioType.is5GHzL, Integer.valueOf(36), RadioType.is5GHzU, Integer.valueOf(149)));
|
||||||
Map.of(RadioType.is2dot4GHz, Integer.valueOf(6), RadioType.is5GHzL, Integer.valueOf(36),
|
|
||||||
RadioType.is5GHzU, Integer.valueOf(149)));
|
|
||||||
|
|
||||||
Mockito.verify(futureResult).get(30L, TimeUnit.SECONDS);
|
Mockito.verify(futureResult).get(30L, TimeUnit.SECONDS);
|
||||||
|
|
||||||
@@ -673,8 +400,7 @@ public class OvsdbDaoTest {
|
|||||||
@Test(expected = RuntimeException.class)
|
@Test(expected = RuntimeException.class)
|
||||||
public void testObsdbDaoEnableNetworkProbeException() throws Exception {
|
public void testObsdbDaoEnableNetworkProbeException() throws Exception {
|
||||||
|
|
||||||
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS))
|
Mockito.when(futureResult.get(30L, TimeUnit.SECONDS)).thenThrow(new OvsdbClientException("OvsdbClientException"));
|
||||||
.thenThrow(new OvsdbClientException("OvsdbClientException"));
|
|
||||||
|
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList())).thenReturn(futureResult);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user