Skip to content
Snippets Groups Projects
Commit 9b47f0d8 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

Merge branch 'master' into L2SS-362-Switch-Env-Mode

parents 9792e012 1e5c032c
No related branches found
No related tags found
1 merge request!133Resolve L2SS-362 "Switch env mode"
Showing
with 53 additions and 76 deletions
......@@ -12,14 +12,6 @@
ABSOLUTE_PATH=$(realpath $(dirname ${BASH_SOURCE}))
export LOFAR20_DIR=${1:-$(realpath ${ABSOLUTE_PATH}/../..)}
# This needs to be modified for a development environment.
# Example: ~/lofar2.0/tango
# The current setting is for a production environment.
export TANGO_LOFAR_LOCAL_DIR=${LOFAR20_DIR}/
export TANGO_LOFAR_CONTAINER_DIR=/opt/lofar2.0/tango/
export TANGO_LOFAR_CONTAINER_MOUNT=${TANGO_LOFAR_LOCAL_DIR}:${TANGO_LOFAR_CONTAINER_DIR}:rw
# This needs to be modified for a development environment.
# In case you run multiple Docker networks on the same host in parallel, you need to specify a unique
# network name for each of them.
......@@ -35,9 +27,6 @@ export TANGO_HOST=$(hostname):10000
# NO MODIFICATION BEYOND THIS POINT!
#
# Provide the -v parameters for Docker and the -e ENV variables.
export TANGO_CONTAINER_ENV="-e TANGO_LOFAR_CONTAINER_DIR=${TANGO_LOFAR_CONTAINER_DIR}"
# Remove all LOFAR1 related environment modifications
function remove_lofar()
{
......
......@@ -98,7 +98,16 @@ class SDP(hardware_device):
version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version())
# SDP will switch from FPGA_mask_RW to TR_FPGA_mask_RW, offer both for now as its a critical flag
FPGA_beamlet_output_enable_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_enable_R"], datatype=numpy.bool_, dims=(16,))
FPGA_beamlet_output_enable_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_enable_RW"], datatype=numpy.bool_, dims=(16,), access=AttrWriteType.READ_WRITE)
FPGA_beamlet_output_hdr_eth_destination_mac_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_eth_destination_mac_R"], datatype=numpy.str, dims=(16,))
FPGA_beamlet_output_hdr_eth_destination_mac_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_eth_destination_mac_RW"], datatype=numpy.str, dims=(16,), access=AttrWriteType.READ_WRITE)
FPGA_beamlet_output_hdr_ip_destination_address_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_ip_destination_address_R"], datatype=numpy.str, dims=(16,))
FPGA_beamlet_output_hdr_ip_destination_address_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_ip_destination_address_RW"], datatype=numpy.str, dims=(16,), access=AttrWriteType.READ_WRITE)
FPGA_beamlet_output_hdr_udp_destination_port_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_udp_destination_port_R"], datatype=numpy.uint16, dims=(16,))
FPGA_beamlet_output_hdr_udp_destination_port_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_udp_destination_port_RW"], datatype=numpy.uint16, dims=(16,), access=AttrWriteType.READ_WRITE)
FPGA_beamlet_output_scale_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_scale_R"], datatype=numpy.uint32, dims=(16,))
FPGA_beamlet_output_scale_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_scale_RW"], datatype=numpy.uint32, dims=(16,), access=AttrWriteType.READ_WRITE)
FPGA_firmware_version_R = attribute_wrapper(comms_annotation=["2:FPGA_firmware_version_R"], datatype=numpy.str, dims=(16,))
FPGA_global_node_index_R = attribute_wrapper(comms_annotation=["2:FPGA_global_node_index_R"], datatype=numpy.uint32, dims=(16,))
FPGA_hardware_version_R = attribute_wrapper(comms_annotation=["2:FPGA_hardware_version_R"], datatype=numpy.str, dims=(16,))
......
......@@ -16,8 +16,7 @@ are running and are in the required state.
**Warning running these tests will make changes to your CDB database config!**
```shell
source bootstrap/etc/lofar20rc.sh
$LOFAR20_DIR/sbin/run_integration_test.sh
sbin/run_integration_test.sh
```
## Limitations
......
......@@ -20,11 +20,12 @@ class TestUNB2Sim(base.IntegrationTestCase):
def test_opcua_connection(self):
"""Check if we can connect to unb2-sim"""
client = Client("opc.tcp://recv-sim:4842")
client = Client("opc.tcp://unb2-sim:4844")
root_node = None
try:
client.connect()
try:
root_node = client.get_root_node()
finally:
client.disconnect()
......
......@@ -120,7 +120,7 @@ Docker container. A simple interactive Docker exec is enough to access them:
```sh
docker exec -it device-sdp /bin/bash
cd /opt/lofar2.0/tango/devices/
cd /opt/lofar/tango/devices/
tox
```
......
# Before doing anything, make 100% certain that all necessary environment
# variables are set.
ifndef LOFAR20_DIR
# Generate the full path to the lofar20rc.sh file
# for exactly this repository.
LOFAR20RC = $(subst docker-compose,bootstrap/etc/lofar20rc.sh,$(abspath .))
$(error There are essential LOFAR2.0 environment variables missing. You must source the lofar20rc.sh file of this repo first. You can do it like this (paste without quotes): ". $(LOFAR20RC)")
endif
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH))))
......@@ -22,7 +14,12 @@ ATTACH_COMPOSE_FILE_ARGS := $(foreach yml,$(filter-out tango.yml,$(COMPOSE_FILES
NETWORK_MODE ?= tangonet
# Host name through which others can reach our control interfaces
ifneq (,$(wildcard /run/WSL))
# Microsoft Windows Subsystem for Linux
HOSTNAME ?= host.docker.internal
else
HOSTNAME ?= $(shell hostname -f)
endif
# If the first make argument is "start" or "stop"...
ifeq (start,$(firstword $(MAKECMDGOALS)))
......@@ -114,11 +111,10 @@ endif
DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
XAUTHORITY=$(XAUTHORITY) \
TANGO_HOST=$(TANGO_HOST) \
MYSQL_HOST=$(MYSQL_HOST) \
HOSTNAME=$(HOSTNAME) \
NETWORK_MODE=$(NETWORK_MODE) \
XAUTHORITY_MOUNT=$(XAUTHORITY_MOUNT) \
TANGO_LOFAR_CONTAINER_MOUNT=$(TANGO_LOFAR_CONTAINER_MOUNT) \
TANGO_LOFAR_CONTAINER_DIR=${TANGO_LOFAR_CONTAINER_DIR} MYSQL_HOST=$(MYSQL_HOST) \
CONTAINER_NAME_PREFIX=$(CONTAINER_NAME_PREFIX) \
COMPOSE_IGNORE_ORPHANS=true \
CONTAINER_EXECUTION_UID=$(shell id -u) \
......@@ -159,7 +155,7 @@ endif
$(DOCKER_COMPOSE_ARGS) docker-compose -f tango.yml -f networks.yml up -d
start: up ## start a service (usage: make start <servicename>)
if [ $(UNAME_S) = Linux ]; then chmod a+r ~/.Xauthority; fi
if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) start $(SERVICE)
stop: ## stop a service (usage: make stop <servicename>)
......
......@@ -70,7 +70,7 @@ services:
json2tango -w -a -u /tango-archiver/data/archiver-devices.json &&
sleep infinity"
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
- ../docker/tango/tango-archiver:/tango-archiver
restart: on-failure
......
......@@ -27,7 +27,7 @@ services:
ports:
- "5705:5705" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- /var/run/docker.sock:/var/run/docker.sock:rw # we want to control our sibling containers, NOT do docker-in-docker (dind)
user: ${CONTAINER_EXECUTION_UID}:${DOCKER_GID} # user that starts this container by definition has access rights to docker
environment:
......@@ -40,5 +40,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/docker_device.py LTS -v -ORBendPoint giop:tcp:0:5705 -ORBendPointPublish giop:tcp:${HOSTNAME}:5705
- python3 -u /opt/lofar/tango/devices/devices/docker_device.py LTS -v -ORBendPoint giop:tcp:0:5705 -ORBendPointPublish giop:tcp:${HOSTNAME}:5705
restart: on-failure
......@@ -26,7 +26,7 @@ services:
ports:
- "5703:5703" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -37,5 +37,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/observation_control.py LTS -v -ORBendPoint giop:tcp:0:5703 -ORBendPointPublish giop:tcp:${HOSTNAME}:5703
- python3 -u /opt/lofar/tango/devices/devices/observation_control.py LTS -v -ORBendPoint giop:tcp:0:5703 -ORBendPointPublish giop:tcp:${HOSTNAME}:5703
restart: on-failure
......@@ -27,7 +27,7 @@ services:
ports:
- "5707:5707" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -38,5 +38,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/recv.py LTS -v -ORBendPoint giop:tcp:0:5707 -ORBendPointPublish giop:tcp:${HOSTNAME}:5707
- python3 -u /opt/lofar/tango/devices/devices/recv.py LTS -v -ORBendPoint giop:tcp:0:5707 -ORBendPointPublish giop:tcp:${HOSTNAME}:5707
restart: on-failure
......@@ -27,7 +27,7 @@ services:
ports:
- "5701:5701" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -38,5 +38,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/sdp/sdp.py LTS -v -ORBendPoint giop:tcp:0:5701 -ORBendPointPublish giop:tcp:${HOSTNAME}:5701
- python3 -u /opt/lofar/tango/devices/devices/sdp/sdp.py LTS -v -ORBendPoint giop:tcp:0:5701 -ORBendPointPublish giop:tcp:${HOSTNAME}:5701
restart: on-failure
......@@ -30,7 +30,7 @@ services:
- "5101:5101/tcp" # port to emit SST TCP packets on
- "5702:5702" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -41,5 +41,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/sdp/sst.py LTS -v -ORBendPoint giop:tcp:0:5702 -ORBendPointPublish giop:tcp:${HOSTNAME}:5702
- python3 -u /opt/lofar/tango/devices/devices/sdp/sst.py LTS -v -ORBendPoint giop:tcp:0:5702 -ORBendPointPublish giop:tcp:${HOSTNAME}:5702
restart: on-failure
......@@ -27,7 +27,7 @@ services:
ports:
- "5704:5704" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -38,5 +38,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/unb2.py LTS -v -ORBendPoint giop:tcp:0:5704 -ORBendPointPublish giop:tcp:${HOSTNAME}:5704
- python3 -u /opt/lofar/tango/devices/devices/unb2.py LTS -v -ORBendPoint giop:tcp:0:5704 -ORBendPointPublish giop:tcp:${HOSTNAME}:5704
restart: on-failure
......@@ -30,7 +30,7 @@ services:
- "5102:5102/tcp" # port to emit XST TCP packets on
- "5706:5706" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -41,5 +41,5 @@ services:
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
# can't know about our Docker port forwarding
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/sdp/xst.py LTS -v -ORBendPoint giop:tcp:0:5706 -ORBendPointPublish giop:tcp:${HOSTNAME}:5706
- python3 -u /opt/lofar/tango/devices/devices/sdp/xst.py LTS -v -ORBendPoint giop:tcp:0:5706 -ORBendPointPublish giop:tcp:${HOSTNAME}:5706
restart: on-failure
......@@ -16,10 +16,10 @@ services:
networks:
- control
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
working_dir: ${TANGO_LOFAR_CONTAINER_DIR}/devices
working_dir: /opt/lofar/tango/devices
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
......
......@@ -22,7 +22,7 @@ services:
networks:
- control
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
environment:
- TANGO_HOST=${TANGO_HOST}
......
......@@ -23,7 +23,7 @@ services:
network_mode: host
volumes:
- ${XAUTHORITY_MOUNT}
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
environment:
- XAUTHORITY=${XAUTHORITY}
......
......@@ -20,8 +20,8 @@ services:
networks:
- control
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ${TANGO_LOFAR_LOCAL_DIR}/jupyter-notebooks:/jupyter-notebooks:rw
- ..:/opt/lofar/tango:rw
- ../jupyter-notebooks:/jupyter-notebooks:rw
- ${HOME}:/hosthome
environment:
- TANGO_HOST=${TANGO_HOST}
......
......@@ -27,7 +27,7 @@ services:
volumes:
- pogo:/home/tango
- ${XAUTHORITY_MOUNT}
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome:rw
environment:
- XAUTHORITY=${XAUTHORITY}
......
function help()
{
echo -e "\nERROR: ${1}\nYou must provide a file that can be accessed from within the Docker container. This is possible for files that\n\t- Have a path in \${HOME} or\n\t- Have a full file path that begins with one of \"/hosthome/\", \"/opt/lofar2.0/tango/\" or \"/opt/lofar2.0/\".\n\nWhy is that? Because the file will be loaded from within the Docker container and only some of the host's file system directories are mounted in the container."
exit -2
}
#!/bin/bash
if [ ${#} -eq 1 ]; then
file=${1}
else
help "A file name must be provided."
echo "A file name must be provided."
exit 1
fi
# Check if the filename begins with /hosthome/, /opt/lofar2.0/tango or
# /opt/lofar2.0/ or if it is in the ${HOME} directory:
if [ ${1:0:10} != /hosthome/ -a ${1:0:20} != /opt/lofar2.0/tango/ -a ${1:0:14} != /opt/lofar2.0/ ]; then
pushd $(dirname ${file}) >/dev/null
full_path=${PWD}
popd >/dev/null
# Check if the file's directory begins with ${HOME}. Then it can be
# accessed via /hosthome. The replacement will then shorten the result.
home_replaced=${full_path#${HOME}}
if [ ${#home_replaced} -ne ${#full_path} ]; then
if [ ! -f ${file} ]; then
help "The file \"${1}\" does not exist."
fi
# The file can be accessed through /hosthome. Modify the parameter.
file=/hosthome${home_replaced}/$(basename ${file})
fi
fi
# copy file into container to read it from container, as the file's location
# in the container won't be the same as on the host.
docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json
docker exec -it ${TANGO_CONTAINER_ENV} dsconfig json2tango --write ${file}
# write settings
docker exec -it dsconfig json2tango --write /tmp/dsconfig-load-settings.json
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment