test: upgrade wamp test.
authorEdouard Tisserant <edouard@beremiz.fr>
Thu, 27 Feb 2025 09:38:10 +0100 (2 weeks ago)
changeset 4119 766f3e0e7277
parent 4118 f9f116d8a022
child 4120 6b4e1452fa16
test: upgrade wamp test.
tests/projects/wamp/.crossbar/config.json
tests/projects/wamp/README
tests/projects/wamp/project_files/wampconf.json
tests/projects/wamp/psk/management.json
tests/projects/wamp/psk/test_service_name.psk
--- a/tests/projects/wamp/.crossbar/config.json	Wed Feb 26 16:33:13 2025 +0100
+++ b/tests/projects/wamp/.crossbar/config.json	Thu Feb 27 09:38:10 2025 +0100
@@ -1,20 +1,15 @@
 {
     "version": 2,
-    "controller": {},
     "workers": [
         {
             "type": "router",
-            "options": {
-                "pythonpath": [
-                    ".."
-                ]
-            },
+            "id": "automation_router",
             "realms": [
                 {
                     "name": "Automation",
                     "roles": [
                         {
-                            "name": "anonymous",
+                            "name": "authenticated",
                             "permissions": [
                                 {
                                     "uri": "",
@@ -36,19 +31,29 @@
                     ]
                 }
             ],
-            "transports": [
+		    "transports": [
                 {
-                    "type": "websocket",
-                    "debug": true,
+                    "type": "web",
                     "endpoint": {
                         "type": "tcp",
                         "port": 8888
                     },
-                    "url": "ws://127.0.0.1:8888/",
-                    "serializers": [
-                        "msgpack",
-                        "json"
-                    ]
+                    "paths": {
+                        "ws": {
+                            "type": "websocket",
+                            "auth": {
+                                "wampcra": {
+                                    "type": "static",
+                                    "users": {
+                                        "test_wamp_ID": {
+                                            "secret": "z+L5NUdkG18PeHjIyIuYAYMRiBjbedvokLV+a0nBiu04N9bhphzVkbQUfq5OJTJfUwaTG/GasmevRB4XNRhNJSbnYS+PDhXb06r/c+C6IfBwryqQyddiiDh6qh5QueT0eYCuxtDCZODe/TTfTI8ACetscGpCPSmlHmELFgMLCp2iYxxuUMw5ugad8E3BoehKCMkGD7Sb8dKDbrOHdvJQjKqcMkdUn4iaoMYmCFoAfqPShDx00K4O0FaU9a9/SNBN",
+                                            "role": "authenticated"
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
                 }
             ]
         }
--- a/tests/projects/wamp/README	Wed Feb 26 16:33:13 2025 +0100
+++ b/tests/projects/wamp/README	Thu Feb 27 09:38:10 2025 +0100
@@ -1,42 +1,23 @@
+
 /* This project contains wamp client config to be loaded at runtime startup. */
-./project_files/wampconf.json
 
-wampconf.json is in "Project Files", so it is copied to runtime's working directory, and then loaded after program transfer + runtime restart.
+    ./project_files/wampconf.json
 
-Otherwise, wamp config file path can be forced :
-./Beremiz_service.py -c /path/to/my/wampconf.json /working/dir
+Note :
+    wampconf.json is in "Project Files", so it is copied to runtime's working 
+    directory, and then loaded after program transfer + runtime restart.
 
-/* Crossbar install */
-#sudo apt-get update
-#sudo apt-get -y dist-upgrade
-sudo apt-get -y install build-essential libssl-dev libffi-dev libreadline-dev libbz2-dev libsqlite3-dev libncurses5dev
-sudo apt-get -y install python3-pip
-sudo python3 -m pip install -U pip
-sudo pip3 install crossbar
-crossbar version
+/* Use pip and python virtual env to obtain crossbar */
+/* Crossbar test router configuration is available in .crossbar directory. */
+/* Start Crossbar command: (directly in project directory)*/
 
-/* Start Crossbar command: */
 crossbar start
 
-/* Crossbar test router configuration is available in .crossbar directory. */
-Tested on version:
+/* Start runtime */
 
-    :::::::::::::::::
-          :::::          _____                      __
-    :::::   :   :::::   / ___/____ ___   ___  ___  / /  ___ _ ____
-    :::::::   :::::::  / /__ / __// _ \ (_-< (_-< / _ \/ _ `// __/
-    :::::   :   :::::  \___//_/   \___//___//___//_.__/\_,_//_/
-          :::::
-    :::::::::::::::::   Crossbar v18.7.2
+# steal config and PSK from config to start runtime directly with them
+cp ${BEREMIZ_DIR}/tests/projects/wamp/project_files/wampconf.json ${RUNTIME_CONF_DIR}/wampconf.json
+cp ${BEREMIZ_DIR}/tests/projects/wamp/psk/test_service_name.psk ${RUNTIME_KEYSTORE}/psk.txt
 
-    Copyright (c) 2013-2018 Crossbar.io Technologies GmbH, licensed under AGPL 3.0.
-
- Crossbar.io        : 18.7.2
-   Autobahn         : 18.7.1
-   Twisted          : 18.7.0-EPollReactor
-   LMDB             : 0.94/lmdb-0.9.22
-   Python           : 3.6.6/CPython
- Frozen executable  : no
- Operating system   : Linux-4.16.0-2-rt-amd64-x86_64-with-debian-buster-sid
- Host machine       : x86_64
- Release key        : RWS9T4NltFjmKSMbEtETnOMxRjLhOEZ6e80T5MYzTTh/+NP9Jk20sJmA
+# launch runtime pointing to confif ans PSK
+python ${BEREMIZ_DIR}/Beremiz_service.py -c ${RUNTIME_CONF_DIR}/wampconf.json -s ${RUNTIME_KEYSTORE}/psk.txt -n test_service_name ${PLC_WORKING_DIR}
--- a/tests/projects/wamp/project_files/wampconf.json	Wed Feb 26 16:33:13 2025 +0100
+++ b/tests/projects/wamp/project_files/wampconf.json	Thu Feb 27 09:38:10 2025 +0100
@@ -1,10 +1,10 @@
 {
-    "ID": "wamptest", 
+    "ID": "test_wamp_ID", 
     "active": true, 
     "protocolOptions": {
         "autoPingInterval": 60, 
         "autoPingTimeout": 20
     }, 
     "realm": "Automation", 
-    "url": "ws://127.0.0.1:8888"
+    "url": "ws://127.0.0.1:8888/ws"
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/projects/wamp/psk/management.json	Thu Feb 27 09:38:10 2025 +0100
@@ -0,0 +1,1 @@
+[[test_service_name, ERPC://127.0.0.1:3000, null, 25/02/24-14:51:25]]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/projects/wamp/psk/test_service_name.psk	Thu Feb 27 09:38:10 2025 +0100
@@ -0,0 +1,1 @@
+test_service_name:z+L5NUdkG18PeHjIyIuYAYMRiBjbedvokLV+a0nBiu04N9bhphzVkbQUfq5OJTJfUwaTG/GasmevRB4XNRhNJSbnYS+PDhXb06r/c+C6IfBwryqQyddiiDh6qh5QueT0eYCuxtDCZODe/TTfTI8ACetscGpCPSmlHmELFgMLCp2iYxxuUMw5ugad8E3BoehKCMkGD7Sb8dKDbrOHdvJQjKqcMkdUn4iaoMYmCFoAfqPShDx00K4O0FaU9a9/SNBN