From 836624be1026d468653c2186a4fc9c29a9c9c2a3 Mon Sep 17 00:00:00 2001
From: Annyas <annyas@astron.nl>
Date: Thu, 16 Sep 2021 16:11:42 +0200
Subject: [PATCH] Unshelved work in progress

---
 CDB/unb2-sim-config.json                 | 23 +++++++++++++++++++++++
 docker-compose/unb2-sim.yml              | 20 ++++++++++++++++++++
 docker-compose/unb2-sim/Dockerfile       | 12 ++++++++++++
 docker-compose/unb2-sim/requirements.txt |  4 ++++
 4 files changed, 59 insertions(+)
 create mode 100644 CDB/unb2-sim-config.json
 create mode 100644 docker-compose/unb2-sim.yml
 create mode 100644 docker-compose/unb2-sim/Dockerfile
 create mode 100644 docker-compose/unb2-sim/requirements.txt

diff --git a/CDB/unb2-sim-config.json b/CDB/unb2-sim-config.json
new file mode 100644
index 000000000..a98fa2749
--- /dev/null
+++ b/CDB/unb2-sim-config.json
@@ -0,0 +1,23 @@
+{
+    "servers": {
+        "UNB2": {
+            "LTS": {
+                "UNB2": {
+                    "LTS/UNB2/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "unb2-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4844"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/docker-compose/unb2-sim.yml b/docker-compose/unb2-sim.yml
new file mode 100644
index 000000000..e031e20f5
--- /dev/null
+++ b/docker-compose/unb2-sim.yml
@@ -0,0 +1,20 @@
+#
+# Docker compose file that launches a UNB2 simulator
+#
+# Defines:
+#   - unb2-sim
+#
+version: '2'
+
+services:
+  unb2-sim:
+    build:
+        context: unb2-sim
+    container_name: ${CONTAINER_NAME_PREFIX}unb2-sim
+    networks:
+      - control
+    volumes:
+        - ${HOME}:/hosthome
+    ports:
+        - "4844:4844"
+    restart: on-failure
diff --git a/docker-compose/unb2-sim/Dockerfile b/docker-compose/unb2-sim/Dockerfile
new file mode 100644
index 000000000..4a6b1acfc
--- /dev/null
+++ b/docker-compose/unb2-sim/Dockerfile
@@ -0,0 +1,12 @@
+FROM ubuntu:20.04
+
+COPY requirements.txt /requirements.txt
+
+ENV A = A
+
+RUN apt-get update && apt-get install -y python3 python3-pip python3-yaml git && \
+    pip3 install -r requirements.txt && \
+    git clone --depth 1 --branch master https://git.astron.nl/lofar2.0/pypcc
+
+WORKDIR /pypcc
+CMD ["python3","pypcc2.py","--simulator", "--port=4844", "--config=UNB2"]
diff --git a/docker-compose/unb2-sim/requirements.txt b/docker-compose/unb2-sim/requirements.txt
new file mode 100644
index 000000000..5badf0e57
--- /dev/null
+++ b/docker-compose/unb2-sim/requirements.txt
@@ -0,0 +1,4 @@
+#check if this file is necessary
+opcua
+numpy
+recordclass>=0.16,<0.16.1
\ No newline at end of file
-- 
GitLab