mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 02:57:49 +00:00
FW Upgrade error messages/status handling, re-enable Survey based stats for ChannelBandwidth and RadioUtilization
This commit is contained in:
@@ -33,13 +33,13 @@ import com.telecominfraproject.wlan.client.session.models.ClientSessionMetricDet
|
||||
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.ChannelBandwidth;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.DetectedAuthMode;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.NeighborScanPacketType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.NetworkType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
import com.telecominfraproject.wlan.customer.models.Customer;
|
||||
import com.telecominfraproject.wlan.customer.models.EquipmentAutoProvisioningSettings;
|
||||
import com.telecominfraproject.wlan.customer.service.CustomerServiceInterface;
|
||||
@@ -52,7 +52,6 @@ import com.telecominfraproject.wlan.equipment.models.RadioConfiguration;
|
||||
import com.telecominfraproject.wlan.equipment.models.StateSetting;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareDownloadRequest;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareFlashRequest;
|
||||
import com.telecominfraproject.wlan.firmware.FirmwareServiceInterface;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
||||
@@ -98,8 +97,8 @@ import com.telecominfraproject.wlan.status.equipment.models.EquipmentAdminStatus
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentLANStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolState;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentResetMethod;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeState;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeState.FailureReason;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.VLANStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSID;
|
||||
@@ -129,10 +128,6 @@ import sts.OpensyncStats.Neighbor;
|
||||
import sts.OpensyncStats.Neighbor.NeighborBss;
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.Report;
|
||||
import sts.OpensyncStats.RssiPeer;
|
||||
import sts.OpensyncStats.RssiPeer.RssiSample;
|
||||
import sts.OpensyncStats.RssiPeer.RssiSource;
|
||||
import sts.OpensyncStats.RssiReport;
|
||||
import sts.OpensyncStats.Survey;
|
||||
import sts.OpensyncStats.Survey.SurveySample;
|
||||
import sts.OpensyncStats.SurveyType;
|
||||
@@ -699,14 +694,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
gatewayController.updateActiveCustomer(ce.getCustomerId());
|
||||
ListOfEquipmentCommandResponses responses = gatewayController.sendCommands(commands);
|
||||
LOG.debug("FW Download Response {}", responses);
|
||||
CEGWFirmwareFlashRequest fwFlashRequest = new CEGWFirmwareFlashRequest(ce.getInventoryId(),
|
||||
ce.getId(), fwVersion.getVersionName());
|
||||
commands = new ArrayList<>();
|
||||
commands.add(fwFlashRequest);
|
||||
responses = gatewayController.sendCommands(commands);
|
||||
LOG.debug("FW Upgrade Response {}", responses);
|
||||
|
||||
LOG.info("FW upgrade request response {}", responses);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -876,8 +863,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
populateNeighbourScanReports(metricRecordList, report, customerId, equipmentId);
|
||||
try {
|
||||
// TODO: depends on survey
|
||||
// populateChannelInfoReports(metricRecordList, report, customerId,
|
||||
// equipmentId);
|
||||
populateChannelInfoReports(metricRecordList, report, customerId, equipmentId);
|
||||
populateApSsidMetrics(metricRecordList, report, customerId, equipmentId, extractApIdFromTopic(topic));
|
||||
// handleRssiMetrics(metricRecordList, report, customerId,
|
||||
// equipmentId);
|
||||
@@ -892,32 +878,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
}
|
||||
|
||||
private void handleRssiMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId,
|
||||
long equipmentId) {
|
||||
LOG.debug("handleRssiMetrics for Customer {} Equipment {}", customerId, equipmentId);
|
||||
|
||||
for (RssiReport rssiReport : report.getRssiReportList()) {
|
||||
|
||||
for (RssiPeer peer : rssiReport.getPeerListList()) {
|
||||
if (peer.getRssiSource().equals(RssiSource.CLIENT)) {
|
||||
int rssi = 0;
|
||||
|
||||
for (RssiSample sample : peer.getRssiListList()) {
|
||||
rssi += getNegativeSignedIntFromUnsigned(sample.getRssi());
|
||||
LOG.debug("RSSI Sample: unsignedValue {} signedValue {}", sample.getRssi(),
|
||||
getNegativeSignedIntFromUnsigned(sample.getRssi()));
|
||||
}
|
||||
|
||||
rssi = rssi / peer.getRssiListCount();
|
||||
|
||||
LOG.debug("RssiReport::RssiPeer::Band {} RssiPeer MAC {} RssiSamples Avg {} RxPpdus {} TxPpdus {}",
|
||||
rssiReport.getBand(), peer.getMacAddress(), rssi, peer.getRxPpdus(), peer.getTxPpdus());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void populateApNodeMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId,
|
||||
long equipmentId) {
|
||||
{
|
||||
@@ -935,8 +895,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
apNodeMetrics.setApPerformance(apPerformance);
|
||||
|
||||
smr.setCreatedTimestamp(deviceReport.getTimestampMs());
|
||||
// data.setChannelUtilization2G(channelUtilization2G);
|
||||
// data.setChannelUtilization5G(channelUtilization5G);
|
||||
|
||||
if (deviceReport.getRadioTempCount() > 0) {
|
||||
float cpuTemperature = 0;
|
||||
@@ -1071,51 +1029,64 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
// private Integer timestampSeconds;
|
||||
|
||||
// populate it from report.survey
|
||||
// for (Survey survey : report.getSurveyList()) {
|
||||
/*
|
||||
* LOG.debug("Survey {}", survey); // int oBSS = 0; // int iBSS = 0;
|
||||
* // int totalBusy = 0; // int durationMs = 0; for (SurveySample
|
||||
* surveySample : survey.getSurveyListList()) { if
|
||||
* (surveySample.getDurationMs() == 0) { continue; }
|
||||
*
|
||||
* // iBSS += surveySample.getBusySelf() + //
|
||||
* surveySample.getBusyTx(); // oBSS += surveySample.getBusyRx(); //
|
||||
* totalBusy += surveySample.getBusy(); // durationMs +=
|
||||
* surveySample.getDurationMs();
|
||||
*
|
||||
* RadioUtilization radioUtil = new RadioUtilization(); radioUtil
|
||||
* .setTimestampSeconds((int) ((survey.getTimestampMs() +
|
||||
* surveySample.getOffsetMs()) / 1000));
|
||||
* radioUtil.setAssocClientTx(100 * surveySample.getBusyTx() /
|
||||
* surveySample.getDurationMs()); radioUtil.setAssocClientRx(100 *
|
||||
* surveySample.getBusyRx() / surveySample.getDurationMs());
|
||||
* radioUtil.setNonWifi( 100 * (surveySample.getBusy() -
|
||||
* surveySample.getBusyTx() - surveySample.getBusyRx()) /
|
||||
* surveySample.getDurationMs());
|
||||
*
|
||||
* RadioType radioType = RadioType.UNSUPPORTED; switch
|
||||
* (survey.getBand()) { case BAND2G: radioType =
|
||||
* RadioType.is2dot4GHz; break; case BAND5G: radioType =
|
||||
* RadioType.is5GHz; break; case BAND5GL: radioType =
|
||||
* RadioType.is5GHzL; break; case BAND5GU: radioType =
|
||||
* RadioType.is5GHzU; break; }
|
||||
*
|
||||
* apNodeMetrics.getRadioUtilization(radioType).add(radioUtil);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* // Double totalUtilization = 100D * totalBusy / durationMs; //
|
||||
* LOG.trace("Total Utilization {}", totalUtilization); // Double
|
||||
* totalWifiUtilization = 100D * (iBSS + oBSS) / // durationMs; //
|
||||
* LOG.trace("Total Wifi Utilization {}", // totalWifiUtilization);
|
||||
* // LOG.trace("Total Non-Wifi Utilization {}", // totalUtilization
|
||||
* - // totalWifiUtilization); // if (survey.getBand() ==
|
||||
* RadioBandType.BAND2G) { //
|
||||
* data.setChannelUtilization2G(totalUtilization.intValue()); // }
|
||||
* else { //
|
||||
* data.setChannelUtilization5G(totalUtilization.intValue()); // }
|
||||
*/
|
||||
// }
|
||||
for (Survey survey : report.getSurveyList()) {
|
||||
|
||||
int oBSS = 0;
|
||||
int iBSS = 0;
|
||||
int totalBusy = 0;
|
||||
int durationMs = 0;
|
||||
for (SurveySample surveySample : survey.getSurveyListList()) {
|
||||
if (surveySample.getDurationMs() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
iBSS += surveySample.getBusySelf() + surveySample.getBusyTx();
|
||||
oBSS += surveySample.getBusyRx();
|
||||
totalBusy += surveySample.getBusy();
|
||||
durationMs += surveySample.getDurationMs();
|
||||
|
||||
RadioUtilization radioUtil = new RadioUtilization();
|
||||
radioUtil
|
||||
.setTimestampSeconds((int) ((survey.getTimestampMs() + surveySample.getOffsetMs()) / 1000));
|
||||
radioUtil.setAssocClientTx(100 * surveySample.getBusyTx() / surveySample.getDurationMs());
|
||||
radioUtil.setAssocClientRx(100 * surveySample.getBusyRx() / surveySample.getDurationMs());
|
||||
radioUtil.setNonWifi(
|
||||
100 * (surveySample.getBusy() - surveySample.getBusyTx() - surveySample.getBusyRx())
|
||||
/ surveySample.getDurationMs());
|
||||
|
||||
RadioType radioType = RadioType.UNSUPPORTED;
|
||||
switch (survey.getBand()) {
|
||||
case BAND2G:
|
||||
radioType = RadioType.is2dot4GHz;
|
||||
break;
|
||||
case BAND5G:
|
||||
radioType = RadioType.is5GHz;
|
||||
break;
|
||||
case BAND5GL:
|
||||
radioType = RadioType.is5GHzL;
|
||||
break;
|
||||
case BAND5GU:
|
||||
radioType = RadioType.is5GHzU;
|
||||
break;
|
||||
}
|
||||
|
||||
apNodeMetrics.getRadioUtilization(radioType).add(radioUtil);
|
||||
|
||||
}
|
||||
|
||||
Double totalUtilization = 100D * totalBusy / durationMs;
|
||||
Double totalWifiUtilization = 100D * (iBSS + oBSS) / durationMs;
|
||||
if (survey.getBand() == RadioBandType.BAND2G) { //
|
||||
apNodeMetrics.setChannelUtilization(RadioType.is2dot4GHz, totalUtilization.intValue());
|
||||
|
||||
} else if (survey.getBand() == RadioBandType.BAND5G) {
|
||||
apNodeMetrics.setChannelUtilization(RadioType.is5GHz, totalUtilization.intValue());
|
||||
} else if (survey.getBand() == RadioBandType.BAND5GL) {
|
||||
apNodeMetrics.setChannelUtilization(RadioType.is5GHzL, totalUtilization.intValue());
|
||||
} else if (survey.getBand() == RadioBandType.BAND5GU) {
|
||||
apNodeMetrics.setChannelUtilization(RadioType.is5GHzU, totalUtilization.intValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1734,6 +1705,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
radioType = RadioType.is5GHzU;
|
||||
}
|
||||
|
||||
ChannelBandwidth channelBandwidth = ((ApElementConfiguration) equipmentServiceInterface.get(equipmentId).getDetails())
|
||||
.getRadioMap().get(radioType).getChannelBandwidth();
|
||||
|
||||
if (survey.getSurveyType().equals(SurveyType.OFF_CHANNEL)
|
||||
|| survey.getSurveyType().equals(SurveyType.FULL)) {
|
||||
|
||||
@@ -1757,7 +1731,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
});
|
||||
|
||||
for (List<SurveySample> surveySampleList : sampleByChannelMap.values()) {
|
||||
ChannelInfo channelInfo = createChannelInfo(equipmentId, radioType, surveySampleList);
|
||||
ChannelInfo channelInfo = createChannelInfo(equipmentId, radioType, surveySampleList, channelBandwidth);
|
||||
|
||||
List<ChannelInfo> channelInfoList = channelInfoReports.getRadioInfo(radioType);
|
||||
if (channelInfoList == null) {
|
||||
@@ -1771,7 +1745,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
List<SurveySample> surveySampleList = survey.getSurveyListList();
|
||||
|
||||
ChannelInfo channelInfo = createChannelInfo(equipmentId, radioType, surveySampleList);
|
||||
ChannelInfo channelInfo = createChannelInfo(equipmentId, radioType, surveySampleList, channelBandwidth);
|
||||
|
||||
List<ChannelInfo> channelInfoList = channelInfoReports.getRadioInfo(radioType);
|
||||
if (channelInfoList == null) {
|
||||
@@ -1787,7 +1761,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
}
|
||||
|
||||
private ChannelInfo createChannelInfo(long equipmentId, RadioType radioType, List<SurveySample> surveySampleList) {
|
||||
private ChannelInfo createChannelInfo(long equipmentId, RadioType radioType, List<SurveySample> surveySampleList, ChannelBandwidth channelBandwidth) {
|
||||
int busyTx = 0; /* Tx */
|
||||
int busySelf = 0; /* Rx_self (derived from succesful Rx frames) */
|
||||
int busy = 0; /* Busy = Rx + Tx + Interference */
|
||||
@@ -1807,8 +1781,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
channelInfo.setTotalUtilization(busy);
|
||||
channelInfo.setWifiUtilization(totalWifi);
|
||||
channelInfo.setBandwidth(((ApElementConfiguration) equipmentServiceInterface.get(equipmentId).getDetails())
|
||||
.getRadioMap().get(radioType).getChannelBandwidth());
|
||||
channelInfo.setBandwidth(channelBandwidth);
|
||||
channelInfo.setNoiseFloor(-84); // TODO: when this
|
||||
// becomes available
|
||||
// add
|
||||
@@ -2148,6 +2121,111 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
return;
|
||||
}
|
||||
|
||||
EquipmentUpgradeState fwUpgradeState = EquipmentUpgradeState.undefined;
|
||||
FailureReason fwUpgradeFailureReason = null;
|
||||
switch (opensyncAPState.getUpgradeStatus()) {
|
||||
case 0:
|
||||
break; // nothing
|
||||
case -1:
|
||||
LOG.error("upgrade_status: Wrong arguments (app error)");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_failed;
|
||||
fwUpgradeFailureReason = FailureReason.downloadRequestRejected;
|
||||
break;
|
||||
case -3:
|
||||
LOG.error("upgrade_status: Incorrect URL)");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_failed;
|
||||
fwUpgradeFailureReason = FailureReason.unreachableUrl;
|
||||
break;
|
||||
case -4:
|
||||
LOG.error("upgrade_status: Failed firmware image download");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_failed;
|
||||
fwUpgradeFailureReason = FailureReason.downloadFailed;
|
||||
break;
|
||||
case -5:
|
||||
LOG.error("upgrade_status: Error while downloading firmware md5 sum file");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_failed;
|
||||
fwUpgradeFailureReason = FailureReason.downloadFailed;
|
||||
break;
|
||||
case -6:
|
||||
LOG.error("upgrade_status: md5 checksum file error");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_failed;
|
||||
fwUpgradeFailureReason = FailureReason.validationFailed;
|
||||
break;
|
||||
case -7:
|
||||
LOG.error("upgrade_status: Firmware image error");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.validationFailed;
|
||||
break;
|
||||
case -8:
|
||||
LOG.error("upgrade_status: Flash erase failed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.applyFailed;
|
||||
break;
|
||||
case -9:
|
||||
LOG.error("upgrade_status: Flash write failed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.applyFailed;
|
||||
break;
|
||||
case -10:
|
||||
LOG.error("upgrade_status: Flash verification failed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.validationFailed;
|
||||
break;
|
||||
case -11:
|
||||
LOG.error("upgrade_status: Set new bootconfig failed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.applyFailed;
|
||||
break;
|
||||
case -12:
|
||||
LOG.error("upgrade_status: Device restart failed");
|
||||
fwUpgradeState = EquipmentUpgradeState.reboot_failed;
|
||||
fwUpgradeFailureReason = FailureReason.rebootTimedout;
|
||||
break;
|
||||
case -14:
|
||||
LOG.error("upgrade_status: Flash BootConfig erase failed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.applyFailed;
|
||||
break;
|
||||
case -15:
|
||||
LOG.error("upgrade_status: Safe update is running");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_failed;
|
||||
fwUpgradeFailureReason = FailureReason.applyFailed;
|
||||
break;
|
||||
case -16:
|
||||
LOG.error("upgrade_status: Not enough free space on device");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_failed;
|
||||
fwUpgradeFailureReason = FailureReason.downloadRequestFailedFlashFull;
|
||||
|
||||
break;
|
||||
case 10:
|
||||
LOG.info("upgrade_status: Firmware download started for AP {}", apId);
|
||||
fwUpgradeState = EquipmentUpgradeState.download_initiated;
|
||||
break;
|
||||
case 11:
|
||||
LOG.info("upgrade_status: Firmware download successful, triggering upgrade.");
|
||||
fwUpgradeState = EquipmentUpgradeState.download_complete;
|
||||
break;
|
||||
case 20:
|
||||
LOG.info("upgrade_status: FW write on alt partition started");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_initiated;
|
||||
break;
|
||||
case 21:
|
||||
LOG.info("upgrade_status: FW image write successfully completed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_complete;
|
||||
break;
|
||||
case 30:
|
||||
LOG.info("upgrade_status: Bootconfig partition update started");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_initiated;
|
||||
break;
|
||||
case 31:
|
||||
LOG.info("upgrade_status: Bootconfig partition update completed");
|
||||
fwUpgradeState = EquipmentUpgradeState.apply_complete;
|
||||
break;
|
||||
default:
|
||||
LOG.debug("upgrade_status: {}", opensyncAPState.getUpgradeStatus());
|
||||
|
||||
}
|
||||
|
||||
Status protocolStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL);
|
||||
if (protocolStatus == null) {
|
||||
protocolStatus = new Status();
|
||||
@@ -2168,7 +2246,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
protocolStatusData.setSystemName(opensyncAPState.getModel());
|
||||
|
||||
List<Status> updates = new ArrayList<>();
|
||||
|
||||
|
||||
// only post update if there is a change
|
||||
if (!((EquipmentProtocolStatusData) statusServiceInterface
|
||||
.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL).getDetails()).equals(protocolStatusData)) {
|
||||
@@ -2190,19 +2268,20 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
EquipmentUpgradeStatusData firmwareStatusData = (EquipmentUpgradeStatusData) firmwareStatus.getDetails();
|
||||
firmwareStatusData.setActiveSwVersion(opensyncAPState.getFirmwareVersion());
|
||||
firmwareStatusData.setTargetSwVersion(opensyncAPState.getVersionMatrix().get("FIRMWARE"));
|
||||
firmwareStatusData.setUpgradeState(EquipmentUpgradeState.getById(opensyncAPState.getUpgradeStatus()));
|
||||
|
||||
firmwareStatusData.setUpgradeState(fwUpgradeState);
|
||||
if (fwUpgradeFailureReason != null) {
|
||||
firmwareStatusData.setReason(fwUpgradeFailureReason);
|
||||
}
|
||||
// only post update if there is a change
|
||||
if (!((EquipmentUpgradeStatusData) statusServiceInterface
|
||||
.getOrNull(customerId, equipmentId, StatusDataType.FIRMWARE).getDetails()).equals(firmwareStatusData)) {
|
||||
firmwareStatus.setDetails(firmwareStatusData);
|
||||
updates.add(firmwareStatus);
|
||||
updates.add(firmwareStatus);
|
||||
}
|
||||
|
||||
|
||||
if (!updates.isEmpty()) {
|
||||
statusServiceInterface.update(updates);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -167,9 +167,9 @@ public class OpensyncCloudGatewayController {
|
||||
case FirmwareDownloadRequest:
|
||||
ret.add(processFirmwareDownload(session, (CEGWFirmwareDownloadRequest) command));
|
||||
break;
|
||||
case FirmwareFlashRequest:
|
||||
ret.add(processFirmwareFlash(session, (CEGWFirmwareFlashRequest) command));
|
||||
break;
|
||||
// case FirmwareFlashRequest:
|
||||
// ret.add(processFirmwareFlash(session, (CEGWFirmwareFlashRequest) command));
|
||||
// break;
|
||||
case RadioReset:
|
||||
ret.add(processRadioReset(session, (CEGWRadioResetRequest) command));
|
||||
break;
|
||||
@@ -274,10 +274,6 @@ public class OpensyncCloudGatewayController {
|
||||
String newRedirectorAddress = ((CEGWStartDebugEngine) command).getGatewayHostname();
|
||||
connectusOvsdbClient.changeRedirectorAddress(inventoryId, newRedirectorAddress);
|
||||
// TODO: add support for additional commands below
|
||||
} else if (command instanceof CEGWFirmwareFlashRequest) {
|
||||
String firmwareVersion = ((CEGWFirmwareFlashRequest) command).getFirmwareVersion();
|
||||
connectusOvsdbClient.processFlashFirmware(inventoryId, firmwareVersion);
|
||||
|
||||
} else if (command instanceof CEGWFirmwareDownloadRequest) {
|
||||
|
||||
CEGWFirmwareDownloadRequest dlRequest = (CEGWFirmwareDownloadRequest)command;
|
||||
@@ -303,10 +299,6 @@ public class OpensyncCloudGatewayController {
|
||||
return sendMessage(session, command.getInventoryId(), command);
|
||||
}
|
||||
|
||||
private EquipmentCommandResponse processFirmwareFlash(OvsdbSession session, CEGWFirmwareFlashRequest command) {
|
||||
return sendMessage(session, command.getInventoryId(), command);
|
||||
}
|
||||
|
||||
private EquipmentCommandResponse processBlinkRequest(OvsdbSession session, CEGWBlinkRequest command) {
|
||||
|
||||
return sendMessage(session, command.getInventoryId(), command);
|
||||
|
||||
@@ -12,8 +12,6 @@ public interface ConnectusOvsdbClientInterface {
|
||||
|
||||
String processFirmwareDownload(String apId, String firmwareUrl, String firmwareVersion, String username,
|
||||
String validationCode);
|
||||
|
||||
String processFlashFirmware(String apId, String firmwareVersion);
|
||||
|
||||
String closeSession(String apId);
|
||||
}
|
||||
|
||||
@@ -99,11 +99,13 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
// of KDC unique qrCode)
|
||||
String key = clientCn + "_" + connectNodeInfo.serialNumber;
|
||||
ovsdbSessionMapInterface.newSession(key, ovsdbClient);
|
||||
|
||||
extIntegrationInterface.apConnected(key, connectNodeInfo);
|
||||
|
||||
monitorOvsdbStateTables(ovsdbClient, key);
|
||||
|
||||
// push configuration to AP
|
||||
connectNodeInfo = processConnectRequest(ovsdbClient, clientCn, connectNodeInfo);
|
||||
monitorOvsdbStateTables(ovsdbClient, key);
|
||||
|
||||
LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key);
|
||||
LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
|
||||
@@ -520,20 +522,4 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
|
||||
return "Initialized firmware download to " + apId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String processFlashFirmware(String apId, String firmwareVersion) {
|
||||
try {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
|
||||
ovsdbDao.flashFirmware(session.getOvsdbClient(), apId, firmwareVersion);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Failed to flash firmware version {} on AP {} ", firmwareVersion, apId, e);
|
||||
return "Failed to flash firmware version " + firmwareVersion + " on AP " + apId + "\n"
|
||||
+ e.getLocalizedMessage();
|
||||
|
||||
}
|
||||
LOG.debug("Flashed firmware version {} on AP {}", firmwareVersion, apId);
|
||||
return "Flashed firmware version " + firmwareVersion + " on AP " + apId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.telecominfraproject.wlan.opensync.ovsdb.dao;
|
||||
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -121,9 +118,9 @@ public class OvsdbDao {
|
||||
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.wifi-iface.max:8}")
|
||||
public int maxInterfacesPerRadio;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.awlan-node.upgrade_dl_timer:300}")
|
||||
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.awlan-node.upgrade_dl_timer:60}")
|
||||
public long upgradeDlTimerSeconds;
|
||||
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.awlan-node.upgrade_timer:300}")
|
||||
@org.springframework.beans.factory.annotation.Value("${connectus.ovsdb.awlan-node.upgrade_timer:60}")
|
||||
public long upgradeTimerSeconds;
|
||||
|
||||
public static final String ovsdbName = "Open_vSwitch";
|
||||
@@ -994,14 +991,13 @@ public class OvsdbDao {
|
||||
if (vlanId != null) {
|
||||
wifiVifConfigInfo.vlanId = vlanId.intValue();
|
||||
}
|
||||
|
||||
|
||||
wifiVifConfigInfo.macList = row.getSetColumn("mac_list");
|
||||
|
||||
if (row.getColumns().get("mac_list_typ") != null &&
|
||||
row.getColumns().get("mac_list_typ").getClass()
|
||||
|
||||
if (row.getColumns().get("mac_list_typ") != null && row.getColumns().get("mac_list_typ").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
wifiVifConfigInfo.macListType = row.getStringColumn("mac_list_typ");
|
||||
}
|
||||
}
|
||||
|
||||
ret.put(wifiVifConfigInfo.ifName + '_' + wifiVifConfigInfo.ssid, wifiVifConfigInfo);
|
||||
}
|
||||
@@ -2013,10 +2009,9 @@ public class OvsdbDao {
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
tableState.setVersion(row.getUuidColumn("_version"));
|
||||
}
|
||||
if ((map.get("upgrade_status") != null) && map.get("upgrade_status").getClass()
|
||||
.equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
|
||||
tableState.setUpgradeTimer(row.getIntegerColumn("upgrade_status").intValue());
|
||||
}
|
||||
|
||||
tableState.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)) {
|
||||
tableState.setDeviceMode(row.getStringColumn("device_mode"));
|
||||
@@ -2124,7 +2119,7 @@ public class OvsdbDao {
|
||||
if (vlanId > 0) {
|
||||
updateColumns.put("vlan_id", new Atom<>(vlanId));
|
||||
if (vlanId > 1) {
|
||||
updateColumns.put("bridge", new Atom<>("vlan" + vlanId));
|
||||
updateColumns.put("bridge", new Atom<>("vlan" + vlanId));
|
||||
}
|
||||
} else {
|
||||
updateColumns.put("vlan_id", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||
@@ -2137,28 +2132,28 @@ public class OvsdbDao {
|
||||
com.vmware.ovsdb.protocol.operation.notation.Map<String, String> securityMap = com.vmware.ovsdb.protocol.operation.notation.Map
|
||||
.of(security);
|
||||
updateColumns.put("security", securityMap);
|
||||
|
||||
|
||||
Set<String> macList = new HashSet<>();
|
||||
if (macBlackList != null && !macBlackList.isEmpty()) {
|
||||
macList = macBlackList;
|
||||
updateColumns.put("mac_list_type", new Atom<>("blacklist"));
|
||||
macList = macBlackList;
|
||||
updateColumns.put("mac_list_type", new Atom<>("blacklist"));
|
||||
} else if (macWhiteList != null && !macWhiteList.isEmpty()) {
|
||||
macList = macWhiteList;
|
||||
updateColumns.put("mac_list_type", new Atom<>("whitelist"));
|
||||
} else {
|
||||
macList = macWhiteList;
|
||||
updateColumns.put("mac_list_type", new Atom<>("whitelist"));
|
||||
} else {
|
||||
updateColumns.put("mac_list_type", new Atom<>("none"));
|
||||
}
|
||||
|
||||
|
||||
if (!macList.isEmpty()) {
|
||||
Set<Atom<String>> atomMacList = new HashSet<>();
|
||||
for (String mac : macList) {
|
||||
atomMacList.add(new Atom<>(mac));
|
||||
}
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set macListSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
Set<Atom<String>> atomMacList = new HashSet<>();
|
||||
for (String mac : macList) {
|
||||
atomMacList.add(new Atom<>(mac));
|
||||
}
|
||||
com.vmware.ovsdb.protocol.operation.notation.Set macListSet = com.vmware.ovsdb.protocol.operation.notation.Set
|
||||
.of(atomMacList);
|
||||
updateColumns.put("mac_list", macListSet);
|
||||
updateColumns.put("mac_list", macListSet);
|
||||
} else {
|
||||
updateColumns.put("mac_list", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||
updateColumns.put("mac_list", new com.vmware.ovsdb.protocol.operation.notation.Set());
|
||||
}
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
@@ -2381,8 +2376,8 @@ public class OvsdbDao {
|
||||
security.put("mode", "1");
|
||||
}
|
||||
}
|
||||
|
||||
//TODO fill from NBI
|
||||
|
||||
// TODO fill from NBI
|
||||
Set<String> macBlackList = new HashSet<>();
|
||||
Set<String> macWhiteList = new HashSet<>();
|
||||
|
||||
@@ -2464,7 +2459,7 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateWifiInetConfig(OvsdbClient ovsdbClient, int vlanId, String ifName, boolean enabled,
|
||||
boolean isNAT, String ifType, String gateway, String inet, Map<String, String> dns, String ipAssignScheme,
|
||||
Uuid vifConfigUuid) {
|
||||
@@ -2650,12 +2645,6 @@ public class OvsdbDao {
|
||||
|
||||
provisionWifiStatsConfigClient(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||
|
||||
provisionWifiStatsConfigBandSteering(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||
|
||||
provisionWifiStatsConfigCapacity(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||
|
||||
provisionWifiStatsRssi(radioConfigs, getProvisionedWifiStatsConfigs(ovsdbClient), operations);
|
||||
|
||||
if (!operations.isEmpty()) {
|
||||
LOG.debug("Sending batch of operations : {} ", operations);
|
||||
|
||||
@@ -2676,80 +2665,6 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
private void provisionWifiStatsConfigCapacity(Map<String, WifiRadioConfigInfo> radioConfigs,
|
||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||
|
||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||
@Override
|
||||
public void accept(WifiRadioConfigInfo rc) {
|
||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_capacity")) {
|
||||
//
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
rowColumns.put("radio_type", new Atom<>(rc.freqBand));
|
||||
rowColumns.put("reporting_interval", new Atom<>(60));
|
||||
// rowColumns.put("sampling_interval", new Atom<>(3));
|
||||
rowColumns.put("stats_type", new Atom<>("capacity"));
|
||||
// rowColumns.put("survey_interval_ms", new Atom<>(65));
|
||||
// rowColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
|
||||
Row updateRow = new Row(rowColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, updateRow));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void provisionWifiStatsConfigBandSteering(Map<String, WifiRadioConfigInfo> radioConfigs,
|
||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||
|
||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||
@Override
|
||||
public void accept(WifiRadioConfigInfo rc) {
|
||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_steering")) {
|
||||
//
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
rowColumns.put("radio_type", new Atom<>(rc.freqBand));
|
||||
rowColumns.put("reporting_interval", new Atom<>(60));
|
||||
// rowColumns.put("sampling_interval", new Atom<>(3));
|
||||
rowColumns.put("stats_type", new Atom<>("steering"));
|
||||
// rowColumns.put("survey_interval_ms", new Atom<>(65));
|
||||
// rowColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
|
||||
Row updateRow = new Row(rowColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, updateRow));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void provisionWifiStatsRssi(Map<String, WifiRadioConfigInfo> radioConfigs,
|
||||
Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, List<Operation> operations) {
|
||||
|
||||
radioConfigs.values().stream().forEach(new Consumer<WifiRadioConfigInfo>() {
|
||||
@Override
|
||||
public void accept(WifiRadioConfigInfo rc) {
|
||||
if (!provisionedWifiStatsConfigs.containsKey(rc.freqBand + "_rssi")) {
|
||||
//
|
||||
Map<String, Value> rowColumns = new HashMap<>();
|
||||
rowColumns.put("radio_type", new Atom<>(rc.freqBand));
|
||||
rowColumns.put("reporting_interval", new Atom<>(30));
|
||||
// rowColumns.put("sampling_interval", new Atom<>(3));
|
||||
rowColumns.put("stats_type", new Atom<>("rssi"));
|
||||
rowColumns.put("survey_interval_ms", new Atom<>(65));
|
||||
// rowColumns.put("survey_type", new Atom<>("on-chan"));
|
||||
|
||||
Row updateRow = new Row(rowColumns);
|
||||
operations.add(new Insert(wifiStatsConfigDbTable, updateRow));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void provisionWifiStatsConfigNeighbor(Map<String, Set<Integer>> allowedChannels,
|
||||
Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs,
|
||||
List<Operation> operations) {
|
||||
@@ -2952,34 +2867,24 @@ public class OvsdbDao {
|
||||
try {
|
||||
LOG.debug("configureFirmwareDownload for {} to version {} url {} validationCode {} username {}", apId,
|
||||
firmwareVersion, firmwareUrl, validationCode, username);
|
||||
|
||||
// TODO: version matrix update
|
||||
// waiting on AP to provide guidance wrt load naming and version
|
||||
// matrix content
|
||||
// get existing table info
|
||||
Row awlanNode = getAWLANNodeDbTableForFirmwareUpdate(ovsdbClient);
|
||||
// Row awlanNode = getAWLANNodeDbTableForFirmwareUpdate(ovsdbClient);
|
||||
//
|
||||
// if (awlanNode == null) {
|
||||
// LOG.error("Cannot update AWLAN_Node firmware information");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (awlanNode == null) {
|
||||
LOG.error("Cannot update AWLAN_Node firmware information");
|
||||
return;
|
||||
}
|
||||
URL aURL = new URL(firmwareUrl);
|
||||
|
||||
Map<String, String> versionMap = awlanNode.getMapColumn("version_matrix");
|
||||
versionMap.put("vendor/ipq40xx", aURL.getPath().substring(0, aURL.getPath().lastIndexOf('/')));
|
||||
versionMap.put("FIRMWARE", firmwareVersion);
|
||||
versionMap.put("FW_VERSION", firmwareVersion.substring(0, firmwareVersion.indexOf('-')));
|
||||
versionMap.put("FW_BUILD",
|
||||
firmwareVersion.substring(firmwareVersion.indexOf('-') + 1, firmwareVersion.lastIndexOf('-')));
|
||||
versionMap.put("FW_COMMIT", firmwareVersion.substring(firmwareVersion.lastIndexOf('-') + 1));
|
||||
versionMap.put("HOST", aURL.getHost());
|
||||
versionMap.put("FW_PROFILE", firmwareVersion.substring(0, firmwareVersion.indexOf('-')));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
|
||||
versionMap.put("DATE", sdf.format(new Date()));
|
||||
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
updateColumns.put("upgrade_dl_timer", new Atom<>(upgradeDlTimerSeconds));
|
||||
updateColumns.put("firmware_pass", new Atom<>(validationCode));
|
||||
updateColumns.put("firmware_url", new Atom<>(firmwareUrl));
|
||||
updateColumns.put("version_matrix", com.vmware.ovsdb.protocol.operation.notation.Map.of(versionMap));
|
||||
updateColumns.put("upgrade_timer", new Atom<>(upgradeTimerSeconds));
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(awlanNodeDbTable, row));
|
||||
@@ -2997,25 +2902,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
public void flashFirmware(OvsdbClient ovsdbClient, String apId, String firmwareVersion) throws Exception {
|
||||
|
||||
LOG.debug("flashFirmware for {} to version {}", apId, firmwareVersion);
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
updateColumns.put("upgrade_timer", new Atom<>(upgradeTimerSeconds));
|
||||
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(awlanNodeDbTable, row));
|
||||
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS);
|
||||
for (OperationResult r : result) {
|
||||
LOG.debug("Op Result {}", r);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeAllStatsConfigs(OvsdbClient ovsdbClient) {
|
||||
|
||||
LOG.info("Remove existing Wifi_Stats_Config table entries");
|
||||
|
||||
Reference in New Issue
Block a user