Device Remote Upgrade


Edge OTA Function Scope Edge Logger Edge Gateway & Extensive
Edge software remote upgrade ×
Edge operating system vulnerability remote upgrade

Development sub-device OTA capacity

Similar to EnOS Cloud, EnOS Edge provides service of OTA upgrading for sub-devices:

  • Getting firmware version: Sub-device reports its own version regularly to Edge, Edge publish version information to cloud and verify the version if it’s latest.
  • Publishing upgrading message: Sub-device receives the upgrade requirement from edge and download the file.
  • Getting the process of upgrading and result: Sub-device can report the process of upgrading and result to edge when sub-device is in process of upgrading. Therefore edge will publish the process to display in cloud side.

Sub-devices OTA depends on storage and feature of the device itself:

  • Sub-devices establishes upgrading channel by http connection or port connection to edge
  • Sub-devices can get individual firmware version and report version to edge by upgrading channel
  • Sub-devices firmware need to be uploaded to OTA component in EnOS control platform
  • Sub-devices need to be ability of managing version
  • Sub-devices need to define itself upgrade process
  • Sub-devices need to be ability to verify integrity of firmware, and if the upgrade failed, sub-devices can rollback the original version

The performance of edge OTA upgrading: In port channel, up to 5 devices can upgrade at the same time(5 thread), propose to delete upgrade after completing upgrading to avoid occupying the edge resource.

Sub-devices report version and get the upgrade message

Sub-devices need to report current version to edge, only those devices which report firmware version can create upgrade task in control platform. Sub-devices call OTA upgrade sever by poll pattern in interval time, report own version to server, server responses the message if or not there is workable firmware upgrade information. There will be available download URL, verify mode and verify code in the message package of server response.

  • Request format:http://IP:5055/checkversion
  • Request data format
{
"assetId":"",
"version":"1.0.0",
"serialNum":"1234-5678-90aa"
}
  • Response data format:

    • No available upgrade message:
    {
    "assetId":"ZR3c5CfFSO",
    "version":"1.0.0",
    "code":0,
    "desc":"no update",
    "signMethod":"",
    "sign":"",
    "downloadurl":""
    }
    
    • Available upgrade message:
    {
    "assetId":"999999",
    "version":"v2.0.0.1",
    "code":1,
    "desc":"has update",
    "signMethod":"MD5",
    "sign": "zxnchksmichasncjdchjcdn",
    "downloadurl":"/version/15912345678"
    }
    
  • Parameter:

Parameter Type Require Description
assetId string Yes device ID
code integer Yes Response cde, 0 means download fail or md5 check fail, 1 means download successfully and md5sum check successfully.
message string Yes Result response
httpstatus integer yes Support error code:400,404,406,500; Response code successfully: 204,no content

Sub device downloads the firmware package

Create a cloud-pushed firmware update task in the control console. Online sub-devices that meet the upgrade conditions will receive firmware information pushed from the cloud via Edge. If the subdevices are not currently online, they will receive an upgrade request when they are next online. When the sub-device receives a message with available updates, it parses the URL of the firmware package from the message and downloads the firmware package via the HTTP protocol. The sub device downloads the firmware package directly via the serial port protocol.

  • Request format:http://IP:5055/version/15912345678

Sub-devices push download status and results

Sub-devices need to actively download the firmware package through the URL and send the download result and download status to the OTA sub-device upgrade server according to the custom policy.

  • Request format:http://IP:5050/downloadresult/15912345678

  • Publishing data format

    • Download fail
    {
    "assetId":"ZR3c5CfFSO",
    "code":0,
    "message":"download fail"
    }
    
    • Download successfully
    {
    "assetId":"ZR3c5CfFSO",
    "code":1,
    "message":"download success"
    }
    
  • Response data format

{
"httpstatus":404,
"message":"unsupported url"
}
  • Parameter
Parameter Type Require Description
assetId string Yes Sub device ID
code integer Yes Response cde, 0 means download fail or md5 check fail, 1 means download successfully and md5sum check successfully
message string Yes Result response
httpstatus integer Yes Support error code:400, 404, 406, 500; Response code successfully: 204,no content

Sub devices publish upgrade result

After the sub device starts downloading firmware, it upgrades the firmware package according to its own policy and calculates its own upgrade progress. Upgrade progress and upgrade results can be reported to the OTA sub-device upgrade server in the following three formats. Operations engineer can view the upgrade progress in the console. Upgrade exceptions in response can be reported through the errcode field.

  • Interface:http://IP:5055/updateresult

  • Publish data forma

    • Upgrade failure message body
    {
    "assetId":"999999",
    "version":"v1.0.0.3",
    "desc":"during upgrade",
    "flag":0,
    "process":0,
    "errcode":0
    }
    
    • Upgrade in progress
    {
    "assetId":"999999",
    "version":"",
    "desc":"updating",
    "flag":1,
    "process": 60,
    "errcode":0
    }
    
    • Upgrade successfully
    {
    "assetId":"999999",
    "version":"v2.0.0.1",
    "desc":"update completed",
    "flag":2,
    "process": 100,
    "errcode":0
    }
    
  • Response format

{
"httpstatus":404,
"message":"unsupported url"
}
  • Parameter
Parameter Type Require Description
assetId string Yes Sub device ID
version string Yes Current sub device version
desc string No Description information
flag integer Yes Upgrade status:0 present upgrading failure, 1 present upgrade in progress,Other values mean error
process integer Yes Upgrade progress: 0-100
errcode string Yes Error code, report error code requires flag is 0
httpstatus integer Yes Support error code:400, 404, 406, 500; Response code successfully: 204,no content

Note

When flag is 2, process is 100, version is the value to be upgraded. The three conditions are all true, cloud will display upgrading successfully.

After the above sub-device configuration is complete, proceed to the next step and add the upgraded device.

Add firmware upgrade

The Edge follows the IoT Hub firmware remote upgrade process to perform OTA upgrades on behalf of sub-devices. After completing the above steps to develop sub device OTA capabilities and add upgraded devices, please refer to Firmware Wireless (OTA) Upgrade for subsequent firmware wireless (OTA) upgrades.

../_images/sn.png

Example of OTA upgrade process

Log in to the EnOS Management Console, select Edge Management from the left navigation bar, select the appropriate Edge device, and perform OTA upgrade on the sub-device. The following is an example of a serial sub-device to illustrate the OTA upgrade process.

  • Steps 1-3 are to create child devices
  • Steps 4-6 are the process of uploading the firmware of the child device. After successful uploading, the child device will regularly compare whether its firmware version number is consistent with the uploaded version. If not, the OTA upgrade will be automatically initiated.

Steps

  1. Select Edge Management in the left navigation bar Edge Details > OTA Upgrade > Add device.

    ../_images/adddevice.png
  2. Select the product, edit the SN after the list of products, and click OK.

    ../_images/editsn.png
  3. In the left navigation bar, select Device Management > OTA Upgrade > firmware Management > Add New Firmware, fill in the firmware form, click OK after completing the form.

  4. Select Device Management in the left navigation bar OTA Upgrade > OTA Task > Add New Task, fill in the task form, and click OK after completing the task.

    Note

    Sub devices need to be online.