Perform the following steps to run an OTA update for the IoTC Agent in the On-Demand mode, that is, with the commandFetchIntervalSeconds property set to 0.
Prerequisites
- In the specification file, set the value of the
headlessExecutionexecution property tofalse. - Using the
package-clitool, perform the following steps:- Create an IoTC Package. For more information about creating an IoTC Package, see Create an IoTC Package.
- Upload the IoTC Package to the repository. Alternatively, use the VMware Pulse IoT Center UI to upload to the repository. For more information about uploading the IoTC Package, see Upload the IoTC Package.
- Set he value of the
commandFetchIntervalSecondsto0.commandFetchIntervalSeconds = 0
- Enroll the device.
Procedure
- Create a campaign using a distribution select query and the packages that you uploaded while creating the campaign.
- Start the campaign.
Results
The IoTC Agent invokes the get-commands when initiated from the DefaultClient binary. The following example outlines the different states of the Gateway during an OTA update. The state of the Gateway is INSTANTIATED when the OTA campaign starts.
Example: Sample Workflow
- Invoke the get-commands to call from the
DefaultClientor an Agent SDK extension. The state of the Gateway changes toINVENTORY_UP_TO_DATE. - Invoke the get-commands to call from the
DefaultClientor an Agent SDK extension. The state of the Gateway changes toWAITING_FOR_*_APPROVAL.In theWAITING_FOR_*_APPROVALstate, schedule the next state. For example:DefaultClient schedule --type=download --campaign-id=<campaign id> DefaultClient schedule --type=download --campaign-id=<campaign id> --start-time=0 --end-time=0 DefaultClient schedule --type=download --campaign-id=<campaign id> --start-time=5000 --end-time=80000
Based on the campaign scheduled time, the state of the device changes fromSCHEDULED_DOWNLOADtoWAITING_FOR_DOWNLOAD. - Invoke the get-commands to call from the
DefaultClientor an Agent SDK extension. The Gateway starts downloading the package and the state of the device changes fromDOWNLOADINGtoDOWNLOAD_COMPLETE. - Invoke the get-commands to call from the
DefaultClientor the Agent SDK extension. The state of the Gateway changes toWAITING_FOR_EXECUTION_APPROVAL.Here, you can schedule a start and end time for running the campaign using the following command:DefaultClient schedule --type=<download|execution|activation> --campaign-id=<campaign Id> [--start-time=<start time window> --end-time=<end time window>]
For example:DefaultClient schedule --type=execution --campaign-id=<campaign id> DefaultClient schedule --type=execution --campaign-id=<campaign id> --start-time=0 --end-time=0 DefaultClient schedule --type=execution --campaign-id=<campaign id> --start-time=5000 --end-time=80000
Based on the campaign scheduled time, the state of the device changes fromSCHEDULED_EXECUTIONtoWAITING_TO_EXECUTE.Here, you can schedule a start and end time for activating the campaign using the following command:DefaultClient schedule --type=<download|execution|activation> --campaign-id=<campaign Id> [--start-time=<start time window> --end-time=<end time window>]
For example:DefaultClient schedule --type=activation --campaign-id=<campaign id> DefaultClient schedule --type=activation --campaign-id=<campaign id> --start-time=0 --end-time=0 DefaultClient schedule --type=activation --campaign-id=<campaign id> --start-time=5000 --end-time=80000
Based on the campaign scheduled time, the state of the device changes fromSCHEDULED_ACTIVATIONtoWAITING_TO_ACTIVATE.
Note: Contact your Device Administrator or Campaign Administrator if the state of the Gateway changes to one of the following states:
DOWNLOAD_FAILEDEXECUTION_FAILEDACTIVATION_FAILED