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>
This commit is contained in:
Sumit Jaiswal 2019-07-01 12:26:04 +05:30 committed by GitHub
parent d582efcc51
commit 539f37ede3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -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:

View file

@ -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:

View file

@ -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"