Skip to content
Snippets Groups Projects
Commit d93ba191 authored by Pieter Donker's avatar Pieter Donker
Browse files

#2995: add central_status_unb2.sh and central_commands_unb2.sh

parent 9468edf2
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
###############################################################################
#
# Copyright (C) 2017
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# Author:
# . Daniel van der Schuur
# . Boudewijn Hut
# . Pieter Donker
# Purpose:
# . Run UniBoard2 commands on local correlator LCU to start data streams
# Usage:
# . called by main.py
###############################################################################
# Parse arguments
###############################################################################
APP=$1 # apertif, arts_sc1, arts_sc4
TELS=$2
UNBS2=$3
OPTIONS=$4
POL=$5
MAC="False"
if [ -z "$6" ]; then
echo "MAC argument not supplied"
elif [ "$6" == "True" ]; then
MAC="True"
fi
echo central_commands.sh: Using MAC : $MAC
echo central_commands.sh: Application : $APP
echo central_commands.sh: Telescopes : $TELS
echo central_commands.sh: UniBoards2 : $UNBS2
echo central_commands.sh: Options : $OPTIONS
echo central_commands.sh: Polarisation : $POL
FAC_DESIGN=arts_unb2b_sc4_fwd-r19573
IMAGE=/home/donker/images/${FAC_DESIGN}.rbf
# Select correct firmware image for this application
if [[ "$APP" == "apertif-ag" ]] || [[ "$APP" == "apertif-dev" ]]; then
IMAGE=/home/hargreaves/arts_unb2b_sc3_single-r19606.rbf
fi
#Extract the RBF file names (without path and extention)
IMAGE_FILENAME=$(basename "$IMAGE")
IMAGE_RBFNAME="${IMAGE_FILENAME%.*}"
###############################################################################
# Destination MAC/IP adresses of output streams
###############################################################################
# Cluster node 1 used for single UNB testing
ARTS001_40G_ETH_DST_MAC=14038001611793 #0x0cc47a197411
#ARTS001_40G_IP_DST_ADDR=3232237569 # 192.168.8.1
ARTS001_40G_IP_DST_ADDR=3232258049 # 192.168.8.1
# Arrays for addresses of all cluster nodes
ARTSCLUSTER_40G_ETH_DST_MAC=(14038001611793 14038001611885 14038001611664 14038006166662 14038001611870 \
14038006166622 14038001611665 14038001611669 14038001611661 14038001611666 \
14038001611668 14038001611703 14038001611836 14038006166667 14038006166666 \
14038001611788 14038001611790 14038006166671 14038001611853 14038001611672 \
14038001611690 14038001611800 14038001611657 14038001611794 14038001611659 \
14038006166661 14038001611841 14038006166670 14038001611799 14038001611801 \
14038001611846 14038001611656 14038001611851 14038001611716 14038001611827 \
14038006166745 14038006166683 14038001611688 14038001611674 14038001611804)
ARTSCLUSTER_40G_ETH_DST_IP=(3232258049 3232258050 3232258051 3232258052 3232258053 \
3232258054 3232258055 3232258056 3232258057 3232258058 \
3232258059 3232258060 3232258061 3232258062 3232258063 \
3232258064 3232258065 3232258066 3232258067 3232258068 \
3232258069 3232258070 3232258071 3232258072 3232258073 \
3232258074 3232258075 3232258076 3232258077 3232258078 \
3232258079 3232258080 3232258081 3232258082 3232258083 \
3232258084 3232258085 3232258086 3232258087 3232258088)
if [ "$MAC" == "True" ]; then
echo central_commands.sh: Returning environment variables
return 0
fi
###############################################################################
# Compare required application images against images stored in flash
###############################################################################
# Get memory map of current images
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 4
# Revert to facory image so we can reflash/load the user firmware
python $UPE/peripherals/util_wdi.py --unb2 $UNBS2 --pn2 0:3 -n 0
# Wait until the factory images are online
sleep 14 # It takes at least a second
if [[ "$IMAGE_RBFNAME" != "$FAC_DESIGN" ]]; then
# Get memory map of factory image
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 4
# Load all firmware images from flash
python $UPE/peripherals/util_epcs.py --unb2 $UNBS2 --pn2 0:3 -n 8 &
# Wait until the user images are online
sleep 14
# Get memory map of the user images
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 4
# Print the user firmware image design names
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 2
fi
# Get number of required images actually running on the FPGAs
ACT_IMAGE=$(python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 2 | grep -c $IMAGE_RBFNAME)
echo -n "Image $IMAGE_RBFNAME found running on $ACT_IMAGE processing nodes: "
NOF_UNIBOARDS2=$(echo $UNBS2, | grep -o ',' | wc -l)
NOF_REQUIRED_MATCHING_IMAGES=$(($NOF_UNIBOARDS2 * 4))
if [ "$OPTIONS" == "noflash" ]; then
echo Continuing without processing node reflash due to noflash option
FLASH=FALSE
elif [ "$ACT_IMAGE" == "$NOF_REQUIRED_MATCHING_IMAGES" ]; then
echo Continuing without processing node reflash
FLASH=FALSE
else
echo Firmware images will be rewritten to flash
FLASH=TRUE
fi
###############################################################################
# Flash and reload application images if needed
###############################################################################
if [ "$FLASH" == "TRUE" ]; then
# Revert to facory image so we can reflash/load the user firmware
python $UPE/peripherals/util_wdi.py --unb2 $UNBS2 --pn2 0:3 -n 0
# Wait until the factory images are online
sleep 14 # It takes at least a second
# Get memory map of factory image
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 4
# Write image to flash if needed
python $UPE/peripherals/util_epcs.py --unb2 $UNBS2 --pn2 0:3 -n 4 -s $IMAGE
# Load the application images
# Wait until PPS
python $UPE/peripherals/util_ppsh.py --unb2 $UNBS2 --bn 0 -n 4
# Load all dish firmware images from flash
python $UPE/peripherals/util_epcs.py --unb2 $UNBS2 --pn2 0:3 -n 8 &
# Wait until the user images are online
sleep 14
# Get memory map of the user images
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 4
# Print the user firmware image design names
python $UPE/peripherals/util_system_info.py --unb2 $UNBS2 --pn2 0:3 -n 2
fi
###############################################################################
# Set destination MAC/IP/Ports
###############################################################################
UNBS2_LOOP="${UNBS2//,/ }"
stream_string_ip=`echo ${ARTSCLUSTER_40G_ETH_DST_IP[@]}`
stream_string_ip=${stream_string//[ ]/,}
stream_string_mac=`echo ${ARTSCLUSTER_40G_ETH_DST_MAC[@]}`
stream_string_mac=${stream_string//[ ]/,}
if [ ${APP:0:8} == "apertif-" ]; then # set output ip/mac if apertif-ag or apertif-dev
for UNB in $UNBS2_LOOP
do
# Send each CB to its own cluster node
for NODENO in {0..3}
do
echo "set output tab demo for $NODEMO"
python $SVN/RadioHDL/trunk/applications/arts/designs/arts_unb2b_sc3/tb/python/pi_arts_unb2b_sc3_output_tab.py --unb2 ${UNB} --pn2 ${NODENO} --stream 0:39 -n 1 -r ${stream_string_ip}
python $SVN/RadioHDL/trunk/applications/arts/designs/arts_unb2b_sc3/tb/python/pi_arts_unb2b_sc3_output_tab.py --unb2 ${UNB} --pn2 ${NODENO} --stream 0:39 -n 2 -r ${stream_string_mac}
done
done
fi
#!/bin/bash
###############################################################################
#
# Copyright (C) 2017
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# Author:
# . Daniel van der Schuur
# . Pieter Donker
# Purpose:
# . Check the status of the central UniBoards2
# Usage:
# . Run after central_commands.sh, with the same arguments
APP=$1 # apertif, arts_sc1, arts_sc4
TELS=$2
UNBS=$3
OPTIONS=$4
POL=$5
MAC="False"
if [ -z "$6" ]; then
echo "MAC argument not supplied"
elif [ "$6" == "True" ]; then
MAC="True"
fi
echo central_status_unb2.sh: Using MAC : $MAC
echo central_status_unb2.sh: Application : $APP
echo central_status_unb2.sh: Telescopes : $TELS
echo central_status_unb2.sh: UniBoards2 : $UNBS
echo central_status_unb2.sh: Options : $OPTIONS
echo central_status_unb2.sh: Polarisation : $POL
NOF_UNIBOARDS=$(echo $UNBS, | grep -o ',' | wc -l)
if [ "$OPTIONS" == "precheck" ]; then
###############################################################################
# Pre (command sequence) check
###############################################################################
echo "central_status_unb2.sh: Performing pre-check"
echo "central_status_unb2.sh: Targeted UniBoards:" $UNBS
# Replace the commas in the lists with spaces
UNBS_NOCOMMAS=${UNBS//,/ }
for UNB in $UNBS_NOCOMMAS; do
timeout 0.2 ping -c 1 10.99.$UNB.1 >/dev/null 2>&1 && UNBS_ONLINE+=$UNB' '
done
if [ -z "$UNBS_ONLINE" ]; then
echo central_status_unb2.sh: Error - all passed central UniBoards offline
else
# Replace the spaces in the lists with commas
UNBS_ONLINE=${UNBS_ONLINE// /,}
# Remove the last comma character rom the lists
UNBS_ONLINE=${UNBS_ONLINE::-1}
echo "central_status_unb2.sh: Online UniBoards2:" $UNBS_ONLINE
if [ "$UNBS_ONLINE" == "$UNBS" ]; then
echo central_status_unb2.sh: Passed - all passed UniBoards2 online
else
echo central_status_unb2.sh: Error - one or more Uniboards2 offline
fi
fi
else
###############################################################################
# Post (command sequence) check
###############################################################################
echo "central_status_unb2.sh: Performing post-check"
UNB_FACTORY=$(python $UPE/peripherals/util_system_info.py --unb2 $UNBS --pn2 0:3 -n 2 | grep -c arts_unb2b_sc4_fwd)
if [ "$UNB_FACTORY" == "0" ]; then
echo central_status_unb2.sh: Passed - Found the application images online
else
echo central_status_unb2.sh: Passed - one or more unb2 FPGAs is running arts_unb2b_sc4_fwd
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment