iosxr tests: Initial work for 2.3 (#20883)

Ensure a loopback device exists for testing
Remove provider:
Default is to run task on Network, device, use delegate_to: localhost for local tasks.
This commit is contained in:
John R Barker 2017-01-31 19:10:14 +00:00 committed by GitHub
parent e6f92bc3a9
commit 553b6151ad
38 changed files with 30 additions and 70 deletions

View file

@ -0,0 +1,2 @@
dependencies:
- prepare_iosxr_tests

View file

@ -4,6 +4,7 @@
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
delegate_to: localhost
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"

View file

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

View file

@ -9,13 +9,11 @@
parents:
- interface Loopback999
match: none
provider: "{{ cli }}"
# Defend against https://github.com/ansible/ansible-modules-core/issues/5146
- name: Commit message too long
iosxr_config:
src: basic/config.j2
provider: "{{ cli }}"
comment: "this is a really long message aaaaabbbbbbcdde end-of-message"
register: result
ignore_errors: true

View file

@ -9,12 +9,10 @@
parents:
- interface Loopback999
match: none
provider: "{{ cli }}"
- name: configure device with comment
iosxr_config:
src: basic/config.j2
provider: "{{ cli }}"
comment: "this is sensible commit message"
register: result
@ -26,7 +24,6 @@
- name: check device with config
iosxr_config:
src: basic/config.j2
provider: "{{ cli }}"
register: result
- assert:

View file

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

View file

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

View file

@ -9,12 +9,10 @@
parents:
- interface Loopback999
match: none
provider: "{{ cli }}"
- name: configure device with config
iosxr_config:
src: basic/config.j2
provider: "{{ cli }}"
match: none
register: result
@ -27,7 +25,6 @@
- name: check device with config
iosxr_config:
src: basic/config.j2
provider: "{{ cli }}"
register: result
- assert:

View file

@ -4,7 +4,6 @@
- name: setup
iosxr_config:
commands: ['no ipv4 access-list test']
provider: "{{ cli }}"
match: none
ignore_errors: yes
@ -12,7 +11,6 @@
iosxr_config:
commands: ['10 permit ipv4 any any log']
parents: ['ipv4 access-list test']
provider: "{{ cli }}"
register: result
- assert:
@ -25,7 +23,6 @@
iosxr_config:
commands: ['10 permit ipv4 any any log']
parents: ['ipv4 access-list test']
provider: "{{ cli }}"
register: result
- assert:
@ -35,7 +32,6 @@
- name: teardown
iosxr_config:
commands: ['no ipv4 access-list test']
provider: "{{ cli }}"
match: none
- debug: msg="END cli/sublevel.yaml"

View file

@ -10,7 +10,6 @@
parents: ['ipv4 access-list test']
before: ['no ipv4 access-list test']
after: ['exit']
provider: "{{ cli }}"
match: none
- name: configure sub level command using block resplace
@ -23,7 +22,6 @@
parents: ['ipv4 access-list test']
replace: block
after: ['exit']
provider: "{{ cli }}"
register: result
- assert:
@ -45,7 +43,6 @@
parents: ['ipv4 access-list test']
replace: block
after: ['exit']
provider: "{{ cli }}"
register: result
- assert:
@ -55,7 +52,6 @@
- name: teardown
iosxr_config:
commands: ['no ipv4 access-list test']
provider: "{{ cli }}"
match: none
- debug: msg="END cli/sublevel_block.yaml"

View file

@ -13,7 +13,6 @@
before: ['no ipv4 access-list test']
after: ['exit']
match: none
provider: "{{ cli }}"
- name: configure sub level command using exact match
iosxr_config:
@ -25,7 +24,6 @@
parents: ['ipv4 access-list test']
after: ['exit']
match: exact
provider: "{{ cli }}"
register: result
- assert:
@ -49,7 +47,6 @@
parents: ['ipv4 access-list test']
after: ['exit']
match: exact
provider: "{{ cli }}"
register: result
- assert:
@ -59,7 +56,6 @@
- name: teardown
iosxr_config:
commands: ['no ipv4 access-list test']
provider: "{{ cli }}"
match: none
- debug: msg="END cli/sublevel_exact.yaml"

View file

@ -13,7 +13,6 @@
before: ['no ipv4 access-list test']
after: ['exit']
match: none
provider: "{{ cli }}"
- name: configure sub level command using strict match
iosxr_config:
@ -27,7 +26,6 @@
after: ['exit']
match: strict
replace: block
provider: "{{ cli }}"
register: result
- assert:
@ -50,7 +48,6 @@
parents: ['ipv4 access-list test']
after: ['exit']
match: strict
provider: "{{ cli }}"
register: result
- assert:
@ -61,6 +58,5 @@
iosxr_config:
commands: ['no ipv4 access-list test']
match: none
provider: "{{ cli }}"
- debug: msg="END cli/sublevel_strict.yaml"

View file

@ -4,13 +4,11 @@
- name: setup
iosxr_config:
commands: ['hostname {{ inventory_hostname_short }}']
provider: "{{ cli }}"
match: none
- name: configure top level command
iosxr_config:
commands: ['hostname foo']
provider: "{{ cli }}"
register: result
- assert:
@ -21,7 +19,6 @@
- name: configure top level command idempotent check
iosxr_config:
commands: ['hostname foo']
provider: "{{ cli }}"
register: result
- assert:
@ -31,7 +28,6 @@
- name: teardown
iosxr_config:
commands: ['hostname {{ inventory_hostname_short }}']
provider: "{{ cli }}"
match: none
- debug: msg="END cli/toplevel.yaml"

View file

@ -6,14 +6,12 @@
commands:
- "no cdp"
- "hostname {{ inventory_hostname_short }}"
provider: "{{ cli }}"
match: none
- name: configure top level command with before
iosxr_config:
commands: ['hostname foo']
after: ['cdp']
provider: "{{ cli }}"
register: result
- assert:
@ -26,7 +24,6 @@
iosxr_config:
commands: ['hostname foo']
after: ['no cdp']
provider: "{{ cli }}"
register: result
- assert:
@ -38,7 +35,6 @@
commands:
- "no cdp"
- "hostname {{ inventory_hostname_short }}"
provider: "{{ cli }}"
match: none
- debug: msg="END cli/toplevel_after.yaml"

View file

@ -6,14 +6,12 @@
commands:
- "no cdp"
- "hostname {{ inventory_hostname_short }}"
provider: "{{ cli }}"
match: none
- name: configure top level command with before
iosxr_config:
commands: ['hostname foo']
before: ['cdp']
provider: "{{ cli }}"
register: result
- assert:
@ -26,7 +24,6 @@
iosxr_config:
commands: ['hostname foo']
before: ['cdp']
provider: "{{ cli }}"
register: result
- assert:
@ -38,7 +35,6 @@
commands:
- "no cdp"
- "hostname {{ inventory_hostname_short }}"
provider: "{{ cli }}"
match: none
- debug: msg="END cli/toplevel_before.yaml"

View file

@ -4,13 +4,11 @@
- name: setup
iosxr_config:
commands: ['hostname {{ inventory_hostname_short }}']
provider: "{{ cli }}"
match: none
- name: configure top level command
iosxr_config:
commands: ['hostname foo']
provider: "{{ cli }}"
match: strict
register: result
@ -22,7 +20,6 @@
- name: configure top level command idempotent check
iosxr_config:
commands: ['hostname foo']
provider: "{{ cli }}"
match: strict
register: result
@ -33,7 +30,6 @@
- name: teardown
iosxr_config:
commands: ['hostname {{ inventory_hostname_short }}']
provider: "{{ cli }}"
match: none
- debug: msg="END cli/toplevel_nonidempotent.yaml"