Skip to content

Commit 9f37f1c

Browse files
authored
Add aireos support for IRCM images (#188)
1 parent 286b0ab commit 9f37f1c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

pyntc/devices/aireos_device.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
)
2525

2626

27-
RE_FILENAME_FIND_VERSION = re.compile(r"^\S+?-[A-Za-z]{2}\d+-(?:\S+-?)?(?:K9-)?(?P<version>\d+-\d+-\d+-\d+)", re.M)
27+
RE_FILENAME_FIND_VERSION = re.compile(r"^.+?(?P<version>\d+(?:-|_)\d+(?:-|_)\d+(?:-|_)\d+)\.", re.M)
2828
RE_AP_IMAGE_COUNT = re.compile(r"^[Tt]otal\s+number\s+of\s+APs\.+\s+(?P<count>\d+)\s*$", re.M)
2929
RE_AP_IMAGE_DOWNLOADED = re.compile(r"^\s*[Cc]ompleted\s+[Pp]redownloading\.+\s+(?P<downloaded>\d+)\s*$", re.M)
3030
RE_AP_IMAGE_UNSUPPORTED = re.compile(r"^\s*[Nn]ot\s+[Ss]upported\.+\s+(?P<unsupported>\d+)\s*$", re.M)
@@ -58,7 +58,7 @@ def convert_filename_to_version(filename):
5858
"""
5959
version_match = RE_FILENAME_FIND_VERSION.match(filename)
6060
version_string = version_match.groupdict()["version"]
61-
version = version_string.replace("-", ".")
61+
version = re.sub("-|_", ".", version_string)
6262
return version
6363

6464

@@ -97,17 +97,17 @@ def _ap_images_match_expected(self, image_option, image, ap_boot_options=None):
9797
Args:
9898
image_option (str): The boot_option dict key ("primary", "backup") to validate.
9999
image (str): The image that the ``image_option`` should match.
100-
ap_boot_options (dict): The results from
100+
ap_boot_options (dict): The results from ``self.ap_boot_options``.
101101
102102
Returns:
103103
bool: True if all APs have ``image_option`` equal to ``image``, else False.
104104
105105
Example:
106106
>>> device = AIREOSDevice(**connection_args)
107-
>>> device.ap_boot_options()
107+
>>> device.ap_boot_options
108108
{
109-
'ap1': {'primary': {'8.10.105.0', 'secondary': '8.10.103.0'},
110-
'ap2': {'primary': {'8.10.105.0', 'secondary': '8.10.103.0'},
109+
'ap1': {'primary': '8.10.105.0', 'secondary': '8.10.103.0'},
110+
'ap2': {'primary': '8.10.105.0', 'secondary': '8.10.103.0'},
111111
}
112112
>>> device._ap_images_match_expected("primary", "8.10.105.0")
113113
True

test/unit/test_devices/test_aireos_device.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99

1010
@pytest.mark.parametrize(
1111
"filename,version",
12-
(("AIR-CT5520-K9-8-8-125-0.aes", "8.8.125.0"), ("AIR-CT5520-8-8-125-0.aes", "8.8.125.0")),
13-
ids=("encrypted", "unencrypted"),
12+
(
13+
("AIR-CT5520-K9-8-8-125-0.aes", "8.8.125.0"),
14+
("AIR-CT5520-8-8-125-0.aes", "8.8.125.0"),
15+
("AS_5500_8_5_161_7.aes", "8.5.161.7"),
16+
("AP_BUNDLE_5500_8_5_161_7.aes", "8.5.161.7"),
17+
),
18+
ids=("encrypted", "unencrypted", "ircm", "ircm-bundle"),
1419
)
1520
def test_convert_filename_to_version(filename, version):
1621
assert aireos_module.convert_filename_to_version(filename) == version

0 commit comments

Comments
 (0)