generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
110 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +0,0 @@ | ||
# The follow are 3rd party libs for validate | ||
jsonschema | ||
# /valiate | ||
|
||
# The follow are 3rd party libs for cli_parse | ||
ntc_templates | ||
pyats ; python_version >= '3.6' and python_version < '3.9' | ||
genie ; python_version >= '3.6' and python_version < '3.9' | ||
textfsm | ||
ttp | ||
xmltodict | ||
# /cli_parse | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/integration/targets/cli_parse/files/nxos_show_version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Cisco Nexus Operating System (NX-OS) Software | ||
TAC support: http://www.cisco.com/tac | ||
Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_series_home.html | ||
Copyright (c) 2002-2016, Cisco Systems, Inc. All rights reserved. | ||
The copyrights to certain works contained herein are owned by | ||
other third parties and are used and distributed under license. | ||
Some parts of this software are covered under the GNU Public | ||
License. A copy of the license is available at | ||
http://www.gnu.org/licenses/gpl.html. | ||
|
||
NX-OSv is a demo version of the Nexus Operating System | ||
|
||
Software | ||
loader: version N/A | ||
kickstart: version 7.3(0)D1(1) | ||
system: version 7.3(0)D1(1) | ||
kickstart image file is: bootflash:///titanium-d1-kickstart.7.3.0.D1.1.bin | ||
kickstart compile time: 1/11/2016 16:00:00 [02/11/2016 10:30:12] | ||
system image file is: bootflash:///titanium-d1.7.3.0.D1.1.bin | ||
system compile time: 1/11/2016 16:00:00 [02/11/2016 13:08:11] | ||
|
||
|
||
Hardware | ||
cisco NX-OSv Chassis ("NX-OSv Supervisor Module") | ||
QEMU Virtual CPU version 2.5 with 3064740 kB of memory. | ||
Processor Board ID TM000B0000B | ||
|
||
Device name: an-nxos-02 | ||
bootflash: 3184776 kB | ||
|
||
Kernel uptime is 110 day(s), 12 hour(s), 32 minute(s), 10 second(s) | ||
|
||
|
||
plugin | ||
Core Plugin, Ethernet Plugin | ||
|
||
Active Package(s) |
18 changes: 18 additions & 0 deletions
18
tests/integration/targets/cli_parse/output/nxos_show_interface_json_text.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
[ | ||
[ | ||
{ | ||
"admin_state": "up,", | ||
"interface": "mgmt0", | ||
"state": "up", | ||
"var": "extra_var" | ||
}, | ||
{ | ||
"admin_state": "up,", | ||
"interface": "Ethernet1/1", | ||
"state": "up", | ||
"var": "extra_var" | ||
} | ||
] | ||
] | ||
] |
7 changes: 7 additions & 0 deletions
7
tests/integration/targets/cli_parse/output/nxos_show_version_textfsm_parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"BOOT_IMAGE": "bootflash:///titanium-d1-kickstart.7.3.0.D1.1.bin", | ||
"LAST_REBOOT_REASON": "", | ||
"OS": "7.3(0)D1(1)", | ||
"PLATFORM": "OSv", | ||
"UPTIME": "110 day(s), 12 hour(s), 32 minute(s), 10 second(s)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 7 additions & 12 deletions
19
tests/integration/targets/cli_parse/tasks/nxos_textfsm.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
--- | ||
- name: "{{ parser }} Run command and parse with textfsm" | ||
ansible.utils.cli_parse: | ||
command: "show version" | ||
parser: | ||
name: ansible.utils.textfsm | ||
register: nxos_textfsm_command | ||
- set_fact: | ||
nxos_textfsm_text_parsed: "{{ lookup('file', '{{ role_path }}/output/nxos_show_version_textfsm_parsed.json') | from_json }}" | ||
|
||
- name: "{{ parser }} Pass text and command" | ||
ansible.utils.cli_parse: | ||
text: "{{ nxos_textfsm_command['stdout'] }}" | ||
text: "{{ lookup('file', '{{ role_path }}/files/nxos_show_version.txt') }}" | ||
parser: | ||
name: ansible.utils.textfsm | ||
command: show version | ||
template_path: "{{ role_path }}/templates/nxos_show_version.textfsm" | ||
register: nxos_textfsm_text | ||
|
||
- name: "{{ parser }} Confirm response" | ||
assert: | ||
that: "{{ item }}" | ||
with_items: | ||
- "{{ nxos_textfsm_command['stdout'] is defined }}" | ||
- "{{ nxos_textfsm_command['stdout_lines'] is defined }}" | ||
- "{{ nxos_textfsm_command['parsed'] == nxos_textfsm_text['parsed'] }}" | ||
- "{{ nxos_textfsm_command['parsed'][0]['BOOT_IMAGE'] is defined }}" | ||
- "{{ nxos_textfsm_text['parsed'] == nxos_textfsm_text['parsed'] }}" | ||
- "{{ nxos_textfsm_text['parsed'][0]['BOOT_IMAGE'] is defined }}" | ||
- "{{ nxos_textfsm_text['parsed'][0] == nxos_textfsm_text_parsed }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters