Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/cliconf/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ def get_device_info(self):
device_info["network_os_version"] = match.group(1).strip(",")

model_search_strs = [
r"^[Aa]llen[ -][Bb]radley (.+) \(revision",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! 🙌
Could you please confirm that the facts gathered by this change are being parsed correctly — especially the model and other relevant fields — using the updated regex patterns? It would also be helpful if you could share the ansible_facts output from devices like the Stratix 5800 and Cisco IE3400 to verify that the model is detected as expected.

Additionally, could we consider adding a basic test case to validate that the regex reliably captures the correct values from show version output? This would help ensure the change is robust and doesn’t break other matches in the future.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks at @Ruchip16 for taking a look! I will look if I can find a good place to mock out a unit test for this. There is a test case for the legacy ios_facts module but I think it comes in after the show version output is processed. Here is a dump of ansible_facts on 3 devices in the current (not patched) state:

TASK [ansible.builtin.debug] ***********************************************************************************************************************************************
ok: [ie-3400] => {
    "ansible_facts": {
        "net_api": "cliconf",
        "net_gather_network_resources": [],
        "net_gather_subset": [
            "default"
        ],
        "net_hostname": “ie-3400",
        "net_image": "flash:packages.conf",
        "net_iostype": "IOS-XE",
        "net_model": "IE-3400-8T2S",
        "net_operatingmode": "controller",
        "net_python_version": "3.12.5",
        "net_serialnum": “ABC1234Y2Y2",
        "net_stacked_models": [
            "IE-3400-8T2S"
        ],
        "net_stacked_serialnums": [
            "ABC1234Y2Y2"
        ],
        "net_system": "ios",
        "net_version": "17.12.04",
        "net_virtual_switch": "STACK",
        "network_resources": {}
    }
}
ok: [ie-9320] => {
    "ansible_facts": {
        "net_api": "cliconf",
        "net_gather_network_resources": [],
        "net_gather_subset": [
            "default"
        ],
        "net_hostname": “ie-9320",
        "net_image": "flash:packages.conf",
        "net_iostype": "IOS-XE",
        "net_model": "IE-9320-22S2C4X",
        "net_operatingmode": "controller",
        "net_python_version": "3.12.5",
        "net_serialnum": “FGH1234J77S",
        "net_stacked_models": [
            "IE-9320-22S2C4X"
        ],
        "net_stacked_serialnums": [
            "FGH1234J77S"
        ],
        "net_system": "ios",
        "net_version": "17.12.04",
        "net_virtual_switch": "STACK",
        "network_resources": {}
    }
}
ok: [stratix-5800] => {
    "ansible_facts": {
        "net_api": "cliconf",
        "net_gather_network_resources": [],
        "net_gather_subset": [
            "default"
        ],
        "net_hostname": “stratix-5800",
        "net_image": "flash:packages.conf",
        "net_iostype": "IOS-XE",
        "net_operatingmode": "controller",
        "net_python_version": "3.12.5",
        "net_serialnum": “CDE1234Y1KQ",
        "net_stacked_models": [
            "1783-MMS10AR"
        ],
        "net_stacked_serialnums": [
            "CDE1234Y1KQ"
        ],
        "net_system": "ios",
        "net_version": "17.12.04",
        "net_virtual_switch": "STACK",
        "network_resources": {}
    }
}

r"^[Cc]isco (.+) \(revision",
r"^[Cc]isco (\S+).+bytes of .*memory",
]
Expand Down
Loading