thin-edge/thin-edge.io

Device Under Test - fully controllable online

Opened this issue · 1 comments

Building a setup which will provide running different tests manually or by Robot Framework Test Suites.

  • DUT should be accessable online
  • The SD Card of the DUT should be accessable online in order to be burned with needed image files (.img)
  • The DUT should be turned ON/OFF remotely to ensure new load of SD Card with new image

Implemented solution:

  • DUT should be accessable online:

    • DUT is member of the ZeroTier Network with the IP: 192.168.193.109
  • The SD Card of the DUT should be accessable online in order to be burned with needed image files (.img)

    • The SD card is inserted in the USD SD Mux device which provides two connections, to the HOST and to the DUT
      Host is accessable online:

      • ssh thinedge@sikahq.myddns.me (ssh public key needs to be provided)
      • ssh 192.168.193.87 over ZeroTier network, the Machine that runs the test must be member of the ZeroTier network as well.
    • Switching the SD card is done by running following commands:

      • sudo venv/bin/usbsdmux /dev/sg0 dut to use it with the DUT
      • sudo venv/bin/usbsdmux /dev/sg0 host to use it with the Host
  • The DUT should be turned ON/OFF remotely to ensure new load of SD Card with new image

    • Tuning the DUT ON and OFF can be done by sending following MQTT messages
      • mosquitto_pub -h 192.168.193.87 -t cmnd/sonoff_switch /POWER -m "ON"
      • mosquitto_pub -h 192.168.193.87 -t cmnd/sonoff_switch /POWER -m "OFF"
  • Creating backup image of the SD Card:

    • Identify the SD Cardlsblk
      • Look for a device that matches the size of your SD card. It will typically be something like /dev/sdX (where X is a letter, such as a, b, c, etc.).
    • Unmount the SD Cardsudo umount /dev/sda1 & sudo umount /dev/sda2
      • Replace /dev/sdX1 with the appropriate partition identifier if it's mounted.
    • Create the Backup sudo dd if=/dev/sda of=~/sdcard_backup.img bs=4M status=progress
  • Restoring backup image to the SD Card

    • sudo dd if=~/sdcard_backup.img of=/dev/sda bs=4M status=progress

IMPORTANT:

  • The SD Card switch to DUT must be done after the DUT was switched off (after the switch turn it on.
  • The Restoring takes longer time than the Backup