apertis-update-manager-ota-api-switch-network manual

medium

Image Types:
fixedfunction-armhf / fixedfunction-arm64 / fixedfunction-amd64
Image Deployment:
OSTree
Type:
functional

Description

Test the apertis-update-manager API for updates over the air when the network is changed from a phone hotspot to wifi.


Resources

  • The DUT u-boot environment must be clean: in u-boot, run: `env default -a` followed by `saveenv`
  • A PC must be connected to DUT serial port
  • The DUT must be connected to network

Pre Conditions

  1. This test requires a properly configured time source: when testing devices not carrying a battery-backed real time clock in a network which prevents connections to NTP servers (and only in that case) manually ensure that the time on the device is set appropriately and that it is propagated to the hardware clock so it is stay set on the next reboot if the power is not plugged off.
  2. $ sudo timedatectl --adjust-system-clock set-time "2019-08-21 18:49:03"
  3. If direct access to repository with updates for DUT is restricted and proxy server should be used, then need to add the address of this proxy for OSTree on DUT by command:
  4. $ sudo ostree config set 'remote "origin"'.proxy "http://10.168.128.45:3128"

Execution Steps

  1. Check the initial deployment
  2. $ sudo ostree admin status
  3. Prepare the copy of commit and deploy to allow the upgrade to the same version
  4. Command below shows you an initial commit ID, for instance
  5. $ export BOOTID=$(sudo ostree admin status | sed -n -e 's/^\* apertis \([0-9a-f]*\)\.[0-9]$/\1/p'); echo $BOOTID
  6. Get the Collection ID and ref
  7. $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
    $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
  8. Create the commit with changed timestamp to allow upgrade with recent update file
  9. $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
  10. Deploy the prepared commit
  11. $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
  12. Wait until the system is booted again and check the deployment
  13. $ sudo ostree admin status
  14. The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'
  15. Remove the initial deployment
  16. $ sudo ostree admin undeploy 1
  17. Reboot the system
  18. Check the current deployment
  19. $ sudo ostree admin status
  20. Start the user interface agent with mode preventing automatic system reboot after update
  21. $ sudo updatectl --register-upgrade-handler &
  22. Enable network updates with CLI tool
  23. $ sudo updatectl --check-network-updates
  24. Check that the user interface agent reports the pending update
  25. ** Message: 21:31:26.117: Network connected: Yes

    ** Message: 21:31:26.123: Upgrade status: Checking

  26. Once the above message is seen switch off the phone hotspot
  27. ** Message: 21:31:26:129: Network connected: No

  28. Re-estabish the network connection to the target via a different wi-fi network or ethernet connection
  29. ** Message: 21:31:28.057: Upgrade status: Downloading

    ** Message: 21:31:51.170: Upgrade status: Deploying

    ** Message: 21:32:11.879: An upgrade is pending

  30. After the update, the device does *not* reboot automatically
  31. Check if there is pending deployment and reboot the DUT
  32. $ sudo ostree admin status
    $ sudo reboot
  33. Check the current deployment has been updated and that the rollback entry points to the prepared deployment
  34. $ sudo ostree admin status
  35. Start the user interface agent
  36. $ sudo updatectl &
  37. Enable network updates with CLI tool
  38. $ sudo updatectl --check-network-updates
  39. Check that the user interface agent reports the system is up to update
  40. ** Message: 21:47:11.501: Network connected: Yes

    ** Message: 21:47:11.508: Upgrade status: Checking

    ** Message: 21:47:13.079: Upgrade status: Downloading

    ** Message: 21:47:13.080: System is up to date


Expected

CLI utility `updatectl` is able to interact with Apertis update manager even if there's a change in the network source

The OTA update was successfully applied