From 2f7f23c9ab55714e176de909d39c8036b565d1e2 Mon Sep 17 00:00:00 2001 From: David Newswanger Date: Thu, 17 Aug 2017 04:39:13 -0400 Subject: [PATCH] nxos: merge nxapi/cli tests - interface, interface_ospf, logging, mtu (#28239) * refactor nxos_interface * refactor nxos_interface_ospf * refactor nxos_logging * refactor nxos_mtu --- .../targets/nxos_interface/tasks/cli.yaml | 16 +++- .../targets/nxos_interface/tasks/nxapi.yaml | 16 +++- .../{cli => common}/set_state_absent.yaml | 10 +-- .../{cli => common}/set_state_present.yaml | 10 +-- .../tests/nxapi/set_state_absent.yaml | 32 ------- .../tests/nxapi/set_state_present.yaml | 33 ------- .../nxos_interface_ospf/tasks/cli.yaml | 16 +++- .../nxos_interface_ospf/tasks/nxapi.yaml | 16 +++- .../nxos_interface_ospf/tests/cli/sanity.yaml | 4 - .../tests/nxapi/sanity.yaml | 4 - .../targets/nxos_logging/tasks/cli.yaml | 16 +++- .../targets/nxos_logging/tasks/nxapi.yaml | 16 +++- .../tests/{cli => common}/basic.yaml | 14 +-- .../nxos_logging/tests/nxapi/basic.yaml | 90 ------------------- .../targets/nxos_mtu/tasks/cli.yaml | 16 +++- .../targets/nxos_mtu/tasks/nxapi.yaml | 16 +++- .../targets/nxos_mtu/tests/cli/set_mtu.yaml | 66 -------------- .../tests/{nxapi => common}/set_mtu.yaml | 16 ++-- .../tests/{cli => common}/set_sysmtu.yaml | 16 ++-- .../nxos_mtu/tests/nxapi/set_sysmtu.yaml | 58 ------------ 20 files changed, 137 insertions(+), 344 deletions(-) rename test/integration/targets/nxos_interface/tests/{cli => common}/set_state_absent.yaml (62%) rename test/integration/targets/nxos_interface/tests/{cli => common}/set_state_present.yaml (66%) delete mode 100644 test/integration/targets/nxos_interface/tests/nxapi/set_state_absent.yaml delete mode 100644 test/integration/targets/nxos_interface/tests/nxapi/set_state_present.yaml delete mode 100644 test/integration/targets/nxos_interface_ospf/tests/cli/sanity.yaml delete mode 100644 test/integration/targets/nxos_interface_ospf/tests/nxapi/sanity.yaml rename test/integration/targets/nxos_logging/tests/{cli => common}/basic.yaml (88%) delete mode 100644 test/integration/targets/nxos_logging/tests/nxapi/basic.yaml delete mode 100644 test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml rename test/integration/targets/nxos_mtu/tests/{nxapi => common}/set_mtu.yaml (74%) rename test/integration/targets/nxos_mtu/tests/{cli => common}/set_sysmtu.yaml (70%) delete mode 100644 test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml diff --git a/test/integration/targets/nxos_interface/tasks/cli.yaml b/test/integration/targets/nxos_interface/tasks/cli.yaml index d675462dd0..0ab3f8f908 100644 --- a/test/integration/targets/nxos_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_interface/tasks/cli.yaml @@ -1,15 +1,25 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + register: cli_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ cli_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ cli }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_interface/tasks/nxapi.yaml index ea525379f7..e071f293a2 100644 --- a/test/integration/targets/nxos_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_interface/tasks/nxapi.yaml @@ -1,9 +1,19 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + register: nxapi_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ nxapi_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" @@ -16,7 +26,7 @@ provider: "{{ cli }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_interface/tests/cli/set_state_absent.yaml b/test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml similarity index 62% rename from test/integration/targets/nxos_interface/tests/cli/set_state_absent.yaml rename to test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml index cf5f222c88..cdfba9d1e2 100644 --- a/test/integration/targets/nxos_interface/tests/cli/set_state_absent.yaml +++ b/test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml @@ -1,17 +1,17 @@ --- -- debug: msg="START cli/set_state_absent.yaml" +- debug: msg="START {{ connection.transport }}/set_state_absent.yaml" - name: setup nxos_config: lines: - interface Loopback1 - provider: "{{ cli }}" + provider: "{{ connection }}" - name: set state=absent nxos_interface: interface: Loopback1 state: absent - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -22,11 +22,11 @@ nxos_interface: interface: Loopback1 state: absent - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/set_state_absent.yaml" +- debug: msg="END {{ connection.transport }}/set_state_absent.yaml" diff --git a/test/integration/targets/nxos_interface/tests/cli/set_state_present.yaml b/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml similarity index 66% rename from test/integration/targets/nxos_interface/tests/cli/set_state_present.yaml rename to test/integration/targets/nxos_interface/tests/common/set_state_present.yaml index 3478ed50a4..d7a7f71477 100644 --- a/test/integration/targets/nxos_interface/tests/cli/set_state_present.yaml +++ b/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml @@ -1,18 +1,18 @@ --- -- debug: msg="START cli/set_state_present.yaml" +- debug: msg="START {{ connection.transport }}/set_state_present.yaml" - name: setup nxos_config: lines: - no interface Loopback1 - provider: "{{ cli }}" + provider: "{{ connection }}" ignore_errors: yes # Fails if the interface is already absent - name: set state=present nxos_interface: interface: Loopback1 state: present - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -23,11 +23,11 @@ nxos_interface: interface: Loopback1 state: present - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/set_state_present.yaml" +- debug: msg="END {{ connection.transport }}/set_state_present.yaml" diff --git a/test/integration/targets/nxos_interface/tests/nxapi/set_state_absent.yaml b/test/integration/targets/nxos_interface/tests/nxapi/set_state_absent.yaml deleted file mode 100644 index 01c5a243af..0000000000 --- a/test/integration/targets/nxos_interface/tests/nxapi/set_state_absent.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START nxapi/set_state_absent.yaml" - -- name: setup - nxos_config: - lines: - - interface Loopback1 - provider: "{{ nxapi }}" - -- name: set state=absent - nxos_interface: - interface: Loopback1 - state: absent - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify state=absent - nxos_interface: - interface: Loopback1 - state: absent - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - -- debug: msg="END nxapi/set_state_absent.yaml" diff --git a/test/integration/targets/nxos_interface/tests/nxapi/set_state_present.yaml b/test/integration/targets/nxos_interface/tests/nxapi/set_state_present.yaml deleted file mode 100644 index 82d6afd76c..0000000000 --- a/test/integration/targets/nxos_interface/tests/nxapi/set_state_present.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- debug: msg="START nxapi/set_state_present.yaml" - -- name: setup - nxos_config: - lines: - - no interface Loopback1 - provider: "{{ nxapi }}" - ignore_errors: yes # Fails if the interface is already absent - -- name: set state=present - nxos_interface: - interface: Loopback1 - state: present - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify state=present - nxos_interface: - interface: Loopback1 - state: present - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - -- debug: msg="END nxapi/set_state_present.yaml" diff --git a/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml b/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml index d675462dd0..0ab3f8f908 100644 --- a/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml +++ b/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml @@ -1,15 +1,25 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + register: cli_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ cli_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ cli }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml b/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml index ea525379f7..e071f293a2 100644 --- a/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml @@ -1,9 +1,19 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + register: nxapi_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ nxapi_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" @@ -16,7 +26,7 @@ provider: "{{ cli }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_interface_ospf/tests/cli/sanity.yaml b/test/integration/targets/nxos_interface_ospf/tests/cli/sanity.yaml deleted file mode 100644 index 420af7420e..0000000000 --- a/test/integration/targets/nxos_interface_ospf/tests/cli/sanity.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- set_fact: connection="{{ cli }}" - -- import_tasks: "{{ role_path }}/tests/common/sanity.yaml" diff --git a/test/integration/targets/nxos_interface_ospf/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_interface_ospf/tests/nxapi/sanity.yaml deleted file mode 100644 index e30ea6eaf7..0000000000 --- a/test/integration/targets/nxos_interface_ospf/tests/nxapi/sanity.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- set_fact: connection="{{ nxapi }}" - -- import_tasks: "{{ role_path }}/tests/common/sanity.yaml" diff --git a/test/integration/targets/nxos_logging/tasks/cli.yaml b/test/integration/targets/nxos_logging/tasks/cli.yaml index d675462dd0..0ab3f8f908 100644 --- a/test/integration/targets/nxos_logging/tasks/cli.yaml +++ b/test/integration/targets/nxos_logging/tasks/cli.yaml @@ -1,15 +1,25 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + register: cli_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ cli_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ cli }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_logging/tasks/nxapi.yaml b/test/integration/targets/nxos_logging/tasks/nxapi.yaml index ea525379f7..e071f293a2 100644 --- a/test/integration/targets/nxos_logging/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_logging/tasks/nxapi.yaml @@ -1,9 +1,19 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + register: nxapi_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ nxapi_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" @@ -16,7 +26,7 @@ provider: "{{ cli }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_logging/tests/cli/basic.yaml b/test/integration/targets/nxos_logging/tests/common/basic.yaml similarity index 88% rename from test/integration/targets/nxos_logging/tests/cli/basic.yaml rename to test/integration/targets/nxos_logging/tests/common/basic.yaml index 93f133fef5..3556f7251f 100644 --- a/test/integration/targets/nxos_logging/tests/cli/basic.yaml +++ b/test/integration/targets/nxos_logging/tests/common/basic.yaml @@ -4,7 +4,7 @@ dest: console dest_level: 0 state: present - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -17,7 +17,7 @@ dest: console dest_level: 0 state: present - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -29,7 +29,7 @@ dest: console dest_level: 0 state: absent - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -42,7 +42,7 @@ dest: console dest_level: 0 state: absent - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -55,7 +55,7 @@ name: test dest_level: 0 state: present - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -67,7 +67,7 @@ nxos_logging: facility: daemon facility_level: 0 - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -80,7 +80,7 @@ aggregate: - { dest: logfile, name: test, dest_level: 0, state: absent } - { facility: daemon, facility_level: 0, state: absent } - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_logging/tests/nxapi/basic.yaml b/test/integration/targets/nxos_logging/tests/nxapi/basic.yaml deleted file mode 100644 index 7631f8e405..0000000000 --- a/test/integration/targets/nxos_logging/tests/nxapi/basic.yaml +++ /dev/null @@ -1,90 +0,0 @@ ---- -- name: Set up console logging - nxos_logging: - dest: console - dest_level: 0 - state: present - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging console 0" in result.commands' - -- name: Set up console logging again (idempotent) - nxos_logging: - dest: console - dest_level: 0 - state: present - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Delete/disable console logging - nxos_logging: - dest: console - dest_level: 0 - state: absent - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging console" in result.commands' - -- name: Delete/disable console logging (idempotent) - nxos_logging: - dest: console - dest_level: 0 - state: absent - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Logfile logging with level - nxos_logging: - dest: logfile - name: test - dest_level: 0 - state: present - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging logfile test 0" in result.commands' - -- name: Configure facility with level - nxos_logging: - facility: daemon - facility_level: 0 - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging level daemon 0" in result.commands' - -- name: remove logging as collection tearDown - nxos_logging: - aggregate: - - { dest: logfile, name: test, dest_level: 0, state: absent } - - { facility: daemon, facility_level: 0, state: absent } - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging logfile" in result.commands' - - '"no logging level daemon" in result.commands' diff --git a/test/integration/targets/nxos_mtu/tasks/cli.yaml b/test/integration/targets/nxos_mtu/tasks/cli.yaml index d675462dd0..0ab3f8f908 100644 --- a/test/integration/targets/nxos_mtu/tasks/cli.yaml +++ b/test/integration/targets/nxos_mtu/tasks/cli.yaml @@ -1,15 +1,25 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + register: cli_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ cli_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ cli }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_mtu/tasks/nxapi.yaml b/test/integration/targets/nxos_mtu/tasks/nxapi.yaml index ea525379f7..e071f293a2 100644 --- a/test/integration/targets/nxos_mtu/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_mtu/tasks/nxapi.yaml @@ -1,9 +1,19 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + register: nxapi_cases + +- set_fact: + test_cases: + files: "{{ test_cases.files }} + {{ nxapi_cases.files }}" - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" @@ -16,7 +26,7 @@ provider: "{{ cli }}" - name: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml b/test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml deleted file mode 100644 index 5070617a32..0000000000 --- a/test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- debug: msg="START cli/set_mtu.yaml" - -- name: setup - nxos_config: - lines: - - no switchport - - no mtu - parents: interface Ethernet3/1 - match: none - provider: "{{ cli }}" - -- name: configure interface mtu - nxos_mtu: - interface: Ethernet3/1 - mtu: 2000 - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify interface mtu - nxos_mtu: - interface: Ethernet3/1 - mtu: 2000 - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: configure invalid (odd) interface mtu - nxos_mtu: - interface: Ethernet3/1 - mtu: 2001 - provider: "{{ cli }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: configure invalid (large) mtu setting - nxos_mtu: - interface: Ethernet3/1 - mtu: 100000 - provider: "{{ cli }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: teardown - nxos_config: - lines: no mtu - parents: interface Ethernet3/1 - match: none - provider: "{{ cli }}" - -- debug: msg="END cli/set_mtu.yaml" diff --git a/test/integration/targets/nxos_mtu/tests/nxapi/set_mtu.yaml b/test/integration/targets/nxos_mtu/tests/common/set_mtu.yaml similarity index 74% rename from test/integration/targets/nxos_mtu/tests/nxapi/set_mtu.yaml rename to test/integration/targets/nxos_mtu/tests/common/set_mtu.yaml index 2f9eec3352..4f60043917 100644 --- a/test/integration/targets/nxos_mtu/tests/nxapi/set_mtu.yaml +++ b/test/integration/targets/nxos_mtu/tests/common/set_mtu.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START nxapi/set_mtu.yaml" +- debug: msg="START {{ connection.transport }}/set_mtu.yaml" - name: setup nxos_config: @@ -8,13 +8,13 @@ - no mtu parents: interface Ethernet3/1 match: none - provider: "{{ nxapi }}" + provider: "{{ connection }}" - name: configure interface mtu nxos_mtu: interface: Ethernet3/1 mtu: 2000 - provider: "{{ nxapi }}" + provider: "{{ connection }}" register: result - assert: @@ -25,7 +25,7 @@ nxos_mtu: interface: Ethernet3/1 mtu: 2000 - provider: "{{ nxapi }}" + provider: "{{ connection }}" register: result - assert: @@ -36,7 +36,7 @@ nxos_mtu: interface: Ethernet3/1 mtu: 2001 - provider: "{{ nxapi }}" + provider: "{{ connection }}" register: result ignore_errors: yes @@ -48,7 +48,7 @@ nxos_mtu: interface: Ethernet3/1 mtu: 100000 - provider: "{{ nxapi }}" + provider: "{{ connection }}" register: result ignore_errors: yes @@ -61,6 +61,6 @@ lines: no mtu parents: interface Ethernet3/1 match: none - provider: "{{ nxapi }}" + provider: "{{ connection }}" -- debug: msg="END nxapi/set_mtu.yaml" +- debug: msg="END {{ connection.transport }}/set_mtu.yaml" diff --git a/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml b/test/integration/targets/nxos_mtu/tests/common/set_sysmtu.yaml similarity index 70% rename from test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml rename to test/integration/targets/nxos_mtu/tests/common/set_sysmtu.yaml index cadfdac0cc..2788106b37 100644 --- a/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml +++ b/test/integration/targets/nxos_mtu/tests/common/set_sysmtu.yaml @@ -1,16 +1,16 @@ --- -- debug: msg="START cli/sysmtu.yaml" +- debug: msg="START {{ connection.transport }}/sysmtu.yaml" - name: setup nxos_config: lines: no system jumbomtu match: none - provider: "{{ cli }}" + provider: "{{ connection }}" - name: configure system mtu nxos_mtu: sysmtu: 2000 - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -20,7 +20,7 @@ - name: verify system mtu nxos_mtu: sysmtu: 2000 - provider: "{{ cli }}" + provider: "{{ connection }}" register: result - assert: @@ -30,7 +30,7 @@ - name: configure invalid (odd) system mtu nxos_mtu: sysmtu: 2001 - provider: "{{ cli }}" + provider: "{{ connection }}" register: result ignore_errors: yes @@ -41,7 +41,7 @@ - name: configure invalid (large) system mtu setting nxos_mtu: sysmtu: 10000 - provider: "{{ cli }}" + provider: "{{ connection }}" register: result ignore_errors: yes @@ -53,6 +53,6 @@ nxos_config: lines: no system jumbomtu match: none - provider: "{{ cli }}" + provider: "{{ connection }}" -- debug: msg="END cli/sysmtu.yaml" +- debug: msg="END {{ connection.transport }}/sysmtu.yaml" diff --git a/test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml b/test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml deleted file mode 100644 index 1b85899c91..0000000000 --- a/test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- debug: msg="START nxapi/sysmtu.yaml" - -- name: setup - nxos_config: - lines: no system jumbomtu - match: none - provider: "{{ nxapi }}" - -- name: configure system mtu - nxos_mtu: - sysmtu: 2000 - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify system mtu - nxos_mtu: - sysmtu: 2000 - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: configure invalid (odd) system mtu - nxos_mtu: - sysmtu: 2001 - provider: "{{ nxapi }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: configure invalid (large) system mtu setting - nxos_mtu: - sysmtu: 10000 - provider: "{{ nxapi }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: teardown - nxos_config: - lines: no system jumbomtu - match: none - provider: "{{ nxapi }}" - -- debug: msg="END nxapi/sysmtu.yaml"