From d718914f0d49b9567121e32a54ac0892228c660d Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Tue, 6 Apr 2021 13:28:07 +0200 Subject: [PATCH 01/14] Adding initial HITL layout --- hitl/README.md | 25 +++++++++++++++++++++++++ hitl/run.sh | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 hitl/README.md create mode 100644 hitl/run.sh diff --git a/hitl/README.md b/hitl/README.md new file mode 100644 index 0000000..a150e6b --- /dev/null +++ b/hitl/README.md @@ -0,0 +1,25 @@ +# Stabilizer HITL Testing + +This directory contains tooling required for Stabilizer hardware-in-the-loop (HITL) testing. + +There is a `Stabilizer` board connected at the Quartiq office that is accessible via a private HITL +repository in order to provide secure hardware testing of the stabilizer application in a public +repository. + +**Note**: In order to ensure application security, all HITL runs must first be approved by a Quartiq +representative before execution. + +# Hardware Configuration +Stabilizer is configured with an ethernet connection to a router. The router runs a DHCP server for +the local network, and Stabilizers MAC address has been assigned to the unique host name of +`gonnigan.ber.quartiq.de`. + +# HITL Workflow +The private HITL repository does the following: + +1. Check out this repository +2. Build firmware images using Cargo +3. Program stabilizer +4. Execute `hitl/run.sh` + +In order to add new HITL tests, update `run.sh` to include the necessary tests. diff --git a/hitl/run.sh b/hitl/run.sh new file mode 100644 index 0000000..a945b0d --- /dev/null +++ b/hitl/run.sh @@ -0,0 +1,17 @@ +#!/usr/bin/bash + +# Title: +# Stabilizer hardware-in-the-loop (HITL) test script. +# +# Description: +# This shell file is executed by the hardware runner in Quartiq's office to exercise the various +# hardware aspects of Stabilizer. + +# Test pinging Stabilizer. This exercises that: +# * DHCP is functional and an IP has been acquired +# * Stabilizer's network is functioning as intended +# * The stabilizer application is opeerational +ping -c 5 -W 20 gonnigan.ber.quartiq.de + +# Test the MQTT interface. +python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' From 2e4fdbb6e2c0925e026bb1084e56a52280a1f612 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Tue, 6 Apr 2021 14:28:08 +0200 Subject: [PATCH 02/14] Fixing python venv setup --- hitl/run.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hitl/run.sh b/hitl/run.sh index a945b0d..40e7397 100644 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -7,11 +7,16 @@ # This shell file is executed by the hardware runner in Quartiq's office to exercise the various # hardware aspects of Stabilizer. +# Set up python for testing +python3 -m venv --system-site-packages py +source py/bin/activate +python3 -m pip install -r requirements.txt + # Test pinging Stabilizer. This exercises that: # * DHCP is functional and an IP has been acquired # * Stabilizer's network is functioning as intended # * The stabilizer application is opeerational -ping -c 5 -W 20 gonnigan.ber.quartiq.de +ping -c 5 -w 20 gonnigan.ber.quartiq.de # Test the MQTT interface. python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' From 2fa94b03a5f5db4940aa0f050bfbd0496e9b5916 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 13:53:29 +0200 Subject: [PATCH 03/14] Updating executability --- hitl/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 hitl/run.sh diff --git a/hitl/run.sh b/hitl/run.sh old mode 100644 new mode 100755 index 40e7397..ff9796c --- a/hitl/run.sh +++ b/hitl/run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/bash -e # Title: # Stabilizer hardware-in-the-loop (HITL) test script. From cd25b44b80517ec2d3fee0a1b9b02b26cce0639e Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 13:55:08 +0200 Subject: [PATCH 04/14] Updating hitl runner to use correct broker --- hitl/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hitl/run.sh b/hitl/run.sh index ff9796c..d3d5523 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -19,4 +19,4 @@ python3 -m pip install -r requirements.txt ping -c 5 -w 20 gonnigan.ber.quartiq.de # Test the MQTT interface. -python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' +python3 miniconf.py --broker mqtt.ber.quartiq.de dt/sinara/stabilizer afe/0 '"G2"' From ef9e5557e55f88402a9849afd25d1d60133ce5aa Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 14:04:11 +0200 Subject: [PATCH 05/14] Adding requirements file --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a3d7fef --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +gmqtt From 38b7884b4916ebc26662017acf12666375e197c1 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 14:18:21 +0200 Subject: [PATCH 06/14] Updating HITL to run against PRs to master --- .github/workflows/hitl.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index f59e8d2..b8611d4 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -1,9 +1,9 @@ name: HITL on: - push: - branches: [ hitl ] workflow_dispatch: + pull_request: + branches: [ master ] jobs: hitl: From 56acd9de2b906f157047c513b86e4cd3698b6f99 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 14:21:44 +0200 Subject: [PATCH 07/14] Removing broker specification --- hitl/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hitl/run.sh b/hitl/run.sh index d3d5523..ff9796c 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -19,4 +19,4 @@ python3 -m pip install -r requirements.txt ping -c 5 -w 20 gonnigan.ber.quartiq.de # Test the MQTT interface. -python3 miniconf.py --broker mqtt.ber.quartiq.de dt/sinara/stabilizer afe/0 '"G2"' +python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' From 5d9c7b0884f244a7d586d966e00fdeb961c05421 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 14:30:39 +0200 Subject: [PATCH 08/14] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Jördens --- hitl/run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hitl/run.sh b/hitl/run.sh index ff9796c..c4a6c15 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash -e +#!/bin/sh # Title: # Stabilizer hardware-in-the-loop (HITL) test script. @@ -15,8 +15,8 @@ python3 -m pip install -r requirements.txt # Test pinging Stabilizer. This exercises that: # * DHCP is functional and an IP has been acquired # * Stabilizer's network is functioning as intended -# * The stabilizer application is opeerational -ping -c 5 -w 20 gonnigan.ber.quartiq.de +# * The stabilizer application is operational +ping -c 5 -w 20 stabilizer-hitl # Test the MQTT interface. python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' From 3187825b6192d0bf5d051565c6cc44c6f94c0e02 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 14:31:49 +0200 Subject: [PATCH 09/14] Updating runner operational flags --- hitl/run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hitl/run.sh b/hitl/run.sh index c4a6c15..6602bf2 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -7,6 +7,9 @@ # This shell file is executed by the hardware runner in Quartiq's office to exercise the various # hardware aspects of Stabilizer. +# Enable shell operating mode flags. +set -eux + # Set up python for testing python3 -m venv --system-site-packages py source py/bin/activate From 416864b66aaf32d926d6d4375f3d50e8cb753760 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 14:38:22 +0200 Subject: [PATCH 10/14] Replacing sh with bash --- hitl/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hitl/run.sh b/hitl/run.sh index 6602bf2..47c6dd1 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Title: # Stabilizer hardware-in-the-loop (HITL) test script. From 7d3698dd8d8faa81cc2462f30886430baf6a6b78 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 15:02:49 +0200 Subject: [PATCH 11/14] Removing source in favor of dot --- hitl/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hitl/run.sh b/hitl/run.sh index 47c6dd1..a01a472 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -12,7 +12,7 @@ set -eux # Set up python for testing python3 -m venv --system-site-packages py -source py/bin/activate +. py/bin/activate python3 -m pip install -r requirements.txt # Test pinging Stabilizer. This exercises that: From b17831b99506c21c9d88b6c818120ba0cd91bed1 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 15:07:17 +0200 Subject: [PATCH 12/14] Updating HITL script to directly call python binaries --- hitl/run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hitl/run.sh b/hitl/run.sh index a01a472..b707192 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -12,8 +12,8 @@ set -eux # Set up python for testing python3 -m venv --system-site-packages py -. py/bin/activate -python3 -m pip install -r requirements.txt + +py/bin/pip install -r requirements.txt # Test pinging Stabilizer. This exercises that: # * DHCP is functional and an IP has been acquired @@ -22,4 +22,4 @@ python3 -m pip install -r requirements.txt ping -c 5 -w 20 stabilizer-hitl # Test the MQTT interface. -python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' +py/bin/python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' From 648731873085c17c24b3400dc1aed71b3a4d1cff Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 15:09:34 +0200 Subject: [PATCH 13/14] Reverting HITL runner changes --- hitl/run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hitl/run.sh b/hitl/run.sh index b707192..a01a472 100755 --- a/hitl/run.sh +++ b/hitl/run.sh @@ -12,8 +12,8 @@ set -eux # Set up python for testing python3 -m venv --system-site-packages py - -py/bin/pip install -r requirements.txt +. py/bin/activate +python3 -m pip install -r requirements.txt # Test pinging Stabilizer. This exercises that: # * DHCP is functional and an IP has been acquired @@ -22,4 +22,4 @@ py/bin/pip install -r requirements.txt ping -c 5 -w 20 stabilizer-hitl # Test the MQTT interface. -py/bin/python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' +python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' From fb32939fc55f62d8b105161c678a3d37147abb28 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 7 Apr 2021 15:21:12 +0200 Subject: [PATCH 14/14] Update hitl/README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Jördens --- hitl/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hitl/README.md b/hitl/README.md index a150e6b..629b587 100644 --- a/hitl/README.md +++ b/hitl/README.md @@ -9,10 +9,10 @@ repository. **Note**: In order to ensure application security, all HITL runs must first be approved by a Quartiq representative before execution. -# Hardware Configuration -Stabilizer is configured with an ethernet connection to a router. The router runs a DHCP server for -the local network, and Stabilizers MAC address has been assigned to the unique host name of -`gonnigan.ber.quartiq.de`. +# Configuration +* Stabilizer is configured with an ethernet connection to a router. The router runs a DHCP server for +the local network, and ensures that the Stabilizer used for these tests is available under the hostname `stabilizer-hitl`. +* An MQTT broker is running at the hostname `mqtt`. # HITL Workflow The private HITL repository does the following: