From c371ed8d30423916d6349ad906cc8f53ed88081f Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Fri, 5 Jan 2018 12:39:04 -0500 Subject: [PATCH] nxos tests to use network_cli (#34474) * Fix over-byte * Fix nxos_l2_interface docs * Update connections for tasks * Add default ssh port * Only report provider when using connection=local * Send empty provider when connection=network_cli * Fix find tasks --- .../modules/network/nxos/nxos_l2_interface.py | 4 +-- lib/ansible/plugins/cliconf/nxos.py | 8 ++--- .../targets/nxos_aaa_server/tasks/cli.yaml | 12 +++++-- .../targets/nxos_aaa_server/tasks/nxapi.yaml | 19 +++-------- .../nxos_aaa_server/tests/common/radius.yaml | 8 +++-- .../nxos_aaa_server/tests/common/tacacs.yaml | 8 +++-- .../nxos_aaa_server_host/tasks/cli.yaml | 12 +++++-- .../nxos_aaa_server_host/tasks/nxapi.yaml | 19 +++-------- .../tests/common/radius.yaml | 8 +++-- .../tests/common/tacacs.yaml | 8 +++-- .../targets/nxos_acl/tasks/cli.yaml | 12 +++++-- .../targets/nxos_acl/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_acl/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_acl_interface/tasks/cli.yaml | 12 +++++-- .../nxos_acl_interface/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_banner/tasks/cli.yaml | 12 +++++-- .../targets/nxos_banner/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_bgp/tasks/cli.yaml | 12 +++++-- .../targets/nxos_bgp/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_bgp/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_bgp_af/tasks/cli.yaml | 12 +++++-- .../targets/nxos_bgp_af/tasks/nxapi.yaml | 6 ++-- .../nxos_bgp_af/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_bgp_neighbor/tasks/cli.yaml | 12 +++++-- .../nxos_bgp_neighbor/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../nxos_bgp_neighbor_af/tasks/cli.yaml | 12 +++++-- .../nxos_bgp_neighbor_af/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_command/tasks/cli.yaml | 12 +++++-- .../targets/nxos_command/tasks/nxapi.yaml | 6 ++-- .../nxos_command/tests/cli/sanity.yaml | 2 ++ .../nxos_command/tests/nxapi/sanity.yaml | 2 ++ .../targets/nxos_config/tasks/cli.yaml | 12 +++++-- .../targets/nxos_config/tasks/nxapi.yaml | 6 ++-- .../nxos_config/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_evpn_global/tasks/cli.yaml | 12 +++++-- .../targets/nxos_evpn_global/tasks/nxapi.yaml | 6 ++-- .../nxos_evpn_global/tests/common/sanity.yaml | 8 +++-- .../targets/nxos_evpn_vni/tasks/cli.yaml | 12 +++++-- .../targets/nxos_evpn_vni/tasks/nxapi.yaml | 6 ++-- .../nxos_evpn_vni/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_facts/tasks/cli.yaml | 12 +++++-- .../targets/nxos_facts/tasks/nxapi.yaml | 6 ++-- .../nxos_facts/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_feature/tasks/cli.yaml | 12 +++++-- .../targets/nxos_feature/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_file_copy/tasks/cli.yaml | 12 +++++-- .../targets/nxos_file_copy/tasks/nxapi.yaml | 19 +++-------- .../nxos_file_copy/tests/cli/sanity.yaml | 2 ++ .../nxos_file_copy/tests/nxapi/sanity.yaml | 2 ++ .../targets/nxos_gir/tasks/cli.yaml | 12 +++++-- .../targets/nxos_gir/tasks/nxapi.yaml | 19 +++-------- .../targets/nxos_gir/tests/common/sanity.yaml | 8 +++-- .../tasks/cli.yaml | 12 +++++-- .../tasks/nxapi.yaml | 19 +++-------- .../tests/common/sanity.yaml | 8 +++-- .../targets/nxos_hsrp/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_hsrp/tasks/nxapi.yaml | 33 +++++++++---------- .../nxos_hsrp/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_igmp/tasks/cli.yaml | 12 +++++-- .../targets/nxos_igmp/tasks/nxapi.yaml | 6 ++-- .../nxos_igmp/tests/common/sanity.yaml | 6 ++-- .../nxos_igmp_interface/tasks/cli.yaml | 12 +++++-- .../nxos_igmp_interface/tasks/nxapi.yaml | 19 +++-------- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_igmp_snooping/tasks/cli.yaml | 12 +++++-- .../nxos_igmp_snooping/tasks/nxapi.yaml | 19 +++-------- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_interface/tasks/cli.yaml | 12 +++++-- .../targets/nxos_interface/tasks/nxapi.yaml | 6 ++-- .../nxos_interface/tests/common/intent.yaml | 6 ++-- .../nxos_interface/tests/common/sanity.yaml | 6 ++-- .../nxos_interface_ospf/tasks/cli.yaml | 12 +++++-- .../nxos_interface_ospf/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_ip_interface/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_ip_interface/tasks/nxapi.yaml | 20 ++++++++--- .../nxos_ip_interface/tests/cli/sanity.yaml | 2 ++ .../nxos_ip_interface/tests/nxapi/sanity.yaml | 2 ++ .../targets/nxos_l2_interface/tasks/cli.yaml | 12 +++++-- .../nxos_l2_interface/tests/common/agg.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_l3_interface/tasks/cli.yaml | 12 +++++-- .../nxos_l3_interface/tasks/nxapi.yaml | 6 ++-- .../nxos_l3_interface/tests/cli/sanity.yaml | 2 ++ .../nxos_l3_interface/tests/nxapi/sanity.yaml | 2 ++ .../targets/nxos_linkagg/tasks/cli.yaml | 12 +++++-- .../targets/nxos_linkagg/tasks/nxapi.yaml | 6 ++-- .../nxos_linkagg/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_lldp/tasks/cli.yaml | 12 +++++-- .../targets/nxos_lldp/tests/cli/sanity.yaml | 2 ++ .../targets/nxos_lldp/tests/nxapi/sanity.yaml | 2 ++ .../targets/nxos_logging/tasks/cli.yaml | 12 +++++-- .../targets/nxos_logging/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_mtu/tasks/cli.yaml | 12 +++++-- .../targets/nxos_mtu/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_ntp/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_ntp/tasks/nxapi.yaml | 20 ++++++++--- .../targets/nxos_ntp/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_ntp_auth/tasks/cli.yaml | 12 +++++-- .../targets/nxos_ntp_auth/tasks/nxapi.yaml | 19 +++-------- .../nxos_ntp_auth/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_ntp_options/tasks/cli.yaml | 12 +++++-- .../targets/nxos_ntp_options/tasks/nxapi.yaml | 19 +++-------- .../nxos_ntp_options/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_nxapi/tasks/cli.yaml | 28 ++++++++++++---- .../targets/nxos_ospf/tasks/cli.yaml | 12 +++++-- .../targets/nxos_ospf/tasks/nxapi.yaml | 6 ++-- .../nxos_ospf/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_ospf_vrf/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_ospf_vrf/tasks/nxapi.yaml | 20 ++++++++--- .../nxos_ospf_vrf/tests/common/sanity.yaml | 6 ++-- .../nxos_overlay_global/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_overlay_global/tasks/nxapi.yaml | 20 ++++++++--- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_pim_interface/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_pim_interface/tasks/nxapi.yaml | 20 ++++++++--- .../tests/common/sanity.yaml | 6 ++-- .../nxos_pim_rp_address/tasks/cli.yaml | 12 +++++-- .../nxos_pim_rp_address/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_portchannel/tasks/cli.yaml | 12 +++++-- .../targets/nxos_portchannel/tasks/nxapi.yaml | 6 ++-- .../nxos_portchannel/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_rollback/tasks/cli.yaml | 12 +++++-- .../targets/nxos_rollback/tasks/nxapi.yaml | 6 ++-- .../nxos_rollback/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_snapshot/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_snapshot/tasks/nxapi.yaml | 33 +++++++++---------- .../nxos_snapshot/tests/common/sanity.yaml | 6 ++-- .../nxos_snmp_community/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_snmp_community/tasks/nxapi.yaml | 20 ++++++++--- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_snmp_host/tasks/cli.yaml | 12 +++++-- .../targets/nxos_snmp_host/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity_snmp_v2_trap.yaml | 6 ++-- .../tests/common/sanity_snmp_v3_inform.yaml | 6 ++-- .../tests/common/sanity_snmp_v3_trap.yaml | 6 ++-- .../targets/nxos_snmp_location/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_snmp_location/tasks/nxapi.yaml | 33 +++++++++---------- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_snmp_user/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_snmp_user/tasks/nxapi.yaml | 33 +++++++++---------- .../nxos_snmp_user/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_static_route/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_static_route/tasks/nxapi.yaml | 33 +++++++++---------- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_switchport/tasks/cli.yaml | 12 +++++-- .../targets/nxos_switchport/tasks/nxapi.yaml | 6 ++-- .../nxos_switchport/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_system/tasks/cli.yaml | 12 +++++-- .../targets/nxos_system/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_udld/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_udld/tasks/nxapi.yaml | 33 +++++++++---------- .../nxos_udld/tests/common/sanity.yaml | 6 ++-- .../nxos_udld_interface/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_udld_interface/tasks/nxapi.yaml | 33 +++++++++---------- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_user/tasks/cli.yaml | 12 +++++-- .../targets/nxos_user/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_user/tests/common/auth.yaml | 4 +-- .../targets/nxos_vlan/tasks/cli.yaml | 12 +++++-- .../targets/nxos_vlan/tasks/nxapi.yaml | 6 ++-- .../nxos_vlan/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vpc/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_vpc/tasks/nxapi.yaml | 20 ++++++++--- .../targets/nxos_vpc/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vpc_interface/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_vpc_interface/tasks/nxapi.yaml | 20 ++++++++--- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vrf/tasks/cli.yaml | 12 +++++-- .../targets/nxos_vrf/tasks/nxapi.yaml | 6 ++-- .../targets/nxos_vrf/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vrf_af/tasks/cli.yaml | 26 ++++++++++++--- .../targets/nxos_vrf_af/tasks/nxapi.yaml | 20 ++++++++--- .../nxos_vrf_af/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vrf_interface/tasks/cli.yaml | 12 +++++-- .../nxos_vrf_interface/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vrrp/tasks/cli.yaml | 12 +++++-- .../targets/nxos_vrrp/tasks/nxapi.yaml | 6 ++-- .../nxos_vrrp/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vtp_domain/tasks/cli.yaml | 12 +++++-- .../targets/nxos_vtp_domain/tasks/nxapi.yaml | 6 ++-- .../nxos_vtp_domain/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vtp_password/tasks/cli.yaml | 12 +++++-- .../nxos_vtp_password/tasks/nxapi.yaml | 6 ++-- .../tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vtp_version/tasks/cli.yaml | 12 +++++-- .../targets/nxos_vtp_version/tasks/nxapi.yaml | 6 ++-- .../nxos_vtp_version/tests/common/sanity.yaml | 6 ++-- .../targets/nxos_vxlan_vtep/tasks/cli.yaml | 12 +++++-- .../targets/nxos_vxlan_vtep/tasks/nxapi.yaml | 6 ++-- .../nxos_vxlan_vtep/tests/common/sanity.yaml | 6 ++-- .../nxos_vxlan_vtep_vni/tasks/cli.yaml | 26 ++++++++++++--- .../nxos_vxlan_vtep_vni/tasks/nxapi.yaml | 33 +++++++++---------- .../tests/common/sanity.yaml | 6 ++-- .../targets/prepare_nxos_tests/tasks/main.yml | 10 +++--- 199 files changed, 1589 insertions(+), 684 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_l2_interface.py b/lib/ansible/modules/network/nxos/nxos_l2_interface.py index f8e0d85409..ae92d1309a 100644 --- a/lib/ansible/modules/network/nxos/nxos_l2_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_l2_interface.py @@ -31,7 +31,7 @@ options: - Full name of the interface excluding any logical unit number, i.e. Ethernet1/1. required: true - aliases: interface + aliases: ['interface'] mode: description: - Mode in which interface needs to be configured. @@ -49,7 +49,7 @@ options: - List of VLANs to be configured in trunk port. If C(mode=trunk), used as the VLAN range to ADD or REMOVE from the trunk. - aliases: trunk_add_vlans + aliases: ['trunk_add_vlans'] trunk_allowed_vlans: description: - List of allowed VLANs in a given trunk port. diff --git a/lib/ansible/plugins/cliconf/nxos.py b/lib/ansible/plugins/cliconf/nxos.py index 1012c1272c..27de3d60bf 100644 --- a/lib/ansible/plugins/cliconf/nxos.py +++ b/lib/ansible/plugins/cliconf/nxos.py @@ -33,9 +33,9 @@ class Cliconf(CliconfBase): device_info = {} device_info['network_os'] = 'nxos' - reply = self.get(b'show version | json') + reply = self.get('show version | json') data = json.loads(reply) - platform_reply = self.get(b'show inventory | json') + platform_reply = self.get('show inventory | json') platform_info = json.loads(platform_reply) device_info['network_os_version'] = data.get('sys_ver_str') or data.get('kickstart_ver_str') @@ -53,7 +53,7 @@ class Cliconf(CliconfBase): def get_config(self, source='running', flags=None): lookup = {'running': 'running-config', 'startup': 'startup-config'} - cmd = b'show {} '.format(lookup[source]) + cmd = 'show {} '.format(lookup[source]) cmd += ' '.join(flags) cmd = cmd.strip() @@ -61,7 +61,7 @@ class Cliconf(CliconfBase): def edit_config(self, command): responses = [] - for cmd in chain([b'configure'], to_list(command), [b'end']): + for cmd in chain(['configure'], to_list(command), ['end']): responses.append(self.send_command(cmd)) return json.dumps(responses) diff --git a/test/integration/targets/nxos_aaa_server/tasks/cli.yaml b/test/integration/targets/nxos_aaa_server/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_aaa_server/tasks/cli.yaml +++ b/test/integration/targets/nxos_aaa_server/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_aaa_server/tasks/nxapi.yaml b/test/integration/targets/nxos_aaa_server/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_aaa_server/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_aaa_server/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_aaa_server/tests/common/radius.yaml b/test/integration/targets/nxos_aaa_server/tests/common/radius.yaml index f91714d0d0..46e46720ac 100644 --- a/test/integration/targets/nxos_aaa_server/tests/common/radius.yaml +++ b/test/integration/targets/nxos_aaa_server/tests/common/radius.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_aaa_server radius.yaml sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server radius.yaml sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup" nxos_aaa_server: &remove @@ -85,11 +87,11 @@ rescue: - - debug: msg="TRANSPORT:{{ connection.transport }} nxos_aaa_server failure detected" + - debug: msg="connection={{ ansible_connection }} nxos_aaa_server failure detected" always: - name: "Remove radius server configuration" nxos_aaa_server: *remove register: result - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_aaa_server radius.yaml sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_aaa_server radius.yaml sanity test" diff --git a/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml b/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml index 9b2adb7608..255d9f7a17 100644 --- a/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml +++ b/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_aaa_server tacacs.yaml sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Enable feature tacacs+" nxos_feature: @@ -84,7 +86,7 @@ rescue: - - debug: msg="TRANSPORT:{{ connection.transport }} nxos_aaa_server failure detected" + - debug: msg="connection={{ ansible_connection }} nxos_aaa_server failure detected" always: @@ -98,4 +100,4 @@ state: disabled provider: "{{ connection }}" - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_aaa_server tacacs.yaml sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test" diff --git a/test/integration/targets/nxos_aaa_server_host/tasks/cli.yaml b/test/integration/targets/nxos_aaa_server_host/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_aaa_server_host/tasks/cli.yaml +++ b/test/integration/targets/nxos_aaa_server_host/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml b/test/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml b/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml index 19f9c3a1e1..572650e97e 100644 --- a/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml +++ b/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_aaa_server_host radius.yaml sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server_host radius.yaml sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup" nxos_aaa_server_host: &remove @@ -117,7 +119,7 @@ rescue: - - debug: msg="TRANSPORT:{{ connection.transport }} nxos_aaa_server_host failure detected" + - debug: msg="connection={{ ansible_connection }} nxos_aaa_server_host failure detected" always: @@ -125,4 +127,4 @@ nxos_aaa_server_host: *remove register: result - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_aaa_server_host radius.yaml sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_aaa_server_host radius.yaml sanity test" diff --git a/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml b/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml index 994ba57628..4229f9affb 100644 --- a/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml +++ b/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_aaa_server_host tacacs.yaml sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_aaa_server_host tacacs.yaml sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Enable feature tacacs+" nxos_feature: @@ -121,7 +123,7 @@ rescue: - - debug: msg="TRANSPORT:{{ connection.transport }} nxos_aaa_server_host failure detected" + - debug: msg="connection={{ ansible_connection }} nxos_aaa_server_host failure detected" always: @@ -135,4 +137,4 @@ state: disabled provider: "{{ connection }}" - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_aaa_server_host tacacs.yaml sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_aaa_server_host tacacs.yaml sanity test" diff --git a/test/integration/targets/nxos_acl/tasks/cli.yaml b/test/integration/targets/nxos_acl/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_acl/tasks/cli.yaml +++ b/test/integration/targets/nxos_acl/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_acl/tasks/nxapi.yaml b/test/integration/targets/nxos_acl/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_acl/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_acl/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_acl/tests/common/sanity.yaml b/test/integration/targets/nxos_acl/tests/common/sanity.yaml index 9aed0e4d60..56bdac267d 100644 --- a/test/integration/targets/nxos_acl/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_acl/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_acl sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_acl sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: time_range="ans-range" when: not ( platform is match("N5K")) @@ -61,4 +63,4 @@ - assert: *false -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_acl sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_acl sanity test" diff --git a/test/integration/targets/nxos_acl_interface/tasks/cli.yaml b/test/integration/targets/nxos_acl_interface/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_acl_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_acl_interface/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_acl_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_acl_interface/tests/common/sanity.yaml index 70d55c323d..8d463d3695 100644 --- a/test/integration/targets/nxos_acl_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_acl_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport}} nxos_acl_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_acl_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -115,4 +117,4 @@ ignore_errors: yes always: - - debug: msg="END TRANSPORT:{{ connection.transport}} nxos_acl_interface sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_acl_interface sanity test" diff --git a/test/integration/targets/nxos_banner/tasks/cli.yaml b/test/integration/targets/nxos_banner/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_banner/tasks/cli.yaml +++ b/test/integration/targets/nxos_banner/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_banner/tasks/nxapi.yaml b/test/integration/targets/nxos_banner/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_banner/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_banner/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp/tasks/cli.yaml b/test/integration/targets/nxos_bgp/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_bgp/tasks/cli.yaml +++ b/test/integration/targets/nxos_bgp/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_bgp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml index 0b7d0ab53b..585820a6eb 100644 --- a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_bgp sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_bgp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: neighbor_down_fib_accelerate="true" when: not titanium @@ -132,4 +134,4 @@ ignore_errors: yes always: - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_bgp sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_bgp sanity test" diff --git a/test/integration/targets/nxos_bgp_af/tasks/cli.yaml b/test/integration/targets/nxos_bgp_af/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_bgp_af/tasks/cli.yaml +++ b/test/integration/targets/nxos_bgp_af/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_af/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp_af/tests/common/sanity.yaml index da39e3f2a9..c0ac6b4d16 100644 --- a/test/integration/targets/nxos_bgp_af/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp_af/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_bgp_af sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_bgp_af sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: advertise_l2vpn_evpn="true" when: platform is search('N9K') @@ -146,4 +148,4 @@ provider: "{{ connection }}" when: platform is search('N9K') - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_bgp_af sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_bgp_af sanity test" diff --git a/test/integration/targets/nxos_bgp_neighbor/tasks/cli.yaml b/test/integration/targets/nxos_bgp_neighbor/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_bgp_neighbor/tasks/cli.yaml +++ b/test/integration/targets/nxos_bgp_neighbor/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml index 72b199c11a..988bd17969 100644 --- a/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport}} nxos_bgp_neighbor sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_bgp_neighbor sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: intname="{{ nxos_int1 }}" @@ -200,4 +202,4 @@ state: disabled provider: "{{ connection }}" -- debug: msg="END TRANSPORT:{{ connection.transport}} nxos_bgp_neighbor sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_bgp_neighbor sanity test" diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp_neighbor_af/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp_neighbor_af/tests/common/sanity.yaml index eb9815f49a..3cc23d82a2 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_bgp_neighbor_af sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_bgp_neighbor_af sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Disable feature BGP" nxos_feature: &disable_bgp @@ -201,4 +203,4 @@ - name: "Disable feature bgp" nxos_feature: *disable_bgp - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_bgp_neighbor_af sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_bgp_neighbor_af sanity test" diff --git a/test/integration/targets/nxos_command/tasks/cli.yaml b/test/integration/targets/nxos_command/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_command/tasks/cli.yaml +++ b/test/integration/targets/nxos_command/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_command/tasks/nxapi.yaml b/test/integration/targets/nxos_command/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_command/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_command/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_command/tests/cli/sanity.yaml b/test/integration/targets/nxos_command/tests/cli/sanity.yaml index f5e60f8e02..465deadd03 100644 --- a/test/integration/targets/nxos_command/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/cli/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:CLI nxos_command sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Disable feature BGP" nxos_feature: diff --git a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml index a4cbae738d..9fea97b6f7 100644 --- a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:NXAPI nxos_command sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Disable feature BGP" nxos_feature: diff --git a/test/integration/targets/nxos_config/tasks/cli.yaml b/test/integration/targets/nxos_config/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_config/tasks/cli.yaml +++ b/test/integration/targets/nxos_config/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_config/tasks/nxapi.yaml b/test/integration/targets/nxos_config/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_config/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_config/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_config/tests/common/sanity.yaml b/test/integration/targets/nxos_config/tests/common/sanity.yaml index 6d1ea0b8ed..3a8efafdbe 100644 --- a/test/integration/targets/nxos_config/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_config/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_config sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_config sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: setup nxos_config: @@ -38,4 +40,4 @@ provider: "{{ connection }}" match: none -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_config sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_config sanity test" diff --git a/test/integration/targets/nxos_evpn_global/tasks/cli.yaml b/test/integration/targets/nxos_evpn_global/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_evpn_global/tasks/cli.yaml +++ b/test/integration/targets/nxos_evpn_global/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml b/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml b/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml index 1028b38b70..b2fb65a718 100644 --- a/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_evpn_global sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_evpn_global sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup" nxos_config: &remove_evpn_config @@ -58,7 +60,7 @@ when: not ( platform is search('N3K')) rescue: - - debug: msg="TRANSPORT:{{ connection.transport }} nxos_evpn_global sanity test - FALURE ENCOUNTERED" + - debug: msg="connection={{ ansible_connection }} nxos_evpn_global sanity test - FALURE ENCOUNTERED" always: @@ -70,4 +72,4 @@ nxos_feature: *disable_feature_nv_overlay ignore_errors: yes - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_evpn_global sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_evpn_global sanity test" diff --git a/test/integration/targets/nxos_evpn_vni/tasks/cli.yaml b/test/integration/targets/nxos_evpn_vni/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_evpn_vni/tasks/cli.yaml +++ b/test/integration/targets/nxos_evpn_vni/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml b/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_evpn_vni/tests/common/sanity.yaml b/test/integration/targets/nxos_evpn_vni/tests/common/sanity.yaml index c37adfaf19..36c691d2dd 100644 --- a/test/integration/targets/nxos_evpn_vni/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_evpn_vni/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_evpn_vni sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_evpn_vni sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup" nxos_config: &remove_evpn @@ -71,4 +73,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_evpn_vni sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_evpn_vni sanity test" diff --git a/test/integration/targets/nxos_facts/tasks/cli.yaml b/test/integration/targets/nxos_facts/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_facts/tasks/cli.yaml +++ b/test/integration/targets/nxos_facts/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_facts/tasks/nxapi.yaml b/test/integration/targets/nxos_facts/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_facts/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_facts/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_facts/tests/common/sanity.yaml b/test/integration/targets/nxos_facts/tests/common/sanity.yaml index 77c9bade21..6b9e789ff9 100644 --- a/test/integration/targets/nxos_facts/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_facts/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_facts sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_facts sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "nxos_facts gather hardware facts" nxos_facts: @@ -75,4 +77,4 @@ - "result.ansible_facts.ansible_net_memfree_mb > 1" - "result.ansible_facts.ansible_net_memtotal_mb > 1" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_facts sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_facts sanity test" diff --git a/test/integration/targets/nxos_feature/tasks/cli.yaml b/test/integration/targets/nxos_feature/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_feature/tasks/cli.yaml +++ b/test/integration/targets/nxos_feature/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_feature/tasks/nxapi.yaml b/test/integration/targets/nxos_feature/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_feature/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_feature/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_file_copy/tasks/cli.yaml b/test/integration/targets/nxos_file_copy/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_file_copy/tasks/cli.yaml +++ b/test/integration/targets/nxos_file_copy/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml b/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml b/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml index e3fbb91218..1b6c03a371 100644 --- a/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:CLI nxos_file_copy sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup - Remove existing file" nxos_command: &remove_file diff --git a/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml index fc5db2e62b..2f4aa98552 100644 --- a/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:NXAPI nxos_file_copy sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup - Remove existing file" nxos_command: &remove_file diff --git a/test/integration/targets/nxos_gir/tasks/cli.yaml b/test/integration/targets/nxos_gir/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_gir/tasks/cli.yaml +++ b/test/integration/targets/nxos_gir/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_gir/tasks/nxapi.yaml b/test/integration/targets/nxos_gir/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_gir/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_gir/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_gir/tests/common/sanity.yaml b/test/integration/targets/nxos_gir/tests/common/sanity.yaml index b5e8b2ab3c..b875684829 100644 --- a/test/integration/targets/nxos_gir/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_gir/tests/common/sanity.yaml @@ -1,5 +1,7 @@ #--- -#- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_gir sanity test" +#- debug: msg="START connection={{ ansible_connection }} nxos_gir sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # #- name: "Setup" # nxos_gir: &setup @@ -92,7 +94,7 @@ # # rescue: # -# - debug: msg="TRANSPORT:{{ connection.transport }} nxos_gir failure detected" +# - debug: msg="connection={{ ansible_connection }} nxos_gir failure detected" # # always: # @@ -100,4 +102,4 @@ # nxos_gir: *setup # register: result # -# - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_gir sanity test" +# - debug: msg="END connection={{ ansible_connection }} nxos_gir sanity test" diff --git a/test/integration/targets/nxos_gir_profile_management/tasks/cli.yaml b/test/integration/targets/nxos_gir_profile_management/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_gir_profile_management/tasks/cli.yaml +++ b/test/integration/targets/nxos_gir_profile_management/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_gir_profile_management/tasks/nxapi.yaml b/test/integration/targets/nxos_gir_profile_management/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_gir_profile_management/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_gir_profile_management/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_gir_profile_management/tests/common/sanity.yaml b/test/integration/targets/nxos_gir_profile_management/tests/common/sanity.yaml index fd13578d66..7f260f0a0d 100644 --- a/test/integration/targets/nxos_gir_profile_management/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_gir_profile_management/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_gir_profile_management sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_gir_profile_management sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Setup - Remove maintenace mode profiles" nxos_gir_profile_management: &remove_maintenance @@ -91,7 +93,7 @@ rescue: - - debug: msg="TRANSPORT:{{ connection.transport }} nxos_gir_profile_management failure detected" + - debug: msg="connection={{ ansible_connection }} nxos_gir_profile_management failure detected" always: @@ -107,4 +109,4 @@ state: disabled provider: "{{ connection }}" - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_gir_profile_management sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_gir_profile_management sanity test" diff --git a/test/integration/targets/nxos_hsrp/tasks/cli.yaml b/test/integration/targets/nxos_hsrp/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_hsrp/tasks/cli.yaml +++ b/test/integration/targets/nxos_hsrp/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml b/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml b/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml index 8fdf1deb6d..0b7cc5885e 100644 --- a/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_hsrp sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_hsrp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -89,4 +91,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_hsrp sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_hsrp sanity test" diff --git a/test/integration/targets/nxos_igmp/tasks/cli.yaml b/test/integration/targets/nxos_igmp/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_igmp/tasks/cli.yaml +++ b/test/integration/targets/nxos_igmp/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_igmp/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_igmp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_igmp/tests/common/sanity.yaml b/test/integration/targets/nxos_igmp/tests/common/sanity.yaml index 2e2a4fbd6f..da8bce3c88 100644 --- a/test/integration/targets/nxos_igmp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_igmp/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_igmp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: @@ -43,4 +45,4 @@ nxos_igmp: *default register: result - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_igmp sanity test" diff --git a/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml b/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml index 6290687e9a..230bb3a1eb 100644 --- a/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_igmp_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -87,4 +89,4 @@ state: disabled provider: "{{ connection }}" - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp_interface sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_igmp_interface sanity test" diff --git a/test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml b/test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml +++ b/test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml b/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml index e6691d320b..9d54832749 100644 --- a/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp_snooping sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_igmp_snooping sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: @@ -45,4 +47,4 @@ nxos_igmp_snooping: *default register: result - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp_snooping sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_igmp_snooping sanity test" diff --git a/test/integration/targets/nxos_interface/tasks/cli.yaml b/test/integration/targets/nxos_interface/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_interface/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ 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 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_interface/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_interface/tests/common/intent.yaml b/test/integration/targets/nxos_interface/tests/common/intent.yaml index 6367e9b174..c91847c037 100644 --- a/test/integration/targets/nxos_interface/tests/common/intent.yaml +++ b/test/integration/targets/nxos_interface/tests/common/intent.yaml @@ -1,4 +1,6 @@ -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_interface intent test" +- debug: msg="START connection={{ ansible_connection }} nxos_interface intent test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint1="{{ nxos_int1 }}" - set_fact: testint2="{{ nxos_int2 }}" @@ -60,4 +62,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_interface intent test" +- debug: msg="END connection={{ ansible_connection }} nxos_interface intent test" diff --git a/test/integration/targets/nxos_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_interface/tests/common/sanity.yaml index fe623ff7b5..03b5294beb 100644 --- a/test/integration/targets/nxos_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint="{{ nxos_int1 }}" @@ -128,4 +130,4 @@ ignore_errors: yes always: - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_interface sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_interface sanity test" diff --git a/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml b/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml +++ b/test/integration/targets/nxos_interface_ospf/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ 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 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_interface_ospf/tests/common/sanity.yaml b/test/integration/targets/nxos_interface_ospf/tests/common/sanity.yaml index 43dea5eaea..3581c8e4d2 100644 --- a/test/integration/targets/nxos_interface_ospf/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_interface_ospf/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_interface_ospf sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_interface_ospf sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint="{{ nxos_int1 }}" @@ -232,4 +234,4 @@ nxos_config: *removepcandlb always: - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_interface_ospf sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_interface_ospf sanity test" diff --git a/test/integration/targets/nxos_ip_interface/tasks/cli.yaml b/test/integration/targets/nxos_ip_interface/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_ip_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_ip_interface/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ip_interface/tests/cli/sanity.yaml b/test/integration/targets/nxos_ip_interface/tests/cli/sanity.yaml index 9e0f1ffd01..81135dafe2 100644 --- a/test/integration/targets/nxos_ip_interface/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_ip_interface/tests/cli/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:CLI nxos_ip_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint1="{{ nxos_int1 }}" - set_fact: testint2="{{ nxos_int2 }}" diff --git a/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml index f57a5f62ea..bc8c528e87 100644 --- a/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:NXAPI nxos_ip_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint1="{{ nxos_int1 }}" - set_fact: testint2="{{ nxos_int2 }}" diff --git a/test/integration/targets/nxos_l2_interface/tasks/cli.yaml b/test/integration/targets/nxos_l2_interface/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_l2_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_l2_interface/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_l2_interface/tests/common/agg.yaml b/test/integration/targets/nxos_l2_interface/tests/common/agg.yaml index 557a03d467..76620ddc0c 100644 --- a/test/integration/targets/nxos_l2_interface/tests/common/agg.yaml +++ b/test/integration/targets/nxos_l2_interface/tests/common/agg.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_l2_interface aggregate test" +- debug: msg="START connection={{ ansible_connection }} nxos_l2_interface aggregate test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname1="{{ nxos_int1 }}" @@ -68,4 +70,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_l2_interface aggregate test" +- debug: msg="END connection={{ ansible_connection }} nxos_l2_interface aggregate test" diff --git a/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml index 0a244aa478..f821dd79b6 100644 --- a/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_l2_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_l2_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -121,4 +123,4 @@ nxos_config: *default ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_l2_interface sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_l2_interface sanity test" diff --git a/test/integration/targets/nxos_l3_interface/tasks/cli.yaml b/test/integration/targets/nxos_l3_interface/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_l3_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_l3_interface/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_l3_interface/tests/cli/sanity.yaml b/test/integration/targets/nxos_l3_interface/tests/cli/sanity.yaml index da5d2a8d18..b6f7a80ca5 100644 --- a/test/integration/targets/nxos_l3_interface/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_l3_interface/tests/cli/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:CLI nxos_l3_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: testint2="{{ nxos_int2 }}" diff --git a/test/integration/targets/nxos_l3_interface/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_l3_interface/tests/nxapi/sanity.yaml index c59a881f6a..5c95b45906 100644 --- a/test/integration/targets/nxos_l3_interface/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_l3_interface/tests/nxapi/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:NXAPI nxos_l3_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: testint2="{{ nxos_int2 }}" diff --git a/test/integration/targets/nxos_linkagg/tasks/cli.yaml b/test/integration/targets/nxos_linkagg/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_linkagg/tasks/cli.yaml +++ b/test/integration/targets/nxos_linkagg/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml b/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml b/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml index bd4b3b25e2..9aa492376c 100644 --- a/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_linkagg sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_linkagg sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint1="{{ nxos_int1 }}" - set_fact: testint2="{{ nxos_int2 }}" @@ -190,4 +192,4 @@ timeout: 60 provider: "{{ connection }}" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_linkagg sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_linkagg sanity test" diff --git a/test/integration/targets/nxos_lldp/tasks/cli.yaml b/test/integration/targets/nxos_lldp/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_lldp/tasks/cli.yaml +++ b/test/integration/targets/nxos_lldp/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_lldp/tests/cli/sanity.yaml b/test/integration/targets/nxos_lldp/tests/cli/sanity.yaml index 94291edd49..777f360f23 100644 --- a/test/integration/targets/nxos_lldp/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_lldp/tests/cli/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:CLI nxos_lldp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Make sure LLDP is not running before tests nxos_config: diff --git a/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml index a0df7811f4..3ed60c2435 100644 --- a/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml @@ -1,5 +1,7 @@ --- - debug: msg="START TRANSPORT:NXAPI nxos_lldp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Make sure LLDP is not running before tests nxos_config: diff --git a/test/integration/targets/nxos_logging/tasks/cli.yaml b/test/integration/targets/nxos_logging/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_logging/tasks/cli.yaml +++ b/test/integration/targets/nxos_logging/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ 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 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_logging/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_logging/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_mtu/tasks/cli.yaml b/test/integration/targets/nxos_mtu/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_mtu/tasks/cli.yaml +++ b/test/integration/targets/nxos_mtu/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ 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 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_mtu/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_mtu/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ntp/tasks/cli.yaml b/test/integration/targets/nxos_ntp/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_ntp/tasks/cli.yaml +++ b/test/integration/targets/nxos_ntp/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ntp/tasks/nxapi.yaml b/test/integration/targets/nxos_ntp/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_ntp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ntp/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ntp/tests/common/sanity.yaml b/test/integration/targets/nxos_ntp/tests/common/sanity.yaml index 8a5f654f9a..0ac117513d 100644 --- a/test/integration/targets/nxos_ntp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_ntp/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ntp sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_ntp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Setup - Remove ntp if configured nxos_ntp: &remove @@ -53,4 +55,4 @@ - name: Remove ntp config nxos_ntp: *remove - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ntp sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_ntp sanity test" diff --git a/test/integration/targets/nxos_ntp_auth/tasks/cli.yaml b/test/integration/targets/nxos_ntp_auth/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_ntp_auth/tasks/cli.yaml +++ b/test/integration/targets/nxos_ntp_auth/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml b/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml b/test/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml index cf7877c9a9..e9e411dfde 100644 --- a/test/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ntp_auth sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_ntp_auth sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Configure text ntp authentication nxos_ntp_auth: &setup @@ -84,4 +86,4 @@ nxos_ntp_auth: *setup ignore_errors: yes - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ntp_auth sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_ntp_auth sanity test" diff --git a/test/integration/targets/nxos_ntp_options/tasks/cli.yaml b/test/integration/targets/nxos_ntp_options/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_ntp_options/tasks/cli.yaml +++ b/test/integration/targets/nxos_ntp_options/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml b/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml index e071f293a2..68e96a2942 100644 --- a/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,21 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_ntp_options/tests/common/sanity.yaml b/test/integration/targets/nxos_ntp_options/tests/common/sanity.yaml index 000096c309..43833de90a 100644 --- a/test/integration/targets/nxos_ntp_options/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_ntp_options/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ntp_options sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_ntp_options sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Apply default ntp config" nxos_ntp_options: &default @@ -71,4 +73,4 @@ nxos_ntp_options: *default register: result - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ntp_options sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_ntp_options sanity test" diff --git a/test/integration/targets/nxos_nxapi/tasks/cli.yaml b/test/integration/targets/nxos_nxapi/tasks/cli.yaml index f715e18a95..edbff7dfaf 100644 --- a/test/integration/targets/nxos_nxapi/tasks/cli.yaml +++ b/test/integration/targets/nxos_nxapi/tasks/cli.yaml @@ -1,19 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run -- name: Reset nxapi to default state - nxos_nxapi: - provider: "{{ cli }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ospf/tasks/cli.yaml b/test/integration/targets/nxos_ospf/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_ospf/tasks/cli.yaml +++ b/test/integration/targets/nxos_ospf/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ospf/tasks/nxapi.yaml b/test/integration/targets/nxos_ospf/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_ospf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ospf/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ospf/tests/common/sanity.yaml b/test/integration/targets/nxos_ospf/tests/common/sanity.yaml index a07cf1abe1..26890f378f 100644 --- a/test/integration/targets/nxos_ospf/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_ospf/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ospf sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_ospf sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Enable feature OSPF" nxos_feature: @@ -52,4 +54,4 @@ - assert: *false - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ospf sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_ospf sanity test" diff --git a/test/integration/targets/nxos_ospf_vrf/tasks/cli.yaml b/test/integration/targets/nxos_ospf_vrf/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_ospf_vrf/tasks/cli.yaml +++ b/test/integration/targets/nxos_ospf_vrf/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ospf_vrf/tasks/nxapi.yaml b/test/integration/targets/nxos_ospf_vrf/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_ospf_vrf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ospf_vrf/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_ospf_vrf/tests/common/sanity.yaml b/test/integration/targets/nxos_ospf_vrf/tests/common/sanity.yaml index e2ad060f2c..9535c2ea0a 100644 --- a/test/integration/targets/nxos_ospf_vrf/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_ospf_vrf/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ospf_vrf sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_ospf_vrf sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Enable feature OSPF" nxos_feature: @@ -62,4 +64,4 @@ - assert: *false -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ospf_vrf sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_ospf_vrf sanity test" diff --git a/test/integration/targets/nxos_overlay_global/tasks/cli.yaml b/test/integration/targets/nxos_overlay_global/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_overlay_global/tasks/cli.yaml +++ b/test/integration/targets/nxos_overlay_global/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_overlay_global/tasks/nxapi.yaml b/test/integration/targets/nxos_overlay_global/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_overlay_global/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_overlay_global/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_overlay_global/tests/common/sanity.yaml b/test/integration/targets/nxos_overlay_global/tests/common/sanity.yaml index 4dc93437ba..1d44a6eee9 100644 --- a/test/integration/targets/nxos_overlay_global/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_overlay_global/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_overlay_global sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_overlay_global sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: overlay_global_supported="false" - set_fact: overlay_global_supported="true" @@ -101,4 +103,4 @@ ignore_errors: yes when: overlay_global_supported - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_overlay_global sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_overlay_global sanity test" diff --git a/test/integration/targets/nxos_pim_interface/tasks/cli.yaml b/test/integration/targets/nxos_pim_interface/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_pim_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_pim_interface/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_pim_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_pim_interface/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_pim_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_pim_interface/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_pim_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_pim_interface/tests/common/sanity.yaml index 7f659cc7ba..42121e9619 100644 --- a/test/integration/targets/nxos_pim_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_pim_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_pim_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_pim_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: "Disable feature PIM" nxos_feature: &disable_feature @@ -99,4 +101,4 @@ - name: "Disable feature PIM" nxos_feature: *disable_feature -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_pim_interface sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_pim_interface sanity test" diff --git a/test/integration/targets/nxos_pim_rp_address/tasks/cli.yaml b/test/integration/targets/nxos_pim_rp_address/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_pim_rp_address/tasks/cli.yaml +++ b/test/integration/targets/nxos_pim_rp_address/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_pim_rp_address/tasks/nxapi.yaml b/test/integration/targets/nxos_pim_rp_address/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_pim_rp_address/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_pim_rp_address/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_portchannel/tasks/cli.yaml b/test/integration/targets/nxos_portchannel/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_portchannel/tasks/cli.yaml +++ b/test/integration/targets/nxos_portchannel/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_portchannel/tasks/nxapi.yaml b/test/integration/targets/nxos_portchannel/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_portchannel/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_portchannel/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_portchannel/tests/common/sanity.yaml b/test/integration/targets/nxos_portchannel/tests/common/sanity.yaml index 2d26696fe7..f1bc00a50e 100644 --- a/test/integration/targets/nxos_portchannel/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_portchannel/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_portchannel sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_portchannel sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: testint1="{{ nxos_int1 }}" - set_fact: testint2="{{ nxos_int2 }}" @@ -96,4 +98,4 @@ nxos_portchannel: *delpc register: result - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_portchannel sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_portchannel sanity test" diff --git a/test/integration/targets/nxos_rollback/tasks/cli.yaml b/test/integration/targets/nxos_rollback/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_rollback/tasks/cli.yaml +++ b/test/integration/targets/nxos_rollback/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_rollback/tasks/nxapi.yaml b/test/integration/targets/nxos_rollback/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_rollback/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_rollback/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_rollback/tests/common/sanity.yaml b/test/integration/targets/nxos_rollback/tests/common/sanity.yaml index 7922669643..16f13d3f30 100644 --- a/test/integration/targets/nxos_rollback/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_rollback/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_rollback sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_rollback sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: delete existing checkpoint file nxos_config: &delete @@ -26,4 +28,4 @@ nxos_config: *delete ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_rollback sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_rollback sanity test" diff --git a/test/integration/targets/nxos_snapshot/tasks/cli.yaml b/test/integration/targets/nxos_snapshot/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_snapshot/tasks/cli.yaml +++ b/test/integration/targets/nxos_snapshot/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml b/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml index 2fe405528d..8a5de08e6c 100644 --- a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snapshot sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snapshot sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: snapshot_run="true" - set_fact: snapshot_run="false" @@ -43,4 +45,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snapshot sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_snapshot sanity test" diff --git a/test/integration/targets/nxos_snmp_community/tasks/cli.yaml b/test/integration/targets/nxos_snmp_community/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_snmp_community/tasks/cli.yaml +++ b/test/integration/targets/nxos_snmp_community/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_community/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_community/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_snmp_community/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_community/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_community/tests/common/sanity.yaml b/test/integration/targets/nxos_snmp_community/tests/common/sanity.yaml index 7b01029789..7676ba3fdd 100644 --- a/test/integration/targets/nxos_snmp_community/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_snmp_community/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_community sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snmp_community sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Setup - Remove snmp_community if configured nxos_snmp_community: &remove @@ -93,4 +95,4 @@ - name: Cleanup nxos_snmp_community: *remove - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_community sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_snmp_community sanity test" diff --git a/test/integration/targets/nxos_snmp_host/tasks/cli.yaml b/test/integration/targets/nxos_snmp_host/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_snmp_host/tasks/cli.yaml +++ b/test/integration/targets/nxos_snmp_host/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_host/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_host/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_snmp_host/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_host/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v2_trap.yaml b/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v2_trap.yaml index 01684c1c53..16c1843574 100644 --- a/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v2_trap.yaml +++ b/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v2_trap.yaml @@ -2,7 +2,9 @@ - set_fact: snmp_type="trap" - set_fact: snmp_version="v2c" -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -61,4 +63,4 @@ - assert: *false - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" diff --git a/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_inform.yaml b/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_inform.yaml index a1010d77a2..84b41a2222 100644 --- a/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_inform.yaml +++ b/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_inform.yaml @@ -3,7 +3,9 @@ - set_fact: snmp_version="v3" - set_fact: snmp_auth="noauth" -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -66,4 +68,4 @@ - assert: *false - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" diff --git a/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_trap.yaml b/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_trap.yaml index d880c0e482..0d92d3b94d 100644 --- a/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_trap.yaml +++ b/test/integration/targets/nxos_snmp_host/tests/common/sanity_snmp_v3_trap.yaml @@ -3,7 +3,9 @@ - set_fact: snmp_version="v3" - set_fact: snmp_auth="noauth" -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Setup - Remove snmp_host if configured nxos_snmp_host: &remove @@ -58,4 +60,4 @@ - assert: *false - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_snmp_host {{ snmp_type }} {{ snmp_version }}sanity test" diff --git a/test/integration/targets/nxos_snmp_location/tasks/cli.yaml b/test/integration/targets/nxos_snmp_location/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_snmp_location/tasks/cli.yaml +++ b/test/integration/targets/nxos_snmp_location/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml b/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml index 7c6e4405a7..89ce99a448 100644 --- a/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_location sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snmp_location sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Setup - Remove snmp_location if configured nxos_snmp_location: &remove @@ -44,4 +46,4 @@ - assert: *false - - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_location sanity test" + - debug: msg="END connection={{ ansible_connection }} nxos_snmp_location sanity test" diff --git a/test/integration/targets/nxos_snmp_user/tasks/cli.yaml b/test/integration/targets/nxos_snmp_user/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_snmp_user/tasks/cli.yaml +++ b/test/integration/targets/nxos_snmp_user/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml b/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml index dbc7252e21..73a5e836f2 100644 --- a/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_user sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_snmp_user sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Create snmp user nxos_snmp_user: &create @@ -38,4 +40,4 @@ that: - "result.changed == false" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_user sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_snmp_user sanity test" diff --git a/test/integration/targets/nxos_static_route/tasks/cli.yaml b/test/integration/targets/nxos_static_route/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_static_route/tasks/cli.yaml +++ b/test/integration/targets/nxos_static_route/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_static_route/tasks/nxapi.yaml b/test/integration/targets/nxos_static_route/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_static_route/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_static_route/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_static_route/tests/common/sanity.yaml b/test/integration/targets/nxos_static_route/tests/common/sanity.yaml index d0e03c52b0..0a1a9da801 100644 --- a/test/integration/targets/nxos_static_route/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_static_route/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_static_route sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_static_route sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: create static route @@ -108,4 +110,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_static_route sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_static_route sanity test" diff --git a/test/integration/targets/nxos_switchport/tasks/cli.yaml b/test/integration/targets/nxos_switchport/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_switchport/tasks/cli.yaml +++ b/test/integration/targets/nxos_switchport/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_switchport/tasks/nxapi.yaml b/test/integration/targets/nxos_switchport/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_switchport/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_switchport/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_switchport/tests/common/sanity.yaml b/test/integration/targets/nxos_switchport/tests/common/sanity.yaml index 1421381fa3..db35d3ff3d 100644 --- a/test/integration/targets/nxos_switchport/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_switchport/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_switchport sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_switchport sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -127,4 +129,4 @@ nxos_config: *default ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_switchport sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_switchport sanity test" diff --git a/test/integration/targets/nxos_system/tasks/cli.yaml b/test/integration/targets/nxos_system/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_system/tasks/cli.yaml +++ b/test/integration/targets/nxos_system/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_system/tasks/nxapi.yaml b/test/integration/targets/nxos_system/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_system/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_system/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_udld/tasks/cli.yaml b/test/integration/targets/nxos_udld/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_udld/tasks/cli.yaml +++ b/test/integration/targets/nxos_udld/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_udld/tasks/nxapi.yaml b/test/integration/targets/nxos_udld/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_udld/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_udld/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_udld/tests/common/sanity.yaml b/test/integration/targets/nxos_udld/tests/common/sanity.yaml index 07d4c0cade..4bf7243a1c 100644 --- a/test/integration/targets/nxos_udld/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_udld/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_udld sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_udld sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: udld_run="true" - set_fact: udld_run="false" @@ -64,4 +66,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_udld sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_udld sanity test" diff --git a/test/integration/targets/nxos_udld_interface/tasks/cli.yaml b/test/integration/targets/nxos_udld_interface/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_udld_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_udld_interface/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_udld_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_udld_interface/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_udld_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_udld_interface/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_udld_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_udld_interface/tests/common/sanity.yaml index 2e1b5b7d00..981d48d705 100644 --- a/test/integration/targets/nxos_udld_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_udld_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_udld_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_udld_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - set_fact: udld_run="true" - set_fact: udld_run="false" @@ -71,4 +73,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_udld_interface sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_udld_interface sanity test" diff --git a/test/integration/targets/nxos_user/tasks/cli.yaml b/test/integration/targets/nxos_user/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_user/tasks/cli.yaml +++ b/test/integration/targets/nxos_user/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_user/tasks/nxapi.yaml b/test/integration/targets/nxos_user/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_user/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_user/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_user/tests/common/auth.yaml b/test/integration/targets/nxos_user/tests/common/auth.yaml index 7485d348b2..e748e6c3e8 100644 --- a/test/integration/targets/nxos_user/tests/common/auth.yaml +++ b/test/integration/targets/nxos_user/tests/common/auth.yaml @@ -10,13 +10,13 @@ - name: test login expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAuthentication=no show version" + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAuthentication=no show version" responses: (?i)password: "pass123" - name: test login with invalid password (should fail) expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAuthentication=no show version" + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PubkeyAuthentication=no show version" responses: (?i)password: "badpass" ignore_errors: yes diff --git a/test/integration/targets/nxos_vlan/tasks/cli.yaml b/test/integration/targets/nxos_vlan/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vlan/tasks/cli.yaml +++ b/test/integration/targets/nxos_vlan/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vlan/tasks/nxapi.yaml b/test/integration/targets/nxos_vlan/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vlan/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vlan/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vlan/tests/common/sanity.yaml b/test/integration/targets/nxos_vlan/tests/common/sanity.yaml index a66691ea5f..50237efec0 100644 --- a/test/integration/targets/nxos_vlan/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vlan/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vlan sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vlan sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: "Enable feature vn segment" @@ -102,4 +104,4 @@ ignore_errors: yes when: platform is search('N9K') -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vlan sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vlan sanity test" diff --git a/test/integration/targets/nxos_vpc/tasks/cli.yaml b/test/integration/targets/nxos_vpc/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vpc/tasks/cli.yaml +++ b/test/integration/targets/nxos_vpc/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vpc/tasks/nxapi.yaml b/test/integration/targets/nxos_vpc/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_vpc/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vpc/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vpc/tests/common/sanity.yaml b/test/integration/targets/nxos_vpc/tests/common/sanity.yaml index f67b659874..08d969bcfb 100644 --- a/test/integration/targets/nxos_vpc/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vpc/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vpc sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vpc sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: enable feature vpc @@ -78,4 +80,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vpc sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vpc sanity test" diff --git a/test/integration/targets/nxos_vpc_interface/tasks/cli.yaml b/test/integration/targets/nxos_vpc_interface/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vpc_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_vpc_interface/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vpc_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_vpc_interface/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_vpc_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vpc_interface/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vpc_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_vpc_interface/tests/common/sanity.yaml index 5a21e73060..fa05b915e4 100644 --- a/test/integration/targets/nxos_vpc_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vpc_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vpc_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vpc_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: enable feature vpc @@ -99,4 +101,4 @@ state: disabled provider: "{{ connection }}" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vpc_interface sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vpc_interface sanity test" diff --git a/test/integration/targets/nxos_vrf/tasks/cli.yaml b/test/integration/targets/nxos_vrf/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vrf/tasks/cli.yaml +++ b/test/integration/targets/nxos_vrf/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrf/tasks/nxapi.yaml b/test/integration/targets/nxos_vrf/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vrf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrf/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrf/tests/common/sanity.yaml b/test/integration/targets/nxos_vrf/tests/common/sanity.yaml index 04e9dfd461..a40f851ea6 100644 --- a/test/integration/targets/nxos_vrf/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vrf/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrf sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vrf sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: Ensure ntc VRF exists on switch @@ -46,4 +48,4 @@ - assert: *false -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrf sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vrf sanity test" diff --git a/test/integration/targets/nxos_vrf_af/tasks/cli.yaml b/test/integration/targets/nxos_vrf_af/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vrf_af/tasks/cli.yaml +++ b/test/integration/targets/nxos_vrf_af/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrf_af/tasks/nxapi.yaml b/test/integration/targets/nxos_vrf_af/tasks/nxapi.yaml index 148d8d6486..68e96a2942 100644 --- a/test/integration/targets/nxos_vrf_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrf_af/tasks/nxapi.yaml @@ -1,15 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml b/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml index d3f8efbe23..1f88064d06 100644 --- a/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrf_af sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vrf_af sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - name: Configure feature bgp nxos_feature: @@ -77,4 +79,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrf_af sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vrf_af sanity test" diff --git a/test/integration/targets/nxos_vrf_interface/tasks/cli.yaml b/test/integration/targets/nxos_vrf_interface/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vrf_interface/tasks/cli.yaml +++ b/test/integration/targets/nxos_vrf_interface/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrf_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_vrf_interface/tests/common/sanity.yaml index 9bfe740f09..56e6ee20b7 100644 --- a/test/integration/targets/nxos_vrf_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vrf_interface/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrf_interface sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vrf_interface sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -58,4 +60,4 @@ match: none ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrf_interface sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vrf_interface sanity test" diff --git a/test/integration/targets/nxos_vrrp/tasks/cli.yaml b/test/integration/targets/nxos_vrrp/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vrrp/tasks/cli.yaml +++ b/test/integration/targets/nxos_vrrp/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrrp/tasks/nxapi.yaml b/test/integration/targets/nxos_vrrp/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vrrp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrrp/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vrrp/tests/common/sanity.yaml b/test/integration/targets/nxos_vrrp/tests/common/sanity.yaml index 7932994162..ae915ff573 100644 --- a/test/integration/targets/nxos_vrrp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vrrp/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrrp sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vrrp sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: "Enable interface-vlan" @@ -104,4 +106,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrrp sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vrrp sanity test" diff --git a/test/integration/targets/nxos_vtp_domain/tasks/cli.yaml b/test/integration/targets/nxos_vtp_domain/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vtp_domain/tasks/cli.yaml +++ b/test/integration/targets/nxos_vtp_domain/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml b/test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vtp_domain/tests/common/sanity.yaml b/test/integration/targets/nxos_vtp_domain/tests/common/sanity.yaml index df0afcbe0d..6bbbd8f245 100644 --- a/test/integration/targets/nxos_vtp_domain/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vtp_domain/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vtp_domain sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vtp_domain sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: enable feature vtp @@ -33,4 +35,4 @@ state: disabled provider: "{{ connection }}" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vtp_domain sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vtp_domain sanity test" diff --git a/test/integration/targets/nxos_vtp_password/tasks/cli.yaml b/test/integration/targets/nxos_vtp_password/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vtp_password/tasks/cli.yaml +++ b/test/integration/targets/nxos_vtp_password/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml b/test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vtp_password/tests/common/sanity.yaml b/test/integration/targets/nxos_vtp_password/tests/common/sanity.yaml index b35a876dc3..ac02691c4c 100644 --- a/test/integration/targets/nxos_vtp_password/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vtp_password/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vtp_password sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vtp_password sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: enable feature vtp @@ -54,4 +56,4 @@ state: disabled provider: "{{ connection }}" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vtp_password sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vtp_password sanity test" diff --git a/test/integration/targets/nxos_vtp_version/tasks/cli.yaml b/test/integration/targets/nxos_vtp_version/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vtp_version/tasks/cli.yaml +++ b/test/integration/targets/nxos_vtp_version/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml b/test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vtp_version/tests/common/sanity.yaml b/test/integration/targets/nxos_vtp_version/tests/common/sanity.yaml index 7b5b0c0c52..79801ab1b6 100644 --- a/test/integration/targets/nxos_vtp_version/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vtp_version/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vtp_version sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vtp_version sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: enable feature vtp @@ -33,4 +35,4 @@ state: disabled provider: "{{ connection }}" -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vtp_version sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vtp_version sanity test" diff --git a/test/integration/targets/nxos_vxlan_vtep/tasks/cli.yaml b/test/integration/targets/nxos_vxlan_vtep/tasks/cli.yaml index 0ab3f8f908..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vxlan_vtep/tasks/cli.yaml +++ b/test/integration/targets/nxos_vxlan_vtep/tasks/cli.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" + connection: local register: cli_cases - set_fact: @@ -18,8 +20,14 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ cli }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml b/test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml index 378db2f016..68e96a2942 100644 --- a/test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml @@ -3,12 +3,14 @@ find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" + connection: local register: test_cases - name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" + connection: local register: nxapi_cases - set_fact: @@ -18,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }} connection={{ nxapi }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vxlan_vtep/tests/common/sanity.yaml b/test/integration/targets/nxos_vxlan_vtep/tests/common/sanity.yaml index d93193a4b6..0b58c9aa59 100644 --- a/test/integration/targets/nxos_vxlan_vtep/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vxlan_vtep/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- - debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep sanity test" +- - debug: msg="START connection={{ ansible_connection }} nxos_vxlan_vtep sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: "Apply N7K specific setup config" @@ -102,4 +104,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vxlan_vtep sanity test" diff --git a/test/integration/targets/nxos_vxlan_vtep_vni/tasks/cli.yaml b/test/integration/targets/nxos_vxlan_vtep_vni/tasks/cli.yaml index d675462dd0..edbff7dfaf 100644 --- a/test/integration/targets/nxos_vxlan_vtep_vni/tasks/cli.yaml +++ b/test/integration/targets/nxos_vxlan_vtep_vni/tasks/cli.yaml @@ -1,15 +1,33 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect cli test cases find: paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run + +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_vxlan_vtep_vni/tasks/nxapi.yaml b/test/integration/targets/nxos_vxlan_vtep_vni/tasks/nxapi.yaml index ea525379f7..68e96a2942 100644 --- a/test/integration/targets/nxos_vxlan_vtep_vni/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vxlan_vtep_vni/tasks/nxapi.yaml @@ -1,28 +1,27 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases + find: + paths: "{{ role_path }}/tests/common" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: collect nxapi test cases find: paths: "{{ role_path }}/tests/nxapi" patterns: "{{ testcase }}.yaml" - register: test_cases + connection: local + 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 }}" -- name: enable nxapi - nxos_config: - lines: - - feature nxapi - - nxapi http port 80 - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable nxapi - nxos_config: - lines: - - no feature nxapi - provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_vxlan_vtep_vni/tests/common/sanity.yaml b/test/integration/targets/nxos_vxlan_vtep_vni/tests/common/sanity.yaml index d697435aff..5e23211544 100644 --- a/test/integration/targets/nxos_vxlan_vtep_vni/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vxlan_vtep_vni/tests/common/sanity.yaml @@ -1,5 +1,7 @@ --- -- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep_vni sanity test" +- debug: msg="START connection={{ ansible_connection }} nxos_vxlan_vtep_vni sanity test" +- debug: msg="Using provider={{ connection.transport }}" + when: ansible_connection == "local" - block: - name: "Apply N7K specific setup config" @@ -134,4 +136,4 @@ provider: "{{ connection }}" ignore_errors: yes -- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep_vni sanity test" +- debug: msg="END connection={{ ansible_connection }} nxos_vxlan_vtep_vni sanity test" diff --git a/test/integration/targets/prepare_nxos_tests/tasks/main.yml b/test/integration/targets/prepare_nxos_tests/tasks/main.yml index 4cac78218e..c21688e195 100644 --- a/test/integration/targets/prepare_nxos_tests/tasks/main.yml +++ b/test/integration/targets/prepare_nxos_tests/tasks/main.yml @@ -3,12 +3,12 @@ nxos_config: lines: - feature nxapi - provider: "{{ cli }}" + connection: network_cli ignore_errors: yes - name: Set nxapi to default state nxos_nxapi: - provider: "{{ cli }}" + connection: network_cli # Gather the list of interfaces on this device and make the list # available for integration tests that need them. @@ -23,8 +23,8 @@ - name: "Collect interface list" nxos_command: commands: ['show interface brief | json'] - provider: "{{ nxapi }}" timeout: 60 + connection: network_cli register: intout - set_fact: intdataraw="{{ intout.stdout_lines[0]['TABLE_interface']['ROW_interface'] }}" @@ -36,7 +36,7 @@ - name: "Gather image version info" nxos_command: commands: ['sh version | json'] - provider: "{{ cli }}" + connection: network_cli register: nxos_version_output - set_fact: image_version="{{ nxos_version_output.stdout[0]['kickstart_ver_str'] }}" @@ -51,7 +51,7 @@ - name: "Gather platform info" nxos_command: commands: ['sh inventory | json'] - provider: "{{ cli }}" + connection: network_cli register: nxos_inventory_output - set_fact: platform="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[0] }}"