From 63a752a8235a71de038441bc1d55d1ca3392833a Mon Sep 17 00:00:00 2001 From: Yury Kudinov Date: Sat, 23 May 2026 08:19:41 +0800 Subject: [PATCH] fix: support viptela-* image naming in get_cml_sdwan_image_definition When SD-WAN images are registered in CML manually (via the REST API or UI) rather than through sdwan-lab setup, they often use the legacy viptela-* naming convention (e.g. viptela-vmanage-20.12.7.1) instead of the expected cat-sdwan-manager-20.12.7.1 format. The exact-match check then fails and sys.exit() fires with a misleading message even though the images are present under different IDs. Add a version-string fallback inside the else branch: if the cat-sdwan-* exact match misses, scan existing_image_definitions for any ID containing the requested software_version string. This matches viptela-* IDs as well as any other non-standard naming that embeds the version number. The fallback is non-breaking: exact match is tried first; the fallback only runs on a miss; the existing controller/validator version-decrement logic is preserved for the case where neither check succeeds. Validated in production: CML 2.10.0 with viptela-* images, sdwan-lab deploy 20.12.7.1 successfully onboards all four SD-WAN node types. --- catalyst_sdwan_lab/tasks/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/catalyst_sdwan_lab/tasks/utils.py b/catalyst_sdwan_lab/tasks/utils.py index 058ccee..e4a36bc 100644 --- a/catalyst_sdwan_lab/tasks/utils.py +++ b/catalyst_sdwan_lab/tasks/utils.py @@ -300,6 +300,12 @@ def get_cml_sdwan_image_definition( if requested_image_definition in existing_image_definitions: return requested_image_definition else: + # Fallback: match by version string in image ID. + # Handles cases where images were registered manually with viptela-* naming + # (e.g. viptela-vmanage-20.12.7.1) instead of the expected cat-sdwan-* convention. + version_matches = [img for img in existing_image_definitions if software_version in img] + if version_matches: + return version_matches[0] if node_definition in ["cat-sdwan-controller", "cat-sdwan-validator"]: # If there's no requested Controller image, try one version lower # For example sometimes Manager is 20.9.3.2 and Controller/Validator is 20.9.3.1