[2.5] Update ios tests (#42509) (#42515)

* [2.5] Update ios tests (#42509)

* 192.168.0.1/24 conflicts with management IP

* Images don't have the hostnames we expect
(cherry picked from commit 399d13d)

Co-authored-by: Nathaniel Case <this.is@nathanielca.se>

* ios test cleanup pt 2 (#42570)

* Remove local from ios_config to avoid needing to add provider

* ios_smoke should test all with local to pick up the slack

(cherry picked from commit 381263ad99)
pull/43174/head
Nathaniel Case 6 years ago committed by Matt Davis
parent e3993bd01b
commit dc37b41b72

@ -14,9 +14,3 @@
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

@ -9,7 +9,6 @@
parents: parents:
- interface Loopback999 - interface Loopback999
match: none match: none
provider: "{{ cli }}"
- name: collect any backup files - name: collect any backup files
find: find:
@ -28,7 +27,6 @@
ios_config: ios_config:
src: basic/config.j2 src: basic/config.j2
backup: yes backup: yes
provider: "{{ cli }}"
register: result register: result
- assert: - assert:

@ -9,13 +9,11 @@
parents: parents:
- interface Loopback999 - interface Loopback999
match: none match: none
provider: "{{ cli }}"
- name: configure device with defaults included - name: configure device with defaults included
ios_config: ios_config:
src: defaults/config.j2 src: defaults/config.j2
defaults: yes defaults: yes
provider: "{{ cli }}"
register: result register: result
- debug: var=result - debug: var=result
@ -30,7 +28,6 @@
ios_config: ios_config:
src: defaults/config.j2 src: defaults/config.j2
defaults: yes defaults: yes
provider: "{{ cli }}"
register: result register: result
- debug: var=result - debug: var=result
@ -44,14 +41,12 @@
ios_config: ios_config:
lines: lines:
- mac-address-table notification mac-move - mac-address-table notification mac-move
provider: "{{ cli }}"
ignore_errors: yes ignore_errors: yes
- name: show interfaces brief to ensure deivce goes to valid prompt - name: show interfaces brief to ensure deivce goes to valid prompt
ios_command: ios_command:
commands: commands:
- show interfaces - show interfaces
provider: "{{ cli }}"
register: result register: result
- assert: - assert:

@ -1,6 +1,10 @@
--- ---
- debug: msg="START cli/diff.yaml on connection={{ ansible_connection }}" - debug: msg="START cli/diff.yaml on connection={{ ansible_connection }}"
- name: Ensure hostname is preset
ios_system:
hostname: "{{ shorter_hostname }}"
- name: ios_config diff against retrieved config - name: ios_config diff against retrieved config
ios_config: ios_config:
diff_against: intended diff_against: intended

@ -9,13 +9,11 @@
parents: parents:
- interface Loopback999 - interface Loopback999
match: none match: none
provider: "{{ cli }}"
- name: save config - name: save config
ios_config: ios_config:
save: true save: true
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -25,7 +23,6 @@
- name: save should always run - name: save should always run
ios_config: ios_config:
save: true save: true
provider: "{{ cli }}"
register: result register: result
- name: delete config (setup) - name: delete config (setup)
@ -34,7 +31,6 @@
lines: lines:
- "no ip http server" - "no ip http server"
save_when: modified save_when: modified
provider: "{{ cli }}"
register: result register: result
- name: save should always run - name: save should always run
@ -43,7 +39,6 @@
lines: lines:
- "ip http server" - "ip http server"
save_when: modified save_when: modified
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -54,7 +49,6 @@
ios_config: ios_config:
lines: lines:
- "no ip http server" - "no ip http server"
provider: "{{ cli }}"
register: result register: result
- debug: msg="END cli/save.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/save.yaml on connection={{ ansible_connection }}"

@ -9,12 +9,10 @@
parents: parents:
- interface Loopback999 - interface Loopback999
match: none match: none
provider: "{{ cli }}"
- name: configure device with config - name: configure device with config
ios_config: ios_config:
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}"
register: result register: result
- name: debug, remove me - name: debug, remove me
@ -30,7 +28,6 @@
- name: check device with config - name: check device with config
ios_config: ios_config:
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}"
register: result register: result
- assert: - assert:

@ -6,7 +6,6 @@
- name: configure with invalid src - name: configure with invalid src
ios_config: ios_config:
src: basic/foobar.j2 src: basic/foobar.j2
provider: "{{ cli }}"
register: result register: result
ignore_errors: yes ignore_errors: yes

@ -9,13 +9,11 @@
parents: parents:
- interface Loopback999 - interface Loopback999
match: none match: none
provider: "{{ cli }}"
- name: configure device with config - name: configure device with config
ios_config: ios_config:
src: basic/config.j2 src: basic/config.j2
match: none match: none
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -28,7 +26,6 @@
- name: check device with config - name: check device with config
ios_config: ios_config:
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}"
register: result register: result
- assert: - assert:

@ -7,13 +7,11 @@
- 'no ip access-list extended test' - 'no ip access-list extended test'
- 'no ip access-list standard test' - 'no ip access-list standard test'
match: none match: none
provider: "{{ cli }}"
- name: configure sub level command - name: configure sub level command
ios_config: ios_config:
lines: ['permit ip any any log'] lines: ['permit ip any any log']
parents: ['ip access-list extended test'] parents: ['ip access-list extended test']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -26,7 +24,6 @@
ios_config: ios_config:
lines: ['permit ip any any log'] lines: ['permit ip any any log']
parents: ['ip access-list extended test'] parents: ['ip access-list extended test']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -38,6 +35,5 @@
lines: lines:
- 'no ip access-list extended test' - 'no ip access-list extended test'
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}"

@ -10,7 +10,6 @@
parents: ['ip access-list extended test'] parents: ['ip access-list extended test']
before: ['no ip access-list extended test'] before: ['no ip access-list extended test']
after: ['exit'] after: ['exit']
provider: "{{ cli }}"
match: none match: none
- name: configure sub level command using block resplace - name: configure sub level command using block resplace
@ -23,7 +22,6 @@
parents: ['ip access-list extended test'] parents: ['ip access-list extended test']
replace: block replace: block
after: ['exit'] after: ['exit']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -45,7 +43,6 @@
parents: ['ip access-list extended test'] parents: ['ip access-list extended test']
replace: block replace: block
after: ['exit'] after: ['exit']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -57,6 +54,5 @@
lines: lines:
- no ip access-list extended test - no ip access-list extended test
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}"

@ -13,7 +13,6 @@
before: no ip access-list extended test before: no ip access-list extended test
after: exit after: exit
match: none match: none
provider: "{{ cli }}"
- name: configure sub level command using exact match - name: configure sub level command using exact match
ios_config: ios_config:
@ -26,7 +25,6 @@
before: no ip access-list extended test before: no ip access-list extended test
after: exit after: exit
match: exact match: exact
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -48,7 +46,6 @@
- permit ip host 4.4.4.4 any log - permit ip host 4.4.4.4 any log
parents: ip access-list extended test parents: ip access-list extended test
match: exact match: exact
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -60,6 +57,5 @@
lines: lines:
- no ip access-list extended test - no ip access-list extended test
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}"

@ -12,7 +12,6 @@
parents: ip access-list extended test parents: ip access-list extended test
before: no ip access-list extended test before: no ip access-list extended test
match: none match: none
provider: "{{ cli }}"
- name: configure sub level command using strict match - name: configure sub level command using strict match
ios_config: ios_config:
@ -23,7 +22,6 @@
- permit ip host 4.4.4.4 any log - permit ip host 4.4.4.4 any log
parents: ip access-list extended test parents: ip access-list extended test
match: strict match: strict
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -39,7 +37,6 @@
parents: ip access-list extended test parents: ip access-list extended test
after: exit after: exit
match: strict match: strict
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -56,6 +53,5 @@
ios_config: ios_config:
lines: no ip access-list extended test lines: no ip access-list extended test
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}"

@ -5,12 +5,10 @@
ios_config: ios_config:
lines: ['hostname {{ shorter_hostname }}'] lines: ['hostname {{ shorter_hostname }}']
match: none match: none
provider: "{{ cli }}"
- name: configure top level command - name: configure top level command
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -21,7 +19,6 @@
- name: configure top level command idempotent check - name: configure top level command idempotent check
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -32,6 +29,5 @@
ios_config: ios_config:
lines: ['hostname {{ shorter_hostname }}'] lines: ['hostname {{ shorter_hostname }}']
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}"

@ -7,13 +7,11 @@
- "snmp-server contact ansible" - "snmp-server contact ansible"
- "hostname {{ shorter_hostname }}" - "hostname {{ shorter_hostname }}"
match: none match: none
provider: "{{ cli }}"
- name: configure top level command with before - name: configure top level command with before
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
after: ['snmp-server contact bar'] after: ['snmp-server contact bar']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -26,7 +24,6 @@
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
after: ['snmp-server contact foo'] after: ['snmp-server contact foo']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -39,6 +36,5 @@
- "no snmp-server contact" - "no snmp-server contact"
- "hostname {{ shorter_hostname }}" - "hostname {{ shorter_hostname }}"
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}"

@ -7,13 +7,11 @@
- "snmp-server contact ansible" - "snmp-server contact ansible"
- "hostname {{ shorter_hostname }}" - "hostname {{ shorter_hostname }}"
match: none match: none
provider: "{{ cli }}"
- name: configure top level command with before - name: configure top level command with before
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
before: ['snmp-server contact bar'] before: ['snmp-server contact bar']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -26,7 +24,6 @@
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
before: ['snmp-server contact foo'] before: ['snmp-server contact foo']
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -39,6 +36,5 @@
- "no snmp-server contact" - "no snmp-server contact"
- "hostname {{ shorter_hostname }}" - "hostname {{ shorter_hostname }}"
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}"

@ -5,13 +5,11 @@
ios_config: ios_config:
lines: ['hostname {{ shorter_hostname }}'] lines: ['hostname {{ shorter_hostname }}']
match: none match: none
provider: "{{ cli }}"
- name: configure top level command - name: configure top level command
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
match: strict match: strict
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -23,7 +21,6 @@
ios_config: ios_config:
lines: ['hostname foo'] lines: ['hostname foo']
match: strict match: strict
provider: "{{ cli }}"
register: result register: result
- assert: - assert:
@ -34,6 +31,5 @@
ios_config: ios_config:
lines: ['hostname {{ shorter_hostname }}'] lines: ['hostname {{ shorter_hostname }}']
match: none match: none
provider: "{{ cli }}"
- debug: msg="END cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}" - debug: msg="END cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}"

@ -17,6 +17,6 @@
- name: run test case (connection=local) - name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local" include: "{{ test_case_to_run }} ansible_connection=local"
with_first_found: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run

@ -30,7 +30,7 @@
- name: Configure interface ipv4 address - name: Configure interface ipv4 address
ios_l3_interface: ios_l3_interface:
name: "{{ test_interface }}" name: "{{ test_interface }}"
ipv4: 192.168.0.1/24 ipv4: 192.168.20.1/24
state: present state: present
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -39,12 +39,12 @@
that: that:
- 'result.changed == true' - 'result.changed == true'
- '"interface {{ test_interface }}" in result.commands' - '"interface {{ test_interface }}" in result.commands'
- '"ip address 192.168.0.1 255.255.255.0" in result.commands' - '"ip address 192.168.20.1 255.255.255.0" in result.commands'
- name: test invalid subnet - name: test invalid subnet
ios_l3_interface: ios_l3_interface:
name: "{{ test_interface }}" name: "{{ test_interface }}"
ipv4: 192.168.0.1/45 ipv4: 192.168.20.1/45
state: present state: present
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result

Loading…
Cancel
Save