cisco.iosxr
cisco.iosxr copied to clipboard
fix cliconf for IOS XRd
SUMMARY
The collection does not work with IOS XRd and cliconf. This PR fixes #509 to allow connections to IOS XRd with cliconf.
ISSUE TYPE
- Bugfix Pull Request
COMPONENT NAME
- plugins/cliconf/iosxr.py
ADDITIONAL INFORMATION
The problem is, that IOS XRd does not support the "show inventory" command. As a solution, I set the output to an empty string if the command fails.
@jmussmann can you please add relevant tests to vaildate the change?
@Ruchip16 thank you for the hint. I added the tests.
@Ruchip16 would it be possible to merge this fix, please?
I have an issue using this ansible galaxy on Cisco IOS XRd, due to the command show inventory not existing on such device.
That would be amazing, my current workaround is to use the fork by @jmussmann (thank you for providing the fix!)
Aloha, would it be possible to merge this? And I would have a suggestion for an improvement to this fix. Instead of using Try and except, why not add in the model_search a search string for XRD and fix the double "show inventory" command:
model_search_strs = [
r"^[Cc]isco (.+) \(\) processor",
r"^[Cc]isco ([A-Z0-9\-]+) processor",
r"^[Cc]isco (XRd).+ processor",
r"^[Cc]isco (.+) \(revision",
r"^[Cc]isco (\S+ \S+).+bytes of .*memory",
]
if "network_os_model" not in device_info:
data = self.get_command_output("show inventory")
match = re.search(r"DESCR: \"[Cc]isco (\S+ \S+)", data, re.M)
if match:
device_info["network_os_model"] = match.group(1)
if device_info["network_os_model"] != 'XRd':
data = self.get_command_output("show inventory")
match = re.search(r"SN: (\S+)\n\nNAME:", data, re.M)
if match:
device_info["network_os_serialnum"] = match.group(1)
I personally like this more, with this we match addional for XRd Thanks Marcel
@jmussmann hey thanks for raising this PR, can you add a changelog so that we can merge the PR? I tried pushing it but seems like i dont have read/write access to push the commits to the PR sadly :(
@jmussmann hey thanks for raising this PR, can you add a changelog so that we can merge the PR? I tried pushing it but seems like i dont have read/write access to push the commits to the PR sadly :(
@Ruchip16 Thanks for merging this change. I now gave write access to the maintainers. Thus you should be able to add a changelog now.