From f5f82d193dcc0b09cf844f8460e50a56653b52bb Mon Sep 17 00:00:00 2001
From: thijs snijder <snijder@astron.nl>
Date: Mon, 5 Sep 2022 16:33:40 +0200
Subject: [PATCH] added CCD devive files

---
 CDB/LOFAR_ConfigDb.json                | 10 ++++++
 CDB/stations/DTS_Outside_ConfigDb.json | 19 +++++++++++
 docker-compose/device-ccd.yml          | 47 ++++++++++++++++++++++++++
 sbin/run_integration_test.sh           |  2 +-
 tangostationcontrol/setup.cfg          |  1 +
 5 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 docker-compose/device-ccd.yml

diff --git a/CDB/LOFAR_ConfigDb.json b/CDB/LOFAR_ConfigDb.json
index 2ba1ebe75..e7af81cae 100644
--- a/CDB/LOFAR_ConfigDb.json
+++ b/CDB/LOFAR_ConfigDb.json
@@ -169,6 +169,16 @@
                 }
             }
         },
+        "CCD": {
+            "STAT": {
+                "CCD": {
+                    "STAT/CCD/1": {
+                        "properties": {
+                        }
+                    }
+                }
+            }
+        },
         "APSPU": {
             "STAT": {
                 "APSPU": {
diff --git a/CDB/stations/DTS_Outside_ConfigDb.json b/CDB/stations/DTS_Outside_ConfigDb.json
index 6f0517559..2c90d6ffe 100644
--- a/CDB/stations/DTS_Outside_ConfigDb.json
+++ b/CDB/stations/DTS_Outside_ConfigDb.json
@@ -60,6 +60,25 @@
                 }
             }
         },
+        "CCD": {
+            "STAT": {
+                "CCD": {
+                    "STAT/CCD/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "10.87.6.67 "
+                            ],
+                            "OPC_Server_Port": [
+                                "4843"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "APSPU": {
             "STAT": {
                 "APSPU": {
diff --git a/docker-compose/device-ccd.yml b/docker-compose/device-ccd.yml
new file mode 100644
index 000000000..009729d2e
--- /dev/null
+++ b/docker-compose/device-ccd.yml
@@ -0,0 +1,47 @@
+#
+# Docker compose file that launches an interactive iTango session.
+#
+# Connect to the interactive session with 'docker attach itango'.
+# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
+#
+# Defines:
+#   - itango: iTango interactive session
+#
+# Requires:
+#   - lofar-device-base.yml
+#
+version: '2.1'
+
+services:
+  device-ccd:
+    image: device-ccd
+    # build explicitly, as docker-compose does not understand a local image
+    # being shared among services.
+    build:
+        context: ..
+        dockerfile: docker-compose/lofar-device-base/Dockerfile
+        args:
+            SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION}
+    container_name: ${CONTAINER_NAME_PREFIX}device-ccd
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "100m"
+        max-file: "10"
+    networks:
+      - control
+    ports:
+      - "5721:5721" # unique port for this DS
+    extra_hosts:
+      - "host.docker.internal:host-gateway"
+    volumes:
+        - ..:/opt/lofar/tango:rw
+    environment:
+      - TANGO_HOST=${TANGO_HOST}
+    working_dir: /opt/lofar/tango
+    entrypoint:
+      - bin/start-ds.sh
+      # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA
+      # can't know about our Docker port forwarding
+      - l2ss-ccd Ccd STAT -v  -v -ORBendPoint giop:tcp:device-ccd:5721 -ORBendPointPublish giop:tcp:${HOSTNAME}:5709
+    restart: on-failure
diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh
index 30df5c7cf..b910bae02 100755
--- a/sbin/run_integration_test.sh
+++ b/sbin/run_integration_test.sh
@@ -69,7 +69,7 @@ sleep 1 # dsconfig container must be up and running...
 # shellcheck disable=SC2016
 echo '/usr/local/bin/wait-for-it.sh ${TANGO_HOST} --strict --timeout=300 -- true' | make run dsconfig bash -
 
-DEVICES="device-boot device-apsct device-apspu device-sdp device-recv device-bst device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam device-psoc device-pcon device-antennafield device-temperature-manager device-observation device-observation-control"
+DEVICES="device-boot device-apsct device-ccd device-apspu device-sdp device-recv device-bst device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam device-psoc device-pcon device-antennafield device-temperature-manager device-observation device-observation-control"
 
 SIMULATORS="sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim"
 
diff --git a/tangostationcontrol/setup.cfg b/tangostationcontrol/setup.cfg
index 0fe48b128..29b26f98a 100644
--- a/tangostationcontrol/setup.cfg
+++ b/tangostationcontrol/setup.cfg
@@ -35,6 +35,7 @@ where=.
 [options.entry_points]
 console_scripts =
     l2ss-apsct = tangostationcontrol.devices.apsct:main
+	l2ss-ccd = tangostationcontrol.devices.ccd:main
     l2ss-apspu = tangostationcontrol.devices.apspu:main
     l2ss-psoc = tangostationcontrol.devices.psoc:main
     l2ss-pcon = tangostationcontrol.devices.pcon:main
-- 
GitLab