--- a/tests/cli_tests/wamp_test.bash Tue Mar 04 14:00:41 2025 +0100
+++ b/tests/cli_tests/wamp_test.bash Tue Mar 04 14:15:54 2025 +0100
@@ -1,6 +1,6 @@
+rm -f ./CLI_OK ./PLC_OK ./PLC_CONNECTED # Start runtime one first time to generate PSK
$BEREMIZPYTHONPATH $BEREMIZPATH/Beremiz_service.py -s psk.txt -n test_wamp_ID -x 0 &
@@ -27,8 +27,15 @@
IFS=':' read -r wamp_ID wamp_secret < psk.txt
+# Prepare crossbar server configuration +yes "" | openssl req -nodes -new -x509 -keyout ./.crossbar/server.key \ + -addext "subjectAltName = DNS:localhost" \ + -out ./.crossbar/server.crt +openssl dhparam -2 -outform PEM -out .crossbar/dhparam.pem 2048 cat > .crossbar/config.json <<JsonEnd
@@ -68,7 +75,12 @@
+ "certificate": "server.crt", + "dhparam": "dhparam.pem" @@ -127,16 +139,23 @@
- "url": "ws://127.0.0.1:8888/ws"
+ "url": "wss://localhost:8888/ws" +# Re-use self-signed server cert for client +cp .crossbar/server.crt wampTrustStore.crt # Start Beremiz runtime again, with wamp enabled
$BEREMIZPYTHONPATH $BEREMIZPATH/Beremiz_service.py -c wampconf.json -s psk.txt -n test_wamp_ID -x 0 &> >(
# Wait for server to print modified value
+ if [[ "$line" =~ ^"WAMP session joined" ]]; then + echo "PLC is connected" if [[ "$line" == "PLCobject : PLC started" ]]; then
echo "PLC was programmed"
@@ -147,13 +166,32 @@
echo wait for runtime to come up
+res=110 # default to ETIMEDOUT + if [[ -a ./PLC_CONNECTED ]]; then +if [ "$res" != "0" ] ; then + echo timeout connecting PLC to crossbar. cp -a $BEREMIZPATH/tests/projects/wamp .
# place PSK so that IDE already knows runtime
cp psk.txt wamp/psk/${wamp_ID}.secret
+# Re-use self-signed server cert for client +cp .crossbar/server.crt wamp/cert/localhost.crt # TODO: patch project's URI to connect to $BEREMIZ_LOCAL_HOST
# used in tests instead of 127.0.0.1
--- a/tests/projects/wamp/beremiz.xml Tue Mar 04 14:00:41 2025 +0100
+++ b/tests/projects/wamp/beremiz.xml Tue Mar 04 14:15:54 2025 +0100
@@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?>
-<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" URI_location="WAMP://127.0.0.1:8888/ws#Automation#test_wamp_ID">
+<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" URI_location="WAMPS://localhost:8888/ws#Automation#test_wamp_ID"> --- a/tests/tools/Docker/Dockerfile Tue Mar 04 14:00:41 2025 +0100
+++ b/tests/tools/Docker/Dockerfile Tue Mar 04 14:15:54 2025 +0100
@@ -128,4 +128,4 @@
ENV BEREMIZPYTHONPATH /home/$UNAME/beremizenv/bin/python
# use venv python and installed command by default
ENV PATH="/home/$UNAME/beremizenv/bin:$PATH"