From 48a9843c8f8f9264eb3aa2a8defbb60e89eb4509 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Mon, 29 Jul 2024 22:57:38 +0200 Subject: [PATCH] add keyword to get the correct bridge service name Signed-off-by: Reuben Miller --- .../libraries/ThinEdgeIO/ThinEdgeIO.py | 14 ++++++++++++++ .../service_monitoring/service_monitoring.robot | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/RobotFramework/libraries/ThinEdgeIO/ThinEdgeIO.py b/tests/RobotFramework/libraries/ThinEdgeIO/ThinEdgeIO.py index 08c79587939..6dc4e730739 100644 --- a/tests/RobotFramework/libraries/ThinEdgeIO/ThinEdgeIO.py +++ b/tests/RobotFramework/libraries/ThinEdgeIO/ThinEdgeIO.py @@ -879,6 +879,20 @@ def configure_ssh(self, user: str = "root", device: str = None) -> str: ) return str(key) + @keyword("Get Bridge Service Name") + def get_bridge_service_name(self, cloud: str) -> str: + """Get the name of the bridge service. + + The service name will depend if the built-in bridge + has been activated or not (on the device). + """ + output = self.execute_command("tedge config get mqtt.bridge.built_in", strip=True, ignore_exit_code=True) + if output == "true": + return f"tedge-mapper-bridge-{cloud}" + + # Legacy mosquitto bridge + return f"mosquitto-{cloud}-bridge" + def to_date(value: relativetime_) -> datetime: if isinstance(value, datetime): diff --git a/tests/RobotFramework/tests/cumulocity/service_monitoring/service_monitoring.robot b/tests/RobotFramework/tests/cumulocity/service_monitoring/service_monitoring.robot index 1df79c24bce..7f538bcdf85 100644 --- a/tests/RobotFramework/tests/cumulocity/service_monitoring/service_monitoring.robot +++ b/tests/RobotFramework/tests/cumulocity/service_monitoring/service_monitoring.robot @@ -28,7 +28,8 @@ Test if all c8y services are up c8y-firmware-plugin Test bridge service status up - External Identity Should Exist ${DEVICE_SN}:device:main:service:mosquitto-c8y-bridge show_info=False + ${SERVICE_NAME}= Get Bridge Service Name cloud=c8y + External Identity Should Exist ${DEVICE_SN}:device:main:service:${SERVICE_NAME} show_info=False Cumulocity.Managed Object Should Have Fragment Values status\=up timeout=${TIMEOUT} Test mosquitto bridge service status mapping