diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a4366d2502abea15bd105fb75a4783955375683..d2ca9404c5659d610b569975472a4f0a6cbbd70b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ # GitLab CI in conjunction with GitLab Runner can use Docker Engine to test and build any application. # Docker, when used with GitLab CI, runs each job in a separate and isolated container using the predefined image that is set up in .gitlab-ci.yml. # In this case we use the latest python docker image to build and test this project. -#image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest +image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest variables: DOCKER_DRIVER: overlay2 @@ -32,18 +32,20 @@ cache: # build: build the docker images for csp-lmc-mid and csp-lmc-low # test: execute tests on csp-lmc-common, csp-lmc-mid, csp-lmc-low # package: create the python packages for common, mid and low -# publish: publish on nexus the mid and low images and the common python package -# pages: create the badges +# publish: publish on nexus the mid common python packages +# pages: move the metrics files to the right folder +# release release the images for csp-lmc-low and mid (only manual) stages: - build_common + - linting_common - test_common - publish_common - build - - test - linting + - release + - test - publish - pages - - release .install_pip: &install_pip |- apt-get -y update && apt-get install -yq curl python3-distutils @@ -66,12 +68,12 @@ pages: - docker-executor stage: pages variables: - COMMON_PATH: csp-lmc-common/docker - MIDCSP_PATH: csp-lmc-mid/docker + COMMON_PATH: csp-lmc-common/ + MIDCSP_PATH: csp-lmc-mid/ script: - pwd - python3 -m pip install junitparser - #update coverage o the last release + #update coverage to the last release - python3 -m pip install --upgrade coverage - ls -lR # copy the content of packages folders in public @@ -79,7 +81,7 @@ pages: # that has been cloned during the build - cp -R $COMMON_PATH/build/ public - cp -R $MIDCSP_PATH/build/* public - - ls -lR + - ls -lR public - junitparser merge public/reports/csp-lmc-common-unit-tests.xml public/reports/csp-lmc-mid-unit-tests.xml public/reports/unit-tests.xml - ls -lR - junitparser merge public/reports/csp-lmc-common-linting.xml public/reports/csp-lmc-mid-linting.xml public/reports/linting.xml diff --git a/README.md b/README.md index a0984ee610374bec3a5fa5116e5d8d01b0a53d10..558cb8e614de70b7806297e90a631ef9c265adb9 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ CPS.LMC project * [Repository](#repository) * [CSP.LMC Common Package](#csp-lmc-common) * [Create the CSP.LMC Common Software python package](#python-package) -* [CSP_Mid LMC](#mid-csp-mid-lmc) - * [Running tests](#running-tests) +* [CSP_Mid LMC](#CSP_Mid.LMC) + * [CSP_Mid LMC Deployment in Kubernetes](#mid-CSP.LMC-Kubernetes-Deployment-via-Helm-Charts) * [CSP_Low LMC](#csp-low-lmc) * [Run in containers](#how-to-run-in-docker-containers) * [Known bugs](#known-bugs) @@ -39,8 +39,10 @@ the same organization: * project source: contains the specific project TANGO Device Class files * pogo: contains the POGO files of the TANGO Device Classes of the project -* docker: containes the `docker`, `docker-compose` and `dsconfig` configuration files as well as the Makefile to generate the docker image and run the tests. * tests: contains the test +* charts: stored the HEML charts to deploy the Mid CSP.LMC system under kubernets environment. +* docker: containes the `docker`, `docker-compose` and `dsconfig` configuration files as well as +the Makefile to generate the docker image and run the tests. To get a local copy of the repository: @@ -52,18 +54,194 @@ git clone https://gitlab.com/ska-telescope/csp-lmc.git * A TANGO development environment properly configured, as described in [SKA developer portal](https://developer.skatelescope.org/en/latest/tools/tango-devenv-setup.html) * [SKA Base classes](https://gitlab.com/ska-telescope/lmc-base-classes) -* -## CSP_Mid.LMC +* access to a K8s/minikube cluster. + +# CSP_Mid.LMC The TANGO devices of the CSP_Mid.LMC prototype run in a containerised environment. Currently only a limitated number of CSP_Mid.LMC and CBF_Mid.LMC devices are run in Docker containers: * the MidCspMaster and MID CbfMaster * the MidCspCapabilityMonitor devices -* two instances of the CSP_Mid and CBF_Mid subarrays +* three instances of the CSP_Mid and CBF_Mid subarrays * four instances of the Very Coarse Channelizer (VCC) devices * four instance of the Frequency Slice Processor (FPS) devices * two instances of the TM TelState Simulator devices +* one instance of the TANGO database + +## Containerised Mid CSP.LMC in Kubernetes + +The Mid CSP.LMC containerised TANGO servers are managed via Kubernetes. +The system is setup so that each k8s Pod has only one Docker container that in turn +runs only one Tango Device Server application.
+Mid CSP.LMC TANGO Servers rely on two different Docker images: `mid-csplmc` and `mid-cbf-mcs`.
+The first one runs the CSP.LMC TANGO devices and the sencond those of the Mid CBF.LMC prototype. + +### Mid CSP.LMC Kubernetes Deployment via Helm Charts + +The deployment of the system is handled by the Helm tool, via the Helm Charts, a set of YAML files describing +how the Kubernetes resources are related.
+The Mid CSP.LMC Helm Charts are stored in the `charts` directory, organized in two sub-folders:
+ +* csp-proto with the Helm chart to deploy only the CSP.LMC devices (MidCspCapabilityMonitor, MidcSpMaster nad MidCspSubarray) +* mid-csp with the Helm chart to deploy the whole Mid CSP.LMC system, including the TANGO Database and the Mid CSF.LMC devices. +In particular, the `mid-csp` chart depends on the CSP.LMC, CBF.LMC and Tango DB charts and these dependecies are + dynamically linked specifying the `dependencies` field in the Chart.yaml.
+ +The `Makefile` in the csp-lmc-mid root directory provides the targets to deploy the system, stop the running services and run +the tests locally, on a k8s/minikube machine. + +To deploy the whole Mid CSP.LMC system run: + +``` bash + make deploy +``` +that installs the mid-csp helm chart specifying `test` as relase name and assigns it to the `csp-proto` namespace. + +Running the command: +```bash +helm list -n csp-proto +``` +an output like the one below is shown: +``` +NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION +test csp-proto 1 2020-09-21 10:07:19.308839059 +0200 CEST deployed mid-csp-0.1.0 0.6.8 +``` + +To list all the pods and service in the csp-proto namespace, issue the command: + +```bash +kubectl get all -n csp-proto +``` + +that provides the following output lines: + +``` +NAME READY STATUS RESTARTS AGE +pod/databaseds-tango-base-test-0 1/1 Running 0 2m48s +pod/mid-cbf-cbf-proto-cbfmaster-test-0 1/1 Running 0 2m50s +pod/mid-cbf-cbf-proto-cbfsubarray01-test-0 1/1 Running 1 2m50s +pod/mid-cbf-cbf-proto-cbfsubarray02-test-0 1/1 Running 1 2m48s +pod/mid-cbf-cbf-proto-cbfsubarray03-test-0 1/1 Running 1 2m48s +pod/mid-cbf-cbf-proto-fsp01-test-0 1/1 Running 0 2m49s +pod/mid-cbf-cbf-proto-fsp02-test-0 1/1 Running 0 2m49s +pod/mid-cbf-cbf-proto-fsp03-test-0 1/1 Running 0 2m50s +pod/mid-cbf-cbf-proto-fsp04-test-0 1/1 Running 0 2m50s +pod/mid-cbf-cbf-proto-tmcspsubarrayleafnodetest-test-0 1/1 Running 0 2m49s +pod/mid-cbf-cbf-proto-tmcspsubarrayleafnodetest2-test-0 1/1 Running 0 2m48s +pod/mid-cbf-cbf-proto-vcc001-test-0 1/1 Running 3 2m47s +pod/mid-cbf-cbf-proto-vcc002-test-0 1/1 Running 3 2m50s +pod/mid-cbf-cbf-proto-vcc003-test-0 1/1 Running 3 2m50s +pod/mid-cbf-cbf-proto-vcc004-test-0 1/1 Running 3 2m49s +pod/mid-cbf-configurator-cbf-proto-test-m6j2p 0/1 Error 0 2m50s +pod/mid-cbf-configurator-cbf-proto-test-qm8xg 0/1 Completed 0 2m15s +pod/midcsplmc-configurator-csp-proto-test-d7hmp 0/1 Completed 0 2m15s +pod/midcsplmc-configurator-csp-proto-test-qnks4 0/1 Error 0 2m50s +pod/midcsplmc-csp-proto-midcapabilitymonitor-test-0 1/1 Running 3 2m48s +pod/midcsplmc-csp-proto-midcspmaster-test-0 1/1 Running 0 2m50s +pod/midcsplmc-csp-proto-midcspsubarray01-test-0 1/1 Running 1 2m50s +pod/midcsplmc-csp-proto-midcspsubarray02-test-0 1/1 Running 1 2m50s +pod/midcsplmc-csp-proto-midcspsubarray03-test-0 1/1 Running 1 2m50s +pod/tango-base-tangodb-0 + + +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +service/databaseds-tango-base-test NodePort 10.103.37.75 10000:31664/TCP 2m50s +service/mid-cbf-cbf-proto-cbfmaster-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-cbfsubarray01-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-cbfsubarray02-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-cbfsubarray03-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-fsp01-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-fsp02-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-fsp03-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-fsp04-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-tmcspsubarrayleafnodetest-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-tmcspsubarrayleafnodetest2-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-vcc001-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-vcc002-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-vcc003-test ClusterIP None 1234/TCP 2m50s +service/mid-cbf-cbf-proto-vcc004-test ClusterIP None 1234/TCP 2m50s +service/midcsplmc-csp-proto-midcapabilitymonitor-test ClusterIP None 1234/TCP 2m50s +service/midcsplmc-csp-proto-midcspmaster-test ClusterIP None 1234/TCP 2m50s +service/midcsplmc-csp-proto-midcspsubarray01-test ClusterIP None 1234/TCP 2m50s +service/midcsplmc-csp-proto-midcspsubarray02-test ClusterIP None 1234/TCP 2m50s +service/midcsplmc-csp-proto-midcspsubarray03-test ClusterIP None 1234/TCP 2m50s +service/tango-base-tangodb NodePort 10.102.174.225 3306:30633/TCP 2m50s + +NAME READY AGE +statefulset.apps/databaseds-tango-base-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-cbfmaster-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-cbfsubarray01-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-cbfsubarray02-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-cbfsubarray03-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-fsp01-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-fsp02-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-fsp03-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-fsp04-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-tmcspsubarrayleafnodetest-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-tmcspsubarrayleafnodetest2-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-vcc001-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-vcc002-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-vcc003-test 1/1 2m50s +statefulset.apps/mid-cbf-cbf-proto-vcc004-test 1/1 2m50s +statefulset.apps/midcsplmc-csp-proto-midcapabilitymonitor-test 1/1 2m50s +statefulset.apps/midcsplmc-csp-proto-midcspmaster-test 1/1 2m50s +statefulset.apps/midcsplmc-csp-proto-midcspsubarray01-test 1/1 2m50s +statefulset.apps/midcsplmc-csp-proto-midcspsubarray02-test 1/1 2m50s +statefulset.apps/midcsplmc-csp-proto-midcspsubarray03-test 1/1 2m50s +statefulset.apps/tango-base-tangodb 1/1 2m50s + +NAME COMPLETIONS DURATION AGE +job.batch/mid-cbf-configurator-cbf-proto-test 1/1 61s 2m50s +job.batch/midcsplmc-configurator-csp-proto-test 1/1 59s 2m50s +``` +The helm release can be deleted and the application stopped using the command: +```bash +make delete +``` +that unistalls the `mid-csp` chart and delete the `test` release in the `csp-proto` namespace. + +Other Makefile targets, such as `describe` and `logs`, provide some useful information when the system has been properly deployed. + +## Run integration tests on a local k8s/minikube cluster + +The project includes a set of tests for the `MidCspMaster` and `MidCspSubarray` TANGO Devices +that can be found in the project `tests` folder.
+To run the tests on the local k8s cluster, issue the command: + +```bash +make k8s_test +``` +from the root project directory.
+ +This command first deploys the system and then executes the integration tests. + +After tests end, run the command: + +```bash +make delete +``` +to uninstall the HELM charts of the `test` release. + +## Gitlab continuos integration tests + +Continuos integration tests in Gitlab rely on the `.gitlab-ci.yml` configuration file that provides al the scripts to build, test and deploy the application.
+This file has been updated to run test in K8s environment and any reference to the use of `docker-compose` as containers manager, +has been removed.
+A new job has been added in the pipline `publish` stage to release the the `csp-proto` helm chart in the SKA Helm charts repositoryhostes under `nexus`. + +## Docker-compose support + +Support to `docker-compose` has not been completely removed even if all the main operations are +performed in kubernetes environment.
+Use of `docker-compose` has been maintened only to simplify the development on machines that +are not capable to run minikube in a virtual machine.
+The `docker` folder of the project contains all the files required to run the system via the +docker-compose tool. +From the docker folder of the project, one can still: + • build the image running `make build` + • start the system dockers with docker-compose executing `make up` + • run the test on the local machine calling `make test` The Docker containers running the CBF_Mid devices are instantiated pulling the `mid-cbf-mcs:test` project image from the [Nexus repository](https://nexus.engageska-portugal.pt).
The CSP_Mid.LMC project provides a [Makefile](Makefile) to start the system containers and the tests.
@@ -75,13 +253,10 @@ The containerised environment relies on three YAML configuration files: Each file includes the stages to run the the `CSP_Mid.LMC TANGO DB`, the `CSP_Mid.LMC` devices and `Mid-CBF.LMC` TANGO Devices inside separate docker containers.
These YAML files are used by `docker-compose` to run both the CSP_Mid.LMC and CBF.LMC TANGO device -instances, that is, to run the whole `CSP_Mid.LMC` prototype.>br\> +instances, that is, to run the whole `CSP_Mid.LMC` prototype.
In this way, it's possible to execute some preliminary integration tests, as for example the assignment/release of receptors to a `CSP_Mid Subarray` and its configuration to execute a scan in Imaging mode.
The `CSP_Mid.LMC` and `Mid-CBF.LMC TANGO` Devices are registered with the same TANGO DB, and its -configuration is performed via the `dsconfig` TANGO Device provided by the [dsconfig project](https://gitlab.com/MaxIV-KitsControls/lib-maxiv-dsconfig).
-This device use a JSON file to configure the TANGO DB.
-The `CSP_Mid.LMC` and `Mid-CBF.LMC` projects provide its own JSON file: -[midcsplmc\_dsconfig.json](csp-lmc/csp-lmc-mid/csp-lmc-mid/docker/config/midcsplmc_dsconfig.json) and [midcbf\_dsconfig.json](sp-lmc/csp-lmc-mid/csp-lmc-mid/docker/config/midcbf_dsconfig.json) +configuration is performed via the `dsconfig` TANGO Device provided by the [dsconfig project](https://gitlab.com/MaxIV-KitsControls/lib-maxiv-dsconfig).
To run the `CSP_Mid.LMC` prototype inside Docker containers,issue the command: @@ -99,11 +274,11 @@ mid-csp-lmc-cbf_dsconfig: the dsconfig container to configure CBF.LMC devi mid-csp-lmc-cbf_dsconfig: the dsconfig container to configure CSP.LMC devices in the TANGO DB mid-csp-lmc-midcspmaster: the CspMaster TANGO device mid-csp-lmc-midcapabilitymonitor: the monitor devices of the CSP_Mid.LMC Capabilities -mid-csp-lmc-midcspsubarray[01-02]: two instances of the CspSubarray TANGO device +mid-csp-lmc-midcspsubarray[01-023: two instances of the CspSubarray TANGO device mid-csp-lmc-rsyslog-csplmc: the rsyslog container for the CSP.LMC devices mid-csp-lmc-rsyslog-cbf : the rsyslog container for the CBF.LMC devices mid-csp-lmc-cbfmaster: the CbfMaster TANGO device -mid-csp-lmc-cbfsubarray[01-02]: two instances of the CbfSubarray TANGO device +mid-csp-lmc-cbfsubarray[01-03]: two instances of the CbfSubarray TANGO device mid-csp-lmc-vcc[001-004]: four instances of the Mid-CBF VCC TANGO device mid-csp-lmc-fsp[01-04]: four instances of the Mid-CBF FSP TANGO device mid-csp-lmc-tmcspsubarrayleafnodetest/2: two instances of the TelState TANGO Device @@ -121,15 +296,6 @@ This means that the TANGO DB running in the container is available on port 10000 Running `jive` on the local host, the `CSP.LMC` and `Mid-CBF.LMC` TANGO Devices registered with the TANGO DB (running in a docker container) can be visualized and explored. -## Running tests - -The project includes a set of tests for the `MidCspMaster` and `MidCspSubarray` TANGO Devices that can be found in the project `tests` folder.
-To run the test on the local host issue the command - -
make test
-from the `docker` project directory.
-The test are run in docker containers providing the proper environment setup and isolation. - ## Known bugs diff --git a/csp-lmc-common/.gitlab-ci.yml b/csp-lmc-common/.gitlab-ci.yml index 0be7f45cd66221f8db76f129d5d9d99cf511b246..bad97a886cd62f0a0200c66c2526ed700ec3a17a 100644 --- a/csp-lmc-common/.gitlab-ci.yml +++ b/csp-lmc-common/.gitlab-ci.yml @@ -61,38 +61,54 @@ build:csp-lmc-common_image: # .test_common: - image: nexus.engageska-portugal.pt/ska-docker/tango-builder:latest - before_script: - - docker login -u $DOCKER_REGISTRY_USERNAME -p $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY_HOST + image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest tags: - docker-executor artifacts: paths: - ./$COMMON_BUILD_PATH/build/ variables: - COMMON_BUILD_PATH: csp-lmc-common/docker + COMMON_BUILD_PATH: csp-lmc-common test:csp-lmc-common: extends: .test_common stage: test_common script: - - cd $COMMON_BUILD_PATH - - make test + - cd $COMMON_BUILD_PATH + - pwd + - python3 -m pip install -r requirements-tst.txt + - python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt + - python3 setup.py test |tee setup_py_test.stdout + - pwd + - mkdir -p build/reports + - ls -alR + - mv setup_py_test.stdout build/csp-lmc-common-setup-test.stdout + - mv htmlcov build/csp-lmc-common_htmlcov + - mv coverage.xml build # # linting stage -.linting_common: - extends: .test_common - stage: linting + +linting:csp-lmc-common: + image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest + stage: linting_common + tags: + - docker-executor + artifacts: + paths: + - ./$COMMON_BUILD_PATH/build/ dependencies: [] script: - apt-get -y update - apt-get install -y python3-pip python3-setuptools python3-wheel --no-install-recommends + - python3 -m pip install pylint2junit - cd $COMMON_BUILD_PATH - - make lint - -linting:csp-lmc-common: - extends: .linting_common - dependencies: [] + - python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt + - mkdir -p build/reports + - pylint --output-format=parseable csp_lmc_common | tee ./build/csp_lmc_common-code-analysis.stdout + - pylint --output-format=pylint2junit.JunitReporter csp_lmc_common > ./build/reports/csp-lmc-common-linting.xml + - ls -alR + variables: + COMMON_BUILD_PATH: csp-lmc-common # # Publish csp-lmc-common python package diff --git a/csp-lmc-common/conftest.py b/csp-lmc-common/conftest.py deleted file mode 100644 index 080583b2c38a220371908294fd125d90253d1a73..0000000000000000000000000000000000000000 --- a/csp-lmc-common/conftest.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -A module defining a list of fixture functions. -""" -import importlib -import pytest - -import tango -from unittest import mock -from tango import DeviceProxy -from tango.test_context import DeviceTestContext - -@pytest.fixture(scope="class") -def tango_context(request): - """Creates and returns a TANGO DeviceTestContext object. - - Parameters - ---------- - request: _pytest.fixtures.SubRequest - A request object gives access to the requesting test context. - """ - test_properties = { - 'CspMaster': {'SkaLevel': '2', - 'CspCbf': 'mid_csp_cbf/sub_elt/master', - 'CspPss': 'mid_csp_pss/sub_elt/master', - 'CspPst': 'mid_csp_pst/sub_elt/master', - }, - 'CspSubarray': {'CspMaster': 'common/elt/master', - 'CbfSubarray': 'mid_csp_cbf/sub_elt/subarray_01', - 'PssSubarray': 'mid_csp_pss/sub_elt/subarray_01', - 'SubID' : 1, - }, - } - # TODO: package_name and class_name can be used in future - # fq_test_class_name = request.cls.__module__ - # fq_test_class_name_details = fq_test_class_name.split(".") - # package_name = fq_test_class_name_details[1] - # class_name = module_name = fq_test_class_name_details[1] - test_class_name = request.cls.__name__ - class_name = test_class_name.split('Test', 1)[-1] - module = importlib.import_module("{}.{}".format("csp_lmc_common", class_name)) - klass = getattr(module, class_name) - tango_context = DeviceTestContext(klass, properties=test_properties.get(class_name)) - tango_context.start() - yield tango_context - tango_context.stop() - -# -# NOTE: if initialize_device is called, the tests crash with error because during the -# CspMaster and CspMaster access to the TANGO DB to get the memorized attributes. -# Need to mock the call to the TANGO DB get_device_attribute -@pytest.fixture(scope="function") -def initialize_device(tango_context): - """Re-initializes the device. - - Parameters - ---------- - tango_context: tango.test_context.DeviceTestContext - Context to run a device without a database. - """ - yield tango_context.device.Init() - -@pytest.fixture(scope="class") -def cbf_master(): - """Create DeviceProxy for the CbfMaster device - to test the device with the TANGO DB - """ - database = tango.Database() - instance_list = database.get_device_exported_for_class('CbfMaster') - for instance in instance_list.value_string: - try: - return tango.DeviceProxy(instance) - except tango.DevFailed: - continue - - -@pytest.fixture(scope="class") -def csp_master(): - """Create DeviceProxy for the CspMaster device - to test the device with the TANGO DB - """ - database = tango.Database() - instance_list = database.get_device_exported_for_class('CspMaster') - for instance in instance_list.value_string: - try: - return tango.DeviceProxy(instance) - except tango.DevFailed: - continue diff --git a/csp-lmc-common/csp_lmc_common/CspMaster.py b/csp-lmc-common/csp_lmc_common/CspMaster.py index 0199ba83eb495c125f1be94ac0727705ad76db26..89d082d76d520482170b006318cd6ea5cdbeca15 100644 --- a/csp-lmc-common/csp_lmc_common/CspMaster.py +++ b/csp-lmc-common/csp_lmc_common/CspMaster.py @@ -1212,12 +1212,12 @@ class CspMaster(SKAMaster): self._build_state = '{}, {}, {}'.format(release.name, release.version, release.description) self._version_id = release.version # connect to TANGO DB - csp_tango_db = tango.Database() + #csp_tango_db = tango.Database() # read the CSP memorized attributes from the TANGO DB. # Note: a memorized attribute has defined the attribute # property '__value' - attribute_properties = csp_tango_db.get_device_attribute_property(self.get_name(), - {'adminMode': ['__value']}) + #attribute_properties = csp_tango_db.get_device_attribute_property(self.get_name(), + # {'adminMode': ['__value']}) # set init values for the CSP Element and Sub-element SCM states self.set_state(tango.DevState.INIT) self._health_state = HealthState.OK @@ -1233,16 +1233,16 @@ class CspMaster(SKAMaster): # build a dictionary with the (attr_name, value) of the memorized attributes # use memorized atrtibute if present, otherwise the default one - memorized_attr_dict = {attr_name : int(value[0]) for attr_name, db_key in attribute_properties.items() - for key, value in db_key.items() - if key == '__value'} - try: - self._admin_mode = memorized_attr_dict['adminMode'] - if self._admin_mode not in [AdminMode.ONLINE, AdminMode.MAINTENANCE]: - self._health_state = HealthState.UNKNOWN - self.set_state(tango.DevState.DISABLE) - except KeyError as key_err: - self.logger.info("Key {} not found".format(key_err)) + #memorized_attr_dict = {attr_name : int(value[0]) for attr_name, db_key in attribute_properties.items() + # for key, value in db_key.items() + # if key == '__value'} + #try: + # self._admin_mode = memorized_attr_dict['adminMode'] + # if self._admin_mode not in [AdminMode.ONLINE, AdminMode.MAINTENANCE]: + # self._health_state = HealthState.UNKNOWN + # self.set_state(tango.DevState.DISABLE) + #except KeyError as key_err: + # self.logger.info("Key {} not found".format(key_err)) # initialize list with CSP sub-element FQDNs self._se_fqdn = [] @@ -1260,17 +1260,17 @@ class CspMaster(SKAMaster): # read the sub-elements adminMode (memorized) attributes from # the TANGO DB. # Note: a memorized attribute has defined the attribute property '__value' - for fqdn in self._se_fqdn: - attribute_properties = csp_tango_db.get_device_attribute_property(fqdn, - {'adminMode': ['__value']}) - self.logger.info("fqdn: {} attribute_properties: {}".format(fqdn, attribute_properties)) - try: - admin_mode_memorized = attribute_properties['adminMode']['__value'] - self._se_admin_mode[fqdn] = int(admin_mode_memorized[0]) - except KeyError as key_err: - msg = ("No key {} found for sub-element {}" - " adminMode attribute".format(key_err, fqdn)) - self.logger.info(msg) + #for fqdn in self._se_fqdn: + # attribute_properties = csp_tango_db.get_device_attribute_property(fqdn, + # {'adminMode': ['__value']}) + # self.logger.info("fqdn: {} attribute_properties: {}".format(fqdn, attribute_properties)) + # try: + # admin_mode_memorized = attribute_properties['adminMode']['__value'] + # self._se_admin_mode[fqdn] = int(admin_mode_memorized[0]) + # except KeyError as key_err: + # msg = ("No key {} found for sub-element {}" + # " adminMode attribute".format(key_err, fqdn)) + # self.logger.info(msg) # _se_proxies: the sub-element proxies # implemented as dictionary: diff --git a/csp-lmc-common/csp_lmc_common/CspSubarray.py b/csp-lmc-common/csp_lmc_common/CspSubarray.py index d81b5355502e1218da2d9272e3508e59ee7c956c..f52a85919b9c47ee0ed3efc3cfd8a1aeec782a76 100644 --- a/csp-lmc-common/csp_lmc_common/CspSubarray.py +++ b/csp-lmc-common/csp_lmc_common/CspSubarray.py @@ -156,25 +156,25 @@ class CspSubarray(SKASubarray): device._sc_subarray_obs_state = defaultdict(lambda: ObsState.IDLE) device._sc_subarray_obs_mode = defaultdict(lambda: ObsMode.IDLE) device._mutex_obs_state = threading.Lock() - device._csp_tango_db = tango.Database() + #device._csp_tango_db = tango.Database() # read the CSP memorized attributes from the TANGO DB. # Note: a memorized attribute has defined the attribute # property '__value' - attribute_properties = device._csp_tango_db.get_device_attribute_property(device.get_name(), - {'adminMode': ['__value']}) + #attribute_properties = device._csp_tango_db.get_device_attribute_property(device.get_name(), + # {'adminMode': ['__value']}) # build a dictionary with the (attr_name, value) of the memorized attributes # use memorized atrtibute if present, otherwise the default one - memorized_attr_dict = {attr_name : int(value[0]) for attr_name, db_key in attribute_properties.items() - for key, value in db_key.items() - if key == '__value'} - try: - device._admin_mode = memorized_attr_dict['adminMode'] - if device._admin_mode not in [AdminMode.ONLINE, AdminMode.MAINTENANCE]: - device._health_state = HealthState.UNKNOWN - device.set_state(tango.DevState.DISABLE) + #memorized_attr_dict = {attr_name : int(value[0]) for attr_name, db_key in attribute_properties.items() + # for key, value in db_key.items() + # if key == '__value'} + #try: + # device._admin_mode = memorized_attr_dict['adminMode'] + # if device._admin_mode not in [AdminMode.ONLINE, AdminMode.MAINTENANCE]: + # device._health_state = HealthState.UNKNOWN + # device.set_state(tango.DevState.DISABLE) - except KeyError as key_err: - device.logger.info("Key {} not found".format(key_err)) + #except KeyError as key_err: + # device.logger.info("Key {} not found".format(key_err)) # list of sub-array sub-component FQDNs device._sc_subarray_fqdn = [] @@ -1653,14 +1653,14 @@ class CspSubarray(SKASubarray): return # read the sub-componet adminMode (memorized) attribute from # the CSP.LMC TANGO DB. - attribute_properties = self._csp_tango_db.get_device_attribute_property(fqdn, - {'adminMode': ['__value']}) - self.logger.debug("fqdn: {} attribute_properties: {}".format(fqdn, attribute_properties)) - try: - admin_mode_memorized = attribute_properties['adminMode']['__value'] - self._sc_subarray_admin_mode[fqdn] = int(admin_mode_memorized[0]) - except KeyError as key_error: - self.logger.warning("No key {} found".format(str(key_error))) + #attribute_properties = self._csp_tango_db.get_device_attribute_property(fqdn, + # {'adminMode': ['__value']}) + #self.logger.debug("fqdn: {} attribute_properties: {}".format(fqdn, attribute_properties)) + #try: + # admin_mode_memorized = attribute_properties['adminMode']['__value'] + # self._sc_subarray_admin_mode[fqdn] = int(admin_mode_memorized[0]) + #except KeyError as key_error: + # self.logger.warning("No key {} found".format(str(key_error))) try: log_msg = "Trying connection to " + str(fqdn) + " device" self.logger.info(log_msg) diff --git a/csp-lmc-common/csp_lmc_common/__init__.py b/csp-lmc-common/csp_lmc_common/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..671427260898519c373f2b9d0da18b603642fec3 100644 --- a/csp-lmc-common/csp_lmc_common/__init__.py +++ b/csp-lmc-common/csp_lmc_common/__init__.py @@ -0,0 +1,8 @@ +__all__ = [ + "CspMaster", + "CspSubarray", +] + +from .CspMaster import CspMaster +from .CspSubarray import CspSubarray + diff --git a/csp-lmc-common/requirements-tst.txt b/csp-lmc-common/requirements-tst.txt new file mode 100644 index 0000000000000000000000000000000000000000..67c373bcd3793c3ec93885ff62ecd7ce775c1619 --- /dev/null +++ b/csp-lmc-common/requirements-tst.txt @@ -0,0 +1,9 @@ +pytest +pytest-bdd +pytest-cov +pytest-json-report +pytest-mock +#pytest-xdist == 1.34.0 +pycodestyle +coverage +mock diff --git a/csp-lmc-common/requirements.txt b/csp-lmc-common/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1deb4d2bbc318a5dfb1b2b1f6a322c714dc00e8 --- /dev/null +++ b/csp-lmc-common/requirements.txt @@ -0,0 +1,4 @@ +numpy == 1.17.2 +pytango >= 9.3.2 +jsonschema >= 3.2.0 +lmcbaseclasses >= 0.6.4 diff --git a/csp-lmc-common/setup.cfg b/csp-lmc-common/setup.cfg index 22862a686bcdda8789becec2dc3e14e22732f0ea..935d6a4084ee08ea6afd14992239057aec987edf 100644 --- a/csp-lmc-common/setup.cfg +++ b/csp-lmc-common/setup.cfg @@ -25,7 +25,7 @@ addopts = --forked --cov-report=term --cov-report=html --cov-report=xml - --junitxml=/build/reports/csp-lmc-common-unit-tests.xml + --junitxml=build/reports/csp-lmc-common-unit-tests.xml console_output_style = progress junit_family=legacy filterwarnings = diff --git a/csp-lmc-common/setup.py b/csp-lmc-common/setup.py index f0281d564d7d1acf1b6e949b3940954d222a10cb..e61ff139c03111d97e7462b5005bed1edb597558 100644 --- a/csp-lmc-common/setup.py +++ b/csp-lmc-common/setup.py @@ -8,6 +8,7 @@ import os import sys +import setuptools from setuptools import setup, find_packages setup_dir = os.path.dirname(os.path.abspath(__file__)) @@ -38,7 +39,10 @@ setup( install_requires = [ 'pytango >9.3.1', 'future', - 'lmcbaseclasses==0.6.5+221be16f' + 'lmcbaseclasses==0.6.5' + ], + dependency_links=[ + 'https://nexus.engageska-portugal.pt/repository/pypi/simple' ], setup_requires=[ 'pytest-runner', @@ -47,7 +51,7 @@ setup( ], test_suite="test", entry_points={'console_scripts':[ - 'CspMaster = csp_lmc_common.CspMaster:main', + 'CspMaster=csp_lmc_common.CspMaster:main', 'CspSubarray=csp_lmc_common.CspSubarray:main']}, classifiers=[ "Development Status :: 3 - Alpha", diff --git a/csp-lmc-common/tests/CspMaster_test.py b/csp-lmc-common/tests/CspMaster_test.py deleted file mode 100755 index 20231c3cae5c2ca7a2524882e17fc3d204e3e1d8..0000000000000000000000000000000000000000 --- a/csp-lmc-common/tests/CspMaster_test.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# This file is part of the csp-lmc project -# -# -# -# Distributed under the terms of the BSD-3-Clause license. -# See LICENSE.txt for more info. -"""Contain the tests for the CspMaster.""" - -# Standard imports -import sys -import os -import time -import numpy as np -# Tango imports -import tango -from tango import DevState -from tango.test_context import DeviceTestContext -import pytest - -#Local imports -from csp_lmc_common.CspMaster import CspMaster -from ska.base.control_model import AdminMode, HealthState - -# Device test case -@pytest.mark.usefixtures("tango_context", "cbf_master") - -class TestCspMaster(object): - properties = {'SkaLevel': '2', - 'CspCbf': 'mid_csp_cbf/sub_elt/master', - 'CspPss': 'mid_csp_pss/sub_elt/master', - 'CspPst': 'mid_csp_pst/sub_elt/master', - } - - def test_State(self, cbf_master, tango_context): - """Test for State after initialization - NOTE: the CspMaster device state is ALARM because - this device relies on several forwarded attributes. - """ - # reinitalize Csp Master and CbfMaster devices - cbf_master.Init() - time.sleep(2) - csp_state = tango_context.device.state() - assert csp_state not in [DevState.FAULT, DevState.DISABLE] - - def test_adminMode_offline(self, tango_context): - """ Test the adminMode attribute w/r""" - tango_context.device.adminMode = AdminMode.OFFLINE - time.sleep(3) - assert tango_context.device.adminMode.value == AdminMode.OFFLINE - - def test_adminMode_online(self, tango_context): - """ Test the adminMode attribute w/r""" - tango_context.device.adminMode = AdminMode.ONLINE - time.sleep(3) - assert tango_context.device.adminMode.value == AdminMode.ONLINE - - def test_write_invalid_admin_mode(self, tango_context): - - with pytest.raises(tango.DevFailed) as df: - tango_context.device.adminMode = 7 - assert "Set value for attribute adminMode is negative or above the maximun authorized" in str(df.value.args[0].desc) - - def test_cspHealthState(self, tango_context): - """ Test the CSP initial healthState. - NOTE: to build the CSP healthState, the sub-elements - not ONLINE or MAINTENACE are not taken into account. - """ - assert tango_context.device.healthState == HealthState.OK - - def test_cbfAdminMode(self, tango_context): - """ Test the CBF adminMode attribute w/r""" - tango_context.device.cspCbfAdminMode = AdminMode.ONLINE - time.sleep(3) - assert tango_context.device.cspCbfAdminMode.value == AdminMode.ONLINE - - def test_cbfHealthState(self, tango_context): - """ Test the CBF initial healthState """ - tango_context.device.cspCbfHealthState == HealthState.OK - - def test_pssState(self, tango_context): - """ Test the PSS initial State """ - assert tango_context.device.cspPssState == DevState.DISABLE - - def test_pssHealthState(self, tango_context): - """ Test the PSS initial healthState """ - assert tango_context.device.cspPssHealthState == HealthState.UNKNOWN - - def test_pssAdminMode(self, tango_context): - """ Test the PSS initial adminMode """ - pss_admin = tango_context.device.cspPssAdminMode - assert pss_admin == AdminMode.NOT_FITTED - - def test_write_adminMode_of_not_running_device(self, tango_context): - assert tango_context.device.cspPssAdminMode == AdminMode.NOT_FITTED - tango_context.device.cspPssAdminMode == AdminMode.ONLINE - time.sleep(3) - assert tango_context.device.cspPssAdminMode == AdminMode.NOT_FITTED - - def test_pstState(self, tango_context): - """ Test the PST initial State """ - assert tango_context.device.cspPstState == DevState.DISABLE - - def test_pstHealthState(self, tango_context): - """ Test the PST initial healthState """ - assert tango_context.device.cspPstHealthState == HealthState.UNKNOWN - - def test_pstAdminMode(self, tango_context): - """ Test the PST initial adminMode """ - assert tango_context.device.cspPstAdminMode == AdminMode.NOT_FITTED - - def test_subelement_cbf_address(self, tango_context): - """Test the cbfMasterAdress value""" - cbf_addr = tango_context.device.cbfMasterAddress - cbf_addr_property = self.properties['CspCbf'] - assert cbf_addr == cbf_addr_property - - def test_subelement_pss_address(self, tango_context): - """Test the pssMasterAdress value""" - pss_addr = tango_context.device.pssMasterAddress - pss_addr_property = self.properties['CspPss'] - assert pss_addr == pss_addr_property - - def test_subelement_pst_address(self, tango_context): - """Test the pstMasterAdress value""" - pst_addr = tango_context.device.pstMasterAddress - pst_addr_property = self.properties['CspPst'] - assert pst_addr == pst_addr_property - - def test_configure_On_command_duration_time(self, tango_context): - tango_context.device.onCmdDurationExpected = 3 - assert tango_context.device.onCmdDurationExpected == 3 - - def test_configure_Off_command_duration_time(self, tango_context): - tango_context.device.offCmdDurationExpected = 3 - assert tango_context.device.offCmdDurationExpected == 3 - - def test_configure_Standby_command_duration_time(self, tango_context): - tango_context.device.standbyCmdDurationExpected = 3 - assert tango_context.device.standbyCmdDurationExpected == 3 - - def test_On_valid_state(self, tango_context, cbf_master): - """ - Test to execute the On command on the CbfMaster and to verify the - attributes related dto command execution: execution measured time, - timeout, command progress. - """ - #reinit CSP and CBFTest master devices - cbf_master.Init() - # sleep for a while to wait state transition - time.sleep(3) - # check CspMstar state - assert tango_context.device.cspCbfState == DevState.STANDBY - # issue the "On" command on CbfTestMaster device - argin = [tango_context.device.cbfMasterAddress,] - tango_context.device.On(argin) - time.sleep(4) - assert tango_context.device.cspCbfState == DevState.ON - time_measured = tango_context.device.onCmdDurationMeasured - assert time_measured >= 0 - # verify the command does not timeout - on_timeout = tango_context.device.onCmdTimeoutExpired - assert not on_timeout - # verify the command progress is 100 - assert tango_context.device.onCommandProgress == 100 - failure = tango_context.device.onCmdFailure - assert not failure - failure_message = tango_context.device.onFailureMessage - assert failure_message =='' - - def test_Standby_valid_state(self, tango_context, cbf_master): - assert tango_context.device.cspCbfState == DevState.ON - # issue the "On" command on CbfTestMaster device - argin = [tango_context.device.cbfMasterAddress,] - tango_context.device.Standby(argin) - time.sleep(4) - assert tango_context.device.cspCbfState == DevState.STANDBY - standby_timeout = tango_context.device.standbyCmdTimeoutExpired - assert not standby_timeout - assert tango_context.device.standbyCommandProgress == 100 - num_of_task = tango_context.device.numOfDevCompletedTask - assert num_of_task == 1 - list_of_task = tango_context.device.listOfDevCompletedTask - assert tango_context.device.cbfMasterAddress in list_of_task - time_measured = tango_context.device.standbyCmdDurationMeasured - assert time_measured >= 0 diff --git a/csp-lmc-common/tests/CspSubarray_test.py b/csp-lmc-common/tests/CspSubarray_test.py deleted file mode 100755 index 2847e71dbd887e90ea96beb67a5da3d2d77922be..0000000000000000000000000000000000000000 --- a/csp-lmc-common/tests/CspSubarray_test.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# This file is part of the csp-lmc project -# -# -# -# Distributed under the terms of the BSD-3-Clause license. -# See LICENSE.txt for more info. -"""Contain the tests for the CspMaster.""" - -# Standard imports -import sys -import os -import time -import pytest -# Tango imports -import tango -from tango import DevState -from tango.test_context import DeviceTestContext -#Local imports -from csp_lmc_common.CspSubarray import CspSubarray -from ska.base.control_model import AdminMode, ObsState, HealthState - -# Device test case -@pytest.mark.usefixtures("tango_context", "csp_master") - -class TestCspSubarray(object): - properties = {'CspMaster': 'common/elt/master', - 'CbfSubarray': 'mid_csp_cbf/sub_elt/subarray_01', - 'PssSubarray': 'mid_csp_pss/sub_elt/subarray_01', - 'SubID': 1, - } - - @classmethod - def mocking(cls): - """Mock external libraries.""" - # Example : Mock numpy - # cls.numpy = SKASubarray.numpy = MagicMock() - # PROTECTED REGION ID(SKASubarray.test_mocking) ENABLED START # - # PROTECTED REGION END # // SKASubarray.test_mocking - - def test_init_State(self, tango_context): - """Test for State at initialization """ - state = tango_context.device.state() - assert state not in [DevState.FAULT] - - def test_cbfsubarray_state(self, tango_context): - assert tango_context.device.cbfSubarrayState == DevState.OFF - - def test_cbfsubarray_adminMode(self, tango_context): - assert tango_context.device.cbfSubarrayAdminMode == AdminMode.MAINTENANCE - - def test_cbfsubarray_healthState(self, tango_context): - assert tango_context.device.cbfSubarrayHealthState == HealthState.OK - - def test_psssubarray_state(self, tango_context): - assert tango_context.device.pssSubarrayState == DevState.DISABLE - - def test_psssubarray_adminMode(self, tango_context): - assert tango_context.device.pssSubarrayAdminMode == AdminMode.NOT_FITTED - - def test_psssubarray_healthState(self, tango_context): - assert tango_context.device.pssSubarrayHealthState == HealthState.UNKNOWN - - def test_psssubarray_obsState(self, tango_context): - assert tango_context.device.pssSubarrayObsState == ObsState.IDLE - - def test_init_obsState(self, tango_context): - """Test the obsState value at initialization """ - obs_state = tango_context.device.obsState - assert obs_state == ObsState.EMPTY - - def test_commands_progress(self, tango_context): - """Test xxCmdProgress attributes """ - assert tango_context.device.scanCmdProgress == 0 - assert tango_context.device.endScanCmdProgress == 0 - assert tango_context.device.goToIdleCmdProgress == 0 - ''' - def test_configure_invalid_state(self, tango_context): - """ Test Configure command execution when subarray - State is not ON - """ - with pytest.raises(tango.DevFailed) as df: - tango_context.device.Configure("") - assert "Command Configure not allowed" in df.value.args[0].desc - - def test_subarray_off(self, tango_context, csp_master): - """ Test subarray state after power-on - NOTE: this is a wrong behaviour of CbfSubarray that - starts in DISABLE state with adminMode = ONLINE and - it moves to OFF only after a power-on. - The CbfSubarray has to start in OFF State when it is - ONLINE and there is no need to power-on it. - This behavior has to be changed - """ - csp_master.On(["mid_csp_cbf/sub_elt/master",]) - time.sleep(4) - csp_state = csp_master.State() - state = tango_context.device.cbfSubarrayState - assert state == DevState.OFF - ''' - - #def test_remove_timing_beams_while_add_is_running_state(self, tango_context): - # """ Test the execution of the RemovingTimingBeams" while - # the AddTimingBeams is already running - # """ - # tango_context.device.AddTimingBeams([1,2,3]) - # with pytest.raises(tango.DevFailed) as df: - # tango_context.device.RemoveTimingBeams([1,2]) - # assert "Can't execute command" in df.value.args[0].desc diff --git a/csp-lmc-common/tests/conftest.py b/csp-lmc-common/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..4748ce899ffee2c827c218bc5cf3721f3893b8d5 --- /dev/null +++ b/csp-lmc-common/tests/conftest.py @@ -0,0 +1,166 @@ +""" +This module contains pytest fixtures and other test setups common to +all ska.low.mccs tests: unit, integration and functional (BDD) +""" +import json +import pytest + + +def pytest_addoption(parser): + """ + Pytest hook; implemented to add the `--true-context` option, used to + indicate that a true Tango subsystem is available, so there is no + need for a MultiDeviceTestContext + + :param parser: the command line options parser + :type parser: an argparse parser + """ + parser.addoption( + "--true-context", + action="store_true", + help=( + "Tell pytest that you have a true Tango context and don't " + "need to spin up a Tango test context" + ), + ) + + +def _load_data_from_json(path): + """ + Loads a dataset from a named json file. + + :param path: path to the JSON file from which the dataset is to be + loaded. + :type name: string + """ + with open(path, "r") as json_file: + return json.load(json_file) + + +def _load_devices(path, device_names): + """ + Loads device configuration data for specified devices from a + specified JSON configuration file. + + :param path: path to the JSON configuration file + :type path: string + :param device_names: names of the devices for which configuration + data should be loaded + :type device_names: list of string + """ + configuration = _load_data_from_json(path) + devices_by_class = {} + + servers = configuration["servers"] + for server in servers: + print("server:{}".format(server)) + for device_name in servers[server]: + if device_name in device_names: + for class_name, device_info in servers[server][device_name].items(): + if class_name not in devices_by_class: + devices_by_class[class_name] = [] + for fqdn, device_specs in device_info.items(): + devices_by_class[class_name].append( + {"name": fqdn, **device_specs} + ) + + devices_info = [] + for device_class in devices_by_class: + device_info = [] + for device in devices_by_class[device_class]: + device_info.append(device) + + devices_info.append({"class": device_class, "devices": device_info}) + + print("devices_info:{}".format(devices_info)) + return devices_info + + +@pytest.fixture(scope="module") +def devices_to_load(request): + """ + Fixture that returns the "devices_to_load" variable from the module + under test. This variable is a dictionary containing three entries: + + * "path": the path to a JSON file containing device configuration + information in dsconfig format + * "package": the package from which classes will be loaded; for + example, if the package is "ska.low.mccs", then if the JSON + configuration file refers to a class named "MccsMaster", then this + will be interpretated as the ska.low.mccs.MccsMaster class + * "devices": a list of names of the devices that are to be loaded. + + """ + return getattr(request.module, "devices_to_load") + + +@pytest.fixture(scope="module") +def device_to_load(request): + """ + Fixture that returns the "device_to_load" variable from the module + under test. This variable is a dictionary containing three entries: + + * "path": the path to a JSON file containing device configuration + information in dsconfig format + * "package": the package from which classes will be loaded; for + example, if the package is "ska.low.mccs", then if the JSON + configuration file refers to a class named "MccsMaster", then this + will be interpretated as the ska.low.mccs.MccsMaster class + * "device": the name of the devices that is to be loaded. + + """ + return getattr(request.module, "device_to_load", None) + + +@pytest.fixture(scope="module") +def device_info(device_to_load): + """ + Constructs a device_info dictionary in the form required by + tango.test_context.DeviceTestContext, with the device as specified + by the device_to_load fixture + + :param device_to_load: fixture that provides a specification of the + device that is to be included in the devices_info dictionary + :type device_to_load: specification of devices to be loaded + :type device_to_load: dictionary + """ + devices = _load_devices( + path=device_to_load["path"], device_names=[device_to_load["device"]] + ) + print("devices:{}".format(devices)) + print("devices[0]:{}".format(devices[0])) + print("devices[0] class:{}".format(devices[0]["class"])) + class_to_import = devices[0]["class"] + print("class to import:{}".format(class_to_import)) + package = __import__(device_to_load["package"], fromlist=class_to_import) + print("package:{}".format(package)) + + return { + "class": getattr(package, devices[0]["class"]), + "properties": devices[0]["devices"][0]["properties"], + } + + +@pytest.fixture(scope="module") +def devices_info(devices_to_load): + """ + Constructs a devices_info dictionary in the form required by + tango.test_context.MultiDeviceTestContext, with devices as specified + by the devices_to_load fixture + + :param devices_to_load: fixture that provides a specification of the + devices that are to be included in the devices_info dictionary + :type devices_to_load: specification of devices to be loaded + :type devices_to_load: dictionary + """ + devices = _load_devices( + path=devices_to_load["path"], device_names=devices_to_load["devices"] + ) + + classes_to_import = list(set(device["class"] for device in devices)) + package = __import__(devices_to_load["package"], fromlist=classes_to_import) + + for device in devices: + device["class"] = getattr(package, device["class"]) + + return devices diff --git a/csp-lmc-common/tests/unit/CspMaster_test.py b/csp-lmc-common/tests/unit/CspMaster_test.py new file mode 100755 index 0000000000000000000000000000000000000000..b95bb659602e1ba78b3bcc193a8b8669bed9a4b8 --- /dev/null +++ b/csp-lmc-common/tests/unit/CspMaster_test.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# This file is part of the csp-lmc project +# +# +# +# Distributed under the terms of the BSD-3-Clause license. +# See LICENSE.txt for more info. +"""Contain the tests for the CspMaster.""" + +# Standard imports +import numpy as np +import pytest +import tango +from tango import DevState +from tango.test_context import DeviceTestContext + +#Local imports +from csp_lmc_common import CspMaster +from ska.base.control_model import AdminMode, HealthState + +device_to_load = { + "path": "docker/config/csplmc_dsconfig.json", + "package": "csp_lmc_common", + "device": "commaster", +} +# Device test case + +@pytest.mark.mock_device_proxy +class TestCspMaster: + + def test_State(self, device_under_test): + """Test for State after initialization + NOTE: the CspMaster device state is ALARM because + this device relies on several forwarded attributes. + """ + # reinitalize Csp Master and CbfMaster devices + csp_state = device_under_test.State() + print(csp_state) + assert csp_state not in [DevState.FAULT, DevState.DISABLE] + + def test_adminMode_offline(self, device_under_test): + """ Test the adminMode attribute w/r""" + device_under_test.adminMode = AdminMode.OFFLINE + assert device_under_test.adminMode.value == AdminMode.OFFLINE + + def test_adminMode_online(self, device_under_test): + """ Test the adminMode attribute w/r""" + device_under_test.adminMode = AdminMode.ONLINE + assert device_under_test.adminMode.value == AdminMode.ONLINE + + def test_write_invalid_admin_mode(self, device_under_test): + + with pytest.raises(tango.DevFailed) as df: + device_under_test.adminMode = 7 + assert "Set value for attribute adminMode is negative or above the maximun authorized" in str(df.value.args[0].desc) + + def test_cspHealthState(self, device_under_test): + """ Test the CSP initial healthState. + NOTE: to build the CSP healthState, the sub-elements + not ONLINE or MAINTENACE are not taken into account. + """ + assert device_under_test.healthState == HealthState.OK + + def test_cbfAdminMode(self, device_under_test): + """ Test the CBF adminMode attribute w/r""" + assert device_under_test.cspCbfAdminMode == AdminMode.NOT_FITTED + + def test_cbfHealthState(self, device_under_test): + """ Test the CBF initial healthState """ + device_under_test.cspCbfHealthState == HealthState.OK + + def test_pssState(self, device_under_test): + """ Test the PSS initial State """ + assert device_under_test.cspPssState == DevState.DISABLE + + def test_pssHealthState(self, device_under_test): + """ Test the PSS initial healthState """ + assert device_under_test.cspPssHealthState == HealthState.UNKNOWN + + def test_pssAdminMode(self, device_under_test): + """ Test the PSS initial adminMode """ + pss_admin = device_under_test.cspPssAdminMode + assert pss_admin == AdminMode.NOT_FITTED + + def test_pstState(self, device_under_test): + """ Test the PST initial State """ + assert device_under_test.cspPstState == DevState.DISABLE + + def test_pstHealthState(self, device_under_test): + """ Test the PST initial healthState """ + assert device_under_test.cspPstHealthState == HealthState.UNKNOWN + + def test_pstAdminMode(self, device_under_test): + """ Test the PST initial adminMode """ + assert device_under_test.cspPstAdminMode == AdminMode.NOT_FITTED + + def test_subelement_cbf_address(self, device_under_test, device_info): + """Test the cbfMasterAdress value""" + cbf_addr = device_under_test.cbfMasterAddress + master_property = device_info['properties'] + cbf_addr_from_property = master_property['CspCbf'] + assert cbf_addr == cbf_addr_from_property[0] + + def test_subelement_pss_address(self, device_under_test, device_info): + """Test the pssMasterAdress value""" + pss_addr = device_under_test.pssMasterAddress + master_property = device_info['properties'] + pss_addr_from_property = master_property['CspPss'] + assert pss_addr == pss_addr_from_property[0] + + def test_subelement_pst_address(self, device_under_test, device_info): + """Test the pstMasterAdress value""" + pst_addr = device_under_test.pstMasterAddress + master_property = device_info['properties'] + pst_addr_from_property = master_property['CspPst'] + assert pst_addr == pst_addr_from_property[0] + + def test_configure_On_command_duration_time(self, device_under_test): + device_under_test.onCmdDurationExpected = 3 + assert device_under_test.onCmdDurationExpected == 3 + + def test_configure_Off_command_duration_time(self, device_under_test): + device_under_test.offCmdDurationExpected = 3 + assert device_under_test.offCmdDurationExpected == 3 + + def test_configure_Standby_command_duration_time(self, device_under_test): + device_under_test.standbyCmdDurationExpected = 3 + assert device_under_test.standbyCmdDurationExpected == 3 diff --git a/csp-lmc-common/tests/unit/CspSubarray_test.py b/csp-lmc-common/tests/unit/CspSubarray_test.py new file mode 100755 index 0000000000000000000000000000000000000000..1eb395036430c8dadac2011cf43fe13bd5ffc40b --- /dev/null +++ b/csp-lmc-common/tests/unit/CspSubarray_test.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# This file is part of the csp-lmc project +# +# +# +# Distributed under the terms of the BSD-3-Clause license. +# See LICENSE.txt for more info. +"""Contain the tests for the CspMaster.""" + +# Standard imports +import pytest +# Tango imports +import tango +from tango import DevState +from tango.test_context import DeviceTestContext +#Local imports +from csp_lmc_common import CspSubarray +from ska.base.control_model import AdminMode, ObsState, HealthState + +# Device test case +device_to_load = { + "path": "docker/config/csplmc_dsconfig.json", + "package": "csp_lmc_common", + "device": "comsub1", +} + +@pytest.mark.mock_device_proxy +class TestCspSubarray: + def test_init_State(self, device_under_test): + """Test for State at initialization """ + state = device_under_test.State() + print("state:{}".format(state)) + assert state not in [DevState.FAULT] + + def test_cbfsubarray_state(self, device_under_test): + assert device_under_test.cbfSubarrayState == DevState.DISABLE + + def test_cbfsubarray_adminMode(self, device_under_test): + assert device_under_test.cbfSubarrayAdminMode == AdminMode.NOT_FITTED + + def test_cbfsubarray_healthState(self, device_under_test): + assert device_under_test.cbfSubarrayHealthState == HealthState.UNKNOWN + + def test_psssubarray_state(self, device_under_test): + assert device_under_test.pssSubarrayState == DevState.DISABLE + + def test_psssubarray_adminMode(self, device_under_test): + assert device_under_test.pssSubarrayAdminMode == AdminMode.NOT_FITTED + + def test_psssubarray_healthState(self, device_under_test): + assert device_under_test.pssSubarrayHealthState == HealthState.UNKNOWN + + def test_psssubarray_obsState(self, device_under_test): + assert device_under_test.pssSubarrayObsState == ObsState.IDLE + + def test_init_obsState(self, device_under_test): + """Test the obsState value at initialization """ + obs_state = device_under_test.obsState + assert obs_state == ObsState.EMPTY + + def test_commands_progress(self, device_under_test): + """Test xxCmdProgress attributes """ + assert device_under_test.scanCmdProgress == 0 + assert device_under_test.endScanCmdProgress == 0 + assert device_under_test.goToIdleCmdProgress == 0 + ''' + def test_configure_invalid_state(self, device_under_test): + """ Test Configure command execution when subarray + State is not ON + """ + with pytest.raises(tango.DevFailed) as df: + device_under_test.Configure("") + assert "Command Configure not allowed" in df.value.args[0].desc + + def test_subarray_off(self, device_under_test, csp_master): + """ Test subarray state after power-on + NOTE: this is a wrong behaviour of CbfSubarray that + starts in DISABLE state with adminMode = ONLINE and + it moves to OFF only after a power-on. + The CbfSubarray has to start in OFF State when it is + ONLINE and there is no need to power-on it. + This behavior has to be changed + """ + csp_master.On(["mid_csp_cbf/sub_elt/master",]) + time.sleep(4) + csp_state = csp_master.State() + state = device_under_test.cbfSubarrayState + assert state == DevState.OFF + ''' + + #def test_remove_timing_beams_while_add_is_running_state(self, device_under_test): + # """ Test the execution of the RemovingTimingBeams" while + # the AddTimingBeams is already running + # """ + # device_under_test.AddTimingBeams([1,2,3]) + # with pytest.raises(tango.DevFailed) as df: + # device_under_test.RemoveTimingBeams([1,2]) + # assert "Can't execute command" in df.value.args[0].desc diff --git a/csp-lmc-common/tests/unit/conftest.py b/csp-lmc-common/tests/unit/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..3d0e2e9877cb492f49fe149af408b0c9a4580d44 --- /dev/null +++ b/csp-lmc-common/tests/unit/conftest.py @@ -0,0 +1,75 @@ +""" +This module contains pytest fixtures and other test setups for the +ska.low.mccs unit tests +""" +from collections import defaultdict +import pytest + +# import tango +from tango.test_context import DeviceTestContext + + +def pytest_itemcollected(item): + """ + pytest hook implementation; add the "forked" custom mark to all + tests that use the `device_context` fixture, causing them to be + sandboxed in their own process + + param item: the collected test for which this hook is called + type item: a collected test + """ + if "device_under_test" in item.fixturenames: + item.add_marker("forked") + + +def pytest_configure(config): + """ + pytest hook, used here to register custom marks to get rid of spurious + warnings + """ + config.addinivalue_line( + "markers", "mock_device_proxy: the test requires tango.DeviceProxy to be mocked" + ) + + +# @pytest.fixture(scope="module") +# def device_info(request): +# """ +# Pytest fixture that retrieves the `device_info` (note singular +# "device") attribute from the module under test. The `device_info` +# attribute contains information about the device under test, such as +# property values, necessary to stand up that device in a +# tango.DeviceTestContext for unit testing. + +# :param request: A pytest object giving access to the requesting test +# context. +# :type request: _pytest.fixtures.SubRequest +# """ +# yield getattr(request.module, "device_info") + + +@pytest.fixture(scope="function") +def device_under_test(request, device_info, mocker): + """ + Creates and returns a DeviceProxy under a DeviceTestContext. + + For tests that are marked with the custom "mock_device_proxy" marker + (i.e. `@pytest.mark.mock_device_proxy`), `tango.DeviceProxy` will be + mocked prior to initialisation of the device under test. + + :param device_info: Information about the device under test that is + needed to stand the device up in a DeviceTestContext, such as + the device class and properties + :type device_info: dict + """ + mock_device_proxy = request.node.get_closest_marker("mock_device_proxy") is not None + if mock_device_proxy: + mock_device_proxies = defaultdict(mocker.Mock) + mocker.patch( + "tango.DeviceProxy", side_effect=lambda fqdn: mock_device_proxies[fqdn] + ) + + with DeviceTestContext( + device_info["class"], properties=device_info["properties"] + ) as device_under_test: + yield device_under_test diff --git a/csp-lmc-mid/.gitlab-ci.yml b/csp-lmc-mid/.gitlab-ci.yml index 1b8306a6c21b38c7311b3a123894b1c5f7227726..11e12e8381437dfd8b6064b650b1e8b0cbe558af 100644 --- a/csp-lmc-mid/.gitlab-ci.yml +++ b/csp-lmc-mid/.gitlab-ci.yml @@ -39,7 +39,7 @@ build:csp-lmc-mid_pkg: only: [master] # -# Build csp-lmc-mid image +# Build and push csp-lmc-mid image # build:csp-lmc-mid_image: image: nexus.engageska-portugal.pt/ska-docker/tango-builder:latest @@ -51,8 +51,9 @@ build:csp-lmc-mid_image: script: - cd $BUILD_PATH - make build + - make push variables: - BUILD_PATH: csp-lmc-mid/docker + BUILD_PATH: csp-lmc-mid # test:csp-lmc-mid: # stage: test @@ -76,38 +77,71 @@ build:csp-lmc-mid_image: # .test: - image: nexus.engageska-portugal.pt/ska-docker/tango-builder:latest - before_script: - - docker login -u $DOCKER_REGISTRY_USERNAME -p $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY_HOST - tags: - - docker-executor + stage: test artifacts: paths: - ./$BUILD_PATH/build/ variables: - BUILD_PATH: csp-lmc-mid/docker - -test:csp-lmc-mid: + BUILD_PATH: csp-lmc-mid + # +#unit:csp-lmc-mid: +# extends: .test +# stage: test +# script: +# - cd $BUILD_PATH +# - pwd +# - python3 -m pip install -r requirements-tst.txt +# - python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt +# - python3 setup.py test --addopts='-k-integration' |tee setup_py_test.stdout +# - pwd +# - mkdir -p build/reports +# - ls -alR +# - mv setup_py_test.stdout build/csp-lmc-mid-setup-test.stdout +# - mv htmlcov build/csp-lmc-mid_htmlcov +# - mv coverage.xml build + +integration:csp-lmc-mid: + tags: + - docker-executor extends: .test - stage: test + image: nexus.engageska-portugal.pt/ska-docker/deploy:0.4.1 script: + - export KUBE_NAMESPACE="ci-csp-proto-$CI_COMMIT_SHORT_SHA" - cd $BUILD_PATH - - make test + - make k8s_test + environment: + name: test + after_script: + - export KUBE_NAMESPACE="ci-csp-proto-$CI_COMMIT_SHORT_SHA" + - cd $BUILD_PATH + - ls -lR + - pwd + - make delete + - make delete_namespace # linting stage -.linting: - extends: .test +# +linting:csp-lmc-mid: + image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest stage: linting + tags: + - docker-executor + artifacts: + paths: + - ./$BUILD_PATH/build/ dependencies: [] script: - apt-get -y update - apt-get install -y python3-pip python3-setuptools python3-wheel --no-install-recommends + - python3 -m pip install pylint2junit - cd $BUILD_PATH - - make lint - -linting:csp-lmc-mid: - extends: .linting - dependencies: [] + - python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt + - mkdir -p build/reports + - pylint --output-format=parseable csp_lmc_mid | tee ./build/csp_lmc_mid-code-analysis.stdout + - pylint --output-format=pylint2junit.JunitReporter csp_lmc_mid > ./build/reports/csp-lmc-mid-linting.xml + - ls -alR + variables: + BUILD_PATH: csp-lmc-mid # # Publish csp-lmc-mid python package @@ -122,7 +156,7 @@ linting:csp-lmc-mid: tags: - docker-executor before_script: - - python3 -m pip install twine + - pip install twine .publish_python_dev: extends: .publish_python @@ -154,6 +188,19 @@ publish:csp-lmc-mid: variables: BUILD_PATH: csp-lmc-mid +publish_chart: + variables: + CHARTS_TO_PUBLISH: csp-proto + stage: publish + tags: + - docker-executor + image: nexus.engageska-portugal.pt/ska-docker/deploy:0.4.2 + script: + - cd $BUILD_PATH + - curl -s https://gitlab.com/ska-telescope/stupid/raw/master/scripts/publish-charts.sh | bash + variables: + BUILD_PATH: csp-lmc-mid + # # Release csp-lmc-mid image on nexus # @@ -171,4 +218,4 @@ release csp-lmc-mid image: refs: - master variables: - BUILD_PATH: csp-lmc-mid/docker + BUILD_PATH: csp-lmc-mid diff --git a/csp-lmc-mid/.make/.make-release-support b/csp-lmc-mid/.make/.make-release-support new file mode 100644 index 0000000000000000000000000000000000000000..f1f3a2cb9fb3ea0ce3a173a35c3c9fe316d75156 --- /dev/null +++ b/csp-lmc-mid/.make/.make-release-support @@ -0,0 +1,106 @@ +#!/bin/bash +# +# Copyright 2015 Xebia Nederland B.V. +# Modifications copyright 2019 SKA Organisation +# +# 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. +# +function hasChanges() { + test -n "$(git status -s .)" +} + +function getRelease() { + awk -F= '/^release=/{print $2}' .release +} + +function getBaseTag() { + sed -n -e "s/^tag=\(.*\)$(getRelease)\$/\1/p" .release +} + +function getTag() { + if [ -z "$1" ] ; then + awk -F= '/^tag/{print $2}' .release + else + echo "$(getBaseTag)$1" + fi +} + +function setRelease() { + if [ -n "$1" ] ; then + sed -i.x -e "s/^tag=.*/tag=$(getTag $1)/" .release + sed -i.x -e "s/^release=.*/release=$1/g" .release + rm -f .release.x + runPreTagCommand "$1" + else + echo "ERROR: missing release version parameter " >&2 + return 1 + fi +} + +function runPreTagCommand() { + if [ -n "$1" ] ; then + COMMAND=$(sed -n -e "s/@@RELEASE@@/$1/g" -e 's/^pre_tag_command=\(.*\)/\1/p' .release) + if [ -n "$COMMAND" ] ; then + if ! OUTPUT=$(bash -c "$COMMAND" 2>&1) ; then echo $OUTPUT >&2 && exit 1 ; fi + fi + else + echo "ERROR: missing release version parameter " >&2 + return 1 + fi +} + +function tagExists() { + tag=${1:-$(getTag)} + test -n "$tag" && test -n "$(git tag | grep "^$tag\$")" +} + +function differsFromRelease() { + tag=$(getTag) + ! tagExists $tag || test -n "$(git diff --shortstat -r $tag .)" +} + +function getVersion() { + result=$(getRelease) + + if differsFromRelease; then + result="$result-$(git log -n 1 --format=%h .)" + fi + + if hasChanges ; then + result="$result-dirty" + fi + echo $result +} + +function nextPatchLevel() { + version=${1:-$(getRelease)} + major_and_minor=$(echo $version | cut -d. -f1,2) + patch=$(echo $version | cut -d. -f3) + version=$(printf "%s.%d" $major_and_minor $(($patch + 1))) + echo $version +} + +function nextMinorLevel() { + version=${1:-$(getRelease)} + major=$(echo $version | cut -d. -f1); + minor=$(echo $version | cut -d. -f2); + version=$(printf "%d.%d.0" $major $(($minor + 1))) ; + echo $version +} + +function nextMajorLevel() { + version=${1:-$(getRelease)} + major=$(echo $version | cut -d. -f1); + version=$(printf "%d.0.0" $(($major + 1))) + echo $version +} diff --git a/csp-lmc-mid/.make/k8s.mk b/csp-lmc-mid/.make/k8s.mk new file mode 100644 index 0000000000000000000000000000000000000000..f3ce0584b26d4129ab929ded91a4d604bd6498a4 --- /dev/null +++ b/csp-lmc-mid/.make/k8s.mk @@ -0,0 +1,299 @@ +IMAGE_TO_RUN_TEST ?= nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest +k8s: ## Which kubernetes are we connected to + @echo "Kubernetes cluster-info:" + @kubectl cluster-info + @echo "" + @echo "kubectl version:" + @kubectl version + @echo "" + @echo "Helm version:" + @helm version --client + +namespace: ## create the kubernetes namespace + kubectl describe namespace $(KUBE_NAMESPACE) || kubectl create namespace $(KUBE_NAMESPACE) + +delete_namespace: ## delete the kubernetes namespace + @if [ "default" == "$(KUBE_NAMESPACE)" ] || [ "kube-system" == "$(KUBE_NAMESPACE)" ]; then \ + echo "You cannot delete Namespace: $(KUBE_NAMESPACE)"; \ + exit 1; \ + else \ + kubectl describe namespace $(KUBE_NAMESPACE) && kubectl delete namespace $(KUBE_NAMESPACE); \ + fi + +deploy: namespace mkcerts depends ## deploy the helm chart + @helm install $(HELM_RELEASE) charts/$(HELM_CHART)/ \ + --namespace $(KUBE_NAMESPACE) \ + --set xauthority="$(XAUTHORITYx)" \ + --set display="$(DISPLAY)" \ + --set ingress.hostname=$(INGRESS_HOST) \ + --set helmTests=false + +delete: ## delete the helm chart release + @helm uninstall $(HELM_RELEASE) --namespace $(KUBE_NAMESPACE) + # if charts deployed locally, remove the repo charts files + # created in charts/mid-csp/charts directory + @if [ "a"$(CI_JOB_ID) == "a" ]; then \ + find ./charts -type f -name "tango*" -delete; \ + find ./charts -type f -name "csp-proto*" -delete; \ + find ./charts -type f -name "requirements.lock" -delete; \ + fi + +install: namespace mkcerts ## install the helm chart + @helm install $(HELM_RELEASE) charts/$(HELM_CHART)/ \ + --namespace $(KUBE_NAMESPACE) \ + --set xauthority="$(XAUTHORITYx)" \ + --set display="$(DISPLAY)" \ + --set ingress.hostname=$(INGRESS_HOST) + +show: mkcerts ## show the helm chart + @helm template $(HELM_RELEASE) charts/$(HELM_CHART)/ \ + --namespace $(KUBE_NAMESPACE) \ + --set xauthority="$(XAUTHORITYx)" \ + --set display="$(DISPLAY)" \ + --set ingress.hostname=$(INGRESS_HOST) + +chart_lint: ## lint check the helm chart + @for i in `ls charts/`; \ + do echo " char dir$${i}"; \ + helm lint charts/$${i}/ \ + --namespace $(KUBE_NAMESPACE) \ + --set ingress.hostname=$(INGRESS_HOST) \ + --set xauthority="$(XAUTHORITYx)" \ + --set display="$(DISPLAY)";\ + done + +helm_delete: ## delete the helm chart release (with Tiller) + @helm delete $(HELM_RELEASE) --purge \ + + +traefik: ## install the helm chart for traefik (in the kube-system namespace). @param: EXTERNAL_IP (i.e. private ip of the master node). + @TMP=`mktemp -d`; \ + $(helm_add_stable_repo) && \ + helm fetch stable/traefik --untar --untardir $$TMP && \ + helm template $(helm_install_shim) $$TMP/traefik -n traefik0 --namespace kube-system \ + --set externalIP="$(EXTERNAL_IP)" \ + | kubectl apply -n kube-system -f - && \ + rm -rf $$TMP ; \ + + +delete_traefik: ## delete the helm chart for traefik. @param: EXTERNAL_IP + @TMP=`mktemp -d`; \ + $(helm_add_stable_repo) && \ + helm fetch stable/traefik --untar --untardir $$TMP && \ + helm template $(helm_install_shim) $$TMP/traefik -n traefik0 --namespace kube-system \ + --set externalIP="$(EXTERNAL_IP)" \ + | kubectl delete -n kube-system -f - && \ + rm -rf $$TMP + +describe: ## describe Pods executed from Helm chart + @for i in `kubectl -n $(KUBE_NAMESPACE) get pods -l release=$(HELM_RELEASE) -o=name`; \ + do echo "---------------------------------------------------"; \ + echo "Describe for $${i}"; \ + echo kubectl -n $(KUBE_NAMESPACE) describe $${i}; \ + echo "---------------------------------------------------"; \ + kubectl -n $(KUBE_NAMESPACE) describe $${i}; \ + echo "---------------------------------------------------"; \ + echo ""; echo ""; echo ""; \ + done + +logs: ## show Helm chart POD logs + @for i in `kubectl -n $(KUBE_NAMESPACE) get pods -l release=$(HELM_RELEASE) -o=name`; \ + do \ + echo "---------------------------------------------------"; \ + echo "Logs for $${i}"; \ + echo kubectl -n $(KUBE_NAMESPACE) logs $${i}; \ + echo kubectl -n $(KUBE_NAMESPACE) get $${i} -o jsonpath="{.spec.initContainers[*].name}"; \ + echo "---------------------------------------------------"; \ + for j in `kubectl -n $(KUBE_NAMESPACE) get $${i} -o jsonpath="{.spec.initContainers[*].name}"`; do \ + RES=`kubectl -n $(KUBE_NAMESPACE) logs $${i} -c $${j} 2>/dev/null`; \ + echo "initContainer: $${j}"; echo "$${RES}"; \ + echo "---------------------------------------------------";\ + done; \ + echo "Main Pod logs for $${i}"; \ + echo "---------------------------------------------------"; \ + for j in `kubectl -n $(KUBE_NAMESPACE) get $${i} -o jsonpath="{.spec.containers[*].name}"`; do \ + RES=`kubectl -n $(KUBE_NAMESPACE) logs $${i} -c $${j} 2>/dev/null`; \ + echo "Container: $${j}"; echo "$${RES}"; \ + echo "---------------------------------------------------";\ + done; \ + echo "---------------------------------------------------"; \ + echo ""; echo ""; echo ""; \ + done + +localip: ## set local Minikube IP in /etc/hosts file for Ingress $(INGRESS_HOST) + @new_ip=`minikube ip` && \ + existing_ip=`grep $(INGRESS_HOST) /etc/hosts || true` && \ + echo "New IP is: $${new_ip}" && \ + echo "Existing IP: $${existing_ip}" && \ + if [ -z "$${existing_ip}" ]; then echo "$${new_ip} $(INGRESS_HOST)" | sudo tee -a /etc/hosts; \ + else sudo perl -i -ne "s/\d+\.\d+.\d+\.\d+/$${new_ip}/ if /$(INGRESS_HOST)/; print" /etc/hosts; fi && \ + echo "/etc/hosts is now: " `grep $(INGRESS_HOST) /etc/hosts` + +mkcerts: ## Make dummy certificates for $(INGRESS_HOST) and Ingress + @if [ ! -d charts/$(HELM_CHART)/secrets ]; then \ + mkdir -p charts/$(HELM_CHART)/secrets; \ + else \ + echo "Creating secrets directory in $(HELM_CHART)"; \ + fi + @if [ ! -f charts/$(HELM_CHART)/secrets/tls.key ]; then \ + openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 \ + -keyout charts/$(HELM_CHART)/secrets/tls.key \ + -out charts/$(HELM_CHART)/secrets/tls.crt \ + -subj "/CN=$(INGRESS_HOST)/O=Minikube"; \ + else \ + echo "SSL cert already exits in charts/$(HELM_CHART)/secrets ... skipping"; \ + fi + +# Utility target to install Helm dependencies +helm_dependencies: + @which helm ; rc=$$?; \ + if [[ $$rc != 0 ]]; then \ + curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3; \ + chmod 700 get_helm.sh; \ + ./get_helm.sh; \ + fi; \ + helm version --client + +# Utility target to install K8s dependencies +kubectl_dependencies: + @([ -n "$(KUBE_CONFIG_BASE64)" ] && [ -n "$(KUBECONFIG)" ]) || (echo "unset variables [KUBE_CONFIG_BASE64/KUBECONFIG] - abort!"; exit 1) + @which kubectl ; rc=$$?; \ + if [[ $$rc != 0 ]]; then \ + curl -L -o /usr/bin/kubectl "https://storage.googleapis.com/kubernetes-release/release/$(KUBERNETES_VERSION)/bin/linux/amd64/kubectl"; \ + chmod +x /usr/bin/kubectl; \ + mkdir -p /etc/deploy; \ + echo $(KUBE_CONFIG_BASE64) | base64 -d > $(KUBECONFIG); \ + fi + @echo -e "\nkubectl client version:" + @kubectl version --client + @echo -e "\nkubectl config view:" + @kubectl config view + @echo -e "\nkubectl config get-contexts:" + @kubectl config get-contexts + @echo -e "\nkubectl version:" + @kubectl version + +kubeconfig: ## export current KUBECONFIG as base64 ready for KUBE_CONFIG_BASE64 + @KUBE_CONFIG_BASE64=`kubectl config view --flatten | base64 -w 0`; \ + echo "KUBE_CONFIG_BASE64: $$(echo $${KUBE_CONFIG_BASE64} | cut -c 1-40)..."; \ + echo "appended to: PrivateRules.mak"; \ + echo -e "\n\n# base64 encoded from: kubectl config view --flatten\nKUBE_CONFIG_BASE64 = $${KUBE_CONFIG_BASE64}" >> PrivateRules.mak + +wait: + @echo "Waiting for device servers to be ready" + @date + @kubectl -n $(KUBE_NAMESPACE) get pods -l cspServer + @jobs=$$(kubectl get job --output=jsonpath={.items..metadata.name} -n $(KUBE_NAMESPACE)); kubectl wait job --for=condition=complete --timeout=300s $$jobs -n $(KUBE_NAMESPACE) + @kubectl -n $(KUBE_NAMESPACE) wait --for=condition=ready --timeout=300s -l cspServer pods + @date + +# +# defines a function to copy the ./test-harness directory into the K8s TEST_RUNNER +# and then runs the requested make target in the container. +# capture the output of the test in a tar file +# stream the tar file base64 encoded to the Pod logs +# +k8s_test = tar -c . | \ + kubectl run $(TEST_RUNNER) \ + --namespace $(KUBE_NAMESPACE) -i --wait --restart=Never \ + --image-pull-policy=IfNotPresent \ + --image=$(IMAGE_TO_RUN_TEST) -- \ + /bin/bash -c "tar xv --strip-components 1 --warning=all && \ + python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt &&\ + python3 -m pip install . &&\ + cd test-harness &&\ + make TANGO_HOST=databaseds-tango-base-$(HELM_RELEASE):10000 $1 && \ + tar -czvf /tmp/build.tgz build && \ + echo '~~~~BOUNDARY~~~~' && \ + cat /tmp/build.tgz | base64 && \ + echo '~~~~BOUNDARY~~~~'" \ + 2>&1 + +# run the test function +# save the status +# clean out build dir +# print the logs minus the base64 encoded payload +# pull out the base64 payload and unpack build/ dir +# base64 payload is given a boundary "~~~~BOUNDARY~~~~" and extracted using perl +# clean up the run to completion container +# exit the saved status +k8s_test: deploy wait## test the application on K8s + @echo "KUBE_NAMESPACE: $(KUBE_NAMESPACE)" + $(call k8s_test,test); \ + status=$$?; \ + rm -fr build; \ + kubectl --namespace $(KUBE_NAMESPACE) logs $(TEST_RUNNER) | perl -ne 'BEGIN {$$on=1;}; if (index($$_, "~~~~BOUNDARY~~~~")!=-1){$$on+=1;next;}; print if $$on % 2;'; \ + kubectl --namespace $(KUBE_NAMESPACE) logs $(TEST_RUNNER) | \ + perl -ne 'BEGIN {$$on=0;}; if (index($$_, "~~~~BOUNDARY~~~~")!=-1){$$on+=1;next;}; print if $$on % 2;' | \ + base64 -d | tar -xzf -; \ + kubectl --namespace $(KUBE_NAMESPACE) delete pod $(TEST_RUNNER); \ + exit $$status + + +rlint: ## run lint check on Helm Chart using gitlab-runner + if [ -n "$(RDEBUG)" ]; then DEBUG_LEVEL=debug; else DEBUG_LEVEL=warn; fi && \ + gitlab-runner --log-level $${DEBUG_LEVEL} exec $(EXECUTOR) \ + --docker-privileged \ + --docker-disable-cache=false \ + --docker-host $(DOCKER_HOST) \ + --docker-volumes $(DOCKER_VOLUMES) \ + --docker-pull-policy always \ + --timeout $(TIMEOUT) \ + --env "DOCKER_HOST=$(DOCKER_HOST)" \ + --env "DOCKER_REGISTRY_USER_LOGIN=$(DOCKER_REGISTRY_USER_LOGIN)" \ + --env "CI_REGISTRY_PASS_LOGIN=$(CI_REGISTRY_PASS_LOGIN)" \ + --env "CI_REGISTRY=$(CI_REGISTRY)" \ + lint-check-chart || true + +# K8s testing with local gitlab-runner +# Run the powersupply tests in the TEST_RUNNER run to completion Pod: +# set namespace +# install dependencies for Helm and kubectl +# deploy into namespace +# run test in run to completion Pod +# extract Pod logs +# set test return code +# delete +# delete namespace +# return result +rk8s_test: ## run k8s_test on K8s using gitlab-runner + if [ -n "$(RDEBUG)" ]; then DEBUG_LEVEL=debug; else DEBUG_LEVEL=warn; fi && \ + KUBE_NAMESPACE=`git rev-parse --abbrev-ref HEAD | tr -dc 'A-Za-z0-9\-' | tr '[:upper:]' '[:lower:]'` && \ + gitlab-runner --log-level $${DEBUG_LEVEL} exec $(EXECUTOR) \ + --docker-privileged \ + --docker-disable-cache=false \ + --docker-host $(DOCKER_HOST) \ + --docker-volumes $(DOCKER_VOLUMES) \ + --docker-pull-policy always \ + --timeout $(TIMEOUT) \ + --env "DOCKER_HOST=$(DOCKER_HOST)" \ + --env "DOCKER_REGISTRY_USER_LOGIN=$(DOCKER_REGISTRY_USER_LOGIN)" \ + --env "CI_REGISTRY_PASS_LOGIN=$(CI_REGISTRY_PASS_LOGIN)" \ + --env "CI_REGISTRY=$(CI_REGISTRY)" \ + --env "KUBE_CONFIG_BASE64=$(KUBE_CONFIG_BASE64)" \ + --env "KUBECONFIG=$(KUBECONFIG)" \ + --env "KUBE_NAMESPACE=$${KUBE_NAMESPACE}" \ + test-chart || true + + +helm_tests: ## run Helm chart tests + helm test $(HELM_RELEASE) --cleanup + +ingress_check: ## curl test Tango REST API - https://tango-controls.readthedocs.io/en/latest/development/advanced/rest-api.html#tango-rest-api-implementations + @echo "---------------------------------------------------" + @echo "Test HTTP:"; echo "" + curl -u "tango-cs:tango" -XGET http://$(INGRESS_HOST)/tango/rest/rc4/hosts/databaseds-tango-example-$(HELM_RELEASE)/10000 | json_pp + @echo "", echo "" + @echo "---------------------------------------------------" + @echo "Test HTTPS:"; echo "" + curl -k -u "tango-cs:tango" -XGET https://$(INGRESS_HOST)/tango/rest/rc4/hosts/databaseds-tango-example-$(HELM_RELEASE)/10000 | json_pp + @echo "" + +help: ## show this help. + @echo "make targets:" + @grep -hE '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + @echo ""; echo "make vars (+defaults):" + @grep -hE '^[0-9a-zA-Z_-]+ \?=.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = " \?\= "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\#\#/ \#/' + +depends: + helm dependency update charts/$(HELM_CHART)/ diff --git a/csp-lmc-mid/.make/postdeploy.mk b/csp-lmc-mid/.make/postdeploy.mk new file mode 100644 index 0000000000000000000000000000000000000000..ffc6536934bc77e3caa4d02fd02ba9211803df15 --- /dev/null +++ b/csp-lmc-mid/.make/postdeploy.mk @@ -0,0 +1,130 @@ +.PHONY: k8s_test smoketest template_tests tango_rest_ingress_check + +# +# IMAGE_TO_TEST defines the tag of the Docker image to test +# +IMAGE_TO_TEST ?= nexus.engageska-portugal.pt/ska-docker/tango-vscode:0.2.4## docker image that will be run for testing purpose +#IMAGE_TO_TEST = $(DOCKER_REGISTRY_HOST)/$(DOCKER_REGISTRY_USER)/$(PROJECT):latest +# Test runner - run to completion job in K8s +TEST_RUNNER = test-makefile-runner-$(CI_JOB_ID)-$(KUBE_NAMESPACE)-$(HELM_RELEASE)##name of the pod running the k8s_tests +# +# defines a function to copy the ./test-harness directory into the K8s TEST_RUNNER +# and then runs the requested make target in the container. +# capture the output of the test in a build folder inside the container +# +TANGO_HOST = databaseds-tango-base-$(HELM_RELEASE):10000 +MARK ?= fast## this will allow to add the mark parameter of pytest +SLEEPTIME ?= 30s ##amount of sleep time for the smoketest target + +# +# defines a function to copy the ./test-harness directory into the K8s TEST_RUNNER +# and then runs the requested make target in the container. +# capture the output of the test in a tar file +# stream the tar file base64 encoded to the Pod logs +# +ktest = tar -c post-deployment/ | \ + kubectl run $(TEST_RUNNER) \ + --namespace $(KUBE_NAMESPACE) -i --wait --restart=Never \ + --image-pull-policy=IfNotPresent \ + --image=$(IMAGE_TO_TEST) -- \ + /bin/bash -c "mkdir csp-lmc-mid && tar xv --directory csp-lmc-mid --strip-components 1 --warning=all && cd csp-lmc-mid && \ + make KUBE_NAMESPACE=$(KUBE_NAMESPACE) HELM_RELEASE=$(HELM_RELEASE) TANGO_HOST=$(TANGO_HOST) MARK=$(MARK) $1 && \ + tar -czvf /tmp/build.tgz build && \ + echo '~~~~BOUNDARY~~~~' && \ + cat /tmp/build.tgz | base64 && \ + echo '~~~~BOUNDARY~~~~'" \ + 2>&1 + +# run the test function +# save the status +# clean out build dir +# print the logs minus the base64 encoded payload +# pull out the base64 payload and unpack build/ dir +# base64 payload is given a boundary "~~~~BOUNDARY~~~~" and extracted using perl +# clean up the run to completion container +# exit the saved status +ktest: smoketest## test the application on K8s + $(call ktest,test); \ + status=$$?; \ + rm -fr build; \ + kubectl --namespace $(KUBE_NAMESPACE) logs $(TEST_RUNNER) | \ + perl -ne 'BEGIN {$$on=0;}; if (index($$_, "~~~~BOUNDARY~~~~")!=-1){$$on+=1;next;}; print if $$on % 2;' | \ + base64 -d | tar -xzf -; \ + kubectl --namespace $(KUBE_NAMESPACE) delete pod $(TEST_RUNNER); \ + exit $$status + + +smoketest: ## check that the number of waiting containers is zero (10 attempts, wait time 30s). + @echo "Smoke test START"; \ + n=10; \ + while [ $$n -gt 0 ]; do \ + waiting=`kubectl get pods -n $(KUBE_NAMESPACE) -o=jsonpath='{.items[*].status.containerStatuses[*].state.waiting.reason}' | wc -w`; \ + echo "Waiting containers=$$waiting"; \ + if [ $$waiting -ne 0 ]; then \ + echo "Waiting $(SLEEPTIME) for pods to become running...#$$n"; \ + sleep $(SLEEPTIME); \ + fi; \ + if [ $$waiting -eq 0 ]; then \ + echo "Smoke test SUCCESS"; \ + exit 0; \ + fi; \ + if [ $$n -eq 1 ]; then \ + waiting=`kubectl get pods -n $(KUBE_NAMESPACE) -o=jsonpath='{.items[*].status.containerStatuses[*].state.waiting.reason}' | wc -w`; \ + echo "Smoke test FAILS"; \ + echo "Found $$waiting waiting containers: "; \ + kubectl get pods -n $(KUBE_NAMESPACE) -o=jsonpath='{range .items[*].status.containerStatuses[?(.state.waiting)]}{.state.waiting.message}{"\n"}{end}'; \ + exit 1; \ + fi; \ + n=`expr $$n - 1`; \ + done + +template_tests: + rc=0; \ + for chrt in `ls charts/`; do \ + helm unittest -f template_tests/*_test.yaml charts/$$chrt \ + || rc=2 && continue; \ + done; \ + exit $$rc + +tango_rest_ingress_check: ## curl test Tango REST API - https://tango-controls.readthedocs.io/en/latest/development/advanced/rest-api.html#tango-rest-api-implementations + @echo "---------------------------------------------------" + @echo "Test HTTP:"; echo "" + curl -u "tango-cs:tango" -XGET http://tango.rest.$(INGRESS_HOST)/tango/rest/rc4/hosts/databaseds-tango-base-$(HELM_RELEASE)/10000 | json_pp + # @echo "", echo "" + # @echo "---------------------------------------------------" + # @echo "Test HTTPS:"; echo "" + # curl -k -u "tango-cs:tango" -XGET https://tango.rest.$(INGRESS_HOST)/tango/rest/rc4/hosts/databaseds-tango-base-$(HELM_RELEASE)/10000 | json_pp + # @echo "" + +oet_podname = $(shell kubectl get pods -l app=rest-oet-$(HELM_RELEASE) -o=jsonpath='{..metadata.name}') +sut_cdm_ver= $(shell kubectl exec -it $(oet_podname) pip list | grep "cdm-shared-library" | awk ' {print $$2}' | awk 'BEGIN { FS = "+" } ; {print $$1}') +sut_cdm_cur_ver=$(shell grep "cdm-shared-library" post-deployment/SUT_requirements.txt | awk 'BEGIN { FS = "==" } ; {print $$2}') +sut_oet_ver = $(shell kubectl exec -it $(oet_podname) pip list | grep "observation-execution-tool" | awk ' {print $$2}' | awk 'BEGIN { FS = "+" } ; {print $$1}') +sut_oet_cur_ver=$(shell grep "observation-execution-tool" post-deployment/SUT_requirements.txt | awk 'BEGIN { FS = "==" } ; {print $$2}') + +check_oet_packages: + @echo "MVP is based on cdm-shared-library=$(sut_cdm_ver)" + @echo "Test are based on cdm-shared-library=$(sut_cdm_cur_ver)" + @if [ $(sut_cdm_ver) != $(sut_cdm_cur_ver) ] ; then \ + echo "Warning: cdm-shared-library package for MVP is not the same as used for testing!"; \ + fi + @echo "MVP is based on observation-execution-tool=$(sut_oet_ver)" + @echo "Test are based on observation-execution-tool=$(sut_oet_cur_ver)" + @if [ $(sut_oet_ver) != $(sut_oet_cur_ver) ] ; then \ + echo "Warning: observation-execution-tool package for MVP is not the same as used for testing!"; \ + fi + +##the following section is for developers requiring the testing pod to be instantiated with a volume mappig to skampi +-include dev-testing.mk + +timestamp=$(shell date -u +"%s") + +sleepy_time: + sleep 5s + +measure_time: + time1=$$SECONDS; \ + make sleepy_time; \ + time2=$$SECONDS; \ + elapsed=$$((time2 - time1)); \ + echo $$elapsed diff --git a/csp-lmc-mid/.make/release.mk b/csp-lmc-mid/.make/release.mk new file mode 100644 index 0000000000000000000000000000000000000000..cdc58a1ceccabd3ea976ca6932ef08574ad22920 --- /dev/null +++ b/csp-lmc-mid/.make/release.mk @@ -0,0 +1,137 @@ +# +# Copyright 2015 Xebia Nederland B.V. +# +# 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. +# +ifneq ($(CI_JOB_ID),) +BRANCH_NAME := $(CI_BUILD_REF_NAME) +else +BRANCH_NAME=$(shell git rev-parse --abbrev-ref HEAD) +endif +ifeq ($(strip $(PROJECT)),) + NAME=$(shell basename $(CURDIR)) +else + NAME=$(PROJECT) +endif + +RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support + +ifeq ($(strip $(DOCKER_REGISTRY_HOST)),) + DOCKER_REGISTRY_HOST = nexus.engageska-portugal.pt +endif + +ifeq ($(strip $(DOCKER_REGISTRY_USER)),) + DOCKER_REGISTRY_USER = ska-docker +endif + +IMAGE=$(DOCKER_REGISTRY_HOST)/$(DOCKER_REGISTRY_USER)/$(NAME) + +VERSION=$(shell . $(RELEASE_SUPPORT) ; getVersion) +TAG=$(shell . $(RELEASE_SUPPORT); getTag) +BASE_RELEASE=$(shell . $(RELEASE_SUPPORT) ;getRelease) + +SHELL=/bin/bash + +DOCKER_BUILD_CONTEXT=. +DOCKER_FILE_PATH=Dockerfile + +.PHONY: pre-build docker-build post-build build release patch-release minor-release major-release tag check-status check-release showver \ + push pre-push do-push post-push + +build: pre-build docker-build post-build ## build the application image + +pre-build: + +post-build: + +pre-push: + +post-push: + +docker-build: .release + docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH) --build-arg DOCKER_REGISTRY_HOST=$(DOCKER_REGISTRY_HOST) --build-arg DOCKER_REGISTRY_USER=$(DOCKER_REGISTRY_USER) + @DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \ + DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \ + if [ $$DOCKER_MAJOR -eq 1 ] && [ $$DOCKER_MINOR -lt 10 ] ; then \ + echo docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\ + docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\ + echo docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE) ;\ + docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE) ;\ + else \ + echo docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\ + echo docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE) ;\ + docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE) ;\ + docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \ + fi + +.release: + @echo "release=0.0.0" > .release + @echo "tag=$(NAME)-0.0.0" >> .release + @echo INFO: .release created + @cat .release + +release: check-status check-release build push + +push: pre-push do-push post-push ## push the image to the Docker registry + +do-push: + @echo "Git branch: $(BRANCH_NAME)"; \ + if [ $(BRANCH_NAME) == "master" ]; then \ + echo "Image tag: $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)" ;\ + docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE);\ + docker push $(IMAGE):$(BASE_RELEASE); \ + else \ + echo "Image tag: $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)-dev" ;\ + docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)-dev ;\ + docker push $(IMAGE):$(BASE_RELEASE)-dev ;\ + fi + +snapshot: build push + +showver: .release + @. $(RELEASE_SUPPORT); getVersion + +bump-patch-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel) +bump-patch-release: .release tag + +bump-minor-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel) +bump-minor-release: .release tag + +bump-major-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel) +bump-major-release: .release tag + +patch-release: tag-patch-release release + @echo $(VERSION) + +minor-release: tag-minor-release release + @echo $(VERSION) + +major-release: tag-major-release release + @echo $(VERSION) + +tag: TAG=$(shell . $(RELEASE_SUPPORT); getTag $(VERSION)) +tag: check-status +# @. $(RELEASE_SUPPORT) ; ! tagExists $(TAG) || (echo "ERROR: tag $(TAG) for version $(VERSION) already tagged in git" >&2 && exit 1) ; + @. $(RELEASE_SUPPORT) ; setRelease $(VERSION) +# git add . +# git commit -m "bumped to version $(VERSION)" ; +# git tag $(TAG) ; +# @ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi + +check-status: + @. $(RELEASE_SUPPORT) ; ! hasChanges || (echo "ERROR: there are still outstanding changes" >&2 && exit 1) ; + +check-release: .release + @. $(RELEASE_SUPPORT) ; tagExists $(TAG) || (echo "ERROR: version not yet tagged in git. make [minor,major,patch]-release." >&2 && exit 1) ; + @. $(RELEASE_SUPPORT) ; ! differsFromRelease $(TAG) || (echo "ERROR: current directory differs from tagged $(TAG). make [minor,major,patch]-release." ; exit 1) + diff --git a/csp-lmc-mid/docker/.release b/csp-lmc-mid/.release similarity index 100% rename from csp-lmc-mid/docker/.release rename to csp-lmc-mid/.release diff --git a/csp-lmc-mid/docker/Dockerfile b/csp-lmc-mid/Dockerfile similarity index 100% rename from csp-lmc-mid/docker/Dockerfile rename to csp-lmc-mid/Dockerfile diff --git a/csp-lmc-mid/Makefile b/csp-lmc-mid/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c72abd72ca7b27f1958ed6c5a059d3e42cf58ba2 --- /dev/null +++ b/csp-lmc-mid/Makefile @@ -0,0 +1,91 @@ +# +# Project makefile for a Tango project. You should normally only need to modify +# DOCKER_REGISTRY_USER and PROJECT below. +# + +# +# DOCKER_REGISTRY_HOST, DOCKER_REGISTRY_USER and PROJECT are combined to define +# the Docker tag for this project. The definition below inherits the standard +# value for DOCKER_REGISTRY_HOST (=rnexus.engageska-portugal.pt) and overwrites +# DOCKER_REGISTRY_USER and PROJECT to give a final Docker tag of +# nexus.engageska-portugal.pt/tango-example/powersupply +# +PROJECT = mid-csp-lmc +DSCONFIG_JSON_FILE ?= csp-lmc-mid/charts/csp-lmc-mid/data/configuration.json + + +# KUBE_NAMESPACE defines the Kubernetes Namespace that will be deployed to +# using Helm. If this does not already exist it will be created +KUBE_NAMESPACE ?= csp-proto + +# HELM_RELEASE is the release that all Kubernetes resources will be labelled +# with +HELM_RELEASE ?= test + +# HELM_CHART the chart name +HELM_CHART ?= mid-csp + +# HELM CHART PACKAGE +HELM_PACKAGE ?= charts/csp-proto + +# INGRESS_HOST is the host name used in the Ingress resource definition for +# publishing services via the Ingress Controller +INGRESS_HOST ?= $(HELM_RELEASE).$(HELM_CHART).local + +# Optional creation of the tango-base dependency +ENABLE_TANGO_BASE ?= true + +# Fixed variables +# Timeout for gitlab-runner when run locally +TIMEOUT = 86400 +# Helm version +HELM_VERSION = v3.2.4 +# kubectl version +KUBERNETES_VERSION = v1.14.1 + +# Docker, K8s and Gitlab CI variables +# gitlab-runner debug mode - turn on with non-empty value +RDEBUG ?= +# gitlab-runner executor - shell or docker +EXECUTOR ?= shell +# DOCKER_HOST connector to gitlab-runner - local domain socket for shell exec +DOCKER_HOST ?= unix:///var/run/docker.sock +# DOCKER_VOLUMES pass in local domain socket for DOCKER_HOST +DOCKER_VOLUMES ?= /var/run/docker.sock:/var/run/docker.sock +# registry credentials - user/pass/registry - set these in PrivateRules.mak +DOCKER_REGISTRY_USER_LOGIN ?= ## registry credentials - user - set in PrivateRules.mak +CI_REGISTRY_PASS_LOGIN ?= ## registry credentials - pass - set in PrivateRules.mak +CI_REGISTRY ?= gitlab.com/ska-telescope/csp-lmc + +CI_PROJECT_DIR ?= . + +KUBE_CONFIG_BASE64 ?= ## base64 encoded kubectl credentials for KUBECONFIG +KUBECONFIG ?= /etc/deploy/config ## KUBECONFIG location + +XAUTHORITYx ?= ${XAUTHORITY} +ifneq ($(CI_JOB_ID),) +THIS_HOST := $(shell ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | head -n1) +DISPLAY := $(THIS_HOST):0 +endif + +# define private overrides for above variables in here +-include PrivateRules.mak + +# Test runner - run to completion job in K8s +TEST_RUNNER = test-runner-$(HELM_CHART)-$(HELM_RELEASE) + +# +# include makefile to pick up the standard Make targets, e.g., 'make build' +# build, 'make push' docker push procedure, etc. The other Make targets +# ('make interactive', 'make test', etc.) are defined in this file. +# +include .make/release.mk +include .make/k8s.mk +include .make/postdeploy.mk + +package: ## package all existing charts into a git based repo + mkdir -p helm-repo + helm package $(HELM_PACKAGE) --destination ./helm-repo ; \ + cd ./helm-repo && helm repo index . + +.PHONY: all test up down help k8s show lint deploy delete logs describe mkcerts localip namespace delete_namespace ingress_check kubeconfig kubectl_dependencies helm_dependencies rk8s_test k8s_test rlint diff --git a/csp-lmc-mid/charts/csp-proto/Chart.yaml b/csp-lmc-mid/charts/csp-proto/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..80601340e8e6abeb0f2a5a6a81d901b187282cf3 --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +appVersion: "0.6.9" +description: A Helm chart for deploying the Mid_CSP.LMC devices on Kubernetes +name: csp-proto +version: 0.1.1 +icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png diff --git a/csp-lmc-mid/charts/csp-proto/data/configuration.json b/csp-lmc-mid/charts/csp-proto/data/configuration.json new file mode 100644 index 0000000000000000000000000000000000000000..fd23f9d50c5104df828e1ab0053fb79889111eed --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/data/configuration.json @@ -0,0 +1,1563 @@ +{ + "servers": { + "CspMaster": { + "csp": { + "CspMaster": { + "mid_csp/elt/master": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "fspMembership": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPSubarrayMembership" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "reportFSPAdminMode": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPAdminMode" + ] + }, + "reportFSPHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPHealthState" + ] + }, + "reportFSPState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPState" + ] + }, + "reportVCCAdminMode": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCAdminMode" + ] + }, + "reportVCCHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCHealthState" + ] + }, + "reportVCCState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCState" + ] + }, + "vccMembership": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCSubarrayMembership" + ] + } + }, + "properties": { + "CspMidCbf": [ + "mid_csp_cbf/sub_elt/master" + ], + "CspMidPss": [ + "mid_csp_pss/sub_elt/master" + ], + "CspMidPst": [ + "mid_csp_pst/sub_elt/master" + ], + "CspSubarrays": [ + "mid_csp/elt/subarray_01", + "mid_csp/elt/subarray_02", + "mid_csp/elt/subarray_03" + ], + "MaxCapabilities": [ + "Subarray:16", + "VlbiBeam:20", + "TimingBeam:16", + "SearchBeam:1500" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000", + "state", + "1000", + "csppststate", + "1000", + "cspcbfstate", + "1000", + "csppsthealthstate", + "1000", + "pssadminmode", + "1000", + "cbfadminmode", + "1000", + "csppssstate", + "1000", + "pstadminmode", + "1000", + "commandprogress", + "3000", + "cspcbfhealthstate", + "1000", + "csppsshealthstate", + "1000" + ] + } + } + } + } + }, + "CspSubarray": { + "sub1": { + "CspSubarray": { + "mid_csp/elt/subarray_01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "receptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/receptors" + ] + }, + "vccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/vccHealthState" + ] + }, + "vccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/vccState" + ] + }, + "cbfOutputLink": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/outputLinksDistribution" + ] + } + }, + "properties": { + "CspMaster": [ + "mid_csp/elt/master" + ], + "SubID": [ + "1" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "obsstate", + "1000", + "obsmode", + "1000" + ] + } + } + } + }, + "sub2": { + "CspSubarray": { + "mid_csp/elt/subarray_02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "receptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/receptors" + ] + }, + "vccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/vccHealthState" + ] + }, + "vccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/vccState" + ] + }, + "cbfOutputLink": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/outputLinksDistribution" + ] + } + }, + "properties": { + "CspMaster": [ + "mid_csp/elt/master" + ], + "SubID": [ + "2" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "obsstate", + "1000", + "obsmode", + "1000" + ] + } + } + } + }, + "sub3": { + "CspSubarray": { + "mid_csp/elt/subarray_03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "receptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/receptors" + ] + }, + "vccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/vccHealthState" + ] + }, + "vccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/vccState" + ] + }, + "cbfOutputLink": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/outputLinksDistribution" + ] + } + }, + "properties": { + "CspMaster": [ + "mid_csp/elt/master" + ], + "SubID": [ + "3" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "obsstate", + "1000", + "obsmode", + "1000" + ] + } + } + } + } + }, + "CspTelState": { + "csp": { + "CspTelState": { + "mid_csp/elt/telstate": { + "attribute_properties": { + }, + "properties": { + } + } + } + } + }, + "DataBaseds": { + "2": { + "DataBase": { + "sys/database/2": {} + } + } + }, + "CbfMaster": { + "master": { + "CbfMaster": { + "mid_csp_cbf/sub_elt/master": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_01", + "mid_csp_cbf/sub_elt/subarray_02", + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "MaxCapabilities": [ + "VCC:4", + "FSP:4", + "Subarray:3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "reportfspstate", + "1000", + "reportvccadminmode", + "1000", + "reportvcchealthstate", + "1000", + "receptortovcc", + "1000", + "reportvccsubarraymembership", + "1000", + "reportfspsubarraymembership", + "1000", + "reportfsphealthstate", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarrayscanid", + "1000", + "reportfspadminmode", + "1000", + "commandprogress", + "2000", + "reportsubarrayhealthstate", + "1000", + "reportvccstate", + "1000", + "reportsubarrayadminmode", + "1000", + "vcctoreceptor", + "3000", + "reportsubarraystate", + "3000", + "state", + "1000" + ] + } + } + } + } + }, + "CbfSubarrayMulti": { + "cbfSubarray-01": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/01_01", + "mid_csp_cbf/fspSubarray/02_01", + "mid_csp_cbf/fspSubarray/03_01", + "mid_csp_cbf/fspSubarray/04_01" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/01" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/01" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "fsphealthstate", + "1000", + "fspstate", + "1000", + "vccstate", + "1000", + "vcchealthstate", + "1000", + "obsstate", + "1000", + "scanid", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/01": {}, + "mid_csp_cbf/sw2/01": {} + } + }, + "cbfSubarray-02": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/01_02", + "mid_csp_cbf/fspSubarray/02_02", + "mid_csp_cbf/fspSubarray/03_02", + "mid_csp_cbf/fspSubarray/04_02" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/02" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/02" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "scanid", + "1000", + "healthstate", + "1000", + "state", + "1000", + "obsstate", + "1000", + "vcchealthstate", + "1000", + "adminmode", + "1000", + "fspstate", + "1000", + "fsphealthstate", + "1000", + "vccstate", + "1000" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/02": {}, + "mid_csp_cbf/sw2/02": {} + } + }, + "cbfSubarray-03": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/01_03", + "mid_csp_cbf/fspSubarray/02_03", + "mid_csp_cbf/fspSubarray/03_03", + "mid_csp_cbf/fspSubarray/04_03" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/03" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/03" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "scanid", + "1000", + "healthstate", + "1000", + "state", + "1000", + "obsstate", + "1000", + "vcchealthstate", + "1000", + "adminmode", + "1000", + "fspstate", + "1000", + "fsphealthstate", + "1000", + "vccstate", + "1000" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/03": {}, + "mid_csp_cbf/sw2/03": {} + } + } + }, + "FspMulti": { + "fsp-01": { + "Fsp": { + "mid_csp_cbf/fsp/01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/01" + ], + "FspID": [ + "1" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/01" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/01" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/01" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/01_01", + "mid_csp_cbf/fspSubarray/01_02", + "mid_csp_cbf/fspSubarray/01_03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/01": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/01": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/01": {} + }, + "FspSubarray": { + "mid_csp_cbf/fspSubarray/01_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "1" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/01_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "1" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/01_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "1" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/01": {} + } + }, + "fsp-02": { + "Fsp": { + "mid_csp_cbf/fsp/02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/02" + ], + "FspID": [ + "2" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/02" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/02" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/02" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/02_01", + "mid_csp_cbf/fspSubarray/02_02", + "mid_csp_cbf/fspSubarray/02_03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/02": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/02": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/02": {} + }, + "FspSubarray": { + "mid_csp_cbf/fspSubarray/02_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "2" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/02_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "2" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/02_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "2" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/02": {} + } + }, + "fsp-03": { + "Fsp": { + "mid_csp_cbf/fsp/03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/03" + ], + "FspID": [ + "3" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/03" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/03" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/03" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/03_01", + "mid_csp_cbf/fspSubarray/03_02" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/03": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/03": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/03": {} + }, + "FspSubarray": { + "mid_csp_cbf/fspSubarray/03_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "3" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/03_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "3" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/03_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "3" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/03": {} + } + }, + "fsp-04": { + "Fsp": { + "mid_csp_cbf/fsp/04": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/04" + ], + "FspID": [ + "4" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/04" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/04" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/04" + ], + "FspSubarray": [ + "mid_csp_cbf/fspSubarray/04_01", + "mid_csp_cbf/fspSubarray/04_02" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/04": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/04": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/04": {} + }, + "FspSubarray": { + "mid_csp_cbf/fspSubarray/04_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "4" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/04_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "4" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspSubarray/04_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "4" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/04": {} + } + } + }, + "VccMulti": { + "vcc-001": { + "Vcc": { + "mid_csp_cbf/vcc/001": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/001" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/001" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/001" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/001" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/001" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/001" + ], + "VccID": [ + "1" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/001": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/001": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/001": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/001": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/001": {}, + "mid_csp_cbf/vcc_sw2/001": {} + } + }, + "vcc-002": { + "Vcc": { + "mid_csp_cbf/vcc/002": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/002" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/002" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/002" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/002" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/002" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/002" + ], + "VccID": [ + "2" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/002": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/002": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/002": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/002": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/002": {}, + "mid_csp_cbf/vcc_sw2/002": {} + } + }, + "vcc-003": { + "Vcc": { + "mid_csp_cbf/vcc/003": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/003" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/003" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/003" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/003" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/003" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/003" + ], + "VccID": [ + "3" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/003": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/003": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/003": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/003": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/003": {}, + "mid_csp_cbf/vcc_sw2/003": {} + } + }, + "vcc-004": { + "Vcc": { + "mid_csp_cbf/vcc/004": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/004" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/004" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/004" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/004" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/004" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/004" + ], + "VccID": [ + "4" + ], + "polled_attr": [ + "state", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/004": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/004": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/004": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/004": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/004": {}, + "mid_csp_cbf/vcc_sw2/004": {} + } + } + }, + "DataBaseds": { + "2": { + "DataBase": { + "sys/database/2": {} + } + } + }, + "TangoAccessControl": { + "1": { + "TangoAccessControl": { + "sys/access_control/1": {} + } + } + }, + "TangoTest": { + "test": { + "TangoTest": { + "sys/tg_test/1": {} + } + } + } + } +} + diff --git a/csp-lmc-mid/charts/csp-proto/data/cspconfig.json b/csp-lmc-mid/charts/csp-proto/data/cspconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..08bb41f842bce42a89850a1cd634bdf4a3bcfb68 --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/data/cspconfig.json @@ -0,0 +1,838 @@ +{ + "servers": { + "MidCspCapabilityMonitor": { + "monitor": { + "CspCapabilityMonitor": { + "mid_csp/capability_monitor/vcc": { + "properties": { + "CapabilityDevices": [ + "mid_csp/vcc/004", + "mid_csp/vcc/003", + "mid_csp/vcc/002", + "mid_csp/vcc/001" + ], + "SkaLevel": [ + "2" + ] + } + }, + "mid_csp/capability_monitor/timing_beams": { + "properties": { + "CapabilityDevices": [ + "mid_csp/timing_beams/04", + "mid_csp/timing_beams/03", + "mid_csp/timing_beams/01", + "mid_csp/timing_beams/02" + ], + "SkaLevel": [ + "2" + ] + } + }, + "mid_csp/capability_monitor/vlbi_beams": { + "properties": { + "CapabilityDevices": [ + "mid_csp/vlbi_beams/03", + "mid_csp/vlbi_beams/04", + "mid_csp/vlbi_beams/02", + "mid_csp/vlbi_beams/01" + ], + "SkaLevel": [ + "2" + ] + } + } + }, + "CspSearchBeamsMonitor": { + "mid_csp/capability_monitor/search_beams": { + "properties": { + "CapabilityDevices": [ + "mid_csp/search_beams/04", + "mid_csp/search_beams/03", + "mid_csp/search_beams/01", + "mid_csp/search_beams/02" + ], + "SkaLevel": [ + "2" + ] + } + } + } + } + }, + "MidCspMaster": { + "master": { + "MidCspMasterBase": { + "mid_csp/elt/master": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "reportFSPAdminMode": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPAdminMode" + ] + }, + "reportFSPHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPHealthState" + ] + }, + "reportFSPState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPState" + ] + }, + "reportSearchBeamAdminMode": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityAdminMode" + ] + }, + "reportSearchBeamHealthState": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityHealthState" + ] + }, + "reportSearchBeamObsState": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityObsState" + ] + }, + "reportSearchBeamState": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityState" + ] + }, + "reportTimingBeamAdminMode": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityAdminMode" + ] + }, + "reportTimingBeamHealthState": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityHealthState" + ] + }, + "reportTimingBeamObsState": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityObsState" + ] + }, + "reportTimingBeamState": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityState" + ] + }, + "reportVCCAdminMode": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCAdminMode" + ] + }, + "reportVCCHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCHealthState" + ] + }, + "reportVCCState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCState" + ] + }, + "reportVlbiBeamAdminMode": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityAdminMode" + ] + }, + "reportVlbiBeamHealthState": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityHealthState" + ] + }, + "reportVlbiBeamObsState": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityObsState" + ] + }, + "reportVlbiBeamState": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityState" + ] + }, + "searchBeamMembership": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityMembership" + ] + }, + "timingBeamMembership": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityMembership" + ] + }, + "unassignedSearchBeamIDs": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/unassignedIDs" + ] + }, + "numOfUnassignedSearchBeams": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/numOfUnassignedIDs" + ] + }, + "numOfReservedSearchBeams": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/numOfReservedIDs" + ] + }, + "unassignedTimingBeamIDs": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/unassignedIDs" + ] + }, + "numOfUnassignedTimingBeams": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/numOfUnassignedIDs" + ] + }, + "numOfUnassignedVlbiBeams": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/numOfUnassignedIDs" + ] + }, + "unassignedVlbiBeamIDs": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/unassignedIDs" + ] + }, + "vccMembership": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCSubarrayMembership" + ] + }, + "vlbiBeamMembership": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityMembership" + ] + } + }, + "properties": { + "CspCbf": [ + "mid_csp_cbf/sub_elt/master" + ], + "CspPss": [ + "mid_csp_pss/sub_elt/master" + ], + "CspPst": [ + "mid_csp_pst/sub_elt/master" + ], + "CspSubarrays": [ + "mid_csp/elt/subarray_01", + "mid_csp/elt/subarray_02", + "mid_csp/elt/subarray_03" + ], + "MaxCapabilities": [ + "VCC:4", + "SearchBeams:1500", + "TimingBeams:16", + "VlbiBeams:20" + ], + "SearchBeamsMonitor": [ + "mid_csp/capability_monitor/search_beams" + ], + "TimingBeamsMonitor": [ + "mid_csp/capability_monitor/timing_beams" + ], + "VlbiBeamsMonitor": [ + "mid_csp/capability_monitor/vlbi_beams" + ], + "SkaLevel": [ + "1" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000", + "state", + "1000", + "csppssadminmode", + "1000", + "csppstadminmode", + "1000", + "cspcbfadminmode", + "1000", + "oncommandprogress", + "1500", + "offcommandprogress", + "1500", + "offcmddurationexpected", + "1500", + "standbycommandprogress", + "1500", + "oncmddurationexpected", + "1500", + "standbycmddurationexpected", + "1500", + "oncmddurationmeasured", + "1500", + "offcmddurationmeasured", + "1500", + "standbycmddurationmeasured", + "1500", + "offcmdtimeoutexpired", + "1500", + "oncmdtimeoutexpired", + "1500", + "csppssstate", + "1000", + "standbycmdtimeoutexpired", + "1000", + "csppststate", + "1000", + "cspcbfhealthstate", + "1000", + "csppsshealthstate", + "1000", + "csppsthealthstate", + "1000", + "cspcbfadminmode", + "1000", + "oncmdfailure", + "2000", + "offcmdfailure", + "2000", + "standbycmdfailure", + "2000", + "cspcbfstate", + "1000" + ] + } + } + } + } + }, + "MidCspSubarray": { + "subarray1": { + "MidCspSubarrayBase": { + "mid_csp/elt/subarray_01": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "assignedFspHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/fspHealthState" + ] + }, + "assignedFspState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/fspState" + ] + }, + "assignedReceptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/receptors" + ] + }, + "assignedVccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/vccHealthState" + ] + }, + "assignedVccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/vccState" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "CspMaster": [ + "mid_csp/elt/master" + ], + "PssSubarray": [ + "mid_csp_pss/sub_elt/subarray_01" + ], + "SkaLevel": [ + "2" + ], + "SubID": [ + "1" + ], + "SubarrayProcModeCorrelation": [ + "mid_csp/elt/correlation-01" + ], + "SubarrayProcModePss": [ + "mid_csp/elt/pss-01" + ], + "SubarrayProcModePst": [ + "mid_csp/elt/pst-01" + ], + "SubarrayProcModeVlbi": [ + "mid_csp/elt/vlbi-01" + ], + "polled_attr": [ + "healthstate", + "1000", + "obsmode", + "1000", + "failureraisedflag", + "1000", + "timeoutexpiredflag", + "1000", + "scancmdprogress", + "1500", + "removeresourcescmdprogress", + "1500", + "addresourcescmdprogress", + "1500", + "endscancmdprogress", + "1500", + "gotoidlecmdprogress", + "1500" + ] + } + } + }, + "MidCspSubarrayProcModeCorrelation": { + "mid_csp/elt/correlation-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "CORRELATION" + ], + "subID": [ + "1" + ] + } + } + }, + "MidCspSubarrayProcModePss": { + "mid_csp/elt/pss-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PSS" + ], + "subID": [ + "1" + ] + } + } + }, + "MidCspSubarrayProcModePst": { + "mid_csp/elt/pst-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PST" + ], + "subID": [ + "1" + ] + } + } + }, + "MidCspSubarrayProcModeVlbi": { + "mid_csp/elt/vlbi-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "VLBI" + ], + "subID": [ + "1" + ] + } + } + } + }, + "subarray2": { + "MidCspSubarrayBase": { + "mid_csp/elt/subarray_02": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "assignedFspHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/fspHealthState" + ] + }, + "assignedFspState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/fspState" + ] + }, + "assignedReceptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/receptors" + ] + }, + "assignedVccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/vccHealthState" + ] + }, + "assignedVccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/vccState" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "CspMaster": [ + "mid_csp/elt/master" + ], + "PssSubarray": [ + "mid_csp_pss/sub_elt/subarray_02" + ], + "SkaLevel": [ + "2" + ], + "SubID": [ + "2" + ], + "SubarrayProcModeCorrelation": [ + "mid_csp/elt/correlation-02" + ], + "SubarrayProcModePss": [ + "mid_csp/elt/pss-02" + ], + "SubarrayProcModePst": [ + "mid_csp/elt/pst-02" + ], + "SubarrayProcModeVlbi": [ + "mid_csp/elt/vlbi-02" + ], + "polled_attr": [ + "healthstate", + "1000", + "obsmode", + "1000", + "failureraisedflag", + "1000", + "timeoutexpiredflag", + "1000", + "scancmdprogress", + "1500", + "removeresourcescmdprogress", + "1500", + "addresourcescmdprogress", + "1500", + "endscancmdprogress", + "1500", + "gotoidlecmdprogress", + "1500" + ] + } + } + }, + "MidCspSubarrayProcModeCorrelation": { + "mid_csp/elt/correlation-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "CORRELATION" + ], + "subID": [ + "2" + ] + } + } + }, + "MidCspSubarrayProcModePss": { + "mid_csp/elt/pss-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PSS" + ], + "subID": [ + "2" + ] + } + } + }, + "MidCspSubarrayProcModePst": { + "mid_csp/elt/pst-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PST" + ], + "subID": [ + "2" + ] + } + } + }, + "MidCspSubarrayProcModeVlbi": { + "mid_csp/elt/vlbi-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "VLBI" + ], + "subID": [ + "2" + ] + } + } + } + }, + "subarray3": { + "MidCspSubarrayBase": { + "mid_csp/elt/subarray_03": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "assignedFspHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/fspHealthState" + ] + }, + "assignedFspState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/fspState" + ] + }, + "assignedReceptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/receptors" + ] + }, + "assignedVccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/vccHealthState" + ] + }, + "assignedVccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/vccState" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "CspMaster": [ + "mid_csp/elt/master" + ], + "PssSubarray": [ + "mid_csp_pss/sub_elt/subarray_03" + ], + "SkaLevel": [ + "2" + ], + "SubID": [ + "3" + ], + "SubarrayProcModeCorrelation": [ + "mid_csp/elt/correlation-03" + ], + "SubarrayProcModePss": [ + "mid_csp/elt/pss-03" + ], + "SubarrayProcModePst": [ + "mid_csp/elt/pst-03" + ], + "SubarrayProcModeVlbi": [ + "mid_csp/elt/vlbi-03" + ], + "polled_attr": [ + "healthstate", + "1000", + "obsmode", + "1000", + "failureraisedflag", + "1000", + "timeoutexpiredflag", + "1000", + "scancmdprogress", + "1500", + "removeresourcescmdprogress", + "1500", + "addresourcescmdprogress", + "1500", + "endscancmdprogress", + "1500", + "gotoidlecmdprogress", + "1500" + ] + } + } + }, + "MidCspSubarrayProcModeCorrelation": { + "mid_csp/elt/correlation-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "CORRELATION" + ], + "subID": [ + "3" + ] + } + } + }, + "MidCspSubarrayProcModePss": { + "mid_csp/elt/pss-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PSS" + ], + "subID": [ + "3" + ] + } + } + }, + "MidCspSubarrayProcModePst": { + "mid_csp/elt/pst-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PST" + ], + "subID": [ + "3" + ] + } + } + }, + "MidCspSubarrayProcModeVlbi": { + "mid_csp/elt/vlbi-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "VLBI" + ], + "subID": [ + "3" + ] + } + } + } + } + }, + "DataBaseds": { + "2": { + "DataBase": { + "sys/database/2": {} + } + } + }, + "TangoAccessControl": { + "1": { + "TangoAccessControl": { + "sys/access_control/1": {} + } + } + }, + "TangoTest": { + "test": { + "TangoTest": { + "sys/tg_test/1": {} + } + } + } + } +} diff --git a/csp-lmc-mid/charts/csp-proto/secrets/.gitkeep b/csp-lmc-mid/charts/csp-proto/secrets/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/csp-lmc-mid/charts/csp-proto/secrets/tls.crt b/csp-lmc-mid/charts/csp-proto/secrets/tls.crt new file mode 100644 index 0000000000000000000000000000000000000000..281f413bab4869e1ae55e7624ed42bfce8b13f19 --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/secrets/tls.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDRTCCAi2gAwIBAgIUCWlGy8z2r11G2Sc52B0zjGpytywwDQYJKoZIhvcNAQEL +BQAwMjEdMBsGA1UEAwwUdGVzdC5jc3AtcHJvdG8ubG9jYWwxETAPBgNVBAoMCE1p +bmlrdWJlMB4XDTIwMDkwNDA2NDM0OFoXDTIxMDkwNDA2NDM0OFowMjEdMBsGA1UE +AwwUdGVzdC5jc3AtcHJvdG8ubG9jYWwxETAPBgNVBAoMCE1pbmlrdWJlMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+y4kIIi+hU5fNdV1JTc4qCDh2VAO +lhXX5LmJAQbWWkzOWszOcqGB0g6P4CNIAgNVmFjPoPNsbxlBrKFpoI78p4y1iW4C +LOGkg4gwND1f8SNE7VJyqCiMti7SdBFF6LRNdp6WwmVKVuRdN4Tk+B+39dlTSVjx +Ykziqy7vRLwBsJlbhxIFRkFNdmzpucYTcjUfB4PM5my30ZGdqMnsZ5Mpzw/BkC+s +VRVMSKq1nmtgMYIZUTgdue/sC/SKuqH4FffiQZ6RLAABl1qXFU/A2RkjSn3VBuYh +CWXPgSvi5mxCWDqf4lGZR+yxWMD+t7AG4IuLUl+KeV8PIjvMWSKb+Fdy9wIDAQAB +o1MwUTAdBgNVHQ4EFgQUdnM99TO9Jn3Oi16QbSIqeDkQr1cwHwYDVR0jBBgwFoAU +dnM99TO9Jn3Oi16QbSIqeDkQr1cwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B +AQsFAAOCAQEA5d3w4vrLHbto4NGfKyjORnqQyxEeI5eZe9xRBaxobdhMlFDshNjC +GTcOdcAiGU9jRn95fItJZraXMYCR+Ysf9edU+YEaVnKioWnCUflxBNa2tZ7c+sNC +zqvcRIYZIGGg1J4RYZ0i0XJsYKn+RCuhSPjR3C1nSN47PPjnk85hnUyofdGHDJ2W +p71ozY2o3lKuw9NiU9kqnW2NRW/QBZvKnGHdq2izP8ciZZJtCsz8Tz9I1AzL2qqx +G8UThABjlIVMzhoRjzQ6vI5mcP/ucJZ1nU2/sqOGI4aLVRNTlv5DsiuPmC6zHD/s +ApaI7734oQBu6SkIrJLNyNwk2cQusgX44Q== +-----END CERTIFICATE----- diff --git a/csp-lmc-mid/charts/csp-proto/secrets/tls.key b/csp-lmc-mid/charts/csp-proto/secrets/tls.key new file mode 100644 index 0000000000000000000000000000000000000000..5747df7263c31ce17210d17f8ea53ad15add313a --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/secrets/tls.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD7LiQgiL6FTl81 +1XUlNzioIOHZUA6WFdfkuYkBBtZaTM5azM5yoYHSDo/gI0gCA1WYWM+g82xvGUGs +oWmgjvynjLWJbgIs4aSDiDA0PV/xI0TtUnKoKIy2LtJ0EUXotE12npbCZUpW5F03 +hOT4H7f12VNJWPFiTOKrLu9EvAGwmVuHEgVGQU12bOm5xhNyNR8Hg8zmbLfRkZ2o +yexnkynPD8GQL6xVFUxIqrWea2AxghlROB257+wL9Iq6ofgV9+JBnpEsAAGXWpcV +T8DZGSNKfdUG5iEJZc+BK+LmbEJYOp/iUZlH7LFYwP63sAbgi4tSX4p5Xw8iO8xZ +Ipv4V3L3AgMBAAECggEBAIEBxdRf51qYUhZYN/6RSiwwF0+B6rvzJBt5n4BDfryK +TkIchrwhb4fvqr234TgHdmL02k8UN1Eoa666iIHKbsGvZ13afouGqPRVckyiaTB0 +qOYrPnBXw02e5sBuTrWiRVbzRQM6+t9+EtJ9EwzNXbKLmFdHs1KForXBOWrYFRYZ +6Yb4ElByKHwaLlqnkdySSSCLkc4Epm+UeXz09GJMwCre+XyYAz1p4iL6IuyQXAhr +IVnYo9zaNHFxVi9Oxvk0fjCv7GEKpY4NtFeSYa1a511ATF0S45qspsCkgUUXGsjF +7fXw13X/oF5bMdoIJ7n+M9jCoky93nksTuB4/kx+HyECgYEA/7IkVlaP6EqZyZby +voK7bjQX3mroLDk6poxg9Bp/j01DbfeLeZB8Yw1QBR3yuVMSoATN33T78F6bqA0W +ekuG30K6YYR5/JeibKTT6VY9edNLTkbsMQFVdbgrJf5KiMKibAELzG78WnTj9SND +xG8qUL30wWC0sfpSi7jDXtgQZ10CgYEA+3qfyynyfayMvbcGtdvCyBO6ZvDlpf/f +pIE1o1amnRiDvLzNNVADHgHa16Jd4ETfSohcgo4aF4QNG4BFE+w+hBjbBWQdtrAM +149+S+g/7U4hYvaeou4719fyFygDynBiF39Sx5ffluHzPmnJXhR8t1kDyMQ2jcb/ +EIYHFeanwmMCgYEAp8dBlrGIDhldXezBbYak7AQcoWIu5E3NEVnNiH8WsnY1R6QG +Dgdjxy8GEcV77mT3NK7SU80UP74kjxm/ZRHH9xl26OQfk0IAXx+suVBQWG7v2/Yn +p2RDqlHlZjG8wI5OO2ZYUpWE2uoWZlT0c6Gp938dagJFrv8dSPc8ozBNWzUCgYBa +6jkMzOxyzMfQ6nNNmdZwWNmBz8NmYPvsUB4hH/l6P9uYhzU0+ek2lvsUDAoeQyfq +nSO8uzzplX7bm2Ld0gHD5eyApXIskrcB00mYja1W0HE3gutVAgW2gcZu4rOEI18D +Ga/GorxdovA6dyoqjgOMkWzRz0XdubyKr7muDEZH+wKBgDw3y6Ujx0fTgENMgrLD +lj205wSOUZe9a5QJQ3HbsKh2qDY0nK2COMo8OW76+a5Vlk2PJLyXQGU2Ceuj+rUq +yY3+cVQfjI3dYv+5nTh4O1XRiZwVhHm/AkUlQ5n0C9KSa4Ejhpb8A7RUDAC8B8cn +p+IuCq0Nk9KtGwdvh9fH/hJ5 +-----END PRIVATE KEY----- diff --git a/csp-lmc-mid/charts/csp-proto/templates/_helpers.tpl b/csp-lmc-mid/charts/csp-proto/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..c1891ce6068e9714dbe0fdf3dbcbbed9443a79fc --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "csp-proto.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "csp-proto.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "csp-proto.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/csp-lmc-mid/charts/csp-proto/templates/csplmc.yaml b/csp-lmc-mid/charts/csp-proto/templates/csplmc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..29afbb5cf81744a27d85665d4e6b4fda2e014c5b --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/templates/csplmc.yaml @@ -0,0 +1,147 @@ +{{ if .Values.csplmc.enabled }} + +--- +# Device Server configurations +apiVersion: v1 +kind: ConfigMap +metadata: + name: "csp-proto-configuration-json-{{ template "csp-proto.name" . }}-{{ .Release.Name }}" + namespace: {{ .Release.Namespace }} +data: + cspconfig.json: +{{ (tpl (.Files.Glob "data/cspconfig.json").AsConfig . ) | indent 2 }} + bootstrap.sh: | + #/bin/sh + /usr/local/bin/wait-for-it.sh databaseds-tango-base-{{ .Release.Name }}:10000 \ + --timeout=30 \ + --strict \ + -- json2tango -w -a -u data/cspconfig.json + rc=$? + if [ $rc -eq 0 ]; then + echo "finished normally." + exit 0 + else + if [ $rc -eq 2 ]; then + echo "finished with an update." + exit 0 + else + echo "finished with an ERROR." + exit $rc + fi + fi + +--- +# run once Job for loading Device Server config +apiVersion: batch/v1 +kind: Job +metadata: + name: midcsplmc-configurator-{{ template "csp-proto.name" . }}-{{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + ttlSecondsAfterFinished: 100 + template: + spec: + containers: + - name: dsconfig + image: "{{ .Values.dsconfig.image.registry }}/{{ .Values.dsconfig.image.image }}:{{ .Values.dsconfig.image.tag }}" + imagePullPolicy: {{ .Values.dsconfig.image.pullPolicy }} + command: # exit code 2 is CONFIG_APPLIED - https://github.com/MaxIV-KitsControls/lib-maxiv-dsconfig/blob/master/dsconfig/utils.py#L11 !!!! this should not be an error !!!! + - sh + - data/bootstrap.sh + env: + - name: TANGO_HOST + value: databaseds-tango-base-{{ .Release.Name }}:10000 + volumeMounts: + - name: configuration + mountPath: data + readOnly: true + volumes: + - name: configuration + configMap: + name: "csp-proto-configuration-json-{{ template "csp-proto.name" . }}-{{ .Release.Name }}" + restartPolicy: Never + +{{- $global := . }} +{{- range $deviceserver := .Values.deviceServers }} + +--- +# giving a dummy Service entry ensures that the single pod is DNS addressable +apiVersion: v1 +kind: Service +metadata: + name: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + namespace: {{ $global.Release.Namespace }} + labels: + app: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "csp-proto.chart" $global }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} +spec: + clusterIP: None + ports: + - name: dummy # Actually, no port is needed. + port: 1234 + targetPort: 1234 + selector: + app: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "csp-proto.chart" $global }} + release: {{ $global.Release.Name }} + +--- +# Single Pod separate statefulset per Device Server +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + namespace: {{ $global.Release.Namespace }} + labels: + app: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "csp-proto.chart" $global }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} +spec: + selector: + matchLabels: + app: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "csp-proto.chart" $global }} + release: {{ $global.Release.Name }} + serviceName: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + replicas: 1 + template: + metadata: + labels: + app: midcsplmc-{{ template "csp-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "csp-proto.chart" $global }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} + cspServer: {{$deviceserver.name}} + spec: + containers: + - name: deviceserver + image: "{{ $global.Values.csplmc.image.registry }}/{{ $global.Values.csplmc.image.image }}:{{ $global.Values.csplmc.image.tag }}" + imagePullPolicy: {{ $global.Values.csplmc.image.pullPolicy }} + command: + - sh + args: +{{ toYaml $deviceserver.args | indent 10 }} + env: + - name: TANGO_HOST + value: databaseds-tango-base-{{ $global.Release.Name }}:10000 + resources: +{{ toYaml $global.Values.resources | indent 10 }} +{{- with $global.Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} +{{- end }} +{{- with $global.Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} +{{- with $global.Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + +{{- end }} # end of range + +{{ end }} diff --git a/csp-lmc-mid/charts/csp-proto/values.yaml b/csp-lmc-mid/charts/csp-proto/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..47b4fd96460d005aadb30fc662f9c73636c8b239 --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/values.yaml @@ -0,0 +1,79 @@ +# Default values for csp-proto. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +display: ":0" +xauthority: "~/.Xauthority" + +system: csp +subsystem: csp-lmc +telescope: SKA-mid + +csplmc: + enabled: true + image: + registry: nexus.engageska-portugal.pt/ska-docker + image: mid-csp-lmc + tag: 0.6.9-dev + pullPolicy: IfNotPresent + +deviceServers: + - name: midcapabilitymonitor + function: csp-capability-monitoring + domain: csp-monitoring + args: + - "-c" + - "/venv/bin/python /app/csp_lmc_mid/MidCspCapabilityMonitor.py monitor" + - name: midcspmaster + function: csp-central-control + domain: csp-monitoring + args: + - "-c" + - "retry --max=20 -- tango_admin --ping-device mid_csp_cbf/sub_elt/master &&\ + retry --max=5 -- tango_admin --ping-device mid_csp/capability_monitor/search_beams &&\ + /venv/bin/python /app/csp_lmc_mid/MidCspMaster.py master" + - name: midcspsubarray01 + function: csp-subarray-observation + domain: subarray + args: + - "-c" + - "retry --max=10 -- tango_admin --ping-device mid_csp/elt/master &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_01 &&\ + /venv/bin/python /app/csp_lmc_mid/MidCspSubarray.py subarray1" + - name: midcspsubarray02 + function: csp-subarray-observation + domain: subarray + args: + - "-c" + - "retry --max=10 -- tango_admin --ping-device mid_csp/elt/master &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_02 &&\ + /venv/bin/python /app/csp_lmc_mid/MidCspSubarray.py subarray2" + - name: midcspsubarray03 + function: csp-subarray-observation + domain: subarray + args: + - "-c" + - "retry --max=10 -- tango_admin --ping-device mid_csp/elt/master &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_03 &&\ + /venv/bin/python /app/csp_lmc_mid/MidCspSubarray.py subarray3" + +dsconfig: + image: + registry: nexus.engageska-portugal.pt/ska-docker + image: tango-dsconfig + tag: 1.2.5.1 + pullPolicy: IfNotPresent + +nodeSelector: {} + +affinity: {} + +tolerations: [] + +resources: + requests: + cpu: 150m # 150m = 0.15 CPU + memory: 128Mi # 128Mi = 0.12 GB mem + limits: + cpu: 250m # 250m = 0.25 CPU + memory: 256Mi # 256Mi = 0.25 GB mem diff --git a/csp-lmc-mid/charts/csp-proto/values.yaml.new b/csp-lmc-mid/charts/csp-proto/values.yaml.new new file mode 100644 index 0000000000000000000000000000000000000000..9700530062b13d49d77068b9e71281226b6f82e2 --- /dev/null +++ b/csp-lmc-mid/charts/csp-proto/values.yaml.new @@ -0,0 +1,59 @@ +# Default values for csp-proto. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +display: ":0" +xauthority: "~/.Xauthority" + + +csplmc: + enabled: true + image: + registry: nexus.engageska-portugal.pt/ska-docker + image: mid-csp-lmc + tag: 0.6.8-452d0a0-dirty + pullPolicy: IfNotPresent + +deviceServers: + - name: midcapabilitymonitor + args: + - "-c" + - "/venv/bin/python /app/csp_lmc_mid/MidCspCapabilityMonitor.py monitor" + - name: midcspmaster + args: + - "-c" + - "retry --max=5 -- tango_admin --ping-device mid_csp/capability_monitor/search_beams &&\ + /venv/bin/python /app/csp_lmc_mid/MidCspMaster.py master" + - name: midcspsubarray01 + args: + - "-c" + - " /venv/bin/python /app/csp_lmc_mid/MidCspSubarray.py subarray1" + - name: midcspsubarray02 + args: + - "-c" + - "/venv/bin/python /app/csp_lmc_mid/MidCspSubarray.py subarray2" + - name: midcspsubarray03 + args: + - "-c" + - "/venv/bin/python /app/csp_lmc_mid/MidCspSubarray.py subarray3" + +dsconfig: + image: + registry: nexus.engageska-portugal.pt/ska-docker + image: tango-dsconfig + tag: 1.2.5.1 + pullPolicy: IfNotPresent + +nodeSelector: {} + +affinity: {} + +tolerations: [] + +resources: + requests: + cpu: 150m # 150m = 0.15 CPU + memory: 128Mi # 128Mi = 0.12 GB mem + limits: + cpu: 250m # 250m = 0.25 CPU + memory: 256Mi # 256Mi = 0.25 GB mem diff --git a/csp-lmc-mid/charts/mid-csp/Chart.lock b/csp-lmc-mid/charts/mid-csp/Chart.lock new file mode 100644 index 0000000000000000000000000000000000000000..e6a9d22102a1cc1197ab07821e0cb9f033788f48 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: csp-lmc + repository: "file://../csp-proto" + version: 0.5.3 +- name: tango-base + repository: https://gitlab.com/ska-telescope/skampi/-/raw/master/repository + version: 0.1.1 +digest: sha256:9d9ae70d4070c7eba89e967b744e8f37fda46778dd0af3b05e49cb642ae32a36 +generated: "2020-09-04T08:16:47.853296221+02:00" diff --git a/csp-lmc-mid/charts/mid-csp/Chart.yaml b/csp-lmc-mid/charts/mid-csp/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4091172a6b468d43a9d4fd961584222b09dd9c0e --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +appVersion: 0.6.9 +description: A Helm chart for deploying the whole Mid_CSP prototype on Kubernetes +name: mid-csp +version: 0.1.0 +icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png +dependencies: +- name: tango-base + version: 0.1.2 + repository: https://gitlab.com/ska-telescope/skampi/-/raw/master/repository + condition: tango-base.enabled +- name: csp-proto + version: 0.1.1 + repository: "file://../csp-proto" + condition: csp-proto.enabled diff --git a/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/Chart.yaml b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d86101a7f758530b00b50b65f2b29fd27b31aeba --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for deploying the CSP_Mid.LMC CBF prototype on Kubernetes +name: cbf-proto +version: 0.4.0 +icon: https://www.skatelescope.org/wp-content/uploads/2016/07/09545_NEW_LOGO_2014.png diff --git a/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/data/midcbfconfig.json b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/data/midcbfconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..e2fcaa5410326ffe107568b3543ca572730e21ef --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/data/midcbfconfig.json @@ -0,0 +1,1719 @@ +{ + "servers": { + "CbfMaster": { + "master": { + "CbfMaster": { + "mid_csp_cbf/sub_elt/master": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_01", + "mid_csp_cbf/sub_elt/subarray_02", + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "MaxCapabilities": [ + "VCC:4", + "FSP:4", + "Subarray:2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "reportfspstate", + "1000", + "reportvccadminmode", + "1000", + "reportvcchealthstate", + "1000", + "receptortovcc", + "1000", + "reportfspCorrSubarraymembership", + "1000", + "reportfsphealthstate", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarrayconfigid", + "1000", + "reportfspadminmode", + "1000", + "commandprogress", + "2000", + "reportsubarrayhealthstate", + "1000", + "reportvccstate", + "1000", + "reportsubarrayadminmode", + "1000", + "vcctoreceptor", + "3000", + "reportsubarraystate", + "3000", + "state", + "1000" + ] + } + } + } + } + }, + "CbfSubarrayMulti": { + "cbfSubarray-01": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_01", + "mid_csp_cbf/fspCorrSubarray/02_01", + "mid_csp_cbf/fspCorrSubarray/03_01", + "mid_csp_cbf/fspCorrSubarray/04_01" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_01", + "mid_csp_cbf/fspPssSubarray/02_01", + "mid_csp_cbf/fspPssSubarray/03_01", + "mid_csp_cbf/fspPssSubarray/04_01" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/01" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/01" + ], + "PssConfigAddress": [ + "mid_csp_cbf/pssconfig/01" + ], + "CorrConfigAddress": [ + "mid_csp_cbf/corrconfig/01" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "healthstate", + "1000", + "fsphealthstate", + "1000", + "fspstate", + "1000", + "vccstate", + "1000", + "vcchealthstate", + "1000", + "configid", + "1000", + "fspList", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/01": {}, + "mid_csp_cbf/sw2/01": {} + }, + "CbfSubarrayPssConfig": { + "mid_csp_cbf/pssConfig/01": { + "properties": { + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_01", + "mid_csp_cbf/fspPssSubarray/02_01", + "mid_csp_cbf/fspPssSubarray/03_01", + "mid_csp_cbf/fspPssSubarray/04_01" + ], + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ] + } + } + }, + "CbfSubarrayCorrConfig": { + "mid_csp_cbf/corrConfig/01": { + "properties": { + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_01", + "mid_csp_cbf/fspCorrSubarray/02_01", + "mid_csp_cbf/fspCorrSubarray/03_01", + "mid_csp_cbf/fspCorrSubarray/04_01" + ], + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ] + } + } + }, + "SendConfig": { + "mid_csp_cbf/SendConfig/01": { + "properties": { + "SubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ] + } + } + } + }, + "cbfSubarray-02": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_02", + "mid_csp_cbf/fspCorrSubarray/02_02", + "mid_csp_cbf/fspCorrSubarray/03_02", + "mid_csp_cbf/fspCorrSubarray/04_02" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_02", + "mid_csp_cbf/fspPssSubarray/02_02", + "mid_csp_cbf/fspPssSubarray/03_02", + "mid_csp_cbf/fspPssSubarray/04_02" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/02" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/02" + ], + "PssConfigAddress": [ + "mid_csp_cbf/pssconfig/02" + ], + "CorrConfigAddress": [ + "mid_csp_cbf/corrconfig/02" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "configid", + "1000", + "healthstate", + "1000", + "vcchealthstate", + "1000", + "adminmode", + "1000", + "fspstate", + "1000", + "fspList", + "1000", + "fsphealthstate", + "1000", + "vccstate", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/02": {}, + "mid_csp_cbf/sw2/02": {} + }, + "CbfSubarrayPssConfig": { + "mid_csp_cbf/pssConfig/02": { + "properties": { + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_02", + "mid_csp_cbf/fspPssSubarray/02_02", + "mid_csp_cbf/fspPssSubarray/03_02", + "mid_csp_cbf/fspPssSubarray/04_02" + ], + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ] + } + } + }, + "CbfSubarrayCorrConfig": { + "mid_csp_cbf/corrConfig/02": { + "properties": { + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_02", + "mid_csp_cbf/fspCorrSubarray/02_02", + "mid_csp_cbf/fspCorrSubarray/03_02", + "mid_csp_cbf/fspCorrSubarray/04_02" + ], + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ] + } + } + }, + "SendConfig": { + "mid_csp_cbf/SendConfig/02": { + "properties": { + "SubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ] + } + } + } + + }, + "cbfSubarray-03": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_03", + "mid_csp_cbf/fspCorrSubarray/02_03", + "mid_csp_cbf/fspCorrSubarray/03_03", + "mid_csp_cbf/fspCorrSubarray/04_03" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_03", + "mid_csp_cbf/fspPssSubarray/02_03", + "mid_csp_cbf/fspPssSubarray/03_03", + "mid_csp_cbf/fspPssSubarray/04_03" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/03" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/03" + ], + "PssConfigAddress": [ + "mid_csp_cbf/pssconfig/03" + ], + "CorrConfigAddress": [ + "mid_csp_cbf/corrconfig/03" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "healthstate", + "1000", + "fsphealthstate", + "1000", + "fspstate", + "1000", + "vccstate", + "1000", + "vcchealthstate", + "1000", + "configid", + "1000", + "fspList", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/03": {}, + "mid_csp_cbf/sw2/03": {} + }, + "CbfSubarrayPssConfig": { + "mid_csp_cbf/pssConfig/03": { + "properties": { + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_03", + "mid_csp_cbf/fspPssSubarray/02_03", + "mid_csp_cbf/fspPssSubarray/03_03", + "mid_csp_cbf/fspPssSubarray/04_03" + ], + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ] + } + } + }, + "CbfSubarrayCorrConfig": { + "mid_csp_cbf/corrConfig/03": { + "properties": { + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_03", + "mid_csp_cbf/fspCorrSubarray/02_03", + "mid_csp_cbf/fspCorrSubarray/03_03", + "mid_csp_cbf/fspCorrSubarray/04_03" + ], + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ] + } + } + }, + "SendConfig": { + "mid_csp_cbf/SendConfig/03": { + "properties": { + "SubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ] + } + } + } + } + }, + "DataBaseds": { + "2": { + "DataBase": { + "sys/database/2": {} + } + } + }, + "FspMulti": { + "fsp-01": { + "Fsp": { + "mid_csp_cbf/fsp/01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/01" + ], + "FspID": [ + "1" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/01" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/01" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/01" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_01", + "mid_csp_cbf/fspCorrSubarray/01_02", + "mid_csp_cbf/fspCorrSubarray/01_03" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_01", + "mid_csp_cbf/fspPssSubarray/01_02", + "mid_csp_cbf/fspPssSubarray/01_03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/01": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/01": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/01": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/01_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "1" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/01_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "1" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/01_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "1" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/01_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "1" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/01_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "1" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/01_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "1" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/01": {} + } + }, + "fsp-02": { + "Fsp": { + "mid_csp_cbf/fsp/02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/02" + ], + "FspID": [ + "2" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/02" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/02" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/02" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/02_01", + "mid_csp_cbf/fspCorrSubarray/02_02", + "mid_csp_cbf/fspCorrSubarray/02_03" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/02_01", + "mid_csp_cbf/fspPssSubarray/02_02", + "mid_csp_cbf/fspPssSubarray/02_03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/02": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/02": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/02": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/02_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "2" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/02_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "2" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/02_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "2" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/02_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "2" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/02_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "2" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/02_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "2" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/02": {} + } + }, + "fsp-03": { + "Fsp": { + "mid_csp_cbf/fsp/03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/03" + ], + "FspID": [ + "3" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/03" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/03" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/03" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/03_01", + "mid_csp_cbf/fspCorrSubarray/03_02", + "mid_csp_cbf/fspCorrSubarray/03_03" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/03_01", + "mid_csp_cbf/fspPssSubarray/03_02", + "mid_csp_cbf/fspPssSubarray/03_03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/03": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/03": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/03": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/03_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "3" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/03_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "3" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/03_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "3" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/03_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "3" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/03_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "3" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/03_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "3" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/03": {} + } + }, + "fsp-04": { + "Fsp": { + "mid_csp_cbf/fsp/04": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/04" + ], + "FspID": [ + "4" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/04" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/04" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/04_01", + "mid_csp_cbf/fspCorrSubarray/04_02", + "mid_csp_cbf/fspCorrSubarray/04_03" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/04_01", + "mid_csp_cbf/fspPssSubarray/04_02", + "mid_csp_cbf/fspPssSubarray/04_03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/04": {} + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/04": {} + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/04": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/04_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "4" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/04_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "4" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/04_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "4" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/04_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "4" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/04_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "4" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/04_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "4" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/04": {} + } + } + }, + "TangoAccessControl": { + "1": { + "TangoAccessControl": { + "sys/access_control/1": {} + } + } + }, + "TangoTest": { + "test": { + "TangoTest": { + "sys/tg_test/1": {} + } + } + }, + "VccMulti": { + "vcc-001": { + "Vcc": { + "mid_csp_cbf/vcc/001": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/001" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/001" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/001" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/001" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/001" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/001" + ], + "VccID": [ + "1" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/001": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/001": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/001": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/001": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/001": {}, + "mid_csp_cbf/vcc_sw2/001": {} + } + }, + "vcc-002": { + "Vcc": { + "mid_csp_cbf/vcc/002": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/002" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/002" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/002" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/002" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/002" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/002" + ], + "VccID": [ + "2" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/002": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/002": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/002": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/002": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/002": {}, + "mid_csp_cbf/vcc_sw2/002": {} + } + }, + "vcc-003": { + "Vcc": { + "mid_csp_cbf/vcc/003": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/003" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/003" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/003" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/003" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/003" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/003" + ], + "VccID": [ + "3" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/003": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/003": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/003": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/003": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/003": {}, + "mid_csp_cbf/vcc_sw2/003": {} + } + }, + "vcc-004": { + "Vcc": { + "mid_csp_cbf/vcc/004": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/004" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/004" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/004" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/004" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/004" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/004" + ], + "VccID": [ + "4" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/004": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/004": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/004": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/004": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/004": {}, + "mid_csp_cbf/vcc_sw2/004": {} + } + } + }, + "TmCspSubarrayLeafNodeTest": { + "tm": { + "TmCspSubarrayLeafNodeTest": { + "ska_mid/tm_leaf_node/csp_subarray01": { + "attribute_properties": { + "dopplerPhaseCorrection": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + + "polled_attr": [ + "delaymodel", + "1000", + "visdestinationaddress", + "1000", + "dopplerphasecorrection", + "1000" + ] + } + } + } + }, + "tm2": { + "TmCspSubarrayLeafNodeTest": { + "ska_mid/tm_leaf_node/csp_subarray02": { + "attribute_properties": { + "dopplerPhaseCorrection": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + + "polled_attr": [ + "delaymodel", + "1000", + "visdestinationaddress", + "1000", + "dopplerphasecorrection", + "1000" + ] + } + } + } + } + } + } +} diff --git a/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/secrets/.gitkeep b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/secrets/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/templates/_helpers.tpl b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..cc68915b80f1c0cae943f217496dfb08e65bac65 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "cbf-proto.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "cbf-proto.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "cbf-proto.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/templates/midcbf.yaml b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/templates/midcbf.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1ab14e4f4364bbcee189f00947937d127b2775c8 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/templates/midcbf.yaml @@ -0,0 +1,146 @@ +{{ if .Values.midcbfmcs.enabled }} + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: "mid-cbf-configuration-json-{{ template "cbf-proto.name" . }}-{{ .Release.Name }}" + namespace: {{ .Release.Namespace }} +data: + midcbfconfig.json: +{{ (tpl (.Files.Glob "data/midcbfconfig.json").AsConfig . ) | indent 2 }} + bootstrap.sh: | + #/bin/sh + /usr/local/bin/wait-for-it.sh databaseds-tango-base-{{ .Release.Name }}:10000 \ + --timeout=30 \ + --strict \ + -- json2tango -w -a -u data/midcbfconfig.json + rc=$? + if [ $rc -eq 0 ]; then + echo "finished normally." + exit 0 + else + if [ $rc -eq 2 ]; then + echo "finished with an update." + exit 0 + else + echo "finished with an ERROR." + exit $rc + fi + fi + +--- +# run once Job for loading Device Server config +apiVersion: batch/v1 +kind: Job +metadata: + name: mid-cbf-configurator-{{ template "cbf-proto.name" . }}-{{ .Release.Name }} + namespace: {{ .Release.Namespace }} +spec: + ttlSecondsAfterFinished: 100 + template: + spec: + containers: + - name: dsconfig + image: "{{ .Values.dsconfig.image.registry }}/{{ .Values.dsconfig.image.image }}:{{ .Values.dsconfig.image.tag }}" + imagePullPolicy: {{ .Values.dsconfig.image.pullPolicy }} + command: # exit code 2 is CONFIG_APPLIED - https://github.com/MaxIV-KitsControls/lib-maxiv-dsconfig/blob/master/dsconfig/utils.py#L11 !!!! this should not be an error !!!! + - sh + - data/bootstrap.sh + env: + - name: TANGO_HOST + value: databaseds-tango-base-{{ .Release.Name }}:10000 + volumeMounts: + - name: configuration + mountPath: data + readOnly: true + volumes: + - name: configuration + configMap: + name: "mid-cbf-configuration-json-{{ template "cbf-proto.name" . }}-{{ .Release.Name }}" + restartPolicy: Never + +{{- $global := . }} +{{- range $deviceserver := .Values.deviceServers }} + +--- +# giving a dummy Service entry ensures that the single pod is DNS addressable +apiVersion: v1 +kind: Service +metadata: + name: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + namespace: {{ $global.Release.Namespace }} + labels: + app: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "cbf-proto.chart" $global }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} +spec: + clusterIP: None + ports: + - name: dummy # Actually, no port is needed. + port: 1234 + targetPort: 1234 + selector: + app: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "cbf-proto.chart" $global }} + release: {{ $global.Release.Name }} + +--- +# Single Pod separate statefulset per Device Server +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + namespace: {{ $global.Release.Namespace }} + labels: + app: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "cbf-proto.chart" $global }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} +spec: + selector: + matchLabels: + app: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "cbf-proto.chart" $global }} + release: {{ $global.Release.Name }} + serviceName: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + replicas: 1 + template: + metadata: + labels: + app: mid-cbf-{{ template "cbf-proto.name" $global }}-{{ $deviceserver.name }}-{{ $global.Release.Name }} + chart: {{ template "cbf-proto.chart" $global }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} + cspServer: {{$deviceserver.name}} + spec: + containers: + - name: deviceserver + image: "{{ $global.Values.midcbfmcs.image.registry }}/{{ $global.Values.midcbfmcs.image.image }}:{{ $global.Values.midcbfmcs.image.tag }}" + imagePullPolicy: {{ $global.Values.midcbfmcs.image.pullPolicy }} + command: + - sh + args: +{{ toYaml $deviceserver.args | indent 10 }} + env: + - name: TANGO_HOST + value: databaseds-tango-base-{{ $global.Release.Name }}:10000 + resources: +{{ toYaml $global.Values.resources | indent 10 }} +{{- with $global.Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} +{{- end }} +{{- with $global.Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} +{{- end }} +{{- with $global.Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} +{{- end }} + +{{- end }} # end of range + +{{ end }} diff --git a/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/values.yaml b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..15b7be20ca7548605c427132332b69b761aca907 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/charts/cbf-proto/values.yaml @@ -0,0 +1,154 @@ +# Default values for csp-proto. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +display: ":0" +xauthority: "~/.Xauthority" + +system: csp +subsystem: cbfmcs-mid +telescope: SKA-mid + +midcbfmcs: + enabled: true + image: + registry: nexus.engageska-portugal.pt/ska-docker + image: mid-cbf-mcs + tag: 0.4.5-2e83f4c + pullPolicy: IfNotPresent + +dsconfig: + image: + registry: nexus.engageska-portugal.pt/ska-docker + image: tango-dsconfig + tag: 1.2.5.1 + pullPolicy: IfNotPresent + +deviceServers: + - name: cbfmaster + function: cbf-central-control + domain: csp-monitoring + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/001 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/002 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/003 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/004 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/fsp/01 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/fsp/02 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/fsp/03 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/fsp/04 &&\ + /venv/bin/python /app/tangods/CbfMaster/CbfMaster/CbfMaster.py master" + - name: cbfsubarray01 + function: cbf-subarray-observation + domain: subarray + args: + - -c + - "retry --max=5 -- tango_admin --ping-device mid_csp_cbf/sub_elt/master &&\ + /venv/bin/python /app/tangods/CbfSubarray/CbfSubarrayMulti/CbfSubarrayMulti.py cbfSubarray-01" + - name: cbfsubarray02 + function: cbf-subarray-observation + domain: subarray + args: + - -c + - "retry --max=5 -- tango_admin --ping-device mid_csp_cbf/sub_elt/master &&\ + /venv/bin/python /app/tangods/CbfSubarray/CbfSubarrayMulti/CbfSubarrayMulti.py cbfSubarray-02" + - name: cbfsubarray03 + function: cbf-subarray-observation + domain: subarray + args: + - -c + - "retry --max=5 -- tango_admin --ping-device mid_csp_cbf/sub_elt/master &&\ + /venv/bin/python /app/tangods/CbfSubarray/CbfSubarrayMulti/CbfSubarrayMulti.py cbfSubarray-03" + - name: vcc001 + function: coarse-channelisation + domain: sensing + args: + - -c + - "/venv/bin/python /app/tangods/Vcc/VccMulti/VccMulti.py vcc-001" + - name: vcc002 + function: coarse-channelisation + domain: sensing + args: + - -c + - "/venv/bin/python /app/tangods/Vcc/VccMulti/VccMulti.py vcc-002" + - name: vcc003 + function: coarse-channelisation + domain: sensing + args: + - -c + - "/venv/bin/python /app/tangods/Vcc/VccMulti/VccMulti.py vcc-003" + - name: vcc004 + function: coarse-channelisation + domain: sensing + args: + - -c + - "/venv/bin/python /app/tangods/Vcc/VccMulti/VccMulti.py vcc-004" + - name: fsp01 + function: fsp-processing + domain: signal-processing + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/001 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/002 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/003 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/004 &&\ + /venv/bin/python /app/tangods/Fsp/FspMulti/FspMulti.py fsp-01" + - name: fsp02 + function: fsp-processing + domain: signal-processing + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/001 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/002 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/003 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/004 &&\ + /venv/bin/python /app/tangods/Fsp/FspMulti/FspMulti.py fsp-02" + - name: fsp03 + function: fsp-processing + domain: signal-processing + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/001 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/002 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/003 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/004 &&\ + /venv/bin/python /app/tangods/Fsp/FspMulti/FspMulti.py fsp-03" + - name: fsp04 + function: fsp-processing + domain: signal-processing + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/001 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/002 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/003 &&\ + retry --max=10 -- tango_admin --ping-device mid_csp_cbf/vcc/004 &&\ + /venv/bin/python /app/tangods/Fsp/FspMulti/FspMulti.py fsp-04" + - name: tmcspsubarrayleafnodetest + function: simul-observation + domain: telstate + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_01 &&\ + /venv/bin/python /app/tangods/TmCspSubarrayLeafNodeTest/TmCspSubarrayLeafNodeTest.py tm" + - name: tmcspsubarrayleafnodetest2 + function: simul-observation + domain: telstate + args: + - -c + - "retry --max=10 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_02 &&\ + /venv/bin/python /app/tangods/TmCspSubarrayLeafNodeTest/TmCspSubarrayLeafNodeTest.py tm2" + +nodeSelector: {} + +affinity: {} + +tolerations: [] + +resources: + requests: + cpu: 100m # 100m = 0.10 CPU + memory: 128Mi # 128Mi = 0.12 GB mem + limits: + cpu: 200m # 200m = 0.20 CPU + memory: 256Mi # 256Mi = 0.25 GB mem diff --git a/csp-lmc-mid/charts/mid-csp/secrets/.gitkeep b/csp-lmc-mid/charts/mid-csp/secrets/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/csp-lmc-mid/charts/mid-csp/secrets/tls.crt b/csp-lmc-mid/charts/mid-csp/secrets/tls.crt new file mode 100644 index 0000000000000000000000000000000000000000..281f413bab4869e1ae55e7624ed42bfce8b13f19 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/secrets/tls.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDRTCCAi2gAwIBAgIUCWlGy8z2r11G2Sc52B0zjGpytywwDQYJKoZIhvcNAQEL +BQAwMjEdMBsGA1UEAwwUdGVzdC5jc3AtcHJvdG8ubG9jYWwxETAPBgNVBAoMCE1p +bmlrdWJlMB4XDTIwMDkwNDA2NDM0OFoXDTIxMDkwNDA2NDM0OFowMjEdMBsGA1UE +AwwUdGVzdC5jc3AtcHJvdG8ubG9jYWwxETAPBgNVBAoMCE1pbmlrdWJlMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+y4kIIi+hU5fNdV1JTc4qCDh2VAO +lhXX5LmJAQbWWkzOWszOcqGB0g6P4CNIAgNVmFjPoPNsbxlBrKFpoI78p4y1iW4C +LOGkg4gwND1f8SNE7VJyqCiMti7SdBFF6LRNdp6WwmVKVuRdN4Tk+B+39dlTSVjx +Ykziqy7vRLwBsJlbhxIFRkFNdmzpucYTcjUfB4PM5my30ZGdqMnsZ5Mpzw/BkC+s +VRVMSKq1nmtgMYIZUTgdue/sC/SKuqH4FffiQZ6RLAABl1qXFU/A2RkjSn3VBuYh +CWXPgSvi5mxCWDqf4lGZR+yxWMD+t7AG4IuLUl+KeV8PIjvMWSKb+Fdy9wIDAQAB +o1MwUTAdBgNVHQ4EFgQUdnM99TO9Jn3Oi16QbSIqeDkQr1cwHwYDVR0jBBgwFoAU +dnM99TO9Jn3Oi16QbSIqeDkQr1cwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B +AQsFAAOCAQEA5d3w4vrLHbto4NGfKyjORnqQyxEeI5eZe9xRBaxobdhMlFDshNjC +GTcOdcAiGU9jRn95fItJZraXMYCR+Ysf9edU+YEaVnKioWnCUflxBNa2tZ7c+sNC +zqvcRIYZIGGg1J4RYZ0i0XJsYKn+RCuhSPjR3C1nSN47PPjnk85hnUyofdGHDJ2W +p71ozY2o3lKuw9NiU9kqnW2NRW/QBZvKnGHdq2izP8ciZZJtCsz8Tz9I1AzL2qqx +G8UThABjlIVMzhoRjzQ6vI5mcP/ucJZ1nU2/sqOGI4aLVRNTlv5DsiuPmC6zHD/s +ApaI7734oQBu6SkIrJLNyNwk2cQusgX44Q== +-----END CERTIFICATE----- diff --git a/csp-lmc-mid/charts/mid-csp/secrets/tls.key b/csp-lmc-mid/charts/mid-csp/secrets/tls.key new file mode 100644 index 0000000000000000000000000000000000000000..5747df7263c31ce17210d17f8ea53ad15add313a --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/secrets/tls.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD7LiQgiL6FTl81 +1XUlNzioIOHZUA6WFdfkuYkBBtZaTM5azM5yoYHSDo/gI0gCA1WYWM+g82xvGUGs +oWmgjvynjLWJbgIs4aSDiDA0PV/xI0TtUnKoKIy2LtJ0EUXotE12npbCZUpW5F03 +hOT4H7f12VNJWPFiTOKrLu9EvAGwmVuHEgVGQU12bOm5xhNyNR8Hg8zmbLfRkZ2o +yexnkynPD8GQL6xVFUxIqrWea2AxghlROB257+wL9Iq6ofgV9+JBnpEsAAGXWpcV +T8DZGSNKfdUG5iEJZc+BK+LmbEJYOp/iUZlH7LFYwP63sAbgi4tSX4p5Xw8iO8xZ +Ipv4V3L3AgMBAAECggEBAIEBxdRf51qYUhZYN/6RSiwwF0+B6rvzJBt5n4BDfryK +TkIchrwhb4fvqr234TgHdmL02k8UN1Eoa666iIHKbsGvZ13afouGqPRVckyiaTB0 +qOYrPnBXw02e5sBuTrWiRVbzRQM6+t9+EtJ9EwzNXbKLmFdHs1KForXBOWrYFRYZ +6Yb4ElByKHwaLlqnkdySSSCLkc4Epm+UeXz09GJMwCre+XyYAz1p4iL6IuyQXAhr +IVnYo9zaNHFxVi9Oxvk0fjCv7GEKpY4NtFeSYa1a511ATF0S45qspsCkgUUXGsjF +7fXw13X/oF5bMdoIJ7n+M9jCoky93nksTuB4/kx+HyECgYEA/7IkVlaP6EqZyZby +voK7bjQX3mroLDk6poxg9Bp/j01DbfeLeZB8Yw1QBR3yuVMSoATN33T78F6bqA0W +ekuG30K6YYR5/JeibKTT6VY9edNLTkbsMQFVdbgrJf5KiMKibAELzG78WnTj9SND +xG8qUL30wWC0sfpSi7jDXtgQZ10CgYEA+3qfyynyfayMvbcGtdvCyBO6ZvDlpf/f +pIE1o1amnRiDvLzNNVADHgHa16Jd4ETfSohcgo4aF4QNG4BFE+w+hBjbBWQdtrAM +149+S+g/7U4hYvaeou4719fyFygDynBiF39Sx5ffluHzPmnJXhR8t1kDyMQ2jcb/ +EIYHFeanwmMCgYEAp8dBlrGIDhldXezBbYak7AQcoWIu5E3NEVnNiH8WsnY1R6QG +Dgdjxy8GEcV77mT3NK7SU80UP74kjxm/ZRHH9xl26OQfk0IAXx+suVBQWG7v2/Yn +p2RDqlHlZjG8wI5OO2ZYUpWE2uoWZlT0c6Gp938dagJFrv8dSPc8ozBNWzUCgYBa +6jkMzOxyzMfQ6nNNmdZwWNmBz8NmYPvsUB4hH/l6P9uYhzU0+ek2lvsUDAoeQyfq +nSO8uzzplX7bm2Ld0gHD5eyApXIskrcB00mYja1W0HE3gutVAgW2gcZu4rOEI18D +Ga/GorxdovA6dyoqjgOMkWzRz0XdubyKr7muDEZH+wKBgDw3y6Ujx0fTgENMgrLD +lj205wSOUZe9a5QJQ3HbsKh2qDY0nK2COMo8OW76+a5Vlk2PJLyXQGU2Ceuj+rUq +yY3+cVQfjI3dYv+5nTh4O1XRiZwVhHm/AkUlQ5n0C9KSa4Ejhpb8A7RUDAC8B8cn +p+IuCq0Nk9KtGwdvh9fH/hJ5 +-----END PRIVATE KEY----- diff --git a/csp-lmc-mid/charts/mid-csp/templates/_helpers.tpl b/csp-lmc-mid/charts/mid-csp/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..bd04ea71305621f17ed373a12010152702f800e9 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "mid-csp.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "mid-csp.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "mid-csp.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "mid-csp.labels" -}} +helm.sh/chart: {{ include "mid-csp.chart" . }} +{{ include "mid-csp.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "mid-csp.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mid-csp.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "mid-csp.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "mid-csp.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/csp-lmc-mid/charts/mid-csp/values.yaml b/csp-lmc-mid/charts/mid-csp/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5048f33d14311602239adfe2694a741089828442 --- /dev/null +++ b/csp-lmc-mid/charts/mid-csp/values.yaml @@ -0,0 +1,11 @@ +# Default values for mid-csp. +csp-proto: + csplmc: + enabled: true +cbf-proto: + midcbfmcs: + enabled: true +tango-base: + tangodb: + enabled: true + use_pv: false diff --git a/csp-lmc-mid/docker/.make/Makefile.mk b/csp-lmc-mid/docker/.make/Makefile.mk index 4534f2faab349226a5f01b16ab5078dd6382164d..2925ad0b5925d34978f414aa28ffe021758d48f0 100644 --- a/csp-lmc-mid/docker/.make/Makefile.mk +++ b/csp-lmc-mid/docker/.make/Makefile.mk @@ -20,7 +20,7 @@ else NAME=$(PROJECT) endif -RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support +RELEASE_SUPPORT := $(shell cp ../.release . ;dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support ifeq ($(strip $(DOCKER_REGISTRY_HOST)),) DOCKER_REGISTRY_HOST = nexus.engageska-portugal.pt @@ -56,14 +56,17 @@ DOCKER_FILE_PATH=Dockerfile build: pre-build docker-build post-build ## build the application image pre-build: - + cp ../.release . + cp ../Dockerfile . post-build: + rm .release + rm Dockerfile pre-push: post-push: -docker-build: .release +docker-build: @echo "VERSION: $(VERSION)" @echo "Building image: $(IMAGE):$(VERSION)" @echo "NAME: $(NAME)" diff --git a/csp-lmc-mid/docker/config/config_result.json b/csp-lmc-mid/docker/config/config_result.json new file mode 100644 index 0000000000000000000000000000000000000000..19ef30b9cca4d59f39d4b153e8d142405f7fdb7c --- /dev/null +++ b/csp-lmc-mid/docker/config/config_result.json @@ -0,0 +1,2542 @@ +{ + "servers": { + "CbfMaster": { + "master": { + "CbfMaster": { + "mid_csp_cbf/sub_elt/master": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_01", + "mid_csp_cbf/sub_elt/subarray_02", + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "MaxCapabilities": [ + "VCC:4", + "FSP:4", + "Subarray:2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "reportfspstate", + "1000", + "reportvccadminmode", + "1000", + "reportvcchealthstate", + "1000", + "receptortovcc", + "1000", + "reportfspCorrSubarraymembership", + "1000", + "reportfsphealthstate", + "1000", + "healthstate", + "1000", + "adminmode", + "1000", + "subarrayconfigid", + "1000", + "reportfspadminmode", + "1000", + "commandprogress", + "2000", + "reportsubarrayhealthstate", + "1000", + "reportvccstate", + "1000", + "reportsubarrayadminmode", + "1000", + "vcctoreceptor", + "3000", + "reportsubarraystate", + "3000", + "state", + "1000" + ] + } + } + } + } + }, + "CbfSubarrayMulti": { + "cbfSubarray-01": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CorrConfigAddress": [ + "mid_csp_cbf/corrconfig/01" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_01", + "mid_csp_cbf/fspCorrSubarray/02_01", + "mid_csp_cbf/fspCorrSubarray/03_01", + "mid_csp_cbf/fspCorrSubarray/04_01" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_01", + "mid_csp_cbf/fspPssSubarray/02_01", + "mid_csp_cbf/fspPssSubarray/03_01", + "mid_csp_cbf/fspPssSubarray/04_01" + ], + "PssConfigAddress": [ + "mid_csp_cbf/pssconfig/01" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/01" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/01" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "healthstate", + "1000", + "fsphealthstate", + "1000", + "fspstate", + "1000", + "vccstate", + "1000", + "vcchealthstate", + "1000", + "configid", + "1000", + "fspList", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "CbfSubarrayCorrConfig": { + "mid_csp_cbf/corrConfig/01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_01", + "mid_csp_cbf/fspCorrSubarray/02_01", + "mid_csp_cbf/fspCorrSubarray/03_01", + "mid_csp_cbf/fspCorrSubarray/04_01" + ] + } + } + }, + "CbfSubarrayPssConfig": { + "mid_csp_cbf/pssConfig/01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_01", + "mid_csp_cbf/fspPssSubarray/02_01", + "mid_csp_cbf/fspPssSubarray/03_01", + "mid_csp_cbf/fspPssSubarray/04_01" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/01": {}, + "mid_csp_cbf/sw2/01": {} + }, + "SendConfig": { + "mid_csp_cbf/SendConfig/01": { + "properties": { + "SubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ] + } + } + } + }, + "cbfSubarray-02": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CorrConfigAddress": [ + "mid_csp_cbf/corrconfig/02" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_02", + "mid_csp_cbf/fspCorrSubarray/02_02", + "mid_csp_cbf/fspCorrSubarray/03_02", + "mid_csp_cbf/fspCorrSubarray/04_02" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_02", + "mid_csp_cbf/fspPssSubarray/02_02", + "mid_csp_cbf/fspPssSubarray/03_02", + "mid_csp_cbf/fspPssSubarray/04_02" + ], + "PssConfigAddress": [ + "mid_csp_cbf/pssconfig/02" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/02" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/02" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "configid", + "1000", + "healthstate", + "1000", + "vcchealthstate", + "1000", + "adminmode", + "1000", + "fspstate", + "1000", + "fspList", + "1000", + "fsphealthstate", + "1000", + "vccstate", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "CbfSubarrayCorrConfig": { + "mid_csp_cbf/corrConfig/02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_02", + "mid_csp_cbf/fspCorrSubarray/02_02", + "mid_csp_cbf/fspCorrSubarray/03_02", + "mid_csp_cbf/fspCorrSubarray/04_02" + ] + } + } + }, + "CbfSubarrayPssConfig": { + "mid_csp_cbf/pssConfig/02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_02", + "mid_csp_cbf/fspPssSubarray/02_02", + "mid_csp_cbf/fspPssSubarray/03_02", + "mid_csp_cbf/fspPssSubarray/04_02" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/02": {}, + "mid_csp_cbf/sw2/02": {} + }, + "SendConfig": { + "mid_csp_cbf/SendConfig/02": { + "properties": { + "SubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ] + } + } + } + }, + "cbfSubarray-03": { + "CbfSubarray": { + "mid_csp_cbf/sub_elt/subarray_03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "scanID": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CorrConfigAddress": [ + "mid_csp_cbf/corrconfig/03" + ], + "FSP": [ + "mid_csp_cbf/fsp/01", + "mid_csp_cbf/fsp/02", + "mid_csp_cbf/fsp/03", + "mid_csp_cbf/fsp/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_03", + "mid_csp_cbf/fspCorrSubarray/02_03", + "mid_csp_cbf/fspCorrSubarray/03_03", + "mid_csp_cbf/fspCorrSubarray/04_03" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_03", + "mid_csp_cbf/fspPssSubarray/02_03", + "mid_csp_cbf/fspPssSubarray/03_03", + "mid_csp_cbf/fspPssSubarray/04_03" + ], + "PssConfigAddress": [ + "mid_csp_cbf/pssconfig/03" + ], + "SW1Address": [ + "mid_csp_cbf/sw1/03" + ], + "SW2Address": [ + "mid_csp_cbf/sw2/03" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ], + "polled_attr": [ + "healthstate", + "1000", + "fsphealthstate", + "1000", + "fspstate", + "1000", + "vccstate", + "1000", + "vcchealthstate", + "1000", + "configid", + "1000", + "fspList", + "1000", + "outputLinksDistribution", + "1000" + ] + } + } + }, + "CbfSubarrayCorrConfig": { + "mid_csp_cbf/corrConfig/03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_03", + "mid_csp_cbf/fspCorrSubarray/02_03", + "mid_csp_cbf/fspCorrSubarray/03_03", + "mid_csp_cbf/fspCorrSubarray/04_03" + ] + } + } + }, + "CbfSubarrayPssConfig": { + "mid_csp_cbf/pssConfig/03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_03", + "mid_csp_cbf/fspPssSubarray/02_03", + "mid_csp_cbf/fspPssSubarray/03_03", + "mid_csp_cbf/fspPssSubarray/04_03" + ] + } + } + }, + "SearchWindow": { + "mid_csp_cbf/sw1/03": {}, + "mid_csp_cbf/sw2/03": {} + }, + "SendConfig": { + "mid_csp_cbf/SendConfig/03": { + "properties": { + "SubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ] + } + } + } + } + }, + "DataBaseds": { + "2": { + "DataBase": { + "sys/database/2": {} + } + } + }, + "FspMulti": { + "fsp-01": { + "Fsp": { + "mid_csp_cbf/fsp/01": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/01" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/01_01", + "mid_csp_cbf/fspCorrSubarray/01_02", + "mid_csp_cbf/fspCorrSubarray/01_03" + ], + "FspID": [ + "1" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/01_01", + "mid_csp_cbf/fspPssSubarray/01_02", + "mid_csp_cbf/fspPssSubarray/01_03" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/01" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/01" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/01" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/01": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/01_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "1" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/01_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "1" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/01_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "1" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/01": {} + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/01_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "1" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/01_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "1" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/01_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "1" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/01": {} + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/01": {} + } + }, + "fsp-02": { + "Fsp": { + "mid_csp_cbf/fsp/02": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/02" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/02_01", + "mid_csp_cbf/fspCorrSubarray/02_02", + "mid_csp_cbf/fspCorrSubarray/02_03" + ], + "FspID": [ + "2" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/02_01", + "mid_csp_cbf/fspPssSubarray/02_02", + "mid_csp_cbf/fspPssSubarray/02_03" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/02" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/02" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/02" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/02": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/02_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "2" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/02_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "2" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/02_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "2" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/02": {} + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/02_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "2" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/02_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "2" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/02_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "2" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/02": {} + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/02": {} + } + }, + "fsp-03": { + "Fsp": { + "mid_csp_cbf/fsp/03": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/03" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/03_01", + "mid_csp_cbf/fspCorrSubarray/03_02", + "mid_csp_cbf/fspCorrSubarray/03_03" + ], + "FspID": [ + "3" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/03_01", + "mid_csp_cbf/fspPssSubarray/03_02", + "mid_csp_cbf/fspPssSubarray/03_03" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/03" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/03" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/03" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/03": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/03_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "3" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/03_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "3" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/03_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "3" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/03": {} + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/03_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "3" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/03_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "3" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/03_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "3" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/03": {} + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/03": {} + } + }, + "fsp-04": { + "Fsp": { + "mid_csp_cbf/fsp/04": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CorrelationAddress": [ + "mid_csp_cbf/fsp_corr/04" + ], + "FspCorrSubarray": [ + "mid_csp_cbf/fspCorrSubarray/04_01", + "mid_csp_cbf/fspCorrSubarray/04_02", + "mid_csp_cbf/fspCorrSubarray/04_03" + ], + "FspID": [ + "4" + ], + "FspPssSubarray": [ + "mid_csp_cbf/fspPssSubarray/04_01", + "mid_csp_cbf/fspPssSubarray/04_02", + "mid_csp_cbf/fspPssSubarray/04_03" + ], + "PSSAddress": [ + "mid_csp_cbf/fsp_pss/04" + ], + "PSTAddress": [ + "mid_csp_cbf/fsp_pst/04" + ], + "VLBIAddress": [ + "mid_csp_cbf/fsp_vlbi/04" + ], + "polled_attr": [ + "adminmode", + "1000", + "healthstate", + "1000", + "state", + "1000", + "subarraymembership", + "1000" + ] + } + } + }, + "FspCorr": { + "mid_csp_cbf/fsp_corr/04": {} + }, + "FspCorrSubarray": { + "mid_csp_cbf/fspCorrSubarray/04_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "4" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/04_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "4" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspCorrSubarray/04_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "4" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPss": { + "mid_csp_cbf/fsp_pss/04": {} + }, + "FspPssSubarray": { + "mid_csp_cbf/fspPssSubarray/04_01": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "FspID": [ + "4" + ], + "SubID": [ + "1" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/04_02": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "FspID": [ + "4" + ], + "SubID": [ + "2" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + }, + "mid_csp_cbf/fspPssSubarray/04_03": { + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "FspID": [ + "4" + ], + "SubID": [ + "3" + ], + "VCC": [ + "mid_csp_cbf/vcc/001", + "mid_csp_cbf/vcc/002", + "mid_csp_cbf/vcc/003", + "mid_csp_cbf/vcc/004" + ] + } + } + }, + "FspPst": { + "mid_csp_cbf/fsp_pst/04": {} + }, + "FspVlbi": { + "mid_csp_cbf/fsp_vlbi/04": {} + } + } + }, + "MidCspCapabilityMonitor": { + "monitor": { + "CspCapabilityMonitor": { + "mid_csp/capability_monitor/timing_beams": { + "properties": { + "CapabilityDevices": [ + "mid_csp/timing_beams/04", + "mid_csp/timing_beams/03", + "mid_csp/timing_beams/01", + "mid_csp/timing_beams/02" + ], + "SkaLevel": [ + "2" + ] + } + }, + "mid_csp/capability_monitor/vcc": { + "properties": { + "CapabilityDevices": [ + "mid_csp/vcc/004", + "mid_csp/vcc/003", + "mid_csp/vcc/002", + "mid_csp/vcc/001" + ], + "SkaLevel": [ + "2" + ] + } + }, + "mid_csp/capability_monitor/vlbi_beams": { + "properties": { + "CapabilityDevices": [ + "mid_csp/vlbi_beams/03", + "mid_csp/vlbi_beams/04", + "mid_csp/vlbi_beams/02", + "mid_csp/vlbi_beams/01" + ], + "SkaLevel": [ + "2" + ] + } + } + }, + "CspSearchBeamsMonitor": { + "mid_csp/capability_monitor/search_beams": { + "properties": { + "CapabilityDevices": [ + "mid_csp/search_beams/04", + "mid_csp/search_beams/03", + "mid_csp/search_beams/01", + "mid_csp/search_beams/02" + ], + "SkaLevel": [ + "2" + ] + } + } + } + } + }, + "MidCspMaster": { + "master": { + "MidCspMasterBase": { + "mid_csp/elt/master": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "numOfReservedSearchBeams": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/numOfReservedIDs" + ] + }, + "numOfUnassignedSearchBeams": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/numOfUnassignedIDs" + ] + }, + "numOfUnassignedTimingBeams": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/numOfUnassignedIDs" + ] + }, + "numOfUnassignedVlbiBeams": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/numOfUnassignedIDs" + ] + }, + "reportFSPAdminMode": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPAdminMode" + ] + }, + "reportFSPHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPHealthState" + ] + }, + "reportFSPState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportFSPState" + ] + }, + "reportSearchBeamAdminMode": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityAdminMode" + ] + }, + "reportSearchBeamHealthState": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityHealthState" + ] + }, + "reportSearchBeamObsState": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityObsState" + ] + }, + "reportSearchBeamState": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityState" + ] + }, + "reportTimingBeamAdminMode": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityAdminMode" + ] + }, + "reportTimingBeamHealthState": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityHealthState" + ] + }, + "reportTimingBeamObsState": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityObsState" + ] + }, + "reportTimingBeamState": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityState" + ] + }, + "reportVCCAdminMode": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCAdminMode" + ] + }, + "reportVCCHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCHealthState" + ] + }, + "reportVCCState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCState" + ] + }, + "reportVlbiBeamAdminMode": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityAdminMode" + ] + }, + "reportVlbiBeamHealthState": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityHealthState" + ] + }, + "reportVlbiBeamObsState": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityObsState" + ] + }, + "reportVlbiBeamState": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityState" + ] + }, + "searchBeamMembership": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/capabilityMembership" + ] + }, + "timingBeamMembership": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/capabilityMembership" + ] + }, + "unassignedSearchBeamIDs": { + "__root_att": [ + "mid_csp/capability_monitor/search_beams/unassignedIDs" + ] + }, + "unassignedTimingBeamIDs": { + "__root_att": [ + "mid_csp/capability_monitor/timing_beams/unassignedIDs" + ] + }, + "unassignedVlbiBeamIDs": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/unassignedIDs" + ] + }, + "vccMembership": { + "__root_att": [ + "mid_csp_cbf/sub_elt/master/reportVCCSubarrayMembership" + ] + }, + "vlbiBeamMembership": { + "__root_att": [ + "mid_csp/capability_monitor/vlbi_beams/capabilityMembership" + ] + } + }, + "properties": { + "CspCbf": [ + "mid_csp_cbf/sub_elt/master" + ], + "CspPss": [ + "mid_csp_pss/sub_elt/master" + ], + "CspPst": [ + "mid_csp_pst/sub_elt/master" + ], + "CspSubarrays": [ + "mid_csp/elt/subarray_01", + "mid_csp/elt/subarray_02", + "mid_csp/elt/subarray_03" + ], + "MaxCapabilities": [ + "VCC:4", + "SearchBeams:1500", + "TimingBeams:16", + "VlbiBeams:20" + ], + "SearchBeamsMonitor": [ + "mid_csp/capability_monitor/search_beams" + ], + "SkaLevel": [ + "1" + ], + "TimingBeamsMonitor": [ + "mid_csp/capability_monitor/timing_beams" + ], + "VlbiBeamsMonitor": [ + "mid_csp/capability_monitor/vlbi_beams" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000", + "state", + "1000", + "csppssadminmode", + "1000", + "csppstadminmode", + "1000", + "cspcbfadminmode", + "1000", + "oncommandprogress", + "1500", + "offcommandprogress", + "1500", + "offcmddurationexpected", + "1500", + "standbycommandprogress", + "1500", + "oncmddurationexpected", + "1500", + "standbycmddurationexpected", + "1500", + "oncmddurationmeasured", + "1500", + "offcmddurationmeasured", + "1500", + "standbycmddurationmeasured", + "1500", + "offcmdtimeoutexpired", + "1500", + "oncmdtimeoutexpired", + "1500", + "csppssstate", + "1000", + "standbycmdtimeoutexpired", + "1000", + "csppststate", + "1000", + "cspcbfhealthstate", + "1000", + "csppsshealthstate", + "1000", + "csppsthealthstate", + "1000", + "cspcbfadminmode", + "1000", + "oncmdfailure", + "2000", + "offcmdfailure", + "2000", + "standbycmdfailure", + "2000", + "cspcbfstate", + "1000" + ] + } + } + } + } + }, + "MidCspSubarray": { + "subarray1": { + "MidCspSubarrayBase": { + "mid_csp/elt/subarray_01": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "assignedFspHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/fspHealthState" + ] + }, + "assignedFspState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/fspState" + ] + }, + "assignedReceptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/receptors" + ] + }, + "assignedVccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/vccHealthState" + ] + }, + "assignedVccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_01/vccState" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "testNumber": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "CspMaster": [ + "mid_csp/elt/master" + ], + "PssSubarray": [ + "mid_csp_pss/sub_elt/subarray_01" + ], + "SkaLevel": [ + "2" + ], + "SubID": [ + "1" + ], + "SubarrayProcModeCorrelation": [ + "mid_csp/elt/correlation-01" + ], + "SubarrayProcModePss": [ + "mid_csp/elt/pss-01" + ], + "SubarrayProcModePst": [ + "mid_csp/elt/pst-01" + ], + "SubarrayProcModeVlbi": [ + "mid_csp/elt/vlbi-01" + ], + "polled_attr": [ + "failureraisedflag", + "1000", + "timeoutexpiredflag", + "1000", + "scancmdprogress", + "1500", + "removeresourcescmdprogress", + "1500", + "addresourcescmdprogress", + "1500", + "endscancmdprogress", + "1500", + "gotoidlecmdprogress", + "1500" + ] + } + } + }, + "MidCspSubarrayProcModeCorrelation": { + "mid_csp/elt/correlation-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "CORRELATION" + ], + "subID": [ + "1" + ] + } + } + }, + "MidCspSubarrayProcModePss": { + "mid_csp/elt/pss-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PSS" + ], + "subID": [ + "1" + ] + } + } + }, + "MidCspSubarrayProcModePst": { + "mid_csp/elt/pst-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PST" + ], + "subID": [ + "1" + ] + } + } + }, + "MidCspSubarrayProcModeVlbi": { + "mid_csp/elt/vlbi-01": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "VLBI" + ], + "subID": [ + "1" + ] + } + } + } + }, + "subarray2": { + "MidCspSubarrayBase": { + "mid_csp/elt/subarray_02": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "assignedFspHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/fspHealthState" + ] + }, + "assignedFspState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/fspState" + ] + }, + "assignedReceptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/receptors" + ] + }, + "assignedVccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/vccHealthState" + ] + }, + "assignedVccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_02/vccState" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "testNumber": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "CspMaster": [ + "mid_csp/elt/master" + ], + "PssSubarray": [ + "mid_csp_pss/sub_elt/subarray_02" + ], + "SkaLevel": [ + "2" + ], + "SubID": [ + "2" + ], + "SubarrayProcModeCorrelation": [ + "mid_csp/elt/correlation-02" + ], + "SubarrayProcModePss": [ + "mid_csp/elt/pss-02" + ], + "SubarrayProcModePst": [ + "mid_csp/elt/pst-02" + ], + "SubarrayProcModeVlbi": [ + "mid_csp/elt/vlbi-02" + ], + "polled_attr": [ + "failureraisedflag", + "1000", + "timeoutexpiredflag", + "1000", + "scancmdprogress", + "1500", + "removeresourcescmdprogress", + "1500", + "addresourcescmdprogress", + "1500", + "endscancmdprogress", + "1500", + "gotoidlecmdprogress", + "1500" + ] + } + } + }, + "MidCspSubarrayProcModeCorrelation": { + "mid_csp/elt/correlation-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "CORRELATION" + ], + "subID": [ + "2" + ] + } + } + }, + "MidCspSubarrayProcModePss": { + "mid_csp/elt/pss-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PSS" + ], + "subID": [ + "2" + ] + } + } + }, + "MidCspSubarrayProcModePst": { + "mid_csp/elt/pst-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PST" + ], + "subID": [ + "2" + ] + } + } + }, + "MidCspSubarrayProcModeVlbi": { + "mid_csp/elt/vlbi-02": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "VLBI" + ], + "subID": [ + "2" + ] + } + } + } + }, + "subarray3": { + "MidCspSubarrayBase": { + "mid_csp/elt/subarray_03": { + "attribute_properties": { + "adminMode": { + "__value": [ + "0" + ], + "abs_change": [ + "-1", + "1" + ] + }, + "assignedFspHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/fspHealthState" + ] + }, + "assignedFspState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/fspState" + ] + }, + "assignedReceptors": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/receptors" + ] + }, + "assignedVccHealthState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/vccHealthState" + ] + }, + "assignedVccState": { + "__root_att": [ + "mid_csp_cbf/sub_elt/subarray_03/vccState" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "obsState": { + "abs_change": [ + "-1", + "1" + ] + }, + "testNumber": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfSubarray": [ + "mid_csp_cbf/sub_elt/subarray_03" + ], + "CspMaster": [ + "mid_csp/elt/master" + ], + "PssSubarray": [ + "mid_csp_pss/sub_elt/subarray_03" + ], + "SkaLevel": [ + "2" + ], + "SubID": [ + "3" + ], + "SubarrayProcModeCorrelation": [ + "mid_csp/elt/correlation-03" + ], + "SubarrayProcModePss": [ + "mid_csp/elt/pss-03" + ], + "SubarrayProcModePst": [ + "mid_csp/elt/pst-03" + ], + "SubarrayProcModeVlbi": [ + "mid_csp/elt/vlbi-03" + ], + "polled_attr": [ + "failureraisedflag", + "1000", + "timeoutexpiredflag", + "1000", + "scancmdprogress", + "1500", + "removeresourcescmdprogress", + "1500", + "addresourcescmdprogress", + "1500", + "endscancmdprogress", + "1500", + "gotoidlecmdprogress", + "1500" + ] + } + } + }, + "MidCspSubarrayProcModeCorrelation": { + "mid_csp/elt/correlation-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "CORRELATION" + ], + "subID": [ + "3" + ] + } + } + }, + "MidCspSubarrayProcModePss": { + "mid_csp/elt/pss-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PSS" + ], + "subID": [ + "3" + ] + } + } + }, + "MidCspSubarrayProcModePst": { + "mid_csp/elt/pst-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "PST" + ], + "subID": [ + "3" + ] + } + } + }, + "MidCspSubarrayProcModeVlbi": { + "mid_csp/elt/vlbi-03": { + "properties": { + "CapID": [ + "1" + ], + "CapType": [ + "VLBI" + ], + "subID": [ + "3" + ] + } + } + } + } + }, + "TangoAccessControl": { + "1": { + "TangoAccessControl": { + "sys/access_control/1": {} + } + } + }, + "TangoRestServer": { + "rest": { + "TangoRestServer": { + "sys/rest/0": {} + } + } + }, + "TangoTest": { + "test": { + "TangoTest": { + "sys/tg_test/1": {} + } + } + }, + "TmCspSubarrayLeafNodeTest": { + "tm": { + "TmCspSubarrayLeafNodeTest": { + "ska_mid/tm_leaf_node/csp_subarray01": { + "attribute_properties": { + "dopplerPhaseCorrection": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_01" + ], + "polled_attr": [ + "delaymodel", + "1000", + "visdestinationaddress", + "1000", + "dopplerphasecorrection", + "1000" + ] + } + } + } + }, + "tm2": { + "TmCspSubarrayLeafNodeTest": { + "ska_mid/tm_leaf_node/csp_subarray02": { + "attribute_properties": { + "dopplerPhaseCorrection": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "CbfMasterAddress": [ + "mid_csp_cbf/sub_elt/master" + ], + "CbfSubarrayAddress": [ + "mid_csp_cbf/sub_elt/subarray_02" + ], + "polled_attr": [ + "delaymodel", + "1000", + "visdestinationaddress", + "1000", + "dopplerphasecorrection", + "1000" + ] + } + } + } + } + }, + "VccMulti": { + "vcc-001": { + "Vcc": { + "mid_csp_cbf/vcc/001": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/001" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/001" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/001" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/001" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/001" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/001" + ], + "VccID": [ + "1" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/001": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/001": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/001": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/001": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/001": {}, + "mid_csp_cbf/vcc_sw2/001": {} + } + }, + "vcc-002": { + "Vcc": { + "mid_csp_cbf/vcc/002": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/002" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/002" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/002" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/002" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/002" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/002" + ], + "VccID": [ + "2" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/002": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/002": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/002": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/002": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/002": {}, + "mid_csp_cbf/vcc_sw2/002": {} + } + }, + "vcc-003": { + "Vcc": { + "mid_csp_cbf/vcc/003": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/003" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/003" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/003" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/003" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/003" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/003" + ], + "VccID": [ + "3" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/003": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/003": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/003": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/003": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/003": {}, + "mid_csp_cbf/vcc_sw2/003": {} + } + }, + "vcc-004": { + "Vcc": { + "mid_csp_cbf/vcc/004": { + "attribute_properties": { + "adminMode": { + "abs_change": [ + "-1", + "1" + ] + }, + "healthState": { + "abs_change": [ + "-1", + "1" + ] + }, + "subarrayMembership": { + "abs_change": [ + "-1", + "1" + ] + } + }, + "properties": { + "Band1And2Address": [ + "mid_csp_cbf/vcc_band12/004" + ], + "Band3Address": [ + "mid_csp_cbf/vcc_band3/004" + ], + "Band4Address": [ + "mid_csp_cbf/vcc_band4/004" + ], + "Band5Address": [ + "mid_csp_cbf/vcc_band5/004" + ], + "SW1Address": [ + "mid_csp_cbf/vcc_sw1/004" + ], + "SW2Address": [ + "mid_csp_cbf/vcc_sw2/004" + ], + "VccID": [ + "4" + ], + "polled_attr": [ + "healthstate", + "1000", + "adminmode", + "1000" + ] + } + } + }, + "VccBand1And2": { + "mid_csp_cbf/vcc_band12/004": {} + }, + "VccBand3": { + "mid_csp_cbf/vcc_band3/004": {} + }, + "VccBand4": { + "mid_csp_cbf/vcc_band4/004": {} + }, + "VccBand5": { + "mid_csp_cbf/vcc_band5/004": {} + }, + "VccSearchWindow": { + "mid_csp_cbf/vcc_sw1/004": {}, + "mid_csp_cbf/vcc_sw2/004": {} + } + } + } + } +} diff --git a/csp-lmc-mid/docker/mid-cbf-mcs.yml b/csp-lmc-mid/docker/mid-cbf-mcs.yml index 96879d8af103033a511f79c99856b954cdcaef82..882c714ae4fd29016f3895c8a66347bedb3dc9f6 100644 --- a/csp-lmc-mid/docker/mid-cbf-mcs.yml +++ b/csp-lmc-mid/docker/mid-cbf-mcs.yml @@ -23,9 +23,9 @@ services: - TANGO_HOST=${TANGO_HOST} command: > sh -c "wait-for-it.sh ${TANGO_HOST} --timeout=60 --strict -- - json2tango -w -a -u csplmc/config/midcbf_dsconfig.json && sleep infinity" + json2tango -w -a -u ../csplmc/charts/mid-csp/charts/cbf-proto/data/midcbfconfig.json && sleep infinity" volumes: - - .:/csplmc + - ..:/csplmc cbfmaster: image: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}/mid-cbf-mcs:0.4.5-2e83f4c diff --git a/csp-lmc-mid/docker/mid-csp-lmc.yml b/csp-lmc-mid/docker/mid-csp-lmc.yml index 5b40e9ceca8ca3a592ff9c5c6295587a5983ca71..5340c2930b9ea97ec0dda4039477c807af034c41 100644 --- a/csp-lmc-mid/docker/mid-csp-lmc.yml +++ b/csp-lmc-mid/docker/mid-csp-lmc.yml @@ -23,9 +23,9 @@ services: - TANGO_HOST=${TANGO_HOST} command: > sh -c "wait-for-it.sh ${TANGO_HOST} --timeout=60 --strict -- - json2tango -w -a -u csplmc/config/midcsplmc_dsconfig.json && sleep infinity" + json2tango -w -a -u csplmc/charts/csp-proto/data/cspconfig.json && sleep infinity" volumes: - - .:/csplmc + - ..:/csplmc midcsp_dumpdsconfig: image: nexus.engageska-portugal.pt/ska-docker/tango-dsconfig:latest diff --git a/csp-lmc-mid/requirements-tst.txt b/csp-lmc-mid/requirements-tst.txt new file mode 100644 index 0000000000000000000000000000000000000000..67c373bcd3793c3ec93885ff62ecd7ce775c1619 --- /dev/null +++ b/csp-lmc-mid/requirements-tst.txt @@ -0,0 +1,9 @@ +pytest +pytest-bdd +pytest-cov +pytest-json-report +pytest-mock +#pytest-xdist == 1.34.0 +pycodestyle +coverage +mock diff --git a/csp-lmc-mid/requirements.txt b/csp-lmc-mid/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a67db3c1938b40a61f402bfa8f89dedc2f47420 --- /dev/null +++ b/csp-lmc-mid/requirements.txt @@ -0,0 +1,5 @@ +numpy == 1.17.2 +pytango >= 9.3.2 +jsonschema >= 3.2.0 +lmcbaseclasses >= 0.6.4 +csp-lmc-common >= 0.6.8 diff --git a/csp-lmc-mid/setup.cfg b/csp-lmc-mid/setup.cfg index 40bde55d005621c8e78d8612ad635ef5e67e1329..d7e22e16a99e6cb4645257562dec1326243901a2 100644 --- a/csp-lmc-mid/setup.cfg +++ b/csp-lmc-mid/setup.cfg @@ -26,7 +26,7 @@ addopts = --forked --cov-report=term --cov-report=html --cov-report=xml - --junitxml=/build/reports/csp-lmc-mid-unit-tests.xml + --junitxml=build/reports/csp-lmc-mid-unit-tests.xml console_output_style = progress junit_family=legacy filterwarnings = diff --git a/csp-lmc-mid/setup.py b/csp-lmc-mid/setup.py index 34a15bd88ecd58136b49c0f1cc7d65abbe6271e1..14177cd6edb1b9175dc802f3d711fddf1c4dacac 100644 --- a/csp-lmc-mid/setup.py +++ b/csp-lmc-mid/setup.py @@ -63,7 +63,6 @@ setup( 'assertpy', 'pytest-forked', 'mock', - 'mid-csp-lmc' ], extras_require={ 'dev': ['prospector[with_pyroma]', 'yapf', 'isort'] diff --git a/csp-lmc-mid/test-harness/Makefile b/csp-lmc-mid/test-harness/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..60db74e1cb46ae09cc74e5ab967fb6f24a9728ea --- /dev/null +++ b/csp-lmc-mid/test-harness/Makefile @@ -0,0 +1,32 @@ +# Use bash shell with pipefail option enabled so that the return status of a +# piped command is the value of the last (rightmost) commnand to exit with a +# non-zero status. This lets us pipe output into tee but still exit on test +# failures. +SHELL = /bin/bash +.SHELLFLAGS = -o pipefail -c + +all: test + +# wait for the device to be available before beginning the test +# A temporary volume is mounted at /build when 'make test' is executing. +# The following steps copy across useful output to this volume which can +# then be extracted to form the CI summary for the test procedure. +test: + retry --max=15 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_01 + retry --max=15 -- tango_admin --ping-device mid_csp_cbf/sub_elt/subarray_02 + retry --max=15 -- tango_admin --ping-device mid_csp/elt/master + retry --max=15 -- tango_admin --ping-device mid_csp/elt/subarray_01 + retry --max=15 -- tango_admin --ping-device mid_csp/elt/subarray_02 + cd /app && python3 setup.py test| tee integration-test.stdout + mkdir -p build/reports && \ + if [ -d build ]; then \ + mv /app/integration-test.stdout ./build/csp-lmc-mid-setup-test.stdout; \ + mv /app/htmlcov ./build/csp-lmc-mid_htmlcov; \ + cp /app/coverage.xml ./build/coverage-csp-lmc-mid.xml; \ + cp /app/build/reports/csp-lmc-mid-unit-tests.xml ./build/reports; \ + fi; + + #cd /build && coverage combine csp-lmc-mid_coverage csp-lmc-common_coverage && coverage xml + #cd /build && mv coverage.xml ./reports/code-coverage.xml + +.PHONY: all test diff --git a/csp-lmc-mid/test-harness/README.md b/csp-lmc-mid/test-harness/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a3c9a496bbd5104392d08378de98af67f349183f --- /dev/null +++ b/csp-lmc-mid/test-harness/README.md @@ -0,0 +1,3 @@ +This directory is uploaded to the container when 'make test' is executed. Files +in this directory will be found inside /build once uploaded to the container. + diff --git a/csp-lmc-mid/test-harness/requirements-tst.txt b/csp-lmc-mid/test-harness/requirements-tst.txt new file mode 100644 index 0000000000000000000000000000000000000000..67c373bcd3793c3ec93885ff62ecd7ce775c1619 --- /dev/null +++ b/csp-lmc-mid/test-harness/requirements-tst.txt @@ -0,0 +1,9 @@ +pytest +pytest-bdd +pytest-cov +pytest-json-report +pytest-mock +#pytest-xdist == 1.34.0 +pycodestyle +coverage +mock diff --git a/csp-lmc-mid/test-harness/requirements.txt b/csp-lmc-mid/test-harness/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a67db3c1938b40a61f402bfa8f89dedc2f47420 --- /dev/null +++ b/csp-lmc-mid/test-harness/requirements.txt @@ -0,0 +1,5 @@ +numpy == 1.17.2 +pytango >= 9.3.2 +jsonschema >= 3.2.0 +lmcbaseclasses >= 0.6.4 +csp-lmc-common >= 0.6.8 diff --git a/csp-lmc-mid/tests/acceptance_tests/MidCspSubarrayConfiguration_test.py b/csp-lmc-mid/tests/acceptance_tests/MidCspSubarrayConfiguration_test.py deleted file mode 100644 index 069dadc4fad9dddc7166ac63e72084611ee7cb81..0000000000000000000000000000000000000000 --- a/csp-lmc-mid/tests/acceptance_tests/MidCspSubarrayConfiguration_test.py +++ /dev/null @@ -1,381 +0,0 @@ -"""Tests for ADR-4 and ADR-10 implementation into CSP.LMC Subarray.""" - -# Standard imports -import sys -import os -import time -import logging -import pytest -import unittest -from pytest import fail - -# Tango imports -import tango -from tango import DevState, EventType - -# Local imports -import json -from ska.base.control_model import ObsState -from utils import Poller, Probe -from assertpy import assert_that - -file_path = os.path.dirname(os.path.abspath(__file__)) -LOGGER = logging.getLogger(__name__) - -def prepare_configuration_string(filename="test_ConfigureScan_ADR4.json"): - """Create the config string for CSP-CBF""" - try: - file_to_load = filename - file_path = os.path.dirname(os.path.abspath(__file__)) - LOGGER.info(f" Reading configuration from {file_to_load}") - json_file = open(file_path + "/" + file_to_load) - configuration_string = json_file.read().replace("\n", "") - return configuration_string - except Exception as e: - LOGGER.warning(f"Unable to locate file {filename}") - - -# Device test case -@pytest.mark.usefixtures("midcsp_master", "midcsp_subarray01", "cbf_subarray01") -class TestBase(unittest.TestCase): - fixture_names = () - - @pytest.fixture(autouse=True) - def auto_injector_fixture(self, request): - names = self.fixture_names - for name in names: - setattr(self, name, request.getfixturevalue(name)) - -class TestCspSubarrayConfiguration(TestBase): - fixture_names = ("midcsp_master", "midcsp_subarray01", "cbf_subarray01") - - def __set_csp_subarray_to_on(self): - """ - Set the CSP Subarray to ON state. - """ - # read from the CSP Master the list of available receptors - unassigned_receptors = self.midcsp_master.unassignedReceptorIDs - # assign the first one to the CSP subarray to force - # the transition to ON - receptor_to_add = unassigned_receptors[0] - LOGGER.debug("Set CSP Subarray adding receptor:{}".format(receptor_to_add)) - self.midcsp_subarray01.AddReceptors([receptor_to_add, ]) - prober_cmd_in_progress = Probe(self.midcsp_subarray01, 'isCmdInProgress', False, - f"Wrong value for command in progress") - Poller(10, 0.2).check(prober_cmd_in_progress) - prober_subarray_state = Probe(self.midcsp_subarray01, 'state', DevState.ON, - f"Wrong CspSubarray state") - Poller(10, 0.2).check(prober_subarray_state) - state = self.midcsp_subarray01.State() - assert state == DevState.ON - - def _set_cspsubarray_to_idle_state(self): - obs_state = self.midcsp_subarray01.obsState - if obs_state == ObsState.READY: - self.midcsp_subarray01.GoToIdle() - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.IDLE, f"CSP Subarray not IDLE") - Poller(7, 0.2).check(prober_obs_state) - - def _reset_subarray_to_disable_state(self): - try: - state = self.midcsp_subarray01.State() - LOGGER.debug("CSP Subarray initial State:{}".format(state)) - if state == DevState.DISABLE: - return - if state == DevState.ON: - self._set_cspsubarray_to_idle_state() - LOGGER.debug("Remove all receptors") - self.midcsp_subarray01.RemoveAllReceptors() - # wait for the transition of the CSP sub-array to OFF - prober_subarray_state = Probe(self.midcsp_subarray01, 'state', DevState.OFF, - f"Wrong CSP Subarray state") - Poller(7, 0.2).check(prober_subarray_state) - - # Set the CSP subarray to OFF issuing the Standby command - # o CSP Master - state = self.midcsp_subarray01.State() - if state == DevState.OFF: - LOGGER.debug("CSP Subarray State is OFF...going to execute Standby") - # wait until Master is ON - prober_master_state = Probe(self.midcsp_master, 'state', DevState.ON, f"Wrong CSP Master state") - Poller(7, 0.2).check(prober_master_state) - self.midcsp_master.Standby("") - prober_subarray_state = Probe(self.midcsp_subarray01, 'state', DevState.DISABLE, - f"Wrong CSP Subarray state") - Poller(5, 0.2).check(prober_subarray_state) - prober_master_state = Probe(self.midcsp_master, 'state', DevState.STANDBY, - f"Wrong CSP Master state") - Poller(7, 0.2).check(prober_master_state) - return - - except tango.DevFailed as tango_err: - LOGGER.warning(f"Unable to reset subarray to init state") - - def _setup_csp_subarray(self): - """ - Set the CSP Subarray state to ON - """ - LOGGER.info("Setup subarray") - self._reset_subarray_to_disable_state() - # switch-on the CspMaster to force CSP Subarray - # transition to OFF - LOGGER.debug("Set CSP Subarray to OFF") - self.midcsp_master.On("") - # wait for the transition of the CSP subarray to OFF - prober_master_state = Probe(self.midcsp_master, 'state', DevState.ON, f"Wrong CSP Master state") - Poller(10, 0.2).check(prober_master_state) - # wait for the transition of the CSP subarray to OFF - prober_subarray_state = Probe(self.midcsp_subarray01, 'state', DevState.OFF, f"Wrong CSP Subarray state") - Poller(10, 0.2).check(prober_subarray_state) - state = self.midcsp_subarray01.State() - assert state in [DevState.OFF], "assuming that mid_csp_subarray_01 is OFF" - self.__set_csp_subarray_to_on() - state = self.midcsp_subarray01.State() - - @pytest.mark.csp_k8s - def test_send_configure_to_cbf_and_json_stored(self): - """ - Configure the CSP Subarray with a JSon string including - the new ADR4 fields. - """ - self._setup_csp_subarray() - configuration_string = prepare_configuration_string() - state = self.midcsp_subarray01.State() - assert state == DevState.ON, "assume the CSP subarray State is ON" - # exercise the device - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - LOGGER.debug(f"sending configure:{configuration_string}") - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - # check - prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, - f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}") - Poller(5, 0.2).check(prober_subarray_obstate) - stored_json = self.midcsp_subarray01.validScanConfiguration - assert stored_json == configuration_string - json_dict = json.loads(configuration_string) - configID = json_dict["id"] - stored_id = self.midcsp_subarray01.configurationID - assert stored_id == configID - - @pytest.mark.csp_k8s - def test_configure_cspsubarray_WITH_json_missing_configId(self): - """ - Configure the CSP Subarray sending a json configuration script - without the configID entry. - """ - # setup the test - # Set the CSP Subarray to ON-IDLE state - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_without_configID.json") - - # exercise the device - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - LOGGER.info(f"Configuring CSP subarray01") - with pytest.raises(tango.DevFailed) as tango_err: - self.midcsp_subarray01.Configure(configuration_string) - if tango_err: - err_msg = str(tango_err.value.args[0].desc) - # TODO: aggiungere quale device fallisce - LOGGER.warning(f"Command configure failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}") - # check - obs_state = self.midcsp_subarray01.obsState - #assert obs_state == ObsState.IDLE, f"CSP Subarray obsState has wrong value ({obs_state})" - assert_that(obs_state).described_as("CSP Subarray obsState has wrong value ({obs_state}").is_equal_to(ObsState.IDLE) - - @pytest.mark.csp_k8s - def test_configure_cspsubarray_WHEN_in_wrong_state(self): - """ - Set the CSP Subarray in a wrong state and issue the - Configure command on it. - """ - # setup the test: Subarray DISABLE-IDLE - - self._setup_csp_subarray() - LOGGER.info("Force CSP Subarray to an invalid state to accept Configure") - self._reset_subarray_to_disable_state() - configuration_string = prepare_configuration_string() - init_state = self.midcsp_subarray01.State() - - # exercise the device - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - LOGGER.info(f"Configuring CSP subarray01") - with pytest.raises(tango.DevFailed) as df: - self.midcsp_subarray01.Configure(configuration_string) - #assert_that(self.midcsp_subarray01.Configure).raises(tango.DevFailed).when_called_with(configuration_string) - if df: - err_msg = str(df.value.args[0].desc) - # TODO: aggiungere quale device fallisce - LOGGER.error(f"Command configure failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}") - # check - # Subarray final ObsState=IDLE - obs_state = self.midcsp_subarray01.obsState - end_state = self.midcsp_subarray01.State() - assert obs_state == ObsState.IDLE, f"Current ObsState should be IDLE" - assert end_state == init_state, f"Current State should be the initial one" - #assert_that(obs_state).described_by("Current ObsState should be IDLE").is_not_equal_to(ObsState.IDLE) - - @pytest.mark.csp_k8s - def test_configure_cbf_WITHOUT_outputlink_information(self): - """ - CSP Subarray sends an invalid json configuration to - CBF Subarray. - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_without_outputlink.json") - # print the subarray stat/obsState - init_state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(init_state, ObsState(obs_state).name)) - # exercise the device - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - # check - # Subarray final ObsState IDLE - prober_subarray_flag = Probe(self.midcsp_subarray01, 'failureRaisedFlag', True, f"Failure flag is false") - Poller(7, 0.2).check(prober_subarray_flag) - obs_state = self.midcsp_subarray01.obsState - end_state = self.midcsp_subarray01.State() - assert obs_state == ObsState.IDLE, f"Current ObsState should be IDLE" - assert end_state == init_state, f"Current State should be the initial one" - - @pytest.mark.csp_k8s - def test_configure_cbf_WITH_invalid_json(self): - """ - CSP Subarray sends an invalid json configuration to - CBF Subarray. - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_invalid_cbf_json.json") - # print the subarray stat/obsState - init_state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(init_state, ObsState(obs_state).name)) - # exercise the device - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - # check - # Subarray final ObsState IDLE - prober_subarray_flag = Probe(self.midcsp_subarray01, 'failureRaisedFlag', True, f"Failure flag is false") - Poller(7, 0.2).check(prober_subarray_flag) - obs_state = self.midcsp_subarray01.obsState - end_state = self.midcsp_subarray01.State() - assert obs_state == ObsState.IDLE, f"Current ObsState should be IDLE" - assert end_state == init_state, f"Current State should be the initial one" - @pytest.mark.csp_k8s - def test_cspsubarray_scan_WITH_invalid_string_id(self): - """ - CSP Subarray receives the Scan command with an invalid - scanId number - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_ADR4.json") - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"CSP Subarray not configured") - Poller(7, 0.2).check(prober_obs_state) - LOGGER.info(f"Issue the Scan command sending the invalid string \"abcd\" as input") - # exercise the device - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - with pytest.raises(tango.DevFailed) as df: - self.midcsp_subarray01.Scan("abcd") - if df: - err_msg = str(df.value.args[0].desc) - LOGGER.error(f"Command Scan failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}") - # check - obs_state = self.midcsp_subarray01.obsState - assert obs_state == ObsState.READY - - @pytest.mark.csp_k8s - def test_cspsubarray_scan_WITH_no_argument(self): - """ - CSP Subarray receives the Scan command with no - input argument - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_ADR4.json") - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"CSP Subarray not configured") - Poller(7, 0.2).check(prober_obs_state) - LOGGER.info(f"Issue the Scan command with no input argument") - # exercise the device - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - with pytest.raises(tango.DevFailed) as df: - self.midcsp_subarray01.Scan() - if df: - err_msg = str(df.value.args[0].desc) - LOGGER.error(f"Command configure failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}") - # check - obs_state = self.midcsp_subarray01.obsState - assert obs_state == ObsState.READY - - @pytest.mark.csp_k8s - def test_cspsubarray_scan_WITH_int_argument(self): - """ - CSP Subarray receives the Scan command with an invalid - argument data type - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_ADR4.json") - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"CSP Subarray not configured") - Poller(7, 0.2).check(prober_obs_state) - LOGGER.info(f"Issue the Scan command sending an int as input") - # exercise the device - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - with pytest.raises(tango.DevFailed) as df: - self.midcsp_subarray01.Scan(1) - if df: - err_msg = str(df.value.args[0].desc) - LOGGER.error(f"Command Scan failed on {self.midcsp_subarray01.dev_name()} with error: {err_msg}") - # check - obs_state = self.midcsp_subarray01.obsState - assert obs_state == ObsState.READY - - @pytest.mark.csp_k8s - def test_cspsubarray_scan_WITH_valid_scan_id(self): - """ - CSP Subarray receives the Scan command with a valid - input argument - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_csp_subarray() - configuration_string = prepare_configuration_string("test_ConfigureScan_ADR4.json") - LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(configuration_string) - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"CSP Subarray not configured") - Poller(7, 0.2).check(prober_obs_state) - LOGGER.info(f"Issue the Scan command") - # exercise the device - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - scan_argin = "11" - self.midcsp_subarray01.Scan([scan_argin,]) - # check - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.SCANNING, f"CSP Subarray wrong obstate") - Poller(7, 0.2).check(prober_obs_state) - # end the scan - self.midcsp_subarray01.EndScan() - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"CSP Subarray wrong obstate") - Poller(7, 0.2).check(prober_obs_state) - assert int(scan_argin) == self.midcsp_subarray01.scanID - diff --git a/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_basic.json b/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_basic.json deleted file mode 100644 index f9baaf5eaee0c02ddaa120cc03c9c97c0e6af117..0000000000000000000000000000000000000000 --- a/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_basic.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "id": "sbi-mvp01-20200325-00001-science_A", - "scanID": 1, - "frequencyBand": "5a", - "band5Tuning": [5.85, 7.25], - "frequencyBandOffsetStream1": 0, - "frequencyBandOffsetStream2": 0, - "dopplerPhaseCorrSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/dopplerPhaseCorrection", - "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/delayModel", - "visDestinationAddressSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray_01/visDestinationAddress", - "rfiFlaggingMask": {}, - "searchWindow": [ - { - "searchWindowID": 1, - "searchWindowTuning": 6000000000, - "tdcEnable": true, - "tdcNumBits": 8, - "tdcPeriodBeforeEpoch": 5, - "tdcPeriodAfterEpoch": 25, - "tdcDestinationAddress": [ - { - "tdcDestinationAddress": ["foo", "bar", "8080"] - }, - { - "receptorID": 1, - "tdcDestinationAddress": ["fizz", "buzz", "80"] - } - ] - }, - { - "searchWindowID": 2, - "searchWindowTuning": 7000000000, - "tdcEnable": false - } - ], - "fsp": [ - { - "fspID": 1, - "functionMode": "CORR", - "frequencySliceID": 1, - "corrBandwidth": 1, - "zoomWindowTuning": 4700000, - "integrationTime": 140, - "channelAveragingMap": [ - [1, 8], - [745, 0], - [1489, 0], - [2233, 0], - [2977, 0], - [3721, 0], - [4465, 0], - [5209, 0], - [5953, 0], - [6697, 0], - [7441, 0], - [8185, 0], - [8929, 0], - [9673, 0], - [10417, 0], - [11161, 0], - [11905, 0], - [12649, 0], - [13393, 0], - [14137, 0] - ] - } - ] -} diff --git a/csp-lmc-mid/tests/acceptance_tests/Makefile b/csp-lmc-mid/tests/integration/Makefile similarity index 100% rename from csp-lmc-mid/tests/acceptance_tests/Makefile rename to csp-lmc-mid/tests/integration/Makefile diff --git a/csp-lmc-mid/tests/MidCspMaster_test.py b/csp-lmc-mid/tests/integration/MidCspMaster_test.py similarity index 99% rename from csp-lmc-mid/tests/MidCspMaster_test.py rename to csp-lmc-mid/tests/integration/MidCspMaster_test.py index 44925cbf765cb8f798e8a3c2e6c601044936ad4b..51396a1684ec54b98b60c6d6cc7ebfd7c3f39bd0 100644 --- a/csp-lmc-mid/tests/MidCspMaster_test.py +++ b/csp-lmc-mid/tests/integration/MidCspMaster_test.py @@ -34,7 +34,7 @@ sys.path.insert(0, os.path.abspath(path)) print(commons_pkg_path) #Local imports from ska.base.control_model import AdminMode -from acceptance_tests.utils import Probe, Poller +from unit.utils import Probe, Poller LOGGER = logging.getLogger(__name__) # Device test case @@ -112,7 +112,6 @@ class TestCspMaster(TestBase): Poller(4, 0.2).check(prober_admin_mode) prober_state = Probe(self.midcsp_master, "state", DevState.DISABLE, f"CSP Master not OFFLINE") Poller(4, 0.2).check(prober_state) - ''' def test_properties(self): """ Test the device property MaxCapability""" self._setup_master() @@ -120,6 +119,7 @@ class TestCspMaster(TestBase): capability_list.sort() #Oss: maxCapability returns a tuple assert self.midcsp_master.maxCapabilities == tuple(capability_list) + ''' def test_forwarded_attributes(self): """ Test the reportVCCState forwarded attribute""" diff --git a/csp-lmc-mid/tests/MidCspSubarray_test.py b/csp-lmc-mid/tests/integration/MidCspSubarray_test.py similarity index 84% rename from csp-lmc-mid/tests/MidCspSubarray_test.py rename to csp-lmc-mid/tests/integration/MidCspSubarray_test.py index fa9713b1cc53d973b2315aee4885905b6b320709..df272434decc3738b689c8d6bab91a8101ff385d 100755 --- a/csp-lmc-mid/tests/MidCspSubarray_test.py +++ b/csp-lmc-mid/tests/integration/MidCspSubarray_test.py @@ -24,24 +24,23 @@ import tango from tango import DevState from assertpy import assert_that -# Path -file_path = os.path.dirname(os.path.abspath(__file__)) -# insert base package directory to import global_enum -# module in commons folder -print(file_path) -data_pkg_path = os.path.abspath(os.path.join(file_path, "./tests")) -sys.path.insert(0, data_pkg_path) - -path = os.path.join(os.path.dirname(__file__), os.pardir) -sys.path.insert(0, os.path.abspath(path)) - #Local imports from ska.base.control_model import ObsState -from acceptance_tests.utils import Probe, Poller +from unit.utils import Probe, Poller LOGGER = logging.getLogger(__name__) -# Device test case -@pytest.mark.usefixtures("midcsp_master", "midcsp_subarray01", "midcsp_subarray02", "cbf_subarray01") +file_path = os.path.dirname(os.path.abspath(__file__)) + +def prepare_configuration_string(filename="test_ConfigureScan_ADR4.json"): + """Create the config string for CSP-CBF""" + try: + file_to_load = file_path + '/../test_data/' + filename + LOGGER.debug(f" Reading configuration from {file_to_load}") + json_file = open(file_to_load) + configuration_string = json_file.read().replace("\n", "") + return configuration_string + except Exception as e: + LOGGER.warning(f"Unable to locate file {filename}") # Device test case @pytest.mark.usefixtures("midcsp_master", "midcsp_subarray01", "cbf_subarray01") @@ -114,11 +113,10 @@ class TestCspSubarray(TestBase): # assign all available receptors to the subarray state = self.midcsp_subarray01.State() obs_state = self.midcsp_subarray01.obsState + LOGGER.info("CSPSubarray state:{}-{}".format(state, obs_state)) + LOGGER.info("Going to assign receptors") self.midcsp_subarray01.AddReceptors(receptor_list.tolist()) # wait for the transition to IDLE - prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.RESOURCING, - f"Wrong CSP Subarray obsState is not RESOURCING") - Poller(10, 0.2).check(prober_obs_state) prober_obs_state = Probe(self.midcsp_subarray01, 'obsState', ObsState.IDLE, f"Wrong CSP Subarray obsState is not IDLE") Poller(10, 0.2).check(prober_obs_state) @@ -132,19 +130,19 @@ class TestCspSubarray(TestBase): """ obs_state = self.midcsp_subarray01.obsState assert obs_state == ObsState.IDLE + receptors = self.midcsp_subarray01.assignedReceptors + LOGGER.info("Receptor assigned to the subarray {}".format(receptors)) try: + LOGGER.info("invoke remove all receptors") self.midcsp_subarray01.RemoveAllReceptors() except Exception as e: LOGGER.info(str(e)) # wait for the transition to EMPTY prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray is not EMPTY") Poller(4, 0.2).check(prober_obs_state) - # Note: here we sleep for a while to let the system update the vccMemebership attribute. This has to - # configured to push event fro the device (not with polling) - #time.sleep(0.2) - receptor_list = self.midcsp_master.unassignedReceptorIDs - #if self.midcsp_subarray01.State() == DevState.OFF: - # self.midcsp_subarray01.On() + obs_state = self.midcsp_subarray01.obsState + LOGGER.info("obs_state:{}".format(obs_state)) + LOGGER.info("EMPTY:{}".format(ObsState.EMPTY)) def _goto_idle(self): """ @@ -159,28 +157,27 @@ class TestCspSubarray(TestBase): def _configure_scan(self): self._setup_subarray() self._assign_receptors() - f = open(file_path + "/acceptance_tests/test_ConfigureScan_ADR4.json") - (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", "")) - f.close() + configuration_string = prepare_configuration_string() + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}") Poller(5, 0.2).check(prober_subarray_obstate) - ''' + @pytest.mark.csp_k8s def test_AFTER_initialization(self): """ Test for State after CSP startup. The CspSubarray State at start is OFF. """ - self._setup_subarray() + self._setup_subarray_off() state = self.midcsp_subarray01.State() LOGGER.info("subarray state:{}".format(state)) prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.OFF, f"CSP Subarray not OFF") Poller(4, 0.2).check(prober_subarray_state) prober_subarray_obsstate = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray not EMPTY") Poller(4, 0.2).check(prober_subarray_obsstate) - ''' + @pytest.mark.csp_k8s def test_subarray_state_AFTER_on_command_execution(self): """ @@ -190,13 +187,13 @@ class TestCspSubarray(TestBase): self._setup_subarray_off() subarray_state = self.midcsp_subarray01.State() obs_state = self.midcsp_subarray01.obsState - #time.sleep(1) LOGGER.debug("CSPSubarray state before test:{}-{}".format(subarray_state, obs_state)) subarray_state = self.midcsp_subarray01.State() self.midcsp_subarray01.On() prober_subarray_state = Probe(self.midcsp_subarray01, "State", DevState.ON, f"CSP Subarray not OFF") Poller(4, 0.2).check(prober_subarray_state) + @pytest.mark.csp_k8s def test_add_receptors_WITH_invalid_id(self): """ Test the assignment of a number of invalid receptor IDs to @@ -231,6 +228,7 @@ class TestCspSubarray(TestBase): # a 0-dimensional array or a 0-length list. Therefore, the result is True. assert not receptors.any(), f"CSP Subarray is not empty" + @pytest.mark.csp_k8s def test_add_receptors_WITH_valid_id(self): """ Test the assignment of valid receptors to a CspSubarray @@ -252,6 +250,7 @@ class TestCspSubarray(TestBase): receptors = self.midcsp_subarray01.assignedReceptors assert set(receptor_list) == set(receptors) + @pytest.mark.csp_k8s def test_add_receptors_ALREADY_belonging_to_subarray(self): """ Test the assignment of already assigned receptors to a CspSubarray @@ -273,6 +272,7 @@ class TestCspSubarray(TestBase): # check the array read first and the array read last are equal assert np.array_equal(receptors, assigned_receptors) + @pytest.mark.csp_k8s def test_subarray_state_AFTER_receptors_assignment(self): """ Test the CspSubarray State after receptors assignment. @@ -290,6 +290,7 @@ class TestCspSubarray(TestBase): f"Wrong CSP Subarray obsState") Poller(10, 0.2).check(prober_obs_state) + @pytest.mark.csp_k8s def test_partial_remove_of_receptors_FROM_the_subarray(self): """ Test the partial deallocation of receptors from a @@ -318,6 +319,7 @@ class TestCspSubarray(TestBase): final_number_of_receptors = len(assigned_receptors) assert (init_number_of_receptors - final_number_of_receptors) == 1 + @pytest.mark.csp_k8s def test_remove_all_receptors_FROM_subarray(self): """ Test the complete deallocation of receptors from a @@ -342,6 +344,7 @@ class TestCspSubarray(TestBase): # check the array is empty (any() in this case returns False) assert not assigned_receptors.any() + @pytest.mark.csp_k8s def test_configure_WHEN_subarray_is_in_wrong_state(self): """ Test that the Configure() command fails if the Subarray @@ -351,17 +354,16 @@ class TestCspSubarray(TestBase): obs_state = self.midcsp_subarray01.obsState state = self.midcsp_subarray01.State() LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - filename = os.path.join(data_pkg_path, "test_ConfigureScan_basic.json") - f = open(file_path + "/test_ConfigureScan_basic.json") - LOGGER.info(f"Configuring CSP subarray01") + configuration_string = prepare_configuration_string("test_ConfigureScan_basic.json") with pytest.raises(tango.DevFailed) as df: - self.midcsp_subarray01.Configure(f.read().replace("\n", "")) + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) if df: err_msg = str(df.value.args[0].desc) LOGGER.error(err_msg) obs_state = self.midcsp_subarray01.obsState assert obs_state == ObsState.EMPTY, f"CSP Subarray obsState is not EMPTY" + @pytest.mark.csp_k8s def test_configure_WHITH_wrong_configuration(self): """ Test that the Configure() command fails if the Subarray @@ -372,13 +374,14 @@ class TestCspSubarray(TestBase): obs_state = self.midcsp_subarray01.obsState state = self.midcsp_subarray01.State() LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - f = open(file_path + "/acceptance_tests/test_ConfigureScan_without_configID.json") + configuration_string = prepare_configuration_string("test_ConfigureScan_without_configID.json") LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(f.read().replace("\n", "")) + self.midcsp_subarray01.Configure(configuration_string) # check obs_state = self.midcsp_subarray01.obsState assert_that(obs_state).described_as("CSP Subarray obsState has wrong value ({obs_state}").is_equal_to(ObsState.FAULT) + @pytest.mark.csp_k8s def test_send_configure_to_cbf_and_json_stored(self): """ Configure the CSP Subarray with a JSon string including @@ -391,9 +394,8 @@ class TestCspSubarray(TestBase): LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) # exercise the device LOGGER.info(f"Configuring CSP subarray01") - f = open(file_path + "/acceptance_tests/test_ConfigureScan_ADR4.json") - (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", "")) - f.close() + configuration_string = prepare_configuration_string() + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) # check prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}") @@ -404,36 +406,7 @@ class TestCspSubarray(TestBase): #stored_id = self.midcsp_subarray01.configurationID #assert stored_id == configID - def test_reconfiguration(self): - """ - Configure the CSP Subarray with a JSon string including - the new ADR4 fields. - """ - self._setup_subarray() - self._assign_receptors() - state = self.midcsp_subarray01.State() - obs_state = self.midcsp_subarray01.obsState - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - # exercise the device - LOGGER.info(f"Configuring CSP subarray01") - f = open(file_path + "/acceptance_tests/test_ConfigureScan_ADR4.json") - (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", "")) - f.close() - # check - prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, - f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}") - Poller(5, 0.2).check(prober_subarray_obstate) - obs_state = self.midcsp_subarray01.obsState - state = self.midcsp_subarray01.State() - LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) - f = open(file_path + "/acceptance_tests/test_ConfigureScan_basic.json") - (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", "")) - f.close() - # check - prober_subarray_obstate = Probe(self.midcsp_subarray01, 'obsState', ObsState.READY, - f"Wrong CSP Subarray obsState {self.midcsp_subarray01.obsState}") - Poller(5, 0.2).check(prober_subarray_obstate) - + @pytest.mark.csp_k8s def test_start_end_scan(self): """ Test that a subarray is able to process the @@ -456,6 +429,7 @@ class TestCspSubarray(TestBase): f"Wrong CSP Subarray obsState") Poller(10, 0.2).check(prober_obs_state) + @pytest.mark.csp_k8s def test_abort_scan(self): """ Test that a subarray is able to process the @@ -477,17 +451,18 @@ class TestCspSubarray(TestBase): f"Wrong CSP Subarray obsState") Poller(10, 0.2).check(prober_obs_state) + @pytest.mark.csp_k8s def test_invoke_configure_command_AFTER_gotoidle(self): self._configure_scan() self.midcsp_subarray01.GoToIdle() LOGGER.info(f"Configuring CSP subarray01") - f = open(file_path + "/acceptance_tests/test_ConfigureScan_ADR4.json") - (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", "")) - f.close() + configuration_string = prepare_configuration_string() + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.READY, f"CSP Subarray not READY") Poller(4, 0.2).check(prober_obs_state) + @pytest.mark.csp_k8s def test_obsreset_cbf_AFTER_invalid_configuration(self): """ CSP Subarray sends an invalid json configuration to @@ -496,14 +471,13 @@ class TestCspSubarray(TestBase): # setup the test: Subarray DISABLE-IDLE self._setup_subarray() self._assign_receptors() - f = open(file_path + "/acceptance_tests/test_ConfigureScan_invalid_cbf_json.json") - # print the subarray stat/obsState init_state = self.midcsp_subarray01.State() obs_state = self.midcsp_subarray01.obsState LOGGER.info("CSP Subarray State before exercise :{}-{}".format(init_state, ObsState(obs_state).name)) # exercise the device LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(f.read().replace("\n", "")) + configuration_string = prepare_configuration_string("test_ConfigureScan_invalid_cbf_json.json") + self.midcsp_subarray01.Configure(configuration_string) # check # Subarray final ObsState IDLE prober_subarray_flag = Probe(self.midcsp_subarray01, 'failureRaisedFlag', True, f"Failure flag is false") @@ -515,6 +489,7 @@ class TestCspSubarray(TestBase): prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.IDLE, f"CSP Subarray not IDLE") Poller(4, 0.2).check(prober_obs_state) + @pytest.mark.csp_k8s def test_send_abort_WHILE_in_configuring(self): """ Configure the CSP Subarray with a JSon string including @@ -527,9 +502,8 @@ class TestCspSubarray(TestBase): LOGGER.info("CSP Subarray State before exercise :{}-{}".format(state, ObsState(obs_state).name)) # exercise the device LOGGER.info(f"Configuring CSP subarray01") - f = open(file_path + "/acceptance_tests/test_ConfigureScan_ADR4.json") - (result_code, msg) = self.midcsp_subarray01.Configure(f.read().replace("\n", "")) - f.close() + configuration_string = prepare_configuration_string() + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) #time.sleep(0.1) self.midcsp_subarray01.Abort() # check @@ -539,30 +513,13 @@ class TestCspSubarray(TestBase): obs_state = self.midcsp_subarray01.obsState assert obs_state == ObsState.ABORTED - def test_restart_AFTER_abort_with_subarray_idle(self): - """ - CSP Subarray invoke a RESTART after fault with - subarray with allocated resources. - """ - # setup the test: Subarray DISABLE-IDLE - self._setup_subarray() - self._assign_receptors() - self.midcsp_subarray01.Abort() - prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.ABORTED, f"CSP Subarray not EMPTY") - Poller(4, 0.2).check(prober_obs_state) - self.midcsp_subarray01.Restart() - prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.EMPTY, f"CSP Subarray not EMPTY") - Poller(4, 0.2).check(prober_obs_state) - assigned_receptors = self.midcsp_subarray01.assignedReceptors - LOGGER.info("assigned_receptors:".format(assigned_receptors)) - def test_restart_AFTER_abort_with_subarray_ready(self): self._setup_subarray() self._assign_receptors() # configure the system with invalid json to send it in FAULT - f = open(file_path + "/acceptance_tests/test_ConfigureScan_ADR4.json") + configuration_string = prepare_configuration_string() LOGGER.info(f"Configuring CSP subarray01") - self.midcsp_subarray01.Configure(f.read().replace("\n", "")) + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) prober_obs_state = Probe(self.midcsp_subarray01, "obsState", ObsState.READY, f"CSP Subarray not READY") Poller(4, 0.2).check(prober_obs_state) self.midcsp_subarray01.Abort() @@ -581,8 +538,9 @@ class TestCspSubarray(TestBase): self._setup_subarray() self._assign_receptors() # configure the system with invalid json to send it in FAULT - f = open(file_path + "/acceptance_tests/test_ConfigureScan_without_configID.json") - self.midcsp_subarray01.Configure(f.read().replace("\n", "")) + configuration_string = prepare_configuration_string("test_ConfigureScan_without_configID.json") + LOGGER.info(f"Configuring CSP subarray01") + (result_code, msg) = self.midcsp_subarray01.Configure(configuration_string) prober_obs_state = Probe(self.midcsp_subarray01, 'obsState',ObsState.FAULT, f"Failure flag is false") Poller(7, 0.2).check(prober_obs_state) obs_state = self.midcsp_subarray01.obsState diff --git a/csp-lmc-mid/tests/configScan_sub1.json b/csp-lmc-mid/tests/integration/configScan_sub1.json similarity index 100% rename from csp-lmc-mid/tests/configScan_sub1.json rename to csp-lmc-mid/tests/integration/configScan_sub1.json diff --git a/csp-lmc-mid/tests/configScan_sub2.json b/csp-lmc-mid/tests/integration/configScan_sub2.json similarity index 100% rename from csp-lmc-mid/tests/configScan_sub2.json rename to csp-lmc-mid/tests/integration/configScan_sub2.json diff --git a/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_ADR4.json b/csp-lmc-mid/tests/integration/test_ConfigureScan_ADR4.json similarity index 100% rename from csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_ADR4.json rename to csp-lmc-mid/tests/integration/test_ConfigureScan_ADR4.json diff --git a/csp-lmc-mid/tests/test_ConfigureScan_basic.json b/csp-lmc-mid/tests/integration/test_ConfigureScan_basic.json similarity index 100% rename from csp-lmc-mid/tests/test_ConfigureScan_basic.json rename to csp-lmc-mid/tests/integration/test_ConfigureScan_basic.json diff --git a/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_invalid_cbf_json.json b/csp-lmc-mid/tests/integration/test_ConfigureScan_invalid_cbf_json.json similarity index 100% rename from csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_invalid_cbf_json.json rename to csp-lmc-mid/tests/integration/test_ConfigureScan_invalid_cbf_json.json diff --git a/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_without_configID.json b/csp-lmc-mid/tests/integration/test_ConfigureScan_without_configID.json similarity index 100% rename from csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_without_configID.json rename to csp-lmc-mid/tests/integration/test_ConfigureScan_without_configID.json diff --git a/csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_without_outputlink.json b/csp-lmc-mid/tests/integration/test_ConfigureScan_without_outputlink.json similarity index 100% rename from csp-lmc-mid/tests/acceptance_tests/test_ConfigureScan_without_outputlink.json rename to csp-lmc-mid/tests/integration/test_ConfigureScan_without_outputlink.json diff --git a/csp-lmc-mid/tests/acceptance_tests/test_requirements.txt b/csp-lmc-mid/tests/integration/test_requirements.txt similarity index 100% rename from csp-lmc-mid/tests/acceptance_tests/test_requirements.txt rename to csp-lmc-mid/tests/integration/test_requirements.txt diff --git a/csp-lmc-mid/tests/acceptance_tests/utils.py b/csp-lmc-mid/tests/integration/utils.py similarity index 94% rename from csp-lmc-mid/tests/acceptance_tests/utils.py rename to csp-lmc-mid/tests/integration/utils.py index 68564b35456e62cf828ed75a24e65f0447e63434..b437ebd0c3f4d6de3bf01fcdcf342a9384454f41 100644 --- a/csp-lmc-mid/tests/acceptance_tests/utils.py +++ b/csp-lmc-mid/tests/integration/utils.py @@ -33,7 +33,7 @@ class Probe: """ device_attr = self.proxy.read_attribute(self.attr_name) self.current_state = device_attr.value - LOGGER.debug("attr_name: {} current_state:{}".format(self.attr_name, self.current_state)) + #LOGGER.debug("attr_name: {} current_state:{}".format(self.attr_name, self.current_state)) def is_satisfied(self): """ diff --git a/csp-lmc-mid/tests/test_data/configScan_sub1.json b/csp-lmc-mid/tests/test_data/configScan_sub1.json new file mode 100644 index 0000000000000000000000000000000000000000..45f56b4b8e21056c7cdbf2d4ce600428ccf16467 --- /dev/null +++ b/csp-lmc-mid/tests/test_data/configScan_sub1.json @@ -0,0 +1,63 @@ +{ + "id": "sbi-mvp01-20200325-00001-science_A", + "frequencyBand": "1", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputLinkMap": [ + [0, 4], + [744, 8], + [1480, 12], + [2234, 16], + [2978, 20], + [3722, 24], + [4466, 28], + [5208, 32], + [5952, 36], + [6696, 40], + [7440, 44], + [8184, 48], + [8928, 52], + [9672, 56], + [10416, 60], + [11160, 64], + [11904, 68], + [12648, 72], + [13392, 76], + [14136, 80] + ], + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/test_data/configScan_sub2.json b/csp-lmc-mid/tests/test_data/configScan_sub2.json new file mode 100644 index 0000000000000000000000000000000000000000..be27a2a2a642ccf76a91182ca4847fb0cf524e95 --- /dev/null +++ b/csp-lmc-mid/tests/test_data/configScan_sub2.json @@ -0,0 +1,63 @@ +{ + "id": "sbi-mvp01-20200325-00001-science_A", + "frequencyBand": "2", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputLinkMap": [ + [0, 4], + [744, 8], + [1480, 12], + [2234, 16], + [2978, 20], + [3722, 24], + [4466, 28], + [5208, 32], + [5952, 36], + [6696, 40], + [7440, 44], + [8184, 48], + [8928, 52], + [9672, 56], + [10416, 60], + [11160, 64], + [11904, 68], + [12648, 72], + [13392, 76], + [14136, 80] + ], + "outputHost": [[0, "192.168.0.3"], [8184, "192.168.0.4"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/test_data/test_ConfigureScan_ADR4.json b/csp-lmc-mid/tests/test_data/test_ConfigureScan_ADR4.json new file mode 100644 index 0000000000000000000000000000000000000000..f3c12a6e4f83bb511f8f05eb97e0ab1691477e01 --- /dev/null +++ b/csp-lmc-mid/tests/test_data/test_ConfigureScan_ADR4.json @@ -0,0 +1,77 @@ +{ + "id": "sbi-mvp01-20200325-00002-science_A", + "frequencyBand": "1", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputLinkMap": [ + [0, 4], + [744, 8], + [1480, 12], + [2234, 16], + [2978, 20], + [3722, 24], + [4466, 28], + [5208, 32], + [5952, 36], + [6696, 40], + [7440, 44], + [8184, 48], + [8928, 52], + [9672, 56], + [10416, 60], + [11160, 64], + [11904, 68], + [12648, 72], + [13392, 76], + [14136, 80] + ], + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + }, + { + "fspID":2, + "functionMode":"CORR", + "frequencySliceID":2, + "integrationTime":1400, + "corrBandwidth":1, + "channelAveragingMap":[[0,2],[744,0]], + "fspChannelOffset":744, + "outputLinkMap":[[0,4],[200,5]], + "zoomWindowTuning":650000, + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/test_data/test_ConfigureScan_basic.json b/csp-lmc-mid/tests/test_data/test_ConfigureScan_basic.json new file mode 100644 index 0000000000000000000000000000000000000000..45f56b4b8e21056c7cdbf2d4ce600428ccf16467 --- /dev/null +++ b/csp-lmc-mid/tests/test_data/test_ConfigureScan_basic.json @@ -0,0 +1,63 @@ +{ + "id": "sbi-mvp01-20200325-00001-science_A", + "frequencyBand": "1", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputLinkMap": [ + [0, 4], + [744, 8], + [1480, 12], + [2234, 16], + [2978, 20], + [3722, 24], + [4466, 28], + [5208, 32], + [5952, 36], + [6696, 40], + [7440, 44], + [8184, 48], + [8928, 52], + [9672, 56], + [10416, 60], + [11160, 64], + [11904, 68], + [12648, 72], + [13392, 76], + [14136, 80] + ], + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/test_data/test_ConfigureScan_invalid_cbf_json.json b/csp-lmc-mid/tests/test_data/test_ConfigureScan_invalid_cbf_json.json new file mode 100644 index 0000000000000000000000000000000000000000..9a68e257c3bac812477699e8e56168164f970bdc --- /dev/null +++ b/csp-lmc-mid/tests/test_data/test_ConfigureScan_invalid_cbf_json.json @@ -0,0 +1,63 @@ +{ + "id": "sbi-mvp01-20200325-00001-science_A", + "frequencyBand": "6", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputLinkMap": [ + [0, 4], + [744, 8], + [1480, 12], + [2234, 16], + [2978, 20], + [3722, 24], + [4466, 28], + [5208, 32], + [5952, 36], + [6696, 40], + [7440, 44], + [8184, 48], + [8928, 52], + [9672, 56], + [10416, 60], + [11160, 64], + [11904, 68], + [12648, 72], + [13392, 76], + [14136, 80] + ], + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/test_data/test_ConfigureScan_without_configID.json b/csp-lmc-mid/tests/test_data/test_ConfigureScan_without_configID.json new file mode 100644 index 0000000000000000000000000000000000000000..c3a9ce2564916ce6e7dd16df573d565d017d4a13 --- /dev/null +++ b/csp-lmc-mid/tests/test_data/test_ConfigureScan_without_configID.json @@ -0,0 +1,62 @@ +{ + "frequencyBand": "1", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputLinkMap": [ + [0, 4], + [744, 8], + [1480, 12], + [2234, 16], + [2978, 20], + [3722, 24], + [4466, 28], + [5208, 32], + [5952, 36], + [6696, 40], + [7440, 44], + [8184, 48], + [8928, 52], + [9672, 56], + [10416, 60], + [11160, 64], + [11904, 68], + [12648, 72], + [13392, 76], + [14136, 80] + ], + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/test_data/test_ConfigureScan_without_outputlink.json b/csp-lmc-mid/tests/test_data/test_ConfigureScan_without_outputlink.json new file mode 100644 index 0000000000000000000000000000000000000000..61a121bf8534268ae74f5ae2fa2ee68ddf528704 --- /dev/null +++ b/csp-lmc-mid/tests/test_data/test_ConfigureScan_without_outputlink.json @@ -0,0 +1,41 @@ +{ + "id": "sbi-mvp01-20200325-00001-science_A", + "frequencyBand": "1", + "delayModelSubscriptionPoint": "ska_mid/tm_leaf_node/csp_subarray01/delayModel", + + "fsp": [ + { + "fspID": 1, + "functionMode": "CORR", + "frequencySliceID": 1, + "corrBandwidth": 0, + "integrationTime": 140, + "fspChannelOffset": 0, + "channelAveragingMap": [ + [0, 1], + [744, 1], + [1488, 1], + [2232, 1], + [2976, 1], + [3720, 1], + [4464, 1], + [5208, 1], + [5952, 1], + [6696, 1], + [7440, 1], + [8184, 1], + [8928, 1], + [9672, 1], + [10416, 1], + [11160, 1], + [11904, 1], + [12648, 1], + [13392, 1], + [14136, 1] + ], + "outputHost": [[0, "192.168.0.1"], [8184, "192.168.0.2"]], + "outputMac": [[0, "06-00-00-00-00-01"]], + "outputPort": [[0, 9000, 1], [8184, 9000, 1]] + } + ] +} diff --git a/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py b/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py index db56b1d22ab57cbb4d1072a58ad0c743f0832ca8..5867030025464b084fe042acf07b9b3a664c78bb 100644 --- a/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py +++ b/csp-lmc-mid/tests/unit/midcspsubarray_unit_test.py @@ -15,7 +15,7 @@ from tango import DevState, DevFailed, DeviceProxy import csp_lmc_common import csp_lmc_mid from utils import Probe, Poller -from csp_lmc_common.CspSubarray import CspSubarray +from csp_lmc_common import CspSubarray from csp_lmc_mid.MidCspSubarrayBase import MidCspSubarrayBase file_path = os.path.dirname(os.path.abspath(__file__)) @@ -549,7 +549,7 @@ def test_midcspsubarray_obsstate_AFTER_cbfsubarray_fault_during_configuration(): #cbf_subarray_device_proxy_mock.Configure.side_effect = return_failed with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -597,7 +597,7 @@ def test_midcspsubarray_obsstate_AFTER_abort_request_during_configuration(): cbf_subarray_device_proxy_mock.Abort.side_effect = return_ok with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -645,7 +645,7 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_is_in_fault_during_abort_reque #cbf_subarray_device_proxy_mock.Abort.side_effect = return_failed with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -700,7 +700,7 @@ def test_midcspsubarray_obsstate_WHEN_abort_invoked_in_resetting(): #cbf_subarray_device_proxy_mock.Abort.side_effect = return_failed with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -751,7 +751,7 @@ def test_midcspsubarray_obsstate_WHEN_restart_invoked_after_cspsubarray_aborted( proxies_to_mock=proxies_to_mock) as tango_context: with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -829,7 +829,7 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_abort_returns_failed(): cbf_subarray_device_proxy_mock.Abort.side_effect = return_failed with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -843,7 +843,6 @@ def test_midcspsubarray_obsstate_WHEN_cbfsubarray_abort_returns_failed(): event_subscription_map[cbf_subarray_state_attr](dummy_event) tango_context.device.Abort() assert tango_context.device.obsState == ObsState.FAULT -''' def test_midcspsubarray_obsstate_WHEN_timeout_in_abort_request_during_configuring(): """ @@ -875,7 +874,7 @@ def test_midcspsubarray_obsstate_WHEN_timeout_in_abort_request_during_configurin proxies_to_mock=proxies_to_mock) as tango_context: with mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.AddReceptorsCommand.do') as mock_do,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.OnCommand.do') as mock_on_do,\ - mock.patch('csp_lmc_common.CspSubarray.CspSubarray._get_expected_delay') as mock_delay_expected,\ + mock.patch('csp_lmc_common.CspSubarray._get_expected_delay') as mock_delay_expected,\ mock.patch('csp_lmc_mid.MidCspSubarrayBase.MidCspSubarrayBase.__len__') as mock_len: mock_len.return_value = len(receptor_list) mock_do.return_value = (ResultCode.OK, "AddReceptors OK") @@ -893,7 +892,7 @@ def test_midcspsubarray_obsstate_WHEN_timeout_in_abort_request_during_configurin prober_obs_state = Probe(tango_context.device, 'timeoutExpiredFlag', True, f"Wrong CspSubarray state") Poller(10, 0.1).check(prober_obs_state) assert tango_context.device.obsState == ObsState.FAULT -''' + def test_midcspsubarray_obsstate_AFTER_configure_WITH_cbf_returning_FAULT(): """ Test the behavior of the MidCspSubarray when the command Configure @@ -1097,7 +1096,7 @@ def raise_exception(command_name): def load_json_file(file_name): print(file_path) print(os.path.dirname(__file__)) - path= os.path.join(os.path.dirname(__file__), '../acceptance_tests' , file_name) + path= os.path.join(os.path.dirname(__file__), '../test_data' , file_name) with open(path, 'r') as f: configuration_string = f.read().replace("\n", "") return configuration_string diff --git a/csp-lmc-mid/tests/unit/utils.py b/csp-lmc-mid/tests/unit/utils.py index 6d90a738a20bcdaa1208c8040b4aeacd191e09ff..c65e2262945dd6fc9c4788a78832b3fadcf51dd8 100644 --- a/csp-lmc-mid/tests/unit/utils.py +++ b/csp-lmc-mid/tests/unit/utils.py @@ -33,7 +33,7 @@ class Probe: """ device_attr = self.proxy.read_attribute(self.attr_name) self.current_state = device_attr.value - LOGGER.info("attr_name: {} current_state:{}".format(self.attr_name, self.current_state)) + #LOGGER.info("attr_name: {} current_state:{}".format(self.attr_name, self.current_state)) def is_satisfied(self): """ diff --git a/csp-lmc-mid/tools/adr8_cbf_plot.py b/csp-lmc-mid/tools/adr8_cbf_plot.py new file mode 100644 index 0000000000000000000000000000000000000000..b1303494beff1bef2dd48cb8b71553f54bed06ba --- /dev/null +++ b/csp-lmc-mid/tools/adr8_cbf_plot.py @@ -0,0 +1,138 @@ +from threading import Thread +import tango +import time +import collections +import matplotlib.pyplot as plt +import matplotlib.animation as animation +from matplotlib.widgets import Button +#import struct +from tango import EventType + + +class attributePlot: + def __init__(self, plotLength = 100, device='mid_csp/elt/subarray_01'): + self.plotMaxLength = plotLength + self.data = collections.deque([0] * plotLength, maxlen=plotLength) + self.cbf_data = collections.deque([0] * plotLength, maxlen=plotLength) + self.test_number = 0 + self.previous_test_num = 0 + self.plotTimer = 0 + self.previousTimer = 0 + self.proxy = 0 + self.proxy_cbf = 0 + self.device = device + self.obs_state = 0 + self.cbf_obs_state = 0 + self.anim = None + try: + self.proxy = tango.DeviceProxy("mid_csp/elt/subarray_01") + self.cbf_proxy = tango.DeviceProxy("mid_csp_cbf/sub_elt/subarray_01") + self.proxy.testNumber = 0 + print('Connected to device {}'.format(device)) + except: + print("Failed to connect to device {}".format(device) ) + + def readAttributeStart(self): + if self.proxy: + self.proxy.subscribe_event("obsState", tango.EventType.CHANGE_EVENT, + self.attributes_change_evt_cb, + stateless=False) + self.proxy.subscribe_event("testNumber", tango.EventType.CHANGE_EVENT, + self.attributes_change_evt_cb, + stateless=False) + if self.cbf_proxy: + self.cbf_proxy.subscribe_event("obsState", tango.EventType.CHANGE_EVENT, + self.attributes_change_evt_cb, + stateless=False) + + def getAttributeData(self, frame, lines, cbf_lines, lineValueText, lineLabel, timeText): + currentTimer = time.perf_counter() + self.plotTimer = int((currentTimer - self.previousTimer) * 1000) # the first reading will be erroneous + self.previousTimer = currentTimer + #timeText.set_text('Plot Interval = ' + str(self.plotTimer) + 'ms') + self.data.append(self.obs_state) # we get the latest data point and append it to our array + self.cbf_data.append(self.cbf_obs_state) + lines.set_data(range(self.plotMaxLength), self.data) + cbf_lines.set_data(range(self.plotMaxLength), self.cbf_data) + #lineValueText.set_text('[' + lineLabel + '] = ' + str(self.obs_state)) + if self.test_number != self.previous_test_num: + lineValueText.set_text('[Test number] = ' + str(self.test_number)) + + def attributes_change_evt_cb(self, evt): + dev_name = evt.device.dev_name() + if not evt.err: + try: + if evt.attr_value.name.lower() == "obsstate": + if 'cbf' in dev_name: + self.cbf_obs_state = evt.attr_value.value + self.cbf_data.append(self.cbf_obs_state) + self.cbf_data.append(self.cbf_obs_state) + self.data.append(self.obs_state) + self.data.append(self.obs_state) + else : + self.obs_state = evt.attr_value.value + # we get the latest data point and append it to our array + self.data.append(self.obs_state) + self.data.append(self.obs_state) + self.cbf_data.append(self.cbf_obs_state) + self.cbf_data.append(self.cbf_obs_state) + if evt.attr_value.name.lower() == "testnumber": + self.previous_test_num = self.test_number + self.test_number = evt.attr_value.value + #print("Received event on {}/{}: {}".format(dev_name, + # str(evt.attr_value.name), + # str(evt.attr_value.value))) + except tango.DevFailed as df: + self.logger.error(str(df.args[0].desc)) + except Exception as except_occurred: + self.logger.error(str(except_occurred)) + else: + for item in evt.errors: + if item.reason == "API_EventTimeout": + print("API_EventTimeout") + def on_press(self, event): + if event.key == 'x': + self.anim.event_source.stop() + if event.key == 'z': + self.anim.event_source.start() + if event.key == 'escape': + exit() + +def main(): + maxPlotLength = 200 + s = attributePlot(maxPlotLength, 'mid_csp/elt/subarray_01') # initializes all required variables + s.readAttributeStart() # starts background thread + + # plotting starts below + pltInterval = 300 # Period at which the plot animation updates [ms] + xmin = 0 + xmax = maxPlotLength + ymin = -1 + ymax = 12 + fig = plt.figure("MID CSP Subarray ADR-8 transitions") + fig.set_size_inches(18.5, 8.5) + ax = plt.axes(xlim=(xmin, xmax), ylim=(ymin, ymax )) + plt.grid() + ax.set_title('obsState real-time graph') + ax.set_xlabel("time") + ax.set_ylabel("obsState") + plt.yticks(range(11), ('EMPTY', 'RESOURCING', 'IDLE', 'CONFIGURING', 'READY', 'SCANNING', 'ABORTING', 'ABORTED', 'RESETTING', 'FAULT', 'RESTARTING')) + + lineLabel = 'CSP obsState' + cbflineLabel = 'CBF obsState' + timeText = ax.text(0.50, 0.95, '', transform=ax.transAxes) + lines = ax.plot([], [], label=lineLabel)[0] + lineValueText = ax.text(0.50, 0.90, '', transform=ax.transAxes) + cbf_lines = ax.plot([], [], 'r-', label=cbflineLabel)[0] + fig.canvas.mpl_connect('key_press_event', s.on_press) + #s.anim = animation.FuncAnimation(fig, s.getAttributeData, fargs=(lines, lineValueText, lineLabel, timeText), interval=pltInterval) # fargs has to be a tuple + s.anim = animation.FuncAnimation(fig, s.getAttributeData, fargs=(lines, cbf_lines, lineValueText, lineLabel, ''), interval=pltInterval) # fargs has to be a tuple + plt.legend(loc="upper left") + plt.show() + exit() + + + +if __name__ == '__main__': + main() + diff --git a/csp-lmc-mid/tools/adr8_plot.py b/csp-lmc-mid/tools/adr8_plot.py new file mode 100644 index 0000000000000000000000000000000000000000..06eed2f79d40016bffaa49922c4c02efc30cc20e --- /dev/null +++ b/csp-lmc-mid/tools/adr8_plot.py @@ -0,0 +1,119 @@ +from threading import Thread +import tango +import time +import collections +import matplotlib.pyplot as plt +import matplotlib.animation as animation +from matplotlib.widgets import Button +#import struct +from tango import EventType + + +class attributePlot: + def __init__(self, plotLength = 100, device='mid_csp/elt/subarray_01'): + self.plotMaxLength = plotLength + self.data = collections.deque([0] * plotLength, maxlen=plotLength) + self.test_number = 0 + self.previous_test_num = 0 + self.plotTimer = 0 + self.previousTimer = 0 + self.proxy = 0 + self.device = device + self.anim = None + try: + self.proxy = tango.DeviceProxy("mid_csp/elt/subarray_01") + self.proxy.testNumber = 0 + print('Connected to device {}'.format(device)) + except: + print("Failed to connect to device {}".format(device) ) + + def readAttributeStart(self): + if self.proxy: + self.proxy.subscribe_event("obsState", tango.EventType.CHANGE_EVENT, + self.attributes_change_evt_cb, + stateless=False) + self.proxy.subscribe_event("testNumber", tango.EventType.CHANGE_EVENT, + self.attributes_change_evt_cb, + stateless=False) + + def getAttributeData(self, frame, lines, lineValueText, lineLabel, timeText): + currentTimer = time.perf_counter() + self.plotTimer = int((currentTimer - self.previousTimer) * 1000) # the first reading will be erroneous + self.previousTimer = currentTimer + #timeText.set_text('Plot Interval = ' + str(self.plotTimer) + 'ms') + self.data.append(self.obs_state) # we get the latest data point and append it to our array + #plt.annotate(test_label, # this is the text + # (x, 5), # this is the point to label + # textcoords="offset points", # how to position the text + # xytext=(0,10), # distance from text to points (x,y) + # ha='center') + lines.set_data(range(self.plotMaxLength), self.data) + #lineValueText.set_text('[' + lineLabel + '] = ' + str(self.obs_state)) + if self.test_number != self.previous_test_num: + lineValueText.set_text('[Test number] = ' + str(self.test_number)) + def attributes_change_evt_cb(self, evt): + dev_name = evt.device.dev_name() + if not evt.err: + try: + if evt.attr_value.name.lower() == "obsstate": + self.obs_state = evt.attr_value.value + self.data.append(self.obs_state) # we get the latest data point and append it to our array + self.data.append(self.obs_state) # we get the latest data point and append it to our array + if evt.attr_value.name.lower() == "testnumber": + self.previous_test_num = self.test_number + self.test_number = evt.attr_value.value + #print("Received event on {}/{}: {}".format(dev_name, + # str(evt.attr_value.name), + # str(evt.attr_value.value))) + except tango.DevFailed as df: + self.logger.error(str(df.args[0].desc)) + except Exception as except_occurred: + self.logger.error(str(except_occurred)) + else: + for item in evt.errors: + if item.reason == "API_EventTimeout": + print("API_EventTimeout") + def on_press(self, event): + if event.key == 'x': + self.anim.event_source.stop() + if event.key == 'z': + self.anim.event_source.start() + if event.key == 'escape': + exit() + +def main(): + maxPlotLength = 200 + s = attributePlot(maxPlotLength, 'mid_csp/elt/subarray_01') # initializes all required variables + s.readAttributeStart() # starts background thread + + # plotting starts below + pltInterval = 100 # Period at which the plot animation updates [ms] + xmin = 0 + xmax = maxPlotLength + ymin = -1 + ymax = 12 + fig = plt.figure("MID CSP Subarray ADR-8 transitions") + fig.set_size_inches(18.5, 8.5) + ax = plt.axes(xlim=(xmin, xmax), ylim=(ymin, ymax )) + plt.grid() + ax.set_title('obsState real-time graph') + ax.set_xlabel("time") + ax.set_ylabel("obsState") + plt.yticks(range(11), ('EMPTY', 'RESOURCING', 'IDLE', 'CONFIGURING', 'READY', 'SCANNING', 'ABORTING', 'ABORTED', 'RESETTING', 'FAULT', 'RESTARTING')) + + lineLabel = 'obsState' + timeText = ax.text(0.50, 0.95, '', transform=ax.transAxes) + lines = ax.plot([], [], label=lineLabel)[0] + lineValueText = ax.text(0.50, 0.90, '', transform=ax.transAxes) + fig.canvas.mpl_connect('key_press_event', s.on_press) + #s.anim = animation.FuncAnimation(fig, s.getAttributeData, fargs=(lines, lineValueText, lineLabel, timeText), interval=pltInterval) # fargs has to be a tuple + s.anim = animation.FuncAnimation(fig, s.getAttributeData, fargs=(lines, lineValueText, lineLabel, ''), interval=pltInterval) # fargs has to be a tuple + plt.legend(loc="upper left") + plt.show() + exit() + + + +if __name__ == '__main__': + main() +