Skip to content

ExploratoryEngineering/nbiot-e2e

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

End to end testing for Telenor NB-IoT

These tools enable automatic firmware updates on devices that periodically send NB-IoT data messages to a server that sends an alert whenever it detects dropped or duplicate messages.

We use Raspberry Pis to run the end 2 end tests from different locations. The plan is that they will send nbiot-packets by connecting an EE-NBIOT-01 directly to the UART on the Raspberry Pi. Some of them might also have an Arduino attached to compile and test that the Arduino library is working.

Preparing an end device

What you'll need

  • Install and configure the aws cli
  • Raspberry Pi 3 B+
  • Raspberry Pi power supply
  • microSD card for the Raspberry Pi
  • If attaching an Arduino UNO to the Pi
    • Arduino UNO
    • USB A to USB B cable (for the UNO)
    • EE-NBIOT-01 board
    • Adapter board with voltage divider (100Ω and 220Ω resistor) for TX (schematic)

Install steps

  1. Download latest Raspbian Stretch Lite and burn to the microSD card using Etcher

  2. Mount the SD card and create an empty file called ssh to enable SSH access

  3. If the Pi has to use WiFi (Ethernet preferred), add a file named wpa_supplicant.conf in the root of the SD card:

    Update the file with SSID and password and remove the network definition that won't be used

         ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
         update_config=1
         country=no
         
         network={
             ssid="no_password_SSID"
             key_mgmt=NONE
         }
         
         network={
             ssid="password_protected_SSID"
             psk="password"
         }
    
  4. Connect the Raspberry Pi using Ethernet and power up

  5. cd _nbiot-e2e_/scripts

  6. Run the setup script and follow the instructions. You will be prompted for a password when the script tries to SSH to the Pi; the password is raspberry.

     ./run_setup_rpi.sh
    

The script takes about 20 minutes, after which the Pi should be up and running the end to end test.

Remote access to the Pi

The Pis are connected to AWS Systems Manager, so we can use Systems Manager to remotely execute scripts on a Pi.

Run single command on a nbiot-e2e Pi

  1. cd _nbiot-e2e_/scripts/remote
  2. List the managed instances: aws ssm describe-instance-information
  3. Copy the instance ID of the Pi you want to connect to
  4. ./exec.sh nbiot-e2e-01 "echo This command will run on nbiot-e2e-01, wait for execution to finish and output the response"

Run single command on all the nbiot-e2e Pis

exec-all.sh executes the arguments on all the nbiot-e2e Pis and send the responses to the SSM-RunCommand-Output log stream in Cloud Watch. It then checks the Cloud Watch logs every second and prints the output.

  1. cd _nbiot-e2e_/scripts/remote
  2. ./exec-all.sh command
  3. Wait for responses. Press CTRL + C to exit.

SSH into the Pi

  1. cd _nbiot-e2e_/scripts/remote

  2. If it's the first time, you need to get the Pi's public ssh key and add it to the e2e server (replace XX with pi number):

     `./getsshpubkey.sh nbiot-e2e-XX`
    

    Copy the STDOUT value and add it to the end of .ssh/authorized_keys on the e2e server

  3. Open the tunnel from the Pi to the e2e server:

     `./open-tunnel.sh nbiot-e2e-XX`
    
  4. ssh [email protected]

    1. ssh to the Pi from the e2e server:

       ssh -o StrictHostKeyChecking=no -p 2222 e2e@localhost
      
    2. You should now be logged in as e2e on the pi

  5. When you're done. Remember to close the tunnel:

     `./close-tunnel.sh nbiot-e2e-XX`