mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 03:28:00 +00:00
WIFI-814: OSGW add support reboot, switch, and factory reset
Adding support for Ap reboot, switch, and factory reset commands to opensync gateway controller and ovsdb dao.
This commit is contained in:
@@ -339,7 +339,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
LOG.info("ConnectNodeInfo {}", connectNodeInfo);
|
||||
|
||||
if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY)) {
|
||||
reconcileFwVersionToTrack(ce, connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY), connectNodeInfo.model);
|
||||
reconcileFwVersionToTrack(ce,
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY),
|
||||
connectNodeInfo.model);
|
||||
} else {
|
||||
LOG.info("Cloud based firmware upgrade is not supported for this AP");
|
||||
}
|
||||
@@ -484,16 +486,20 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
protocolStatusData.setReportedCC(CountryCode.ca);
|
||||
protocolStatusData.setReportedHwVersion(connectNodeInfo.platformVersion);
|
||||
if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY)) {
|
||||
protocolStatusData.setReportedSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY));
|
||||
protocolStatusData.setReportedSwVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY));
|
||||
} else if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_NAME_KEY)) {
|
||||
protocolStatusData.setReportedSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
protocolStatusData.setReportedSwVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
} else {
|
||||
protocolStatusData.setReportedSwVersion("Unknown");
|
||||
}
|
||||
if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY)) {
|
||||
protocolStatusData.setReportedSwAltVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY));
|
||||
protocolStatusData.setReportedSwAltVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY));
|
||||
} else if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_NAME_KEY)) {
|
||||
protocolStatusData.setReportedSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
protocolStatusData.setReportedSwVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
} else {
|
||||
protocolStatusData.setReportedSwVersion("Unknown");
|
||||
}
|
||||
@@ -522,16 +528,20 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
EquipmentUpgradeStatusData fwUpgradeStatusData = (EquipmentUpgradeStatusData) statusRecord.getDetails();
|
||||
if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY)) {
|
||||
fwUpgradeStatusData.setActiveSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY));
|
||||
fwUpgradeStatusData.setActiveSwVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY));
|
||||
} else if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_NAME_KEY)) {
|
||||
fwUpgradeStatusData.setActiveSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
fwUpgradeStatusData
|
||||
.setActiveSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
} else {
|
||||
fwUpgradeStatusData.setActiveSwVersion("Unknown");
|
||||
}
|
||||
if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY)) {
|
||||
fwUpgradeStatusData.setAlternateSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY));
|
||||
fwUpgradeStatusData.setAlternateSwVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY));
|
||||
} else if (connectNodeInfo.versionMatrix.containsKey(OvsdbStringConstants.FW_IMAGE_NAME_KEY)) {
|
||||
fwUpgradeStatusData.setAlternateSwVersion(connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
fwUpgradeStatusData.setAlternateSwVersion(
|
||||
connectNodeInfo.versionMatrix.get(OvsdbStringConstants.FW_IMAGE_NAME_KEY));
|
||||
} else {
|
||||
fwUpgradeStatusData.setAlternateSwVersion("Unknown");
|
||||
}
|
||||
@@ -773,8 +783,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
ret.setApProfile(profileContainer.getOrNull(equipmentConfig.getProfileId()));
|
||||
|
||||
ret.setRfProfile(
|
||||
profileContainer.getChildOfTypeOrNull(equipmentConfig.getProfileId(), ProfileType.rf));
|
||||
ret.setRfProfile(profileContainer.getChildOfTypeOrNull(equipmentConfig.getProfileId(), ProfileType.rf));
|
||||
|
||||
ret.setSsidProfile(
|
||||
profileContainer.getChildrenOfType(equipmentConfig.getProfileId(), ProfileType.ssid));
|
||||
@@ -1260,15 +1269,26 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
}
|
||||
|
||||
int upgradeStatusFromAp = opensyncAPState.getUpgradeStatus();
|
||||
|
||||
EquipmentUpgradeState fwUpgradeState = OvsdbToWlanCloudTypeMappingUtility
|
||||
.getCloudEquipmentUpgradeStateFromOpensyncUpgradeStatus(upgradeStatusFromAp);
|
||||
EquipmentUpgradeState fwUpgradeState = null;
|
||||
FailureReason fwUpgradeFailureReason = null;
|
||||
|
||||
if (opensyncAPState.getFirmwareUrl().equals(OvsdbStringConstants.OVSDB_AWLAN_AP_FACTORY_RESET)
|
||||
|| opensyncAPState.getFirmwareUrl().equals(OvsdbStringConstants.OVSDB_AWLAN_AP_FACTORY_RESET)
|
||||
|| opensyncAPState.getFirmwareUrl().equals(OvsdbStringConstants.OVSDB_AWLAN_AP_FACTORY_RESET)
|
||||
|| opensyncAPState.getFirmwareUrl().equals("")) {
|
||||
|
||||
fwUpgradeState = EquipmentUpgradeState.undefined;
|
||||
|
||||
} else {
|
||||
fwUpgradeState = OvsdbToWlanCloudTypeMappingUtility
|
||||
.getCloudEquipmentUpgradeStateFromOpensyncUpgradeStatus(upgradeStatusFromAp);
|
||||
|
||||
if (upgradeStatusFromAp < 0) {
|
||||
fwUpgradeFailureReason = OvsdbToWlanCloudTypeMappingUtility
|
||||
.getCloudEquipmentUpgradeFailureReasonFromOpensyncUpgradeStatus(upgradeStatusFromAp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Status protocolStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL);
|
||||
if (protocolStatus == null) {
|
||||
@@ -1288,10 +1308,16 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
if (opensyncAPState.getVersionMatrix().containsKey(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY)) {
|
||||
reportedFwImageName = opensyncAPState.getVersionMatrix().get(OvsdbStringConstants.FW_IMAGE_ACTIVE_KEY);
|
||||
} else {
|
||||
reportedFwImageName = opensyncAPState.getVersionMatrix().get(OvsdbStringConstants.FW_IMAGE_NAME_KEY);
|
||||
|
||||
}
|
||||
|
||||
if (opensyncAPState.getVersionMatrix().containsKey(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY)) {
|
||||
reportedAltFwImageName = opensyncAPState.getVersionMatrix().get(OvsdbStringConstants.FW_IMAGE_INACTIVE_KEY);
|
||||
} else {
|
||||
reportedAltFwImageName = opensyncAPState.getVersionMatrix().get(OvsdbStringConstants.FW_IMAGE_NAME_KEY);
|
||||
|
||||
}
|
||||
|
||||
EquipmentProtocolStatusData protocolStatusData = (EquipmentProtocolStatusData) protocolStatus.getDetails();
|
||||
@@ -1334,7 +1360,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
.getDetails();
|
||||
if (reportedFwImageName != null) {
|
||||
if (!firmwareStatusData.getActiveSwVersion().equals(reportedFwImageName)
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState) || !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)) {
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState)
|
||||
|| !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)) {
|
||||
firmwareStatusData.setActiveSwVersion(reportedFwImageName);
|
||||
firmwareStatusData.setAlternateSwVersion(reportedAltFwImageName);
|
||||
firmwareStatusData.setUpgradeState(fwUpgradeState, fwUpgradeFailureReason);
|
||||
@@ -1364,7 +1391,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
.getDetails();
|
||||
if (reportedFwImageName != null) {
|
||||
if (!firmwareStatusData.getActiveSwVersion().equals(reportedFwImageName)
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState) || !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)) {
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState)
|
||||
|| !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)) {
|
||||
firmwareStatusData.setActiveSwVersion(reportedFwImageName);
|
||||
firmwareStatusData.setAlternateSwVersion(reportedAltFwImageName);
|
||||
firmwareStatusData.setUpgradeState(fwUpgradeState, fwUpgradeFailureReason);
|
||||
@@ -1394,7 +1422,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
EquipmentUpgradeStatusData firmwareStatusData = (EquipmentUpgradeStatusData) firmwareStatus
|
||||
.getDetails();
|
||||
if (reportedFwImageName != null) {
|
||||
if (!firmwareStatusData.getActiveSwVersion().equals(reportedFwImageName) || !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)
|
||||
if (!firmwareStatusData.getActiveSwVersion().equals(reportedFwImageName)
|
||||
|| !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState)
|
||||
|| !firmwareStatusData.getReason().equals(fwUpgradeFailureReason)) {
|
||||
firmwareStatusData.setActiveSwVersion(reportedFwImageName);
|
||||
@@ -1424,8 +1453,10 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
.getDetails();
|
||||
if (reportedFwImageName != null) {
|
||||
if (!firmwareStatusData.getActiveSwVersion().equals(reportedFwImageName)
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState)) {
|
||||
|| !firmwareStatusData.getUpgradeState().equals(fwUpgradeState)
|
||||
|| !firmwareStatusData.getAlternateSwVersion().equals(reportedAltFwImageName)) {
|
||||
firmwareStatusData.setActiveSwVersion(reportedFwImageName);
|
||||
firmwareStatusData.setAlternateSwVersion(reportedAltFwImageName);
|
||||
firmwareStatusData.setUpgradeState(fwUpgradeState, fwUpgradeFailureReason);
|
||||
firmwareStatus.setDetails(firmwareStatusData);
|
||||
updates.add(firmwareStatus);
|
||||
@@ -1907,7 +1938,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.error("Invalid Subnet Mask", e);
|
||||
try {
|
||||
clientDhcpDetails.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("subnet_mask").getBytes()));
|
||||
clientDhcpDetails
|
||||
.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("subnet_mask").getBytes()));
|
||||
} catch (UnknownHostException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
LOG.error("Invalid Subnet Mask Address", e);
|
||||
@@ -1921,7 +1953,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.error("Invalid Primary DNS", e);
|
||||
try {
|
||||
clientDhcpDetails.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("primary_dns").getBytes()));
|
||||
clientDhcpDetails
|
||||
.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("primary_dns").getBytes()));
|
||||
} catch (UnknownHostException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
LOG.error("Invalid Primary DNS Address", e);
|
||||
@@ -1936,7 +1969,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
} catch (UnknownHostException e) {
|
||||
LOG.error("Invalid Secondary DNS", e);
|
||||
try {
|
||||
clientDhcpDetails.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("secondary_dns").getBytes()));
|
||||
clientDhcpDetails
|
||||
.setGatewayIp(InetAddress.getByAddress(dhcpLeasedIps.get("secondary_dns").getBytes()));
|
||||
} catch (UnknownHostException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
LOG.error("Invalid Seconary DNS Address", e);
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.role.PortalUserRole;
|
||||
import com.telecominfraproject.wlan.core.model.service.GatewayType;
|
||||
import com.telecominfraproject.wlan.core.client.PingClient;
|
||||
import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundException;
|
||||
@@ -41,6 +42,7 @@ import com.telecominfraproject.wlan.equipmentgateway.models.CEGWConfigChangeNoti
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareDownloadRequest;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareFlashRequest;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWRadioResetRequest;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWRebootRequest;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWRouteCheck;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWStartDebugEngine;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWStopDebugEngine;
|
||||
@@ -54,6 +56,7 @@ import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
|
||||
import com.telecominfraproject.wlan.routing.models.EquipmentGatewayRecord;
|
||||
import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
|
||||
import com.telecominfraproject.wlan.server.exceptions.ConfigurationException;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentResetMethod;
|
||||
|
||||
/**
|
||||
* Opensync Gateway Controller - integration code for cloud deployment
|
||||
@@ -191,6 +194,9 @@ public class OpensyncCloudGatewayController {
|
||||
case RadioReset:
|
||||
ret.add(processRadioReset(session, (CEGWRadioResetRequest) command));
|
||||
break;
|
||||
case RebootRequest:
|
||||
ret.add(processRadioReboot(session, (CEGWRebootRequest) command));
|
||||
break;
|
||||
case ClientBlocklistChangeNotification:
|
||||
ret.add(sendClientBlocklistChangeNotification(session,
|
||||
(CEGWClientBlocklistChangeNotification) command));
|
||||
@@ -224,6 +230,10 @@ public class OpensyncCloudGatewayController {
|
||||
return sendMessage(session, command.getInventoryId(), command);
|
||||
}
|
||||
|
||||
private EquipmentCommandResponse processRadioReboot(OvsdbSession session, CEGWRebootRequest command) {
|
||||
return sendMessage(session, command.getInventoryId(), command);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/defaults", method = RequestMethod.GET)
|
||||
public GatewayDefaults retrieveGatewayDefaults() {
|
||||
return new GatewayDefaults();
|
||||
@@ -339,6 +349,33 @@ public class OpensyncCloudGatewayController {
|
||||
response = new EquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand,
|
||||
"Received Command " + command.getCommandType() + " for " + inventoryId, command,
|
||||
registeredGateway.getHostname(), registeredGateway.getPort());
|
||||
} else if (command instanceof CEGWRebootRequest) {
|
||||
|
||||
CEGWRebootRequest rebootRequest = (CEGWRebootRequest) command;
|
||||
// Reboot the AP, Reset method specifies what kind of reboot, i.e.
|
||||
// Factory reset, reboot without changes, etc.
|
||||
EquipmentResetMethod resetMethod = rebootRequest.getPerformReset();
|
||||
switch (resetMethod) {
|
||||
case FactoryReset:
|
||||
response.setResultDetail(tipwlanOvsdbClient.processFactoryResetRequest(inventoryId));
|
||||
break;
|
||||
case NoReset:
|
||||
if (rebootRequest.isUseInactiveBank()) {
|
||||
response.setResultDetail(tipwlanOvsdbClient.processRebootRequest(inventoryId, true));
|
||||
} else {
|
||||
response.setResultDetail(tipwlanOvsdbClient.processRebootRequest(inventoryId, false));
|
||||
}
|
||||
break;
|
||||
case ConfigReset:
|
||||
case UNSUPPORTED: // for UNSUPPORTED or default just respond
|
||||
// with Unsupported Command
|
||||
default:
|
||||
response = new EquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand,
|
||||
"Received Command " + command.getCommandType() + " for " + inventoryId, command,
|
||||
registeredGateway.getHostname(), registeredGateway.getPort());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -25,4 +25,9 @@ public interface OvsdbClientInterface {
|
||||
String closeSession(String apId);
|
||||
|
||||
String processFirmwareFlash(String apId, String firmwareVersion, String username);
|
||||
|
||||
String processRebootRequest(String apId, boolean switchBanks);
|
||||
|
||||
String processFactoryResetRequest(String apId);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.telecominfraproject.wlan.opensync.external.integration.models.Opensyn
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncAPVIFState;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.models.OpensyncWifiAssociatedClients;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.OvsdbDao;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.utilities.OvsdbStringConstants;
|
||||
import com.telecominfraproject.wlan.opensync.util.SslUtil;
|
||||
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
|
||||
import com.vmware.ovsdb.callback.ConnectionCallback;
|
||||
@@ -752,6 +753,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
LOG.debug("TipWlanOvsdbClient::startDebugEngine apId {} gatewayHostname {} gatewayPort {}", apId,
|
||||
gatewayHostname, gatewayPort);
|
||||
|
||||
try {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
OvsdbClient ovsdbClient = session.getOvsdbClient();
|
||||
|
||||
@@ -768,12 +770,20 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
|
||||
LOG.debug("Started debug engine on AP {} with gateway {} port {}", apId, gatewayHostname, gatewayPort);
|
||||
return "Started debug engine on AP " + apId + " with gateway " + gatewayHostname + " port " + gatewayPort;
|
||||
} catch (Exception e) {
|
||||
LOG.error(
|
||||
"TipWlanOvsdbClient::startDebugEngine Failed to start debug engine on AP {} with gateway {} port {}",
|
||||
apId, gatewayHostname, gatewayPort, e);
|
||||
return "Failed to start debug engine on AP " + apId + " with gateway " + gatewayHostname + " port "
|
||||
+ gatewayPort;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String stopDebugEngine(String apId) {
|
||||
LOG.debug("TipWlanOvsdbClient::stopDebugEngine apId {}", apId);
|
||||
|
||||
try {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
OvsdbClient ovsdbClient = session.getOvsdbClient();
|
||||
|
||||
@@ -781,8 +791,65 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
ovsdbDao.configureCommands(ovsdbClient, OvsdbDao.StopDebugEngineApCommand, payload, Long.valueOf(0L),
|
||||
Long.valueOf(0L));
|
||||
|
||||
LOG.debug("Stop debug engine on AP {}", apId);
|
||||
LOG.debug("TipWlanOvsdbClient::stopDebugEngine Stop debug engine on AP {}", apId);
|
||||
return "Stop debug engine on AP " + apId;
|
||||
} catch (Exception e) {
|
||||
LOG.error("TipWlanOvsdbClient::stopDebugEngine Failed to request stop debug engine on AP {}", apId, e);
|
||||
return "Failed to request stop debug engine on AP " + apId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String processRebootRequest(String apId, boolean switchBanks) {
|
||||
try {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
OvsdbClient ovsdbClient = session.getOvsdbClient();
|
||||
|
||||
if (switchBanks) {
|
||||
LOG.debug("TipWlanOvsdbClient::processRebootRequest Switch software bank on AP {}", apId);
|
||||
|
||||
ovsdbDao.rebootOrResetAp(ovsdbClient, OvsdbStringConstants.OVSDB_AWLAN_AP_SWITCH_SOFTWARE_BANK);
|
||||
LOG.debug("TipWlanOvsdbClient::processRebootRequest triggered switch software bank on AP {}", apId);
|
||||
return "Switch software bank on AP " + apId;
|
||||
|
||||
} else {
|
||||
LOG.debug("TipWlanOvsdbClient::processRebootRequest Reboot AP {}", apId);
|
||||
|
||||
ovsdbDao.rebootOrResetAp(ovsdbClient, OvsdbStringConstants.OVSDB_AWLAN_AP_REBOOT);
|
||||
LOG.debug("TipWlanOvsdbClient::processRebootRequest triggered reboot of AP {}", apId);
|
||||
return "Reboot AP " + apId;
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (switchBanks) {
|
||||
LOG.debug("TipWlanOvsdbClient::processRebootRequest failed to trigger switch software bank on AP {}",
|
||||
apId, e);
|
||||
return "failed to trigger switch software bank on AP " + apId;
|
||||
} else {
|
||||
LOG.error("TipWlanOvsdbClient::processRebootRequest failed to trigger reboot of AP {}", apId, e);
|
||||
return "Failed to trigger reboot of AP " + apId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String processFactoryResetRequest(String apId) {
|
||||
|
||||
LOG.debug("TipWlanOvsdbClient::processFactoryResetRequest for AP {}", apId);
|
||||
|
||||
try {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
OvsdbClient ovsdbClient = session.getOvsdbClient();
|
||||
ovsdbDao.rebootOrResetAp(ovsdbClient, OvsdbStringConstants.OVSDB_AWLAN_AP_FACTORY_RESET);
|
||||
LOG.debug("TipWlanOvsdbClient::processRebootRequest Triggered a factory reset of AP {}", apId);
|
||||
return "Triggered a factory reset of AP " + apId;
|
||||
} catch (Exception e) {
|
||||
LOG.error("TipWlanOvsdbClient::processRebootRequest failed to trigger a factory reset of AP {}", apId, e);
|
||||
return "failed to trigger a factory reset of AP " + apId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3648,6 +3648,29 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
public void rebootOrResetAp(OvsdbClient ovsdbClient, String desiredApAction) {
|
||||
try {
|
||||
LOG.debug("rebootOrResetAp on AP perform {}.", desiredApAction, upgradeTimerSeconds);
|
||||
List<Operation> operations = new ArrayList<>();
|
||||
Map<String, Value> updateColumns = new HashMap<>();
|
||||
updateColumns.put("firmware_url", new Atom<>(desiredApAction));
|
||||
Row row = new Row(updateColumns);
|
||||
operations.add(new Update(awlanNodeDbTable, row));
|
||||
CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations);
|
||||
|
||||
OperationResult[] result = fResult.join();
|
||||
for (OperationResult r : result) {
|
||||
LOG.debug("Op Result {}", r);
|
||||
}
|
||||
} catch (OvsdbClientException e) {
|
||||
LOG.error("Could not trigger {}", desiredApAction, e);
|
||||
throw new RuntimeException(e);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void removeAllStatsConfigs(OvsdbClient ovsdbClient) {
|
||||
|
||||
LOG.info("Remove existing Wifi_Stats_Config table entries");
|
||||
|
||||
@@ -14,4 +14,12 @@ public class OvsdbStringConstants {
|
||||
public static final String FW_IMAGE_ACTIVE_KEY = "FW_IMAGE_ACTIVE";
|
||||
public static final String FW_IMAGE_INACTIVE_KEY = "FW_IMAGE_INACTIVE";
|
||||
|
||||
// AWLAN_Node values which can be placed in firmware_url column to trigger
|
||||
// behavior other than firmware download/flash
|
||||
public static final String OVSDB_AWLAN_AP_REBOOT = "reboot";
|
||||
public static final String OVSDB_AWLAN_AP_FACTORY_RESET = "factory";
|
||||
public static final String OVSDB_AWLAN_AP_SWITCH_SOFTWARE_BANK = "switch";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user