1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/ios_ping/tests/cli/ping.yaml
2017-10-25 14:16:28 +02:00

56 lines
1.3 KiB
YAML

---
- debug: msg="START cli/ping.yaml"
- ios_command:
commands: show version
authorize: yes
register: show_version_result
- set_fact: management_interface=GigabitEthernet0/0
when: "'Cisco IOS' in show_version_result.stdout[0]"
- set_fact: management_interface=GigabitEthernet1
when: "'Cisco IOS-XE' in show_version_result.stdout[0]"
- name: Get show ip management nterface output
ios_command:
commands:
- "show ip interface {{ management_interface }} | include Internet address"
authorize: yes
register: show_ip_interface_result
- name: Extract the IP address from registered output
set_fact: management_ip="{{ show_ip_interface_result.stdout[0].split()[-1].split('/')[0] }}"
- name: expected successful ping
ios_ping: &valid_ip
dest: '{{ management_ip }}'
authorize: yes
register: esp
- name: unexpected unsuccessful ping
ios_ping: &invalid_ip
dest: '10.255.255.250'
timeout: 45
authorize: yes
register: uup
ignore_errors: yes
- name: unexpected successful ping
ios_ping:
<<: *valid_ip
state: 'absent'
register: usp
ignore_errors: yes
- name: expected unsuccessful ping
ios_ping:
<<: *invalid_ip
state: 'absent'
register: eup
- name: assert
assert:
that:
- esp.failed == eup.failed == false
- usp.failed == uup.failed == true