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 headlessExecution execution property to false.
  • Using the package-cli tool, perform the following steps:
    1. Create an IoTC Package. For more information about creating an IoTC Package, see Create an IoTC Package.
    2. 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 commandFetchIntervalSeconds to 0.
    commandFetchIntervalSeconds = 0
  • Enroll the device.

Procedure

  1. Create a campaign using a distribution select query and the packages that you uploaded while creating the campaign.
  2. 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

  1. Invoke the get-commands to call from the DefaultClient or an Agent SDK extension. The state of the Gateway changes to INVENTORY_UP_TO_DATE.
  2. Invoke the get-commands to call from the DefaultClient or an Agent SDK extension. The state of the Gateway changes to WAITING_FOR_*_APPROVAL.
    In the WAITING_FOR_*_APPROVAL state, 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 from SCHEDULED_DOWNLOAD to WAITING_FOR_DOWNLOAD.
  3. Invoke the get-commands to call from the DefaultClient or an Agent SDK extension. The Gateway starts downloading the package and the state of the device changes from DOWNLOADING to DOWNLOAD_COMPLETE.
  4. Invoke the get-commands to call from the DefaultClient or the Agent SDK extension. The state of the Gateway changes to WAITING_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 from SCHEDULED_EXECUTION to WAITING_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 from SCHEDULED_ACTIVATION to WAITING_TO_ACTIVATE.
Note: Contact your Device Administrator or Campaign Administrator if the state of the Gateway changes to one of the following states:
  • DOWNLOAD_FAILED
  • EXECUTION_FAILED
  • ACTIVATION_FAILED