From afb23b2a2ccf852843ad36a0d509fdb8e996f0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Tue, 8 Sep 2026 14:12:12 +0200 Subject: [PATCH 1/2] Parse Aruba AOS-CX versions --- netutils/os_version.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/netutils/os_version.py b/netutils/os_version.py index 3edc07f4..91b44834 100644 --- a/netutils/os_version.py +++ b/netutils/os_version.py @@ -133,6 +133,28 @@ def compare_version_strict(current_version: str, comparison: str, target_version return _compare_version(current_version, comparison, target_version, "strict") +def _hpe_arubaos_cx_version_metadata(version: str) -> t.Dict[str, t.Any]: + """Parse Aruba AOS-CX versions. + + Examples: + >>> _hpe_arubaos_cx_version_metadata("FL.10.13.1161") + {'release': 'FL', 'major': '10', 'minor': '13', 'patch': '1161'} + + >>> _hpe_arubaos_cx_version_metadata("GL.10.13.1090") + {'release': 'GL', 'major': '10', 'minor': '13', 'patch': '1090'} + """ + regex = re.compile( + r"^(?P[A-Z]{2})\.(?P\d+)\.(?P\d+)\.(?P\d+)$" + ) + + parsed_version = regex.match(version) + + if parsed_version: + return parsed_version.groupdict() + + return {"Error": "Unable to evaluate the version number entered."} + + def _juniper_junos_version_metadata(version: str) -> t.Dict[str, t.Any]: """Parses JunOS Version into usable bits matching JunOS Standards. @@ -286,6 +308,9 @@ def _basic_version_metadata(version: str) -> t.Dict[str, t.Any]: "juniper": { "junos": _juniper_junos_version_metadata, }, + "hpe": { + "arubaos-cx": _hpe_arubaos_cx_version_metadata, + }, } From 964b459956fcede9301f4ef69c0443014dca712b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Tue, 8 Sep 2026 14:13:01 +0200 Subject: [PATCH 2/2] ArubaOS-CX uses a custom version format --- tests/unit/test_os_versions.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/unit/test_os_versions.py b/tests/unit/test_os_versions.py index e647fd6e..3c553a8a 100755 --- a/tests/unit/test_os_versions.py +++ b/tests/unit/test_os_versions.py @@ -4,6 +4,7 @@ from netutils import os_version from netutils.constants import UPGRADE_PATHS +from netutils.os_version import version_metadata LOOSE_VERSION = [ {"sent": {"current_version": "10.1", "comparison": ">=", "target_version": "10.2"}, "received": False}, @@ -33,6 +34,35 @@ ] PLATFORM_VERSION_METADATA = [ + # ArubaOS-CX uses a custom version format + { + "sent": { + "vendor": "hpe", + "platform": "arubaos-cx", + "version": "FL.10.13.1161", + }, + "received": { + "major": "10", + "minor": "13", + "patch": "1161", + "release": "FL", + "vendor_metadata": True, + }, + }, + { + "sent": { + "vendor": "hpe", + "platform": "arubaos-cx", + "version": "GL.10.13.1090", + }, + "received": { + "major": "10", + "minor": "13", + "patch": "1090", + "release": "GL", + "vendor_metadata": True, + }, + }, # Cisco and Arista use the generic parsing { "sent": {"vendor": "cisco", "platform": "ios", "version": "15.7(2.0z)M"},