From 0017d9b452d4b3805942c1cfa83416225132ed93 Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Thu, 25 Jul 2024 15:12:36 +0200 Subject: [PATCH] feat: add mqtt host variables --- .../MQTT/058_01.robot | 12 ++++++------ .../MQTT/058_02.robot | 4 ++-- .../MQTT/058_03.robot | 4 ++-- .../MQTT/058_04.robot | 4 ++-- resources/mqttUtils/MqttUtils.resource | 12 ++++++------ resources/variables.py | 2 ++ 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_01.robot index 93b3d182..8367ae8f 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_01.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_01.robot @@ -24,19 +24,19 @@ ${topic} ngsild-test-suite/topic *** Test Cases *** 058_01_01 Without User And Port [Tags] sub-mqtt-notification 5_8_6 - mosquitto.conf mqtt://127.0.0.1/${topic} + mosquitto.conf mqtt://${mqtt_broker_host}/${topic} 058_01_02 With Non Default Port [Tags] sub-mqtt-notification 5_8_6 - mosquitto.conf mqtt://127.0.0.1:2883/${topic} port=2883 + mosquitto.conf mqtt://${mqtt_broker_host}:${mqtt_broker_non_default_port}/${topic} port=${mqtt_broker_non_default_port} 058_01_03 With User [Tags] sub-mqtt-notification 5_8_6 - mosquitto.conf mqtt://user@127.0.0.1/${topic} + mosquitto.conf mqtt://user@${mqtt_broker_host}/${topic} 058_01_04 With User And Password [Tags] sub-mqtt-notification 5_8_6 - mosquitto_with_user.conf mqtt://user_with_password:password@127.0.0.1/${topic} username=user_with_password password=password + mosquitto_with_user.conf mqtt://user_with_password:password@${mqtt_broker_host}/${topic} username=user_with_password password=password 058_01_05 With User Password And Non Default Port [Tags] sub-mqtt-notification 5_8_6 - mosquitto_with_user.conf mqtt://user_with_password:password@127.0.0.1:2883/${topic} username=user_with_password password=password port=2883 + mosquitto_with_user.conf mqtt://user_with_password:password@${mqtt_broker_host}:${mqtt_broker_non_default_port}/${topic} username=user_with_password password=password port=${mqtt_broker_non_default_port} *** Keywords *** @@ -48,7 +48,7 @@ Receive MQTT Notification Setup Mqtt Subscription ${endpoint_uri} Set Username And Password ${username} ${password} - Connect 127.0.0.1 ${port} + Connect ${mqtt_broker_host} ${port} Subscribe topic=${topic} qos=1 ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_02.robot index 3f985a69..5db442ac 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_02.robot @@ -20,7 +20,7 @@ ${building_id_prefix} urn:ngsi-ld:Building: ${entity_building_filepath} building-simple-attributes-sample.jsonld ${fragment_filename} airQualityLevel-fragment.jsonld ${topic} ngsild-test-suite/topic -${endpoint} mqtt://127.0.0.1/${topic} +${endpoint} mqtt://${mqtt_broker_host}/${topic} ${config_filename} mosquitto.conf @@ -49,7 +49,7 @@ Receive MQTT Notification Start Mqtt Server And Connect Start Mqtt Server ${config_filename} 1883 - Connect 127.0.0.1 1883 + Connect ${mqtt_broker_host} 1883 Subscribe topic=${topic} qos=1 After Test diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_03.robot index 863e9534..ee91ce8b 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_03.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_03.robot @@ -20,7 +20,7 @@ ${building_id_prefix} urn:ngsi-ld:Building: ${entity_building_filepath} building-simple-attributes-sample.jsonld ${fragment_filename} airQualityLevel-fragment.jsonld ${topic} ngsild-test-suite/topic -${endpoint} mqtt://127.0.0.1/${topic} +${endpoint} mqtt://${mqtt_broker_host}/${topic} ${config_filename} mosquitto.conf @@ -51,7 +51,7 @@ Receive Mqtt Notification Start Mqtt Server And Connect Start Mqtt Server ${config_filename} 1883 - Connect 127.0.0.1 1883 + Connect ${mqtt_broker_host} 1883 Subscribe topic=${topic} qos=1 After Test diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_04.robot index e45aca73..297f693e 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_04.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/MQTT/058_04.robot @@ -20,7 +20,7 @@ ${building_id_prefix} urn:ngsi-ld:Building: ${entity_building_filepath} building-simple-attributes-sample.jsonld ${fragment_filename} airQualityLevel-fragment.jsonld ${topic} ngsild-test-suite/topic -${endpoint} mqtt://127.0.0.1/${topic} +${endpoint} mqtt://${mqtt_broker_host}/${topic} ${config_filename} mosquitto.conf @@ -54,7 +54,7 @@ Start Mqtt Server And Connect Start Mqtt Server ${config_filename} 1883 Setup Mqtt Subscription ${endpoint} - Connect 127.0.0.1 1883 + Connect ${mqtt_broker_host} 1883 Subscribe topic=${topic} qos=1 After Test diff --git a/resources/mqttUtils/MqttUtils.resource b/resources/mqttUtils/MqttUtils.resource index 8ee17e86..d14ac9a6 100644 --- a/resources/mqttUtils/MqttUtils.resource +++ b/resources/mqttUtils/MqttUtils.resource @@ -17,12 +17,12 @@ Start Mqtt Server ${result} = Run Process ${request} shell=yes IF ${result.rc} > 0 - Log The launch of mosquitto encount an error - Log Check that docker is installed - Log that the port ${port} is available - Log and that no other container named ${container_name} is running - Log ${result.stdout} - Log ${result.stderr} + Log To Console The launch of mosquitto encounter an error + Log To Console Check that docker is installed + Log To Console that the port ${port} is available + Log To Console and that no other container named ${container_name} is running + Log To Console ${result.stdout} + Log To Console ${result.stderr} END Stop Mqtt Server diff --git a/resources/variables.py b/resources/variables.py index 10170932..8e573fd3 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -3,6 +3,8 @@ temporal_api_url = 'http://localhost:8080/ngsi-ld/v1' ngsild_test_suite_context = 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' notification_server_host = '0.0.0.0' notification_server_port = 8085 +mqtt_broker_host = '127.0.0.1' +mqtt_broker_non_default_port = 8085 context_source_host = '0.0.0.0' context_source_port = 8086 context_server_host = '0.0.0.0' -- GitLab