Preparation for tests
This document describes step by step how to prepare the environment to run Fobnail and prepare it for provisioning.
Running Fobnail Firmware
- Install docker using the guide for Linux distribution present on your computer.
- Add your user to the docker group:
sudo usermod -aG docker $USER. Then log out of the desktop session then log in again. This step is one-time only.
Prepare the Fobnail environment by opening the terminal and running the following commands:
git clone firstname.lastname@example.org:fobnail/fobnail.git cd fobnail/ git checkout token_provisioning git submodule update --init --recursive
fobnail-sdkrepository in PATH by running the following commands in the new terminal:
git clone email@example.com:fobnail/fobnail-sdk.git cd fobnail-sdk/ mv run-fobnail-sdk.sh ~/.local/bin/ source ~/.bashrc
Configure Network, for a fast but temporary solution, you can only use the first 3 commands.
fobnail_test_root.crtfile in the main
You can take
Start Fobnail by running the following commands:
export FOBNAIL_PO_ROOT=fobnail_test_root.crt export FOBNAIL_LOG=debug ./build.sh --run
Wait for similar output:
.Finished dev [optimized + debuginfo] target(s) in 3m 21s Running `target/x86_64-unknown-linux-gnu/debug/fobnail` INFO fobnail > Hello from main
If the output as above is displayed, it means that the CoAP server was successfully set up and started.
Installing libraries required for provisioning
Install the necessary libraries by running the following command:
pip3 install cbor pem hexdump
libcoaplibrary by following the procedure
If you run into
git checkoutproblems, try copying all of the content below and running it in a terminal:
git clone --recursive -b 'develop' \ 'https://github.com/obgm/libcoap.git' /tmp/libcoap && \ cd /tmp/libcoap && \ git checkout --recurse-submodules 2a329e1c763a47a910f075aad4478398aaaea400
libcoap3 is required, coap-client from libcoap2 will not work properly
Open the terminal and run the following command to test coap-client:
coap-client -m get coap://169.254.0.1
If you get
4.04 Not foundoutput, you have installed the dependencies correctly.
The CoAp server should be running to be able to receive commands from the
client. Note that provisioning token won't work when the token is already
provisioned. To unprovision the token remove the
flash.bin file from the
Download and prepare the testing repository by opening the terminal and running the following commands:
git clone firstname.lastname@example.org:fobnail/fobnail-test-environment.git cd fobnail-test-environment virtualenv -p $(which python3) robot-venv source robot-venv/bin/activate pip install -U -r requirements.txt
Running test cases example:
robot -L TRACE -o <output-file-prefix> -r <report_file_prefix> -l <output_file_name>.html -v absolute_fobnail_path:<path_to_fobnail> tests/<test_file_name>.robot