PR to implement ansible_net_model for iosxr facts module (#58488)

* resolves 57767

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* added test

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
pull/58581/head
Sumit Jaiswal 5 years ago committed by GitHub
parent d582efcc51
commit 539f37ede3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -84,6 +84,10 @@ ansible_net_python_version:
description: The Python version Ansible controller is using
returned: always
type: str
ansible_net_model:
description: The model name returned from the device
returned: always
type: str
# hardware
ansible_net_filesystems:

@ -60,9 +60,12 @@ class Cliconf(CliconfBase):
if match:
device_info['network_os_image'] = match.group(1)
match = re.search(r'^Cisco (.+) \(revision', data, re.M)
if match:
device_info['network_os_model'] = match.group(1)
model_search_strs = [r'^Cisco (.+) \(revision', r'^[Cc]isco (\S+ \S+).+bytes of .*memory']
for item in model_search_strs:
match = re.search(item, data, re.M)
if match:
device_info['network_os_model'] = match.group(1)
break
match = re.search(r'^(.+) uptime', data, re.M)
if match:

@ -9,8 +9,6 @@
provider: "{{ cli }}"
register: result
- assert:
that:
# _facts modules should never report a change
@ -21,7 +19,7 @@
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
- "'default' in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
- "result.ansible_facts.ansible_net_model == 'IOS XRv'"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined"

Loading…
Cancel
Save