From ebbb04da973e69b8ab19611524e6f4b45ef8edea Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 13 Oct 2021 10:06:06 +0200
Subject: [PATCH] L2SS-358: Load simulators by default, and describe how to
 load different stock station configurations

---
 CDB/apsct-sim-config.json             |  23 -----
 CDB/apspu-sim-config.json             |  23 -----
 CDB/recv-sim-config.json              |  23 -----
 CDB/sdp-sim-config.json               |  61 ------------
 CDB/stations/simulators_configDb.json | 137 ++++++++++++++++++++++++++
 CDB/unb2-sim-config.json              |  23 -----
 docker-compose/Makefile               |   1 +
 docs/source/configure_station.rst     |   8 +-
 docs/source/installation.rst          |   8 +-
 9 files changed, 146 insertions(+), 161 deletions(-)
 delete mode 100644 CDB/apsct-sim-config.json
 delete mode 100644 CDB/apspu-sim-config.json
 delete mode 100644 CDB/recv-sim-config.json
 delete mode 100644 CDB/sdp-sim-config.json
 create mode 100644 CDB/stations/simulators_configDb.json
 delete mode 100644 CDB/unb2-sim-config.json

diff --git a/CDB/apsct-sim-config.json b/CDB/apsct-sim-config.json
deleted file mode 100644
index 820e79e7c..000000000
--- a/CDB/apsct-sim-config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-    "servers": {
-        "APSCT": {
-            "LTS": {
-                "APSCT": {
-                    "LTS/APSCT/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "apsct-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4843"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/CDB/apspu-sim-config.json b/CDB/apspu-sim-config.json
deleted file mode 100644
index 2823a4d89..000000000
--- a/CDB/apspu-sim-config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-    "servers": {
-        "APSPU": {
-            "LTS": {
-                "APSPU": {
-                    "LTS/APSPU/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "apspu-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4843"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/CDB/recv-sim-config.json b/CDB/recv-sim-config.json
deleted file mode 100644
index ced1e8153..000000000
--- a/CDB/recv-sim-config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-    "servers": {
-        "RECV": {
-            "LTS": {
-                "RECV": {
-                    "LTS/RECV/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "recv-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4840"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/CDB/sdp-sim-config.json b/CDB/sdp-sim-config.json
deleted file mode 100644
index f733a85a6..000000000
--- a/CDB/sdp-sim-config.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
-    "servers": {
-        "SDP": {
-            "LTS": {
-                "SDP": {
-                    "LTS/SDP/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "sdptr-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4840"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        },
-        "SST": {
-            "LTS": {
-                "SST": {
-                    "LTS/SST/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "sdptr-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4840"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        },
-        "XST": {
-            "LTS": {
-                "XST": {
-                    "LTS/XST/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "sdptr-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4840"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/CDB/stations/simulators_configDb.json b/CDB/stations/simulators_configDb.json
new file mode 100644
index 000000000..a1dbb2a69
--- /dev/null
+++ b/CDB/stations/simulators_configDb.json
@@ -0,0 +1,137 @@
+{
+    "servers": {
+        "APSCT": {
+            "LTS": {
+                "APSCT": {
+                    "LTS/APSCT/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "apsct-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4843"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "APSPU": {
+            "LTS": {
+                "APSPU": {
+                    "LTS/APSPU/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "apspu-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4843"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "RECV": {
+            "LTS": {
+                "RECV": {
+                    "LTS/RECV/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "recv-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4840"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "SDP": {
+            "LTS": {
+                "SDP": {
+                    "LTS/SDP/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "sdptr-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4840"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "SST": {
+            "LTS": {
+                "SST": {
+                    "LTS/SST/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "sdptr-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4840"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "XST": {
+            "LTS": {
+                "XST": {
+                    "LTS/XST/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "sdptr-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4840"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        },
+        "UNB2": {
+            "LTS": {
+                "UNB2": {
+                    "LTS/UNB2/1": {
+                        "properties": {
+                            "OPC_Server_Name": [
+                                "unb2-sim"
+                            ],
+                            "OPC_Server_Port": [
+                                "4841"
+                            ],
+                            "OPC_Time_Out": [
+                                "5.0"
+                            ]
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/CDB/unb2-sim-config.json b/CDB/unb2-sim-config.json
deleted file mode 100644
index 87a6f0d4d..000000000
--- a/CDB/unb2-sim-config.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-    "servers": {
-        "UNB2": {
-            "LTS": {
-                "UNB2": {
-                    "LTS/UNB2/1": {
-                        "properties": {
-                            "OPC_Server_Name": [
-                                "unb2-sim"
-                            ],
-                            "OPC_Server_Port": [
-                                "4841"
-                            ],
-                            "OPC_Time_Out": [
-                                "5.0"
-                            ]
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index 81e5e4a85..86bbd989b 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -159,6 +159,7 @@ bootstrap: pull build # first start, initialise from scratch
 	$(MAKE) start dsconfig # boot up containers to load configurations
 	sleep 5 # wait for dsconfig container to come up
 	../sbin/update_ConfigDb.sh ../CDB/LOFAR_ConfigDb.json # load default configuration
+	../sbin/update_ConfigDb.sh ../CDB/simulators_ConfigDb.json # by default, use simulators
 
 start: up ## start a service (usage: make start <servicename>)
 	if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi
diff --git a/docs/source/configure_station.rst b/docs/source/configure_station.rst
index 412795ff0..0796d0980 100644
--- a/docs/source/configure_station.rst
+++ b/docs/source/configure_station.rst
@@ -1,7 +1,13 @@
 Enter your LOFAR2.0 Hardware Configuration
 ===========================================
 
-The software will need to be told various aspects of your station configuration, for example, the hostnames of the station hardware to control. The following settings are installation specific, and are stored as *properties* in the :ref:`tangodb`. The format used here is ``device.property``:
+The software will need to be told various aspects of your station configuration, for example, the hostnames of the station hardware to control. The following settings are installation specific, and are stored as *properties* in the :ref:`tangodb`.
+
+Stock configurations are provided for several stations, as well as using simulators to simulate the station's interface (which is the default after bootstrapping a station). These are provided in the ``CDB/stations/`` directory, and can be loaded using for example::
+
+    sbin/update_ConfigDb.sh CDB/stations/LTS_ConfigDb.json
+
+The following sections describe the settings that are station dependent, and thus must or can be set.
 
 Mandatory settings
 -------------------
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index cb0122ae9..58ccf2cd3 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -20,13 +20,7 @@ Next, we bootstrap the system. This will build our docker images, start key ones
   cd docker-compose
   make bootstrap
 
-If you lack access to LOFAR station hardware, load additional configurations to use the simulators instead::
-
-  for sim in ../CDB/*-sim-config.json; do
-    ../sbin/update_ConfigDb.sh ../CDB${sim}-config.json
-  done
-
-If you do have access to LOFAR station hardware, you will have to :doc:`configure_station`.
+If you do have access to LOFAR station hardware, you must upload its configuration to the configuration database. See :doc:`configure_station`.
 
 Now we are ready to start the other containers::
 
-- 
GitLab