Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • lofar2.0/sdptr
  • lukken/sdptr
2 results
Select Git revision
Loading items
Show changes
Commits on Source (1209)
Showing with 1124 additions and 107 deletions
default:
image:
name: $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG
pull_policy: always
stages:
- prepare
- image
- hardware-setup
- hardware-test
- sdptr-build-test
- linting
- memory-test
- quality-control
# Prepare image to run ci on
trigger_prepare:
stage: prepare
trigger:
strategy: depend
include: .prepare.gitlab-ci.yml
docker-build:
stage: image
image: docker:latest
tags:
- dind
rules:
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" --build-arg SOURCE_IMAGE=$CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG .
- docker push "$CI_REGISTRY_IMAGE${tag}"
fw-flash-get-image:
tags:
- sdptr
stage: hardware-setup
script:
# Download programming file from HDL branch that triggered this pipeline
- echo "Downloading firmware image archive from HDL repo - branch '$HDL_BRANCH'"
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.astron.nl/desp/hdl/ -b $HDL_BRANCH
- echo "Extracting firmware image RBF"
- cd hdl/applications/lofar2/images
- tar -xvf lofar2_unb2b_sdp_station_full.tar.gz
- echo "Copying firmware image RBF to sdptr/test/py/control"
- cp *.rbf ../../../../test/py/control
- echo "Done"
artifacts:
paths:
- test/py/control/*.rbf
rules:
- if: '$HDL_BRANCH'
fw-flash-write:
tags:
- sdptr
stage: hardware-test
script:
- echo "Writing firmware image"
- ls
- cd test/py/control
- IMAGE=$(ls *.rbf)
- echo 'IMAGE:' $IMAGE
#- ./sdp_firmware.py --host dop386 -n 79 --write --image USER --file $IMAGE
- echo "Done"
artifacts:
paths:
- test/py/control/*.rbf
rules:
- if: '$HDL_BRANCH'
fw-flash-verify:
tags:
- sdptr
stage: hardware-test
script:
- echo "Verifying firmware image"
- ls
- cd test/py/control
- IMAGE=$(ls *.rbf)
- echo 'IMAGE:' $IMAGE
#- ./sdp_firmware.py --host dop386 -n 79 --read --verify --image USER --file $IMAGE
- echo "Done"
artifacts:
paths:
- test/py/control/*.rbf
rules:
- if: '$HDL_BRANCH'
fw-reboot:
tags:
- sdptr
stage: hardware-test
script:
- echo "Rebooting firmware"
- ls
- cd test/py/control
#- ./sdp_firmware.py --host dop386 -n 79 --reboot --image USER
#- sleep 20
- echo "Done"
artifacts:
paths:
- test/py/control/*.rbf
rules:
- if: '$HDL_BRANCH'
fw-check-version:
tags:
- sdptr
stage: hardware-test
script:
- echo "Checking firmware version"
- cd test/py/control
- IMAGE=$(ls *.rbf)
- echo 'IMAGE:' $IMAGE
- VERSION=$(basename $IMAGE .rbf)
- echo 'VERSION:' $VERSION
#- ./sdp_firmware.py --host dop386 -n 79 --version_test $VERSION
- echo "Done"
artifacts:
paths:
rules:
- if: '$HDL_BRANCH'
fw-pps-test:
tags:
- sdptr
stage: hardware-test
script:
- echo "Checking PPS count"
- cd test/py/control
#- ./sdp_firmware.py --host dop386 -n 79 --pps_test
- echo "Done"
artifacts:
paths:
rules:
- if: '$HDL_BRANCH'
fw-sst-output-header-test:
tags:
- sdptr
stage: hardware-test
script:
- echo "Validating sst output packet headers"
- cd test/py/control
# The IP and MAC configured below is of enp5s0 (NIC) on dop386, therefore this test can only succeed when ran on dop386 as it captures the 1GbE statistic data.
#- ./stat_stream_sst.py --host dop386 -n 79 --ip 10.99.0.253 --mac 00:15:17:98:5f:bf --test-header -vv --mtime 5
- echo "Done"
artifacts:
paths:
rules:
- if: '$HDL_BRANCH'
fw-beamlet-output-header-test:
tags:
- sdptr
stage: hardware-test
script:
- echo "Validating beamlet output packet headers"
- cd test/py/control
# Todo Enable test when CICD works on ARTS rack
# The IP and MAC configured below is of ens6 (NIC) on dop369, therefore this test can only succeed when ran on dop369 as it captures the 10GbE data.
#- ./beamlet_stream.py --host dop369 -n 8 --ip 192.168.2.249 --mac 64:9d:99:b1:67:73 --validate-headers --packet-type B_488 -vv --mtime 5
- echo "Done"
artifacts:
paths:
rules:
- if: '$HDL_BRANCH'
fw-beamlet-output-data-test:
tags:
- sdptr
stage: hardware-test
script:
- echo "Validating beamlet output packet data"
- cd test/py/control
# Todo Enable test when CICD works on ARTS rack.
# The IP and MAC configured below is of ens6 (NIC) on dop421, therefore this test can only succeed when ran on dop421 as it captures the 10GbE data.
#- ./beamlet_stream.py --host 10.99.0.250 -n 0:15 --validate-beamlets --mac ec:0d:9a:bf:f2:dc --ip 192.168.1.250 --n_rn 3 --o_rn 5 --packet-type B_488 --mtime 5 -vv
- echo "Done"
artifacts:
paths:
rules:
- if: '$HDL_BRANCH'
sdptr-build-run-check-test:
stage: sdptr-build-test
allow_failure: true
before_script:
- DEBIAN_FRONTEND=noninteractive apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf automake git make g++ build-essential python3-pip python3-ipython
- pip3 install virtualenv
script:
# build sdptr, start stub, start sdptr, try to communicate with sdptr.
- export TERM=xterm-256color
- . ./init_sdptr_regressiontest.sh
- ./regressiontest/sdptr_regression_test.sh pc --test-run
- echo "Done"
artifacts:
paths:
run_pylint_base:
stage: linting
allow_failure: true
script:
- cd test/py/base
- flake8
run_pylint_control:
stage: linting
allow_failure: true
script:
- cd test/py/control
- flake8
run_pylint_stub:
stage: linting
allow_failure: true
script:
- cd test/py/stub
- flake8
address-sanitizer-memory-test:
stage: memory-test
allow_failure: true
script:
# Replace AM_CXXFLAGS to prepare for fsanitize address
- sed -i 's/^AM_CXXFLAGS = .*/AM_CXXFLAGS = -std=c++11 -pedantic -Wall -Woverloaded-virtual -Wwrite-strings -D_REENTRANT -g3 -fsanitize=address -fno-omit-frame-pointer/g' */**/Makefile.am
- sed -i 's/^AM_CXXFLAGS = .*/AM_CXXFLAGS = -std=c++11 -pedantic -Wall -Woverloaded-virtual -Wwrite-strings -D_REENTRANT -g3 -fsanitize=address -fno-omit-frame-pointer/g' */Makefile.am
- autoreconf -v -f -i
- ./configure
- make clean
- make -j 4
- ASAN_OPTIONS=detect_leaks=0 LD_LIBRARY_PATH=/usr/local/lib/ ./src/sdptr -d > output.txt 2>&1 &
- pid=$!
- sleep 10
- kill $pid
# Negation at start essential for correctness
- bash -c "! cat output.txt | grep AddressSanitizer"
artifacts:
paths:
- output.txt
sonarcloud-check:
stage: quality-control
allow_failure: true
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner
only:
refs:
- merge_requests
- master
stages:
- build
build_ci_runner_image:
stage: build
image: docker:stable
tags:
- dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- |
if docker pull $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG; then
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG docker/ci-runner
else
docker pull $CI_REGISTRY_IMAGE/ci-build-runner:latest || true
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:latest --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG docker/ci-runner
fi
- docker push $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG # push the image
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
docker image tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/ci-build-runner:latest
docker push $CI_REGISTRY_IMAGE/ci-build-runner:latest
fi
workflow:
rules:
- when: always
ARG SOURCE_IMAGE
FROM ${SOURCE_IMAGE} AS build
# Install build tools for sdptr and the C language OPC-UA lib
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common && \
DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:open62541-team/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf automake git make g++ build-essential pkg-config libboost-dev libboost-regex-dev libboost-system-dev libboost-program-options-dev libopen62541-1-dev libopen62541-1-tools zlib1g-dev && \
apt-get clean
WORKDIR /sdptr
# Copy sdptr
COPY . /sdptr
# Build and install
RUN cd /sdptr && \
autoreconf -v -f -i && \
./configure && \
./tag_software_version.py && \
bash -c "make -j `nproc` install"
FROM ubuntu:20.04
# Install build tools for sdptr and the C language OPC-UA lib
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common && \
DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:open62541-team/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y libopen62541-1 zlib1g && \
apt-get clean
COPY --from=build /usr/local/ /usr/local/
RUN ln -s /usr/local/bin/sdptr /usr/local/bin/sdptr-lba
RUN ln -s /usr/local/bin/sdptr /usr/local/bin/sdptr-hba
RUN ln -s /usr/local/bin/sdptr /usr/local/bin/sdptr-hba0
RUN ln -s /usr/local/bin/sdptr /usr/local/bin/sdptr-hba1
\ No newline at end of file
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright 2019 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten, Copyright 2023 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten,
ASTRON Netherlands Institute for Radio Astronomy ASTRON Netherlands Institute for Radio Astronomy
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
......
L2SDP-116: extend monitoring thread with FPGA Volt, Temp
If you use (part of) this software please attribute the use to ASTRON as indicated in the
file NOTICE in the root of the source code repository.
# In brief:
in case of missing automake/ autoconf:
```
sudo apt install autoconf
sudo apt install automake
```
in case of missing boost libraries:
`sudo apt-get install libboost-dev`
(or even `sudo apt-get install libboost-all-dev`)
# Compile instructions:
compile from scratch:
```
autoreconf -f -i
./configure
make
```
# Configure server if needed:
vi src/sdptr.conf
Usage:
Startup server process:
(for testing)
```
cd src
./sdptr --type=LTS --configfile=sdptr.conf --nodaemon
```
# OPC ua
## Python C library install
(note: already installed on dop36)
git clone https://github.com/open62541/open62541
follow install instructions from https://open62541.org/doc/current/installing.html
194 cd
195 mkdir opcua
196 cd opcua/
200 cd open62541/
203 sudo apt-get install git build-essential gcc pkg-config cmake python
204 sudo apt-get install cmake-curses-gui # for the ccmake graphical interface
205 sudo apt-get install libmbedtls-dev # for encryption support
206 sudo apt-get install check libsubunit-dev # for unit tests
207 sudo apt-get install python-sphinx graphviz # for documentation generation
208 sudo apt-get install python-sphinx-rtd-theme # documentation style
210 cd build/
212 rm -r *
215 cmake ..
216 make
218 sudo make install
## Python Client Install
(note: already installed on dop36)
```
sudo apt install python-opcua
sudo apt install python-opcua-tools
cd opcua/
git clone https://github.com/FreeOpcUa/python-opcua.git
```
## Test the OPCua client with the proviced C client
Compile the OPCua client:
`cd test/c/ua_client`
then execute the command shown in the README file in that directory
1. Start the sdptr server on dop36:
Default the config file `sdptr.conf` is read from `/etc/` directory, and can be changed using key `--configfile` then the full path is given.
```
cd src
./sdptr --type LTS --configfile=sdptr.conf --nodaemon
```
2. Run the client:
```
cd test/c/ua_client
./client
```
The (test) client reads out all available Uniboard registers.
## Test the OPCua client with the opcua-client (GUI) on test-lcu2.astron.nl
`ssh -J hiemstra@portal.astron.nl -L localhost:55555:test-lcu2.astron.nl:55555 hiemstra@test-lcu2.astron.nl`
run OPCua GUI client:
`opcua-client`
then open an OPCua connection to: `opc.tcp://dop36:4840`
#! /usr/bin/env bash
###############################################################################
#
# Copyright 2023 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten
# ASTRON Netherlands Institute for Radio Astronomy
# JIVE (Joint Institute for VLBI in Europe)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################
# check if open62541 is available, if not build and install it.
# 1) check if the open62541 opcua lib is available
# 2) check if the build tools are available, install if needed
# 3) build open62541 and install it
#
command_exists () {
type "$1" &> /dev/null ;
}
# clone and/or build libopen62541 lib
if [[ ! -d "/usr/local/include/open62541" ]]; then
if ! command_exists make ; then
echo "installing build-essential"
sudo apt install build-essential
fi
if ! command_exists gcc ; then
echo "installing gcc"
sudo apt install gcc
fi
if ! command_exists pkg-config ; then
echo "installing pkg-config"
sudo apt install pkg-config
fi
if ! command_exists cmake ; then
echo "installing cmake"
sudo apt install cmake
fi
cd ${HOME}/git || exit 1
if [[ ! -d "open62541" ]]; then
git clone https://github.com/open62541/open62541
fi
if [[ -d "open62541" ]]; then
cd open62541 || exit 1
git submodule update --init --recursive
mkdir build
cd build || exit 1
rm -r *
cmake ..
make
sudo make install
fi
fi
exit 0
\ No newline at end of file
#! /usr/bin/env bash
###############################################################################
#
# Copyright 2023 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten
# ASTRON Netherlands Institute for Radio Astronomy
# JIVE (Joint Institute for VLBI in Europe)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################
# check if sdptr is available, if not build it.
# 1) check if the open62541 opcua lib is available
# 2) check if the build tools are available, install if needed
# 3) build sdptr
#
command_exists () {
type "$1" &> /dev/null ;
}
SDPTR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# look for sdptr in the src dir, if it not excists build it
if [[ ! -f "${SDPTR_DIR}/src/sdptr" ]]; then
# check if needed programs are availble
if ! command_exists autoreconf ; then
echo "installing autoconf"
sudo apt install autoconf
fi
if ! command_exists automake ; then
echo "installing automake"
sudo apt install automake
fi
# check if needed lib is available
./check_open62541_lib
# build sdptr
make clean
autoreconf -f -i
./configure
make
fi
\ No newline at end of file
#### Setting up Raspberrypi-4 for running and developing the sdp translator (sdptr)
##### Install raspbian os on a SDcard.
see `install_os_raspberrypi.md`
##### Setup for developing sdptr.
Install missing tools/programs.
```
sudo apt-get install build-essential gcc pkg-config cmake autoconf automake
sudo apt-get install vim screen
```
Add a git directory.
```
mkdir ~/git
cd ~/git
```
##### Installation of open62541 opc-ua library.
The opc-ua library is needed by sdptr.
Get source code:
```
git clone https://github.com/open62541/open62541.git
cd ~/git/open62541
git submodule update --init --recursive
```
Compile and install.
```
mkdir ~/git/open62541/build
cd ~/git/open62541/build
cmake ..
make
sudo make install
```
##### Installation and compiling sdptr.
Install from git repository.
```
cd ~/git
git clone https://git.astron.nl/lofar2.0/sdptr.git
```
First time or after changing the Makefile
```
cd ~/git/sdptr
autoreconf -f -i
./configure
```
Compile sdptr.
```
cd ~/git/sdptr
make
```
##### Running sdptr.
see `running_sdptr.md`
##### Installation of raspbian os on a SDcard.
Download Raspberry Pi Imager for your operating system
- Linux: https://downloads.raspberrypi.org/imager/imager_latest_amd64.deb
- Windows: https://downloads.raspberrypi.org/imager/imager_latest.exe
- macOS: https://downloads.raspberrypi.org/imager/imager_latest.dmg
Install and run the Imager (you need a sd-card reader).
- CHOOSE OS, "Raspberry Pi OS (other)" > "Raspberry Pi OS Lite (32-bit)"
- CHOOSE STORA..., "Select SDcard"
- SETTINGS, check 'Enable SSH', 'Set locale settings' and select 'Time zone' SAVE
- WRITE.
##### Startup and configuration.
Put the SD-card in the RaspberryPi and startup, login=pi, password=raspberry.
```
sudo raspi-config
```
##### Install missing tools/programs.
```
sudo apt-get install git vim screen
```
>For only running "sdptr" more is not needed.
\ No newline at end of file
#### Running the SDP Translator (sdptr).
sdptr can run without hardware connected.
first source init_sdptr.sh
```
cd ~/git/sdptr
. ./init_sdptr.sh
```
Now the translator can be run from everywhere
```
sdptr [options]
```
options:
```
-h, --help : This screen
-v, --version : SDPTR version
-d, --nodeamon : With this flag, sdptr runs NOT as daemon
-p, --port : OPC-ua port to use, defaults to 4840
-f, --fpgas : Specify number of FPGAs, defaults to 16
-g, --first_gn : Specify first global number, defaults to 0
-b, --beamsets : Specify number of beamsets, defaults to 1
-i, --ip_prefix : Specify ip prefix, defaults to '10.99.'
-V, --verbosity : debug level -9=OFF, -3=FATAL, -2=ERROR, -1=WARNING, 0=INFO, 1=DEBUG, defaults to 0
```
#### Setup for automatic running
The following files need to be copied to '/usr/local/bin' as root:
- sdptr
- run_sdptr (script used by user or cron)
- restart_sdptr (script used by user)
To be able to run the LBA and HBA translator at the same time make in the same directory 2 symbolic links:
```
ln -s sdptr sdptr-lba
ln -s sdptr sdptr-hba
```
To autostart sdptr for LBA and HBA on powerup of the raspberrypi or if it was stopped for an other reason, add the run_sdptr to the cronjob.
Start the cron editor, **sudo crontab -e** and add the following line, if done save and close the file.
```
* * * * * /usr/local/bin/run_sdptr
```
#### Restart the sdp translator(s) manualy
The following command can be used to restart the both translators:
```
sudo restart_sdptr
```
<mxfile host="Electron" modified="2021-10-26T13:42:21.699Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/15.4.0 Chrome/91.0.4472.164 Electron/13.5.0 Safari/537.36" etag="OHNUp0CJlWRR91P8V602" version="15.4.0" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">7V1Zc+M2Ev41qspOlVU8RIp8lO3Yye544thzJHlRQSIkMcNreIytPOS3LwACEnFIog7Ymhl6tzJiA7zQje7+utFgz76Kn29zkC3u0gBGPcsInnv2dc+yLMMz0D+Ysqwppjl0a8o8DwNKWxMew38gJdIT51UYwILrWKZpVIYZT5ymSQKnJUcDeZ4+8d1macTfNQNzKBEepyCSqZ/CoFxQqusM1g2/wHC+YLc2Xb9uiQHrTV+lWIAgfWqQ7J979lWepmX9K36+ghEePjYwn35dforefnZv//t78QV8uPzf+3cfL+qL3exzyuodcpiUB196Wd46f91N7Y/58vm6uC0eRqP8go7CVxBVdMCKICvznoW4bCMe2pc955KQ+osefusb9N/+NMt6zjUdlXLJxrp4CuMIJOjocpYm5SNtMdExiMJ5gn5P0RvAHBG+wrwMEZtGtKFMM0SdLsIoeAuWaYXfsyjB9DM7ulykefgPuiyI6DVRc15SiRsYXI9HfCYiY2oOC9Tnng2eKZDuwDPX8S0oSkqYplEEsiKcrF4jBvk8TC7Tskxj2mkWRtFVGqU5GQN75uD/kafL08+w0eKSPzo2DXr9h0e6HZepNOABhM8NIadcv4VpDMt8ibrQVjaH2RQ26PFTcz5Q2qIxFVZzGNA5OF9dei1m6AeVtD2kzpGk7hHm6IUeqiQJk3nPHqHWCVITDTlMsG4KMW9wI/lluREWjHeo5Q06mJdkEFdnPF7XfetrB6CUBBYNYCmxKklrCW7wlZKYEEdwVm4U4SIDU/QOb0mf68Ga8kBHFpNSdO4sIspkEQYBTLD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g1p/suhYj0mAxAM2x08vxiMvvP7rJh+++/3h7nE8cszrP3+7sI+W4iNE1uBEdnvchQs40TijFFhayyvZhzmcKu2PapO95qGS84fJoHLM9UiS5fCS5ItRGs2SJIN4cWeqxqZUBoLkeHUw3dIKJ7LrPa1AEmCzlIclqSEeseVYk1xcoMWvzuLvdNHDH57tl3l/VVtZ34nvhqjvH8Zvxg+fFC11WLm/cT2Y4rk2PAOr+dz6CLufYOetyOfWd74x3re85Tu3vOOO92M33HY/db6hoTKk/OzNDd11QMjoQvLXa5+lelqg8XrMAJmyTzmu6m9ouPVWmlKwp61G2BgUEsOhvqoyaqBKJZ0g0aucw4POGry4NXC0WANPLPEUL6HZGig21iaaHq+0rBI0EUkyF4t6iVeqLEAePKERxeqCfdDDqApYKE0A3q2q3/x6El6cvCauvp6kUatsXBlzBnrFEz73MvQU389wXlKvHI+VjtErfS7B96PoFU+LXjHFr6CKS8016xW5pKYIshJrlhC7kwWSiNqRrDKiFlSqA+O/HMKVt/lInNIAlLUiqYnlAiYNP3Xlu64dHaS0kiCq75Zm04sKkOH9UsFCt09zztpHUD62au2wyqk5xQ5dSpFRrXzYr+DEslQVJ4/X99h7X32LHEsL1gew2FhusqdI7F5hc6wgGBoFwXWGnCRYsiDYtt+3ZFGw9xcFdJinmD1rZYPedXGHP+SBiP8H</diagram></mxfile>
\ No newline at end of file
### Python SDP control using OPC-ua.
Python scripts to test and control the "SDP Translator" (OPC-ua to SDP).
Source init_sdptr.sh in git/sdptr to get access to all script from everywhere, only in the active terminal.
```
cd git/sdptr
. ./init_sdptr.sh
```
The scrips listed below can be run without the ./
```
sdp_rw -h
```
#### available scripts.
```
sdp_rw.py # universal script for reading/writing all available points.
beamlet_stream.py # control beamlet stream.
stat_stream_sst.py # control/monitor/plot SST statistics streams.
stat_stream_bst.py # control/monitor/plot BST statistics streams.
stat_stream_xst.py # control/monitor/plot XST statistics streams.
subband_weights.py # set/get beamlet weights.
bf_weights.py # set/get/test bf weights.
ring_common.py # set/get ring settings.
wg.py # control waveform generator.
plot_input_data.py # receive input data and make a plot from it.
plot_histogram.py # receive histogram data and make a plot from it.
sdp_firmware.py # reboot, read, write, verify, test an image.
sdp_speedtest.py # test read performance of the sdp translator.
```
>more info about the scripts can be found in: ./test/py/readme.md
<mxfile host="Electron" modified="2021-10-26T13:40:38.566Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/15.4.0 Chrome/91.0.4472.164 Electron/13.5.0 Safari/537.36" etag="Z2KFRDV92nsLcqLHjVp-" version="15.4.0" type="device"><diagram id="kgpKYQtTHZ0yAKxKKP6v" name="Page-1">7VxZc9s4Ev41qtp9sAoHz8f4mn3ITFL2bmXnycWIkMQJRTAUFcvz6xfgIREHJYiHJCfrF4tNEiS7v270BUzw3Wr7Wxaky99pSOIJAuF2gu8nCCELQvaPU95KCgQAlJRFFoUVbU94jv4m9YUVdROFZC1cmFMa51EqEmc0ScgsF2hBltFX8bI5jcWnpsGCKITnWRCr1C9RmC8rqmNb+xP/ItFiWT8aOn55ZhXUV1efsl4GIX1tkPDDBN9llOblr9X2jsScfTVjyvseW87u3iwjSW5yw6en7093P1bxHbL/+PQXvf17cbu+gdgpx/kRxJvqm6vXzd9qJmR0k4SEDwMm+PZ1GeXkOQ1m/OwrkzujLfNVzI4g+7n7TH7tIg7W6+r3+hvJZ8vqYE6TvJI250RxfEdjmhVPxI+PmP3xm/KMfiPtZ2qh8CfPoziurwzJPNjEjC+3lL1plHP82fzB1deSLCfbVkbCnXgYsgldkTx7Y5dUN9hOJdEa1FZ1/LpHiOdVtGUDHNiuiEGFysVu7L3c2I9KdCeIkXHkElJUpOM+fHAegCIdJEknoQkZSha+KAtblYVlQ1UWzgCiwMnm9nGb+bO3jyBNPn35Nwp+u4GKJDbBy5pk7DMVkTAup/znZhV/jOYkjgq2pCSL2LsQzqm4In/e026ZrcsDRssqWc1oHAfpOvpaDMu5n5HZJltHP8gTWZdKVlAFAAgSVpWpRRAacbXKB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a+mgsaylGsU2PP7zLgHa2zpb9MbtPgFssfRWXlB58UI+Nq164pEKQ1LZE3lwihq94UCq5BuvCcKKAeVDA3AxA6qWRcveWgnIP3cXrX3R7S0OFUbfaRMtPshuucG8jmiObW+B/JGYbbKD2P+3t+gv6Tq7fYbtLbQvq4ay0kKCV5p945tctS2S/rnNoA+vzgxezy4/XZTjpL1foKvjtsrs0Ra8qz0knGXpyzxdqFsu/NyaAIF9daqgroJ6T6rQkudoUQXPTBWG2AFR+7ZqQf4/d59/NR2A/tXpAFTj8fekBC1t5y1K4JspwWhLy6CaWtuE6ZrOmI/6q+nCbkefK9IF9K51AZ60BSICZsowGreROv3mXdsOT8/4SfV30Ke3kOf3pOWa4y1QO2hYjldHkB4jPbN7N55saf2p21iAVi84P32/ND1me6fy2OF+k/Xy8v1m9fjhfw==</diagram></mxfile>
\ No newline at end of file
FROM ubuntu:20.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common && \
DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:open62541-team/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf automake git make g++ build-essential pkg-config python3-pip python3-ipython libboost-dev libboost-regex-dev libboost-system-dev libboost-program-options-dev libopen62541-1-dev libopen62541-1-tools zlib1g-dev && \
apt-get clean \
RUN pip3 install pylint
RUN pip3 install flake8
\ No newline at end of file
# set FACT and USER image to flash for unb2b and unb2c
#
FACT_IMAGE_UNB2B=${UNB2_IMAGES}/unb2b_minimal-rce6b96eed.rbf
USER_IMAGE_UNB2B=${UNB2_IMAGES}/lofar2_unb2b_sdp_station_full_wg-b3d679286.rbf
# FACT_IMAGE_UNB2C=${UNB2_IMAGES}/unb2c_minimal-re6769e2e3.rbf
FACT_IMAGE_UNB2C=${UNB2_IMAGES}/unb2c_test_ddr_16G_I-r5f4ea2394.rbf
# USER_IMAGE_UNB2C=${UNB2_IMAGES}/lofar2_unb2c_sdp_station_full-dbc6375ef.rbf
# USER_IMAGE_UNB2C=${UNB2_IMAGES}/lofar2_unb2c_sdp_station_full-d601da896.rbf
USER_IMAGE_UNB2C=${UNB2_IMAGES}/lofar2_unb2c_sdp_station_full-3b0adbdd1.rbf
#!/usr/bin/env bash
#set -e
###############################################################################
#
# Copyright 2023 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten
# ASTRON Netherlands Institute for Radio Astronomy
# JIVE (Joint Institute for VLBI in Europe)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################
###############################################################################
#
# flash factory image on all connected fpgas
# - output is also in user base dir
# flash_results.txt -> all log output
# flash_status.txt -> one line with 'FLASH-FAILURE ...' or 'FLASH-SUCCESS'
#
# usage.
# - call this script to flash the factory image:
# ./flash_image -h
# ./flash_image unb2c --fact --user
# ./flash_image unb2c --fact --user --host dop386 --port 4840 --nodes 0,2,8:15
# - see flash_status.txt for status:
# cat flash_status.txt
###############################################################################
SDPTR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# directory for fw_images
export UNB2_IMAGES="${HOME}/notebooks/unb2_images"
# read generic functions/definitions
source ${SDPTR_DIR}/generic.sh
# source flash.config to get FACT and USER image to use
source ./flash.config
LOGFILE=${SDPTR_DIR}/flash_result.txt
STATEFILE=${SDPTR_DIR}/flash_status.txt
date > ${STATEFILE}
echo "Start logfile" > ${LOGFILE}
# copy all stdout output also to the logfile
exec > >(tee -ia ${LOGFILE})
# copy all stderr output also to the same logfile
exec 2>&1
#exec 2> >(tee -ia $LOGFILE)
# helper function for command parsing
exit_with_error() {
sdptr_error_noexit "${0}" "$@"
cat <<@EndOfHelp@
Usage: $(basename "${0}") buildset [options]
Arguments: buildset Name of the buildset to flash for ("unb2b" or "unb2c").
Options: --host=* which host to connect to.
--port=* which opc-ua port to use.
--fact: flash factory image.
--user: flash user image.
--nodes=*: nodes to flash (* = 0,3,5 or 8:15)
--> Note: It does not matter where the options are placed: before, in between or after the arguments.
@EndOfHelp@
exit 1
}
# parse cmdline
POSITIONAL=()
host=
port=4840
fact=
user=
nodes=
while [[ $# -gt 0 ]]
do
case $1 in
--host=*)
host=${1#*=}
;;
--port=*)
port=${1#*=}
;;
--nodes=*)
nodes=${1#*=}
;;
--fact)
fact="flash"
;;
--user)
user="flash"
;;
-*|--*)
exit_with_error "Unknown option: " "${1}"
;;
*) POSITIONAL+=("$1")
;;
esac
shift
done
if [ ${#POSITIONAL[@]} -gt 0 ]; then
set -- "${POSITIONAL[@]}"
fi
# check the positional parameters
if [ $# -lt 1 ]; then
exit_with_error "Wrong number of arguments specified."
fi
buildset=$1
if [[ "${buildset}" == "unb2b" ]]; then
# look if image files exists
if [[ ! -f "${FACT_IMAGE_UNB2B}" ]]; then
echo "${FACT_IMAGE_UNB2B} not found."
exit 1
fi
if [[ ! -f "${USER_IMAGE_UNB2B}" ]]; then
echo "${USER_IMAGE_UNB2B} not found."
exit 1
fi
FACT_IMAGE=${FACT_IMAGE_UNB2B}
USER_IMAGE=${USER_IMAGE_UNB2B}
elif [[ "${buildset}" == "unb2c" ]]; then
# look if image files exists
if [[ ! -f "${FACT_IMAGE_UNB2C}" ]]; then
echo "${FACT_IMAGE_UNB2C} not found."
exit 1
fi
if [[ ! -f "${USER_IMAGE_UNB2C}" ]]; then
echo "${USER_IMAGE_UNB2C} not found."
exit 1
fi
FACT_IMAGE=${FACT_IMAGE_UNB2C}
USER_IMAGE=${USER_IMAGE_UNB2C}
else
echo "ERROR: Unknown buildset, ${buildset}"
exit 1
fi
# source init_sdptr_python.sh
cd ${SDPTR_DIR}
source ./init_sdptr_python.sh
if [[ -n "${nodes}" ]]; then
sdp_rw.py --host ${host} --port ${port} --nodes ${nodes} -r firmware_version
else
sdp_rw.py --host ${host} --port ${port} -r firmware_version
fi
# write fact and/or user image
# fact image is important, so verify it.
#
if [[ -n "${fact}" ]]; then
if [[ -n "${nodes}" ]]; then
echo "flash factory image to nodes: ${nodes}"
sdp_firmware.py --host "${host}" --port "${port}" --nodes "${nodes}" --write --read --verify --image FACT --file "${FACT_IMAGE}"
else
echo "flash factory image to all nodes"
sdp_firmware.py --host "${host}" --port "${port}" --write --read --verify --image FACT --file "${FACT_IMAGE}"
fi
if grep -Fq "NOT SAME" "${LOGFILE}"; then
# if found
echo "FAILURE, factory image NOT same, do NOT reboot and retry to flash"
echo "FLASH-FACTORY-IMAGE-FAILURE" >> "${STATEFILE}"
exit 1
else
# if not found
echo "SUCCESS, flashing factory image"
echo "FLASH-FACTORY-IMAGE-SUCCESS" >> "${STATEFILE}"
fi
fi
if [[ -n "${user}" ]]; then
if [[ -n "${nodes}" ]]; then
echo "flash user image to nodes: ${nodes}"
sdp_firmware.py --host "${host}" --port "${port}" --nodes "${nodes}" --write --image USER --file "${USER_IMAGE}"
else
echo "flash user image to all nodes"
sdp_firmware.py --host "${host}" --port "${port}" --write --image USER --file "${USER_IMAGE}"
fi
echo "SUCCESS, flashing user image"
echo "FLASH-USER-IMAGE-SUCCESS" >> "${STATEFILE}"
fi
###############################################################################
#
# Copyright 2023 Stichting Nederlandse Wetenschappelijk Onderzoek Instituten
# ASTRON Netherlands Institute for Radio Astronomy
# JIVE (Joint Institute for VLBI in Europe)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################
# This file contains a collection of convenience functions and definitions.
#
# automatically export to subsequent commands (-a)
set -a
#exits on any error in pipeline, not just the last error
set -o pipefail
# only set variables if we didn't set them before
if [ "${sdptr_generic_read:-not_set}" = "not_set" ]; then
# display a (colourfull ...) error message.
# the script will be terminated immediately
# exit with <errorcode> (default=1)
# usage: sdptr_error <caller> <message> [<errorcode>]
sdptr_error() {
caller=${1:-""}
msg=${2:-""}
exitcode=${3:-1}
if [ -z "${caller}" -o -z "${msg}" ]; then
echo "usage: sdptr_error <caller's name> <message> [<exitcode>]"
exit 1
fi
caller=$(basename ${caller} | tr [a-z] [A-Z])
echo -n "$(tput setaf 6)$(tput bold)[${caller}] "
echo -e "$(tput setaf 1)ERROR - ${msg}. $(tput sgr0)"
# Exit if $NO_EXIT does not exist, else only return
if [ -z ${NO_EXIT:-""} ]; then exit ${exitcode}; else return 1; fi
}
# Non-exiting version of sdptr_error in case we wish to accumulate errors and
# call an exiting sdptr_error after displaying accumulated errors.
sdptr_error_noexit() {
caller=${1:-""}
msg=${2:-""}
if [ -z "${caller}" -o -z "${msg}" ]; then
echo "usage: sdptr_error <caller's name> <message>"
exit 1
fi
caller=$(basename ${caller} | tr [a-z] [A-Z])
echo -n "$(tput setaf 6)$(tput bold)[${caller}] "
echo -e "$(tput setaf 1)ERROR - ${msg}.$(tput sgr0)"
}
sdptr_warning() {
caller=${1:-""}
msg=${2:-""}
if [ -z "${caller}" -o -z "${msg}" ]; then
echo "usage: sdptr_warning <caller's name> <message>"
exit 1
fi
caller=$(basename ${caller} | tr [a-z] [A-Z])
echo -n "$(tput setaf 6)$(tput bold)[${caller}] "
echo -e "$(tput setaf 3)WARNING - ${msg}.$(tput sgr0)"
return 0
}
# usage: sdptr_info <caller> <message>
sdptr_info() {
caller=${1:-""}
shift
if [ -z "${caller}" -o -z "$*" ]; then
echo "usage: sdptr_info <scriptname> <msg1> [<msg2> .. <msgN>]"
exit 1
fi
caller=$(basename ${caller} | tr [a-z] [A-Z])
echo -e "$(tput setaf 6)$(tput bold)[${caller}] $* $(tput sgr0)"
return 0
}
# usage:
# sdptr_exec <calling script> [OPTS] <command to run>
# OPTS:
# [msg=<override defaultmsg>]
# msg=no => suppress displaying of messages
# if command fails, do display the
# command that failed
# [expect=<expected exit code>] (default: 0)
# exits with same exitcode as the command
sdptr_exec() {
# step one: extract calling scriptname, which is $1
caller=$1; shift
# anything left is supposedly the command to exec + args
# prepare the "msg" to display
msg=
output=
expect=0
# unless someone gave msg="...." as orginal 2nd arg
# (and now, since the first "shift", it is 1st)
for ac ; do
case ${ac} in
output=*)
# well allrighty then, override default msg
output=$(echo "${ac}" | sed 's/^output=//')
shift
;;
msg=*)
# well allrighty then, override default msg
msg=$(echo "${ac}" | sed 's/^msg=//')
shift
;;
expect=*)
expect=$(echo "${ac}" | sed 's/^expect=//')
shift
;;
* )
# first non-option argument; stop for loop!
break
;;
esac
done
if [ -z "${msg}" ]; then
msg="Running \"$*\""
fi
# show usr what we're up to
if [ "${msg}" != "no" ]; then
sdptr_info ${caller} "${msg}"
fi
# remember if errexit is switched on because we have to disable it
exit_on_err=true
if [ "${SHELLOPTS//*errexit*}" == "$SHELLOPTS" ]; then
exit_on_err=false
fi
set +e
# and let's actually do it!
if [ "${output}" = "no" ]; then
$* >/dev/null 2>/dev/null
else
$*
fi
exitcode=$?
# switch errexit on if is was on when we were called (no side effects)
if [ $exit_on_err ]; then
set -e
fi
echo "exitcode=${exitcode}"
# Finally check if the exitcode of the command we executed is the expected one.
if [ "${exitcode}" -ne "${expect}" ]; then
if [ "${msg}" == "no" ]; then
echo "****** Failed command ****"
echo $*
exit ${exitcode}
fi
sdptr_error ${caller} "\"${msg}\" failed" $?
fi
}
# format the date in a specific form
# if changing the format, make sure
# that dateindent has the same length
# again (dateindent used for pretty
# printing multiline stuff without
# having to print the date in every line)
date="/bin/date +'%d %m %Y %T'"
# format dd mm yyyy HH:MM:ss
dateindent=' '
#
# Some generic, often used functions
#
# return the current date/time in a
# predefined format - see above
# Use eg as
# echo "`timestamp` Aaargh - Failed to clobber!"
sdptr_timestamp() {
echo "${date}"
}
# Define function to add directories to a given environment variable
# args: name_of_env_var new_path [new_path ...]
# Directories are only added when they exist.
sdptr_pathadd() {
for new_dir in ${@:2}
do
eval dir_to_add=$(echo ${new_dir})
if [ ! -d ${dir_to_add} ]; then
echo "WARNING: directory ${dir_to_add} NOT added to $1 because directory doesn't exist!"
else
if ! echo ${!1} | grep -E -q "(^|:)$dir_to_add($|:)" ; then
eval export ${1}=${1:+${!1#:}:}${dir_to_add}
fi
fi
done
unset dir_to_add new_dir
}
# Mark the fact that we read this file and end the guarded part
sdptr_generic_read="yes"
fi
# About this folder
This folder contains the unit tests that are triggered in ../.gitlab-ci.yml.
import unittest
import os
RBF = '/home/schuur/git/hdl/applications/lofar2/images/lofar2_unb2b_sdp_station_full-r8026db491.rbf'
# RBF = '/home/schuur/git/hdl/applications/lofar2/images/lofar2_unb2b_sdp_station_bf-rc125dfd6d.rbf'
# The design name that should be read out
IMAGE = 'lofar2_unb2b_sdp_station_full-r1684353841'
IMAGE = 'lofar2_unb2b_sdp_station_full-r895903289'
class HardwareTest(unittest.TestCase):
def setUp(self):
"""
Program the FPGA. Below code will be replaced by calls to the OPC-UA
python client. For now we are using UPE GEAR in a shell script to
progam.
"""
os.system(f'./program_fpga.sh {RBF}')
def test_design_name(self):
"""
Read out the firmware design name and check if the name matches the
programming file. This will be replaced by code that uses the OPC-UA
python client.
"""
self.assertEqual(os.system(f'./read_design_name.sh {IMAGE}'), 0)
if __name__ == '__main__':
unittest.main()