Added support to keep config with firmware download

This commit is contained in:
Vivek Kumar Dutta 2024-02-14 17:32:05 +05:30
parent a41cefa09b
commit 97f9633e52
2 changed files with 39 additions and 4 deletions

View file

@ -108,3 +108,34 @@ If the exit code from the idle script is zero then firmware image can be activat
* This document is only target for Firmware management using USP.
* TimeWindow.{i}.Mode = 'ConfirmationNeeded' is not supported.
## Vendor extension option to keep config while firmware download
It deployments for some customers, its required to do a factory reset after doing a firmware upgrade to start the CPE from clean state and then provision it from ACS/Controller.
As per standard datamodel, it's at-least 2 step time consuming process:
- Download the Firmware using 'Device.DeviceInfo.FirmwareImage.{i}.Download()' operate command with AutoActivate=1
- Wait for the 'Device.Boot!' event
- Factory reset the CPE using 'Device.FactoryReset()'
- Wait for the Boot event and then start provisioning.
We added an addition vendor specific input option which can be used by USP controller to factoryReset the CPE along with Firmware Upgrade, with this customer can save the cost of one additional reboot, which result into faster provisioning of the CPE.
Below are the current input options defined for Download operate command
```bash
Device.DeviceInfo.FirmwareImage.{i}.Download()
Device.DeviceInfo.FirmwareImage.{i}.Download() input:AutoActivate
Device.DeviceInfo.FirmwareImage.{i}.Download() input:CheckSum
Device.DeviceInfo.FirmwareImage.{i}.Download() input:CheckSumAlgorithm
Device.DeviceInfo.FirmwareImage.{i}.Download() input:CommandKey
Device.DeviceInfo.FirmwareImage.{i}.Download() input:FileSize
Device.DeviceInfo.FirmwareImage.{i}.Download() input:Password
Device.DeviceInfo.FirmwareImage.{i}.Download() input:URL
Device.DeviceInfo.FirmwareImage.{i}.Download() input:Username
Device.DeviceInfo.FirmwareImage.{i}.Download() input:X_IOPSYS_EU_KeepConfig
```
Customer can use X_IOPSYS_EU_KeepConfig=0, to do factory reset(not copy the current config to next firmware) while doing the download.
> Note: Default value of X_IOPSYS_EU_KeepConfig is 1, so in case this option not used, it keeps the config(as the default behavior of the CPE).

View file

@ -662,7 +662,7 @@ static void dmubus_receive_sysupgrade(struct ubus_context *ctx, struct ubus_even
static int bbf_fw_image_download(const char *url, const char *auto_activate, const char *username, const char *password,
const char *file_size, const char *checksum_algorithm, const char *checksum,
const char *bank_id, const char *command, const char *obj_path, const char *commandKey)
const char *bank_id, const char *command, const char *obj_path, const char *commandKey, char *keep)
{
char fw_image_path[256] = "/tmp/firmware-XXXXXX";
json_object *json_obj = NULL;
@ -726,8 +726,11 @@ static int bbf_fw_image_download(const char *url, const char *auto_activate, con
goto end;
}
// default state is to preserve the config over firmware upgrades
char *keep_config = DM_STRLEN((char *)keep) ? keep : "1";
// Apply Firmware Image
dmubus_call_blocking("fwbank", "upgrade", UBUS_ARGS{{"path", fw_image_path, String}, {"auto_activate", act, Boolean}, {"bank", bank_id, Integer}}, 3, &json_obj);
dmubus_call_blocking("fwbank", "upgrade", UBUS_ARGS{{"path", fw_image_path, String}, {"auto_activate", act, Boolean}, {"bank", bank_id, Integer}, {"keep_settings", keep_config, Boolean}}, 4, &json_obj);
if (json_obj == NULL) {
res = 1;
snprintf(fault_msg, sizeof(fault_msg), "Internal error occurred when applying the firmware");
@ -1720,6 +1723,7 @@ static operation_args firmware_image_download_args = {
"CheckSumAlgorithm",
"CheckSum",
"CommandKey",
BBF_VENDOR_PREFIX"KeepConfig",
NULL
}
};
@ -1755,11 +1759,11 @@ static int operate_DeviceInfoFirmwareImage_Download(char *refparam, struct dmctx
char *checksum_algorithm = dmjson_get_value((json_object *)value, 1, "CheckSumAlgorithm");
char *checksum = dmjson_get_value((json_object *)value, 1, "CheckSum");
char *commandKey = dmjson_get_value((json_object *)value, 1, "CommandKey");
char *keep_config = dmjson_get_value((json_object *)value, 1, BBF_VENDOR_PREFIX"KeepConfig");
char *bank_id = dmjson_get_value((json_object *)data, 1, "id");
int res = bbf_fw_image_download(url, auto_activate, username, password, file_size, checksum_algorithm, checksum, bank_id, command, obj_path, commandKey);
int res = bbf_fw_image_download(url, auto_activate, username, password, file_size, checksum_algorithm, checksum, bank_id, command, obj_path, commandKey, keep_config);
if (res == 1) {
bbfdm_set_fault_message(ctx, "Firmware validation failed");