From 553b6151ad93fe806c29a970e923e090fe71ff64 Mon Sep 17 00:00:00 2001 From: John R Barker Date: Tue, 31 Jan 2017 19:10:14 +0000 Subject: [PATCH] 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. --- test/integration/iosxr.yaml | 1 - test/integration/targets/ios_facts/meta/main.yml | 2 ++ test/integration/targets/iosxr_command/meta/main.yml | 2 ++ .../integration/targets/iosxr_command/tasks/cli.yaml | 1 + .../iosxr_command/tests/cli/bad_operator.yaml | 1 - .../targets/iosxr_command/tests/cli/contains.yaml | 1 - .../targets/iosxr_command/tests/cli/invalid.yaml | 2 -- .../targets/iosxr_command/tests/cli/output.yaml | 2 -- .../targets/iosxr_command/tests/cli/timeout.yaml | 1 - test/integration/targets/iosxr_config/meta/main.yml | 2 ++ test/integration/targets/iosxr_config/tasks/cli.yaml | 1 + .../targets/iosxr_config/tests/cli/backup.yaml | 2 -- .../iosxr_config/tests/cli/comment-too-long.yaml | 2 -- .../targets/iosxr_config/tests/cli/comment.yaml | 3 --- .../targets/iosxr_config/tests/cli/src_basic.yaml | 3 --- .../targets/iosxr_config/tests/cli/src_invalid.yaml | 1 - .../iosxr_config/tests/cli/src_match_none.yaml | 3 --- .../targets/iosxr_config/tests/cli/sublevel.yaml | 4 ---- .../iosxr_config/tests/cli/sublevel_block.yaml | 4 ---- .../iosxr_config/tests/cli/sublevel_exact.yaml | 4 ---- .../iosxr_config/tests/cli/sublevel_strict.yaml | 4 ---- .../targets/iosxr_config/tests/cli/toplevel.yaml | 4 ---- .../iosxr_config/tests/cli/toplevel_after.yaml | 4 ---- .../iosxr_config/tests/cli/toplevel_before.yaml | 4 ---- .../tests/cli/toplevel_nonidempotent.yaml | 4 ---- test/integration/targets/iosxr_facts/meta/main.yml | 2 ++ test/integration/targets/iosxr_facts/tasks/cli.yaml | 1 + .../targets/iosxr_facts/tests/cli/all_facts.yaml | 1 - .../targets/iosxr_facts/tests/cli/default_facts.yaml | 1 - .../iosxr_facts/tests/cli/invalid_subset.yaml | 2 -- .../targets/iosxr_facts/tests/cli/not_hardware.yaml | 1 - .../integration/targets/iosxr_template/meta/main.yml | 2 ++ .../targets/iosxr_template/tasks/cli.yaml | 1 + .../targets/iosxr_template/tests/cli/backup.yaml | 3 --- .../targets/iosxr_template/tests/cli/basic.yaml | 4 ---- .../targets/iosxr_template/tests/cli/force.yaml | 4 ---- .../targets/prepare_iosxr_tests/tasks/main.yml | 12 ++++++++++++ .../targets/prepare_iosxr_tests/templates/config.j2 | 4 ++++ 38 files changed, 30 insertions(+), 70 deletions(-) create mode 100644 test/integration/targets/ios_facts/meta/main.yml create mode 100644 test/integration/targets/iosxr_command/meta/main.yml create mode 100644 test/integration/targets/iosxr_config/meta/main.yml create mode 100644 test/integration/targets/iosxr_facts/meta/main.yml create mode 100644 test/integration/targets/iosxr_template/meta/main.yml create mode 100644 test/integration/targets/prepare_iosxr_tests/tasks/main.yml create mode 100644 test/integration/targets/prepare_iosxr_tests/templates/config.j2 diff --git a/test/integration/iosxr.yaml b/test/integration/iosxr.yaml index 117d3aec30..46ead03b7f 100644 --- a/test/integration/iosxr.yaml +++ b/test/integration/iosxr.yaml @@ -1,7 +1,6 @@ --- - hosts: iosxr gather_facts: no - connection: local vars: limit_to: "*" diff --git a/test/integration/targets/ios_facts/meta/main.yml b/test/integration/targets/ios_facts/meta/main.yml new file mode 100644 index 0000000000..159cea8d38 --- /dev/null +++ b/test/integration/targets/ios_facts/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_ios_tests diff --git a/test/integration/targets/iosxr_command/meta/main.yml b/test/integration/targets/iosxr_command/meta/main.yml new file mode 100644 index 0000000000..d4da833dd5 --- /dev/null +++ b/test/integration/targets/iosxr_command/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_command/tasks/cli.yaml b/test/integration/targets/iosxr_command/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/iosxr_command/tasks/cli.yaml +++ b/test/integration/targets/iosxr_command/tasks/cli.yaml @@ -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 }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml b/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml index cc345ddcb6..84aa658796 100644 --- a/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml +++ b/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml @@ -8,7 +8,6 @@ - show interfaces GigabitEthernet 0/0 wait_for: - "result[0] contains 'Description: Foo'" - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/iosxr_command/tests/cli/contains.yaml b/test/integration/targets/iosxr_command/tests/cli/contains.yaml index 5491cc19c3..7fe8014dc3 100644 --- a/test/integration/targets/iosxr_command/tests/cli/contains.yaml +++ b/test/integration/targets/iosxr_command/tests/cli/contains.yaml @@ -9,7 +9,6 @@ wait_for: - "result[0] contains 6.0.0" - "result[1] contains GigabitEthernet0/0/0/1" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/iosxr_command/tests/cli/invalid.yaml b/test/integration/targets/iosxr_command/tests/cli/invalid.yaml index ce18444a93..9b88f566c2 100644 --- a/test/integration/targets/iosxr_command/tests/cli/invalid.yaml +++ b/test/integration/targets/iosxr_command/tests/cli/invalid.yaml @@ -4,7 +4,6 @@ - name: run invalid command iosxr_command: commands: ['show foo'] - provider: "{{ cli }}" register: result ignore_errors: yes @@ -17,7 +16,6 @@ commands: - show version - show foo - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/iosxr_command/tests/cli/output.yaml b/test/integration/targets/iosxr_command/tests/cli/output.yaml index 36ee04981a..5c803e7fad 100644 --- a/test/integration/targets/iosxr_command/tests/cli/output.yaml +++ b/test/integration/targets/iosxr_command/tests/cli/output.yaml @@ -4,7 +4,6 @@ - name: get output for single command iosxr_command: commands: ['show version'] - provider: "{{ cli }}" register: result - assert: @@ -17,7 +16,6 @@ commands: - show version - show interfaces - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/iosxr_command/tests/cli/timeout.yaml b/test/integration/targets/iosxr_command/tests/cli/timeout.yaml index ef787b077c..00533d785e 100644 --- a/test/integration/targets/iosxr_command/tests/cli/timeout.yaml +++ b/test/integration/targets/iosxr_command/tests/cli/timeout.yaml @@ -7,7 +7,6 @@ - show version wait_for: - "result[0] contains bad_value_string" - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/iosxr_config/meta/main.yml b/test/integration/targets/iosxr_config/meta/main.yml new file mode 100644 index 0000000000..d4da833dd5 --- /dev/null +++ b/test/integration/targets/iosxr_config/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_config/tasks/cli.yaml b/test/integration/targets/iosxr_config/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/iosxr_config/tasks/cli.yaml +++ b/test/integration/targets/iosxr_config/tasks/cli.yaml @@ -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 }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/backup.yaml b/test/integration/targets/iosxr_config/tests/cli/backup.yaml index 9bb43556fa..4c9056b83a 100644 --- a/test/integration/targets/iosxr_config/tests/cli/backup.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/backup.yaml @@ -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: diff --git a/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml b/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml index 97b79cdf82..ebf44f464f 100644 --- a/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml @@ -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 diff --git a/test/integration/targets/iosxr_config/tests/cli/comment.yaml b/test/integration/targets/iosxr_config/tests/cli/comment.yaml index cd43e9cd7c..e6dc9f0037 100644 --- a/test/integration/targets/iosxr_config/tests/cli/comment.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/comment.yaml @@ -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: diff --git a/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml b/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml index 4d86af8b24..cb5f666826 100644 --- a/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml @@ -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: diff --git a/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml b/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml index c5bb287724..362f22586a 100644 --- a/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml @@ -6,7 +6,6 @@ - name: configure with invalid src iosxr_config: src: basic/foobar.j2 - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml b/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml index 1340c6a83f..fd817aa988 100644 --- a/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml @@ -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: diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml index c292e9e536..47416b32e4 100644 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml index 0e49ed9ee2..cbac65dc2e 100644 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml index 5b3db3f0da..2fa24a8ae8 100644 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml index 2ce0bc7c9d..3ec2650188 100644 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml index 078e99263e..a2e4c24612 100644 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml index 874bbfa751..a4bedb7754 100644 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml index 9915201634..7fe40a9581 100644 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml @@ -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" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml index b72bf0cf88..efda155d96 100644 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml +++ b/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml @@ -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" diff --git a/test/integration/targets/iosxr_facts/meta/main.yml b/test/integration/targets/iosxr_facts/meta/main.yml new file mode 100644 index 0000000000..d4da833dd5 --- /dev/null +++ b/test/integration/targets/iosxr_facts/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_facts/tasks/cli.yaml b/test/integration/targets/iosxr_facts/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/iosxr_facts/tasks/cli.yaml +++ b/test/integration/targets/iosxr_facts/tasks/cli.yaml @@ -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 }}" diff --git a/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml b/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml index 7fe30225d3..806657e7e2 100644 --- a/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml +++ b/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml @@ -4,7 +4,6 @@ - name: test getting all facts iosxr_facts: - provider: "{{ cli }}" gather_subset: - all register: result diff --git a/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml b/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml index ebf9aa2652..118637cfff 100644 --- a/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml +++ b/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml @@ -4,7 +4,6 @@ - name: test getting default facts iosxr_facts: - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml b/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml index 1c2d28ca27..1fd902e55e 100644 --- a/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml +++ b/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml @@ -4,7 +4,6 @@ - name: test invalid subset (foobar) iosxr_facts: - provider: "{{ cli }}" gather_subset: - "foobar" register: result @@ -26,7 +25,6 @@ - name: test subset specified multiple times iosxr_facts: - provider: "{{ cli }}" gather_subset: - "!hardware" - "hardware" diff --git a/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml b/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml index 626d4e832b..1019c22dd3 100644 --- a/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml +++ b/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml @@ -4,7 +4,6 @@ - name: test not hardware iosxr_facts: - provider: "{{ cli }}" gather_subset: - "!hardware" register: result diff --git a/test/integration/targets/iosxr_template/meta/main.yml b/test/integration/targets/iosxr_template/meta/main.yml new file mode 100644 index 0000000000..d4da833dd5 --- /dev/null +++ b/test/integration/targets/iosxr_template/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_template/tasks/cli.yaml b/test/integration/targets/iosxr_template/tasks/cli.yaml index d675462dd0..46d86dd698 100644 --- a/test/integration/targets/iosxr_template/tasks/cli.yaml +++ b/test/integration/targets/iosxr_template/tasks/cli.yaml @@ -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 }}" diff --git a/test/integration/targets/iosxr_template/tests/cli/backup.yaml b/test/integration/targets/iosxr_template/tests/cli/backup.yaml index 38a8034e70..370d321e6a 100644 --- a/test/integration/targets/iosxr_template/tests/cli/backup.yaml +++ b/test/integration/targets/iosxr_template/tests/cli/backup.yaml @@ -6,7 +6,6 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" ignore_errors: yes - name: collect any backup files @@ -26,7 +25,6 @@ iosxr_template: src: basic/config.j2 backup: yes - provider: "{{ cli }}" register: result - assert: @@ -50,6 +48,5 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/backup.yaml" diff --git a/test/integration/targets/iosxr_template/tests/cli/basic.yaml b/test/integration/targets/iosxr_template/tests/cli/basic.yaml index 6e3ac11fec..1591685de7 100644 --- a/test/integration/targets/iosxr_template/tests/cli/basic.yaml +++ b/test/integration/targets/iosxr_template/tests/cli/basic.yaml @@ -6,12 +6,10 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - name: configure device with config iosxr_template: src: basic/config.j2 - provider: "{{ cli }}" register: result - assert: @@ -22,7 +20,6 @@ - name: check device with config iosxr_template: src: basic/config.j2 - provider: "{{ cli }}" register: result - assert: @@ -35,6 +32,5 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/basic.yaml" diff --git a/test/integration/targets/iosxr_template/tests/cli/force.yaml b/test/integration/targets/iosxr_template/tests/cli/force.yaml index ccd373471e..b4184213b8 100644 --- a/test/integration/targets/iosxr_template/tests/cli/force.yaml +++ b/test/integration/targets/iosxr_template/tests/cli/force.yaml @@ -6,12 +6,10 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - name: configure device with config iosxr_template: src: basic/config.j2 - provider: "{{ cli }}" force: yes register: result @@ -23,7 +21,6 @@ - name: check device with config iosxr_template: src: basic/config.j2 - provider: "{{ cli }}" force: yes register: result @@ -37,6 +34,5 @@ commands: - no interface Loopback999 match: none - provider: "{{ cli }}" - debug: msg="END cli/force.yaml" diff --git a/test/integration/targets/prepare_iosxr_tests/tasks/main.yml b/test/integration/targets/prepare_iosxr_tests/tasks/main.yml new file mode 100644 index 0000000000..f741b0947e --- /dev/null +++ b/test/integration/targets/prepare_iosxr_tests/tasks/main.yml @@ -0,0 +1,12 @@ +--- + +- name: Ensure we have loopback 888 for testing + iosxr_config: + src: config.j2 + + +# Some AWS hostnames can be longer than those allowed by the system we are testing +# Truncate the hostname +# http://jinja.pocoo.org/docs/2.9/templates/#truncate +- set_fact: + shorter_hostname: '{{ inventory_hostname_short| truncate(10, True, "") }}' diff --git a/test/integration/targets/prepare_iosxr_tests/templates/config.j2 b/test/integration/targets/prepare_iosxr_tests/templates/config.j2 new file mode 100644 index 0000000000..c8eb3457f9 --- /dev/null +++ b/test/integration/targets/prepare_iosxr_tests/templates/config.j2 @@ -0,0 +1,4 @@ +interface Loopback888 + description test for ansible + shutdown +