From e9d7fa04181e91effad9fbfa2026e3994d695776 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Thu, 17 May 2018 18:47:15 -0400 Subject: [PATCH] HTTP(S) API connection plugin (#39224) * HTTPAPI connection * Punt run_commands to cliconf or httpapi * Fake enable_mode on eapi * Pull changes to nxos * Move load_config to edit_config for future-preparedness * Don't fail on lldp disabled * Re-enable check_rc on nxos' run_commands * Reorganize nxos httpapi plugin for compatibility * draft docs for connection: httpapi * restores docs for connection:local for eapi * Add _remote_is_local to httpapi --- .../getting_started/network_differences.rst | 37 ++- .../rst/network/user_guide/platform_eos.rst | 92 ++++-- .../rst/network/user_guide/platform_index.rst | 2 +- .../rst/network/user_guide/platform_nxos.rst | 17 +- docs/docsite/rst/user_guide/become.rst | 17 +- lib/ansible/config/base.yml | 8 + lib/ansible/module_utils/network/eos/eos.py | 62 +--- lib/ansible/module_utils/network/nxos/nxos.py | 41 +-- lib/ansible/modules/network/eos/eos_facts.py | 3 +- lib/ansible/plugins/action/eos.py | 6 +- lib/ansible/plugins/action/nxos.py | 9 +- lib/ansible/plugins/cliconf/eos.py | 91 ++++++ lib/ansible/plugins/cliconf/nxos.py | 55 ++++ lib/ansible/plugins/connection/httpapi.py | 303 ++++++++++++++++++ lib/ansible/plugins/httpapi/__init__.py | 0 lib/ansible/plugins/httpapi/eos.py | 158 +++++++++ lib/ansible/plugins/httpapi/nxos.py | 135 ++++++++ lib/ansible/plugins/loader.py | 7 + .../targets/eos_banner/tasks/cli.yaml | 6 - .../targets/eos_banner/tasks/eapi.yaml | 4 +- .../eos_banner/tests/cli/basic-login.yaml | 7 +- .../eos_banner/tests/eapi/basic-login.yaml | 10 +- .../eos_banner/tests/eapi/basic-motd.yaml | 6 +- .../eos_banner/tests/eapi/net_banner.yaml | 3 +- .../targets/eos_command/tasks/cli.yaml | 6 - .../targets/eos_command/tasks/eapi.yaml | 4 +- .../eos_command/tests/cli/bad_operator.yaml | 1 - .../eos_command/tests/cli/contains.yaml | 3 +- .../targets/eos_command/tests/cli/equal.yaml | 2 - .../eos_command/tests/cli/greaterthan.yaml | 2 - .../tests/cli/greaterthanorequal.yaml | 2 - .../eos_command/tests/cli/invalid.yaml | 2 - .../eos_command/tests/cli/lessthan.yaml | 2 - .../tests/cli/lessthanorequal.yaml | 2 - .../eos_command/tests/cli/notequal.yaml | 2 - .../targets/eos_command/tests/cli/output.yaml | 2 - .../eos_command/tests/cli/timeout.yaml | 1 - .../eos_command/tests/eapi/bad_operator.yaml | 1 - .../eos_command/tests/eapi/contains.yaml | 11 +- .../targets/eos_command/tests/eapi/equal.yaml | 10 +- .../eos_command/tests/eapi/greaterthan.yaml | 12 +- .../tests/eapi/greaterthanorequal.yaml | 10 +- .../eos_command/tests/eapi/invalid.yaml | 2 - .../eos_command/tests/eapi/lessthan.yaml | 14 +- .../tests/eapi/lessthanorequal.yaml | 14 +- .../eos_command/tests/eapi/notequal.yaml | 10 +- .../eos_command/tests/eapi/output.yaml | 2 - .../eos_command/tests/eapi/timeout.yaml | 1 - .../targets/eos_config/tasks/cli.yaml | 6 - .../targets/eos_config/tasks/eapi.yaml | 4 +- .../targets/eos_config/tests/cli/backup.yaml | 2 - .../eos_config/tests/cli/check_mode.yaml | 5 - .../targets/eos_config/tests/cli/config.yaml | 6 - .../eos_config/tests/cli/defaults.yaml | 3 - .../targets/eos_config/tests/cli/save.yaml | 3 - .../eos_config/tests/cli/src_basic.yaml | 3 - .../eos_config/tests/cli/src_invalid.yaml | 1 - .../eos_config/tests/cli/src_match_none.yaml | 3 - .../eos_config/tests/cli/sublevel.yaml | 4 - .../eos_config/tests/cli/sublevel_block.yaml | 4 - .../eos_config/tests/cli/sublevel_exact.yaml | 4 - .../eos_config/tests/cli/sublevel_strict.yaml | 4 - .../eos_config/tests/cli/toplevel.yaml | 4 - .../eos_config/tests/cli/toplevel_after.yaml | 4 - .../eos_config/tests/cli/toplevel_before.yaml | 4 - .../targets/eos_config/tests/eapi/backup.yaml | 12 +- .../eos_config/tests/eapi/defaults.yaml | 3 - .../targets/eos_config/tests/eapi/save.yaml | 3 - .../eos_config/tests/eapi/src_basic.yaml | 3 - .../eos_config/tests/eapi/src_invalid.yaml | 1 - .../eos_config/tests/eapi/src_match_none.yaml | 3 - .../eos_config/tests/eapi/sublevel.yaml | 4 - .../eos_config/tests/eapi/sublevel_block.yaml | 4 - .../eos_config/tests/eapi/sublevel_exact.yaml | 4 - .../tests/eapi/sublevel_strict.yaml | 4 - .../eos_config/tests/eapi/toplevel.yaml | 4 - .../eos_config/tests/eapi/toplevel_after.yaml | 4 - .../tests/eapi/toplevel_before.yaml | 4 - .../targets/eos_facts/tasks/cli.yaml | 6 - .../targets/eos_facts/tasks/eapi.yaml | 4 +- .../eos_facts/tests/cli/all_facts.yaml | 1 - .../eos_facts/tests/cli/default_facts.yaml | 1 - .../eos_facts/tests/cli/invalid_subset.yaml | 2 - .../eos_facts/tests/cli/not_hardware.yaml | 1 - .../eos_facts/tests/eapi/all_facts.yaml | 3 - .../eos_facts/tests/eapi/default_facts.yaml | 3 - .../eos_facts/tests/eapi/invalid_subset.yaml | 2 - .../eos_facts/tests/eapi/not_hardware.yaml | 3 - .../targets/eos_interface/tasks/eapi.yaml | 4 +- .../targets/eos_l2_interface/tasks/eapi.yaml | 4 +- .../targets/eos_l3_interface/tasks/eapi.yaml | 4 +- .../targets/eos_lldp/tasks/eapi.yaml | 4 +- .../targets/eos_logging/tasks/eapi.yaml | 4 +- .../targets/eos_smoke/tasks/cli.yaml | 2 +- .../targets/eos_smoke/tasks/eapi.yaml | 6 + .../eos_smoke/tests/cli/common_config.yaml | 111 +++---- .../eos_smoke/tests/eapi/common_config.yaml | 103 +++--- .../eos_smoke/tests/eapi/misc_tests.yaml | 26 -- .../targets/eos_system/tasks/eapi.yaml | 4 +- .../targets/eos_user/tasks/eapi.yaml | 4 +- .../targets/nxos_aaa_server/tasks/nxapi.yaml | 6 +- .../nxos_aaa_server/tests/common/radius.yaml | 5 - .../nxos_aaa_server/tests/common/tacacs.yaml | 7 - .../nxos_aaa_server_host/tasks/nxapi.yaml | 6 +- .../tests/common/radius.yaml | 8 - .../tests/common/tacacs.yaml | 10 - .../targets/nxos_acl/tasks/nxapi.yaml | 6 +- .../targets/nxos_acl/tests/common/sanity.yaml | 10 - .../nxos_acl_interface/tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 8 - .../targets/nxos_banner/tasks/nxapi.yaml | 6 +- .../nxos_banner/tests/cli/basic-exec.yaml | 2 - .../nxos_banner/tests/cli/basic-motd.yaml | 2 - .../nxos_banner/tests/cli/basic-no-motd.yaml | 2 - .../nxos_banner/tests/nxapi/basic-exec.yaml | 2 - .../nxos_banner/tests/nxapi/basic-motd.yaml | 2 - .../tests/nxapi/basic-no-motd.yaml | 2 - .../targets/nxos_become/tasks/nxapi.yaml | 6 +- .../targets/nxos_become/tests/cli/sanity.yaml | 3 - .../targets/nxos_bgp/tasks/nxapi.yaml | 6 +- .../nxos_bgp/tests/common/dis_policy.yaml | 5 - .../targets/nxos_bgp/tests/common/hels.yaml | 5 - .../nxos_bgp/tests/common/isolate.yaml | 5 - .../targets/nxos_bgp/tests/common/param.yaml | 15 - .../targets/nxos_bgp/tests/common/sanity.yaml | 6 - .../nxos_bgp/tests/common/supp_fib.yaml | 7 - .../targets/nxos_bgp_af/tasks/nxapi.yaml | 6 +- .../nxos_bgp_af/tests/common/sanity.yaml | 17 - .../nxos_bgp_neighbor/tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 13 - .../nxos_bgp_neighbor_af/tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 14 - .../targets/nxos_command/tasks/cli.yaml | 10 +- .../targets/nxos_command/tasks/nxapi.yaml | 6 +- .../nxos_command/tests/cli/sanity.yaml | 13 +- .../tests/{cli => common}/bad_operator.yaml | 5 +- .../tests/{cli => common}/contains.yaml | 5 +- .../tests/{cli => common}/equal.yaml | 6 +- .../tests/{cli => common}/greaterthan.yaml | 6 +- .../{cli => common}/greaterthanorequal.yaml | 6 +- .../tests/{cli => common}/invalid.yaml | 6 +- .../tests/{cli => common}/lessthan.yaml | 6 +- .../{cli => common}/lessthanorequal.yaml | 6 +- .../nxos_command/tests/common/negative.yaml | 29 -- .../tests/{cli => common}/notequal.yaml | 6 +- .../tests/{cli => common}/output.yaml | 6 +- .../tests/{cli => common}/timeout.yaml | 5 +- .../tests/nxapi/bad_operator.yaml | 20 -- .../nxos_command/tests/nxapi/contains.yaml | 20 -- .../nxos_command/tests/nxapi/equal.yaml | 34 -- .../nxos_command/tests/nxapi/greaterthan.yaml | 34 -- .../tests/nxapi/greaterthanorequal.yaml | 34 -- .../nxos_command/tests/nxapi/invalid.yaml | 30 -- .../nxos_command/tests/nxapi/lessthan.yaml | 34 -- .../tests/nxapi/lessthanorequal.yaml | 34 -- .../nxos_command/tests/nxapi/notequal.yaml | 34 -- .../nxos_command/tests/nxapi/output.yaml | 28 -- .../nxos_command/tests/nxapi/sanity.yaml | 17 +- .../nxos_command/tests/nxapi/timeout.yaml | 20 -- .../targets/nxos_config/tasks/cli.yaml | 8 +- .../targets/nxos_config/tasks/nxapi.yaml | 6 +- .../nxos_config/tests/cli/multilevel.yaml | 6 - .../nxos_config/tests/cli/sublevel.yaml | 4 - .../nxos_config/tests/cli/sublevel_exact.yaml | 4 - .../tests/cli/sublevel_strict.yaml | 4 - .../nxos_config/tests/cli/toplevel_after.yaml | 4 - .../tests/cli/toplevel_before.yaml | 4 - .../nxos_config/tests/common/backup.yaml | 8 +- .../nxos_config/tests/common/defaults.yaml | 9 +- .../nxos_config/tests/common/sanity.yaml | 14 +- .../nxos_config/tests/common/save.yaml | 9 +- .../nxos_config/tests/common/src_basic.yaml | 9 +- .../nxos_config/tests/common/src_invalid.yaml | 7 +- .../tests/common/src_match_none.yaml | 9 +- .../tests/common/sublevel_block.yaml | 9 +- .../nxos_config/tests/common/toplevel.yaml | 10 +- .../tests/common/toplevel_nonidempotent.yaml | 10 +- .../nxos_config/tests/nxapi/multilevel.yaml | 4 - .../nxos_config/tests/nxapi/sublevel.yaml | 4 - .../tests/nxapi/sublevel_exact.yaml | 4 - .../tests/nxapi/sublevel_strict.yaml | 4 - .../tests/nxapi/toplevel_after.yaml | 4 - .../tests/nxapi/toplevel_before.yaml | 4 - .../targets/nxos_evpn_global/tasks/nxapi.yaml | 6 +- .../nxos_evpn_global/tests/common/sanity.yaml | 5 - .../targets/nxos_evpn_vni/tasks/nxapi.yaml | 6 +- .../nxos_evpn_vni/tests/common/sanity.yaml | 8 - .../targets/nxos_facts/tasks/nxapi.yaml | 6 +- .../nxos_facts/tests/common/all_facts.yaml | 1 - .../tests/common/default_facts.yaml | 1 - .../tests/common/invalid_subset.yaml | 2 - .../nxos_facts/tests/common/not_hardware.yaml | 1 - .../nxos_facts/tests/common/sanity.yaml | 3 - .../targets/nxos_feature/tasks/cli.yaml | 8 +- .../targets/nxos_feature/tasks/nxapi.yaml | 6 +- .../nxos_feature/tests/common/configure.yaml | 8 - .../nxos_feature/tests/common/invalid.yaml | 3 - .../targets/nxos_file_copy/tasks/nxapi.yaml | 6 +- .../nxos_file_copy/tests/cli/sanity.yaml | 5 - .../nxos_file_copy/tests/nxapi/sanity.yaml | 5 - .../targets/nxos_gir/tasks/nxapi.yaml | 6 +- .../targets/nxos_gir/tests/common/sanity.yaml | 4 - .../tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 6 - .../targets/nxos_hsrp/tasks/nxapi.yaml | 6 +- .../nxos_hsrp/tests/common/sanity.yaml | 9 - .../targets/nxos_igmp/tasks/nxapi.yaml | 6 +- .../nxos_igmp/tests/common/sanity.yaml | 3 - .../nxos_igmp_interface/tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 12 - .../nxos_igmp_snooping/tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 3 - .../targets/nxos_interface/tasks/nxapi.yaml | 6 +- .../nxos_interface/tests/common/intent.yaml | 5 - .../nxos_interface/tests/common/sanity.yaml | 8 - .../tests/common/set_state_absent.yaml | 3 - .../tests/common/set_state_present.yaml | 3 - .../nxos_interface/tests/common/sub_int.yaml | 2 - .../nxos_interface_ospf/tasks/nxapi.yaml | 6 +- .../tests/common/sanity.yaml | 17 - .../nxos_ip_interface/tasks/nxapi.yaml | 6 +- .../nxos_ip_interface/tests/cli/sanity.yaml | 8 - .../nxos_ip_interface/tests/nxapi/sanity.yaml | 8 - .../nxos_l2_interface/tasks/nxapi.yaml | 6 +- .../nxos_l2_interface/tests/common/agg.yaml | 6 - .../tests/common/sanity.yaml | 10 - .../nxos_l3_interface/tasks/nxapi.yaml | 6 +- .../nxos_l3_interface/tests/cli/sanity.yaml | 7 - .../nxos_l3_interface/tests/nxapi/sanity.yaml | 6 - .../targets/nxos_linkagg/tasks/nxapi.yaml | 6 +- .../nxos_linkagg/tests/common/sanity.yaml | 12 - .../targets/nxos_lldp/tasks/nxapi.yaml | 8 +- .../targets/nxos_lldp/tests/cli/sanity.yaml | 5 - .../targets/nxos_lldp/tests/nxapi/sanity.yaml | 5 - .../targets/nxos_logging/tasks/nxapi.yaml | 6 +- .../nxos_logging/tests/common/basic.yaml | 6 - .../tests/common/net_logging.yaml | 3 - .../targets/nxos_ntp/tasks/nxapi.yaml | 6 +- .../targets/nxos_ntp_auth/tasks/nxapi.yaml | 6 +- .../targets/nxos_ntp_options/tasks/nxapi.yaml | 6 +- .../targets/nxos_nxapi/tasks/cli.yaml | 6 - .../targets/nxos_nxapi/tasks/nxapi.yaml | 8 +- .../targets/nxos_ospf/tasks/nxapi.yaml | 6 +- .../targets/nxos_ospf_vrf/tasks/nxapi.yaml | 6 +- .../nxos_overlay_global/tasks/nxapi.yaml | 6 +- .../targets/nxos_pim/tasks/nxapi.yaml | 6 +- .../nxos_pim_interface/tasks/nxapi.yaml | 6 +- .../nxos_pim_rp_address/tasks/nxapi.yaml | 6 +- .../targets/nxos_portchannel/tasks/nxapi.yaml | 6 +- .../targets/nxos_rollback/tasks/nxapi.yaml | 6 +- .../targets/nxos_smoke/tasks/cli.yaml | 4 +- .../targets/nxos_smoke/tasks/nxapi.yaml | 6 + .../targets/nxos_snapshot/tasks/nxapi.yaml | 6 +- .../nxos_snmp_community/tasks/nxapi.yaml | 6 +- .../nxos_snmp_contact/tasks/nxapi.yaml | 6 +- .../targets/nxos_snmp_host/tasks/nxapi.yaml | 6 +- .../nxos_snmp_location/tasks/nxapi.yaml | 6 +- .../targets/nxos_snmp_traps/tasks/nxapi.yaml | 6 +- .../targets/nxos_snmp_user/tasks/nxapi.yaml | 6 +- .../nxos_static_route/tasks/nxapi.yaml | 6 +- .../targets/nxos_switchport/tasks/nxapi.yaml | 6 +- .../targets/nxos_system/tasks/nxapi.yaml | 6 +- .../targets/nxos_udld/tasks/nxapi.yaml | 6 +- .../nxos_udld_interface/tasks/nxapi.yaml | 6 +- .../targets/nxos_user/tasks/nxapi.yaml | 6 +- .../targets/nxos_vlan/tasks/nxapi.yaml | 6 +- .../targets/nxos_vpc/tasks/nxapi.yaml | 6 +- .../nxos_vpc_interface/tasks/nxapi.yaml | 6 +- .../targets/nxos_vrf/tasks/nxapi.yaml | 6 +- .../targets/nxos_vrf_af/tasks/nxapi.yaml | 6 +- .../nxos_vrf_interface/tasks/nxapi.yaml | 6 +- .../targets/nxos_vrrp/tasks/nxapi.yaml | 6 +- .../targets/nxos_vtp_domain/tasks/nxapi.yaml | 6 +- .../nxos_vtp_password/tasks/nxapi.yaml | 6 +- .../targets/nxos_vtp_version/tasks/nxapi.yaml | 6 +- .../targets/nxos_vxlan_vtep/tasks/nxapi.yaml | 6 +- .../nxos_vxlan_vtep_vni/tasks/nxapi.yaml | 6 +- 277 files changed, 1325 insertions(+), 1676 deletions(-) create mode 100644 lib/ansible/plugins/connection/httpapi.py create mode 100644 lib/ansible/plugins/httpapi/__init__.py create mode 100644 lib/ansible/plugins/httpapi/eos.py create mode 100644 lib/ansible/plugins/httpapi/nxos.py delete mode 100644 test/integration/targets/eos_smoke/tests/eapi/misc_tests.yaml rename test/integration/targets/nxos_command/tests/{cli => common}/bad_operator.yaml (65%) rename test/integration/targets/nxos_command/tests/{cli => common}/contains.yaml (66%) rename test/integration/targets/nxos_command/tests/{cli => common}/equal.yaml (77%) rename test/integration/targets/nxos_command/tests/{cli => common}/greaterthan.yaml (76%) rename test/integration/targets/nxos_command/tests/{cli => common}/greaterthanorequal.yaml (75%) rename test/integration/targets/nxos_command/tests/{cli => common}/invalid.yaml (70%) rename test/integration/targets/nxos_command/tests/{cli => common}/lessthan.yaml (77%) rename test/integration/targets/nxos_command/tests/{cli => common}/lessthanorequal.yaml (75%) delete mode 100644 test/integration/targets/nxos_command/tests/common/negative.yaml rename test/integration/targets/nxos_command/tests/{cli => common}/notequal.yaml (79%) rename test/integration/targets/nxos_command/tests/{cli => common}/output.yaml (69%) rename test/integration/targets/nxos_command/tests/{cli => common}/timeout.yaml (62%) delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/bad_operator.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/contains.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/equal.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/greaterthan.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/greaterthanorequal.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/invalid.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/lessthan.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/lessthanorequal.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/notequal.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/output.yaml delete mode 100644 test/integration/targets/nxos_command/tests/nxapi/timeout.yaml diff --git a/docs/docsite/rst/network/getting_started/network_differences.rst b/docs/docsite/rst/network/getting_started/network_differences.rst index 832ba37649..962b7102d2 100644 --- a/docs/docsite/rst/network/getting_started/network_differences.rst +++ b/docs/docsite/rst/network/getting_started/network_differences.rst @@ -11,11 +11,7 @@ Execution on the Control Node Unlike most Ansible modules, network modules do not run on the managed nodes. From a user's point of view, network modules work like any other modules. They work with ad-hoc commands, playbooks, and roles. Behind the scenes, however, network modules use a different methodology than the other (Linux/Unix and Windows) modules use. Ansible is written and executed in Python. Because the majority of network devices can not run Python, the Ansible network modules are executed on the Ansible control node, where ``ansible`` or ``ansible-playbook`` runs. -Execution on the control node shapes two other differences in how network modules function: - -- Network modules do not run every task in a playbook. They request current config first, compare current config to the state described by the task or playbook, and execute a task only if it changes the state of the managed node. - -- Network modules that offer a backup option write the backup files onto the control node. With Linux/Unix modules, where a configuration file already exists on the managed node(s), the backup file gets written by default in the same directory as the new, changed file. Network modules do not update configuration files on the managed nodes, because network configuration is not written in files. Network modules write backup files on the control node, in the `backup` directory under the playbook root directory. +Network modules also use the control node as a destination for backup files, for those modules that offer a ``backup`` option. With Linux/Unix modules, where a configuration file already exists on the managed node(s), the backup file gets written by default in the same directory as the new, changed file. Network modules do not update configuration files on the managed nodes, because network configuration is not written in files. Network modules write backup files on the control node, usually in the `backup` directory under the playbook root directory. Multiple Communication Protocols ================================================================================ @@ -23,14 +19,15 @@ Multiple Communication Protocols Because network modules execute on the control node instead of on the managed nodes, they can support multiple communication protocols. The communication protocol (XML over SSH, CLI over SSH, API over HTTPS) selected for each network module depends on the platform and the purpose of the module. Some network modules support only one protocol; some offer a choice. The most common protocol is CLI over SSH. You set the communication protocol with the ``ansible_connection`` variable: .. csv-table:: - :header: "Value of ansible_connection", "Protocol", "Requires" - :widths: 30, 10, 10 + :header: "Value of ansible_connection", "Protocol", "Requires", "Persistent?" + :widths: 30, 10, 10, 10 - "network_cli", "CLI over SSH", "network_os setting" - "netconf", "XML over SSH", "network_os setting" - "local", "depends on provider", "provider setting" + "network_cli", "CLI over SSH", "network_os setting", "yes" + "netconf", "XML over SSH", "network_os setting", "yes" + "httpapi", "API over HTTP/HTTPS", "network_os setting", "yes" + "local", "depends on provider", "provider setting", "no" -Beginning with Ansible 2.5, we recommend using ``network_cli`` or ``netconf`` for ``ansible_connection`` whenever possible. For details on using API over HTTPS connections, see the :ref:`platform-specific ` pages. +Beginning with Ansible 2.6, we recommend using one of the persistent connection types listed above instead of ``local``. With persistent connections, you can define the hosts and credentials only once, rather than in every task. For more details on using each connection type on various platforms, see the :ref:`platform-specific ` pages. Modules Organized by Network Platform @@ -46,12 +43,15 @@ A network platform is a set of network devices with a common operating system th All modules within a network platform share certain requirements. Some network platforms have specific differences - see the :ref:`platform-specific ` documentation for details. -Privilege Escalation: `authorize` and `become` +Privilege Escalation: ``enable`` mode, ``become``, and ``authorize`` ================================================================================ -Several network platforms support privilege escalation, where certain tasks must be done by a privileged user. This is generally known as ``enable`` mode (the equivalent of ``sudo`` in \*nix administration). Ansible network modules offer privilege escalation for those network devices that support it. However, different platforms use privilege escalation in different ways. +Several network platforms support privilege escalation, where certain tasks must be done by a privileged user. On network devices this is called ``enable`` mode (the equivalent of ``sudo`` in \*nix administration). Ansible network modules offer privilege escalation for those network devices that support it. For details of which platforms support ``enable`` mode, with examples of how to use it, see the :ref:`platform-specific ` documentation. -Network platforms that support ``connection: network_cli`` and privilege escalation use the top-level Ansible parameter ``become: yes`` with ``become_method: enable``. For modules in these platforms, a ``group_vars`` file would look like: +Using ``become`` for privilege escalation +----------------------------------------- + +As of Ansible 2.6, you can use the top-level Ansible parameter ``become: yes`` with ``become_method: enable`` to run a task, play, or playbook with escalated privileges on any network platform that supports privilege escalation. You must use either ``connection: network_cli`` or ``connection: httpapi`` with ``become: yes`` with ``become_method: enable``. If you are using ``network_cli`` to connect Ansible to your network devices, a ``group_vars`` file would look like: .. code-block:: yaml @@ -60,9 +60,10 @@ Network platforms that support ``connection: network_cli`` and privilege escalat ansible_become: yes ansible_become_method: enable -We recommend using ``network_cli`` connections whenever possible. +Legacy playbooks: ``authorize`` for privilege escalation +----------------------------------------------------------------- -Some network platforms support privilege escalation but cannot use ``network_cli`` connections yet. This includes all platforms in older versions of Ansible (< 2.5) and HTTPS connections using ``eapi`` in version 2.5. With these connections, you must use a ``provider`` dictionary and include ``authorize: yes`` and ``auth_pass: my_enable_password``. For that use case, a ``group_vars`` file looks like: +If you are running Ansible 2.5 or older, some network platforms support privilege escalation but not ``network_cli`` or ``httpapi`` connections. This includes all platforms in versions 2.4 and older, and HTTPS connections using ``eapi`` in version 2.5. With a ``local`` connection, you must use a ``provider`` dictionary and include ``authorize: yes`` and ``auth_pass: my_enable_password``. For that use case, a ``group_vars`` file looks like: .. code-block:: yaml @@ -76,7 +77,7 @@ Some network platforms support privilege escalation but cannot use ``network_cli transport: eapi use_ssl: no -And you use the ``eapi`` variable in your play(s) or task(s): +And you use the ``eapi`` variable in your task(s): .. code-block:: yaml @@ -91,4 +92,6 @@ And you use the ``eapi`` variable in your play(s) or task(s): state: present provider: "{{ eapi }}" +Note that while Ansible 2.6 supports the use of ``connection: local`` with ``provider`` dictionaries, this usage will be deprecated in future and eventually removed. + For more information, see :ref:`Become and Networks` diff --git a/docs/docsite/rst/network/user_guide/platform_eos.rst b/docs/docsite/rst/network/user_guide/platform_eos.rst index dbff640de5..961e95c284 100644 --- a/docs/docsite/rst/network/user_guide/platform_eos.rst +++ b/docs/docsite/rst/network/user_guide/platform_eos.rst @@ -11,27 +11,35 @@ Arista EOS supports multiple connections. This page offers details on how each c Connections Available ================================================================================ -+---------------------------+-----------------------------------------------+-----------------------------------------+ -|.. | CLI | eAPI | -+===========================+===============================================+=========================================+ -| **Protocol** | SSH | HTTP(S) | -+---------------------------+-----------------------------------------------+-----------------------------------------+ -| | **Credentials** | | uses SSH keys / SSH-agent if present | | uses HTTPS certificates if present | -| | | | accepts ``-u myuser -k`` if using password | | | -+---------------------------+-----------------------------------------------+-----------------------------------------+ -| **Indirect Access** | via a bastion (jump host) | via a web proxy | -+---------------------------+-----------------------------------------------+-----------------------------------------+ -| | **Connection Settings** | | ``ansible_connection: network_cli`` | | ``ansible_connection: local`` | -| | | | | | Requires ``transport: eapi`` | -| | | | | | in the ``provider`` dictionary | -+---------------------------+-----------------------------------------------+-----------------------------------------+ -| | **Enable Mode** | | supported - use ``ansible_become: yes`` | | supported - use ``authorize: yes`` | -| | (Privilege Escalation) | | with ``ansible_become_method: enable`` | | and ``auth_pass:`` in the | -| | | | and ``ansible_become_pass:`` | | ``provider`` dictionary | -+---------------------------+-----------------------------------------------+-----------------------------------------+ -| **Returned Data Format** | ``stdout[0].`` | ``stdout[0].messages[0].`` | -+---------------------------+-----------------------------------------------+-----------------------------------------+ ++---------------------------+-----------------------------------------------+---------------------------------------------+ +|.. | CLI | eAPI | ++===========================+===============================================+=============================================+ +| **Protocol** | SSH | HTTP(S) | ++---------------------------+-----------------------------------------------+---------------------------------------------+ +| | **Credentials** | | uses SSH keys / SSH-agent if present | | uses HTTPS certificates if present | +| | | | accepts ``-u myuser -k`` if using password | | | ++---------------------------+-----------------------------------------------+---------------------------------------------+ +| **Indirect Access** | via a bastion (jump host) | via a web proxy | ++---------------------------+-----------------------------------------------+---------------------------------------------+ +| | **Connection Settings** | | ``ansible_connection: network_cli`` | | ``ansible_connection: httpapi`` | +| | | | | | OR | +| | | | | | ``ansible_connection: local`` | +| | | | | | with ``transport: eapi`` | +| | | | | | in the ``provider`` dictionary | ++---------------------------+-----------------------------------------------+---------------------------------------------+ +| | **Enable Mode** | | supported - use ``ansible_become: yes`` | | supported: | +| | (Privilege Escalation) | | with ``ansible_become_method: enable`` | | ``httpapi`` | +| | | | | | uses ``ansible_become: yes`` | +| | | | | | with ``ansible_become_method: enable`` | +| | | | | | ``local`` | +| | | | | | uses ``authorize: yes`` | +| | | | | | and ``auth_pass:`` | +| | | | | | in the ``provider`` dictionary | ++---------------------------+-----------------------------------------------+---------------------------------------------+ +| **Returned Data Format** | ``stdout[0].`` | ``stdout[0].messages[0].`` | ++---------------------------+-----------------------------------------------+---------------------------------------------+ +For legacy playbooks, EOS still supports ``ansible_connection: local``. We recommend modernizing to use ``ansible_connection: network_cli`` or ``ansible_connection: httpapi`` as soon as possible. Using CLI in Ansible 2.5 ================================================================================ @@ -86,13 +94,47 @@ Before you can use eAPI to connect to a switch, you must enable eAPI. To enable become_method: enable when: ansible_network_os == 'eos' -You can find more options for enabling HTTP/HTTPS and local http in the :ref:`eos_eapi ` module documentation. +You can find more options for enabling HTTP/HTTPS connections in the :ref:`eos_eapi ` module documentation. Once eAPI is enabled, change your ``group_vars/eos.yml`` to use the eAPI connection. Example eAPI ``group_vars/eos.yml`` ----------------------------------- +.. code-block:: yaml + + ansible_connection: httpapi + ansible_network_os: eos + ansible_user: myuser + ansible_ssh_pass: !vault... + become: yes + become_method: enable + proxy_env: + http_proxy: http://proxy.example.com:8080 + +- If you are accessing your host directly (not through a web proxy) you can remove the ``proxy_env`` configuration. +- If you are accessing your host through a web proxy using ``https``, change ``http_proxy`` to ``https_proxy``. + + +Example eAPI Task +----------------- + +.. code-block:: yaml + + - name: Backup current switch config (eos) + eos_config: + backup: yes + register: backup_eos_location + environment: "{{ proxy_env }}" + when: ansible_network_os == 'eos' + +In this example the ``proxy_env`` variable defined in ``group_vars`` gets passed to the ``environment`` option of the module in the task. + +eAPI examples with ``connection: local`` +----------------------------------------- + +``group_vars/eos.yml``: + .. code-block:: yaml ansible_connection: local @@ -107,12 +149,7 @@ Example eAPI ``group_vars/eos.yml`` proxy_env: http_proxy: http://proxy.example.com:8080 -- If you are accessing your host directly (not through a web proxy) you can remove the ``proxy_env`` configuration. -- If you are accessing your host through a web proxy using ``https``, change ``http_proxy`` to ``https_proxy``. - - -Example eAPI Task ------------------ +eAPI task: .. code-block:: yaml @@ -129,5 +166,4 @@ In this example two variables defined in ``group_vars`` get passed to the module - the ``eapi`` variable gets passed to the ``provider`` option of the module - the ``proxy_env`` variable gets passed to the ``environment`` option of the module - .. include:: shared_snippets/SSH_warning.rst diff --git a/docs/docsite/rst/network/user_guide/platform_index.rst b/docs/docsite/rst/network/user_guide/platform_index.rst index 0f15ddba62..58c7033aef 100644 --- a/docs/docsite/rst/network/user_guide/platform_index.rst +++ b/docs/docsite/rst/network/user_guide/platform_index.rst @@ -4,7 +4,7 @@ Platform Options **************** -Some Ansible Network platforms support multiple connection types, privilege escalation, or other options. The pages in this section offer standardized guides to understanding available options on each network platform. We welcome contributions from community-maintained platforms to this section. +Some Ansible Network platforms support multiple connection types, privilege escalation (``enable`` mode), or other options. The pages in this section offer standardized guides to understanding available options on each network platform. We welcome contributions from community-maintained platforms to this section. .. toctree:: :maxdepth: 2 diff --git a/docs/docsite/rst/network/user_guide/platform_nxos.rst b/docs/docsite/rst/network/user_guide/platform_nxos.rst index 69fb73a35f..f5f4360429 100644 --- a/docs/docsite/rst/network/user_guide/platform_nxos.rst +++ b/docs/docsite/rst/network/user_guide/platform_nxos.rst @@ -21,9 +21,7 @@ Connections Available +---------------------------+-----------------------------------------------+-----------------------------------------+ | **Indirect Access** | via a bastion (jump host) | via a web proxy | +---------------------------+-----------------------------------------------+-----------------------------------------+ -| | **Connection Settings** | | ``ansible_connection: network_cli`` | | ``ansible_connection: local`` | -| | | | | | Requires ``transport: nxapi`` | -| | | | | | in the ``provider`` dictionary | +| | **Connection Settings** | | ``ansible_connection: network_cli`` | | ``ansible_connection: httpapi`` | +---------------------------+-----------------------------------------------+-----------------------------------------+ | | **Enable Mode** | | supported - use ``ansible_become: yes`` | | not supported by NX-API | | | (Privilege Escalation) | | with ``ansible_become_method: enable`` | | | @@ -32,6 +30,7 @@ Connections Available | **Returned Data Format** | ``stdout[0].`` | ``stdout[0].messages[0].`` | +---------------------------+-----------------------------------------------+-----------------------------------------+ +For legacy playbooks, NXOS still supports ``ansible_connection: local``. We recommend modernizing to use ``ansible_connection: network_cli`` or ``ansible_connection: httpapi`` as soon as possible. Using CLI in Ansible 2.5 ================================================================================ @@ -93,13 +92,10 @@ Example NX-API ``group_vars/nxos.yml`` .. code-block:: yaml - ansible_connection: local + ansible_connection: httpapi ansible_network_os: nxos ansible_user: myuser ansible_ssh_pass: !vault... - nxapi: - host: "{{ inventory_hostname }}" - transport: nxapi proxy_env: http_proxy: http://proxy.example.com:8080 @@ -115,15 +111,10 @@ Example NX-API Task - name: Backup current switch config (nxos) nxos_config: backup: yes - provider: "{{ nxapi }}" register: backup_nxos_location environment: "{{ proxy_env }}" when: ansible_network_os == 'nxos' -In this example two variables defined in ``group_vars`` get passed to the module of the task: - -- the ``nxapi`` variable gets passed to the ``provider`` option of the module -- the ``proxy_env`` variable gets passed to the ``environment`` option of the module - +In this example the ``proxy_env`` variable defined in ``group_vars`` gets passed to the ``environment`` option of the module used in the task. .. include:: shared_snippets/SSH_warning.rst diff --git a/docs/docsite/rst/user_guide/become.rst b/docs/docsite/rst/user_guide/become.rst index f208b522a3..7f2587f8f9 100644 --- a/docs/docsite/rst/user_guide/become.rst +++ b/docs/docsite/rst/user_guide/become.rst @@ -213,15 +213,11 @@ module. Become and Networks =================== +As of version 2.6, Ansible supports ``become`` for privilege escalation (entering ``enable`` mode or privileged EXEC mode) on all :ref:`Ansible-maintained platforms` that support ``enable`` mode: `eos``, ``ios``, and ``nxos``. Using ``become`` replaces the ``authorize`` and ``auth_pass`` options in a ``provider`` dictionary. -network_cli and become ----------------------- +You must set the connection type to either ``connection: network_cli`` or ``connection: httpapi`` to use ``become`` for privilege escalation on network devices. Check the :ref:`platform_options` and :ref:`network_modules` documentation for details. -Ansible 2.5 added support for ``become`` to be used to enter ``enable`` mode (Privileged EXEC mode) on network devices that support it. This replaces the previous ``authorize`` and ``auth_pass`` options in ``provider``. - -You must set the host connection type to ``connection: network_cli`` to use ``become`` for privilege escalation on network devices. Ansible 2.5.3 supports ``become`` for privilege escalation on ``eos``, ``ios``, and ``nxos``. - -You can use escalated privileges on only the specific tasks that need them, on an entire play, or on all plays. Adding ``become: yes`` and ``become_method: enable`` instructs Ansible to enter ``enable`` mode before executing the task, play, or playbook. +You can use escalated privileges on only the specific tasks that need them, on an entire play, or on all plays. Adding ``become: yes`` and ``become_method: enable`` instructs Ansible to enter ``enable`` mode before executing the task, play, or playbook where those parameters are set. If you see this error message, the task that generated it requires ``enable`` mode to succeed: @@ -281,13 +277,10 @@ If you need a password to enter ``enable`` mode, you can specify it in one of tw As a reminder passwords should never be stored in plain text. For information on encrypting your passwords and other secrets with Ansible Vault, see :doc:`playbooks_vault`. - -.. _become-network-auth-and-auth-password: - authorize and auth_pass ----------------------- -For HTTPS connections that cannot use ``connection: network_cli``, you can enter ``enable`` mode using the module options ``authorize`` and ``auth_pass``: +Ansible still supports ``enable`` mode with ``connection: local`` for legacy playbooks. To enter ``enable`` mode with ``connection: local``, use the module options ``authorize`` and ``auth_pass``: .. code-block:: yaml @@ -302,7 +295,7 @@ For HTTPS connections that cannot use ``connection: network_cli``, you can enter authorize: yes auth_pass: " {{ secret_auth_pass }}" -Note that over time more platforms and connections will support ``become``. As this happens, the use of ``authorize`` and of ``provider`` dictionaries will be deprecated. Check the :ref:`platform_options` and :ref:`network_modules` documentation for details. +We recommend updating your playbooks to use ``become`` for network-device ``enable`` mode consistently. The use of ``authorize`` and of ``provider`` dictionaries will be deprecated in future. Check the :ref:`platform_options` and :ref:`network_modules` documentation for details. .. _become-windows: diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 27f1e14250..46e28c959c 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -655,6 +655,14 @@ DEFAULT_HOST_LIST: section: defaults type: pathlist yaml: {key: defaults.inventory} +DEFAULT_HTTPAPI_PLUGIN_PATH: + name: HttpApi Plugins Path + default: ~/.ansible/plugins/httpapi:/usr/share/ansible/plugins/httpapi + description: Colon separated paths in which Ansible will search for HttpApi Plugins. + env: [{name: ANSIBLE_HTTPAPI_PLUGINS}] + ini: + - {key: httpapi_plugins, section: defaults} + type: pathspec DEFAULT_INTERNAL_POLL_INTERVAL: name: Internal poll interval default: 0.001 diff --git a/lib/ansible/module_utils/network/eos/eos.py b/lib/ansible/module_utils/network/eos/eos.py index 22bf86f6ee..f4ddd02e73 100644 --- a/lib/ansible/module_utils/network/eos/eos.py +++ b/lib/ansible/module_utils/network/eos/eos.py @@ -163,46 +163,8 @@ class Cli: def run_commands(self, commands, check_rc=True): """Run list of commands on remote device and return results """ - responses = list() connection = self._get_connection() - - for cmd in to_list(commands): - if isinstance(cmd, dict): - command = cmd['command'] - prompt = cmd['prompt'] - answer = cmd['answer'] - else: - command = cmd - prompt = None - answer = None - - out = connection.get(command, prompt, answer) - out = to_text(out, errors='surrogate_or_strict') - - try: - out = self._module.from_json(out) - except ValueError: - out = str(out).strip() - - responses.append(out) - - return responses - - def send_config(self, commands): - conn = self._get_connection() - - multiline = False - rc = 0 - for command in to_list(commands): - if command == 'end': - continue - - if command.startswith('banner') or multiline: - multiline = True - elif command == 'EOF' and multiline: - multiline = False - - conn.get(command, None, None, multiline) + return connection.run_commands(commands, check_rc) def configure(self, commands): """Sends configuration commands to the remote device @@ -239,32 +201,12 @@ class Cli: return result conn = self._get_connection() - session = 'ansible_%s' % int(time.time()) - result = {'session': session} - - out = conn.get('configure session %s' % session) - - if replace: - out = conn.get('rollback clean-config') - try: - self.send_config(commands) + return conn.load_config(commands, commit, replace) except ConnectionError as exc: - self.close_session(session) message = getattr(exc, 'err', exc) self._module.fail_json(msg="Error on executing commands %s" % commands, data=to_text(message, errors='surrogate_then_replace')) - out = conn.get('show session-config diffs') - if out: - result['diff'] = to_text(out, errors='surrogate_then_replace').strip() - - if commit: - conn.get('commit') - else: - self.close_session(session) - - return result - class Eapi: diff --git a/lib/ansible/module_utils/network/nxos/nxos.py b/lib/ansible/module_utils/network/nxos/nxos.py index 33c4a91c9f..a3c06dafc3 100644 --- a/lib/ansible/module_utils/network/nxos/nxos.py +++ b/lib/ansible/module_utils/network/nxos/nxos.py @@ -146,47 +146,8 @@ class Cli: def run_commands(self, commands, check_rc=True): """Run list of commands on remote device and return results """ - responses = list() connection = self._get_connection() - - for item in to_list(commands): - if item['output'] == 'json' and not is_json(item['command']): - cmd = '%s | json' % item['command'] - elif item['output'] == 'text' and is_json(item['command']): - cmd = item['command'].rsplit('|', 1)[0] - else: - cmd = item['command'] - - out = '' - try: - out = connection.get(cmd) - code = 0 - except ConnectionError as e: - code = getattr(e, 'code', 1) - message = getattr(e, 'err', e) - err = to_text(message, errors='surrogate_then_replace') - - try: - out = to_text(out, errors='surrogate_or_strict') - except UnicodeError: - self._module.fail_json(msg=u'Failed to decode output from %s: %s' % (cmd, to_text(out))) - - if check_rc and code != 0: - self._module.fail_json(msg=err) - - if not check_rc and code != 0: - try: - out = self._module.from_json(err) - except ValueError: - out = to_text(message).strip() - else: - try: - out = self._module.from_json(out) - except ValueError: - out = to_text(out).strip() - - responses.append(out) - return responses + return connection.run_commands(commands, check_rc) def load_config(self, config, return_error=False, opts=None): """Sends configuration commands to the remote device diff --git a/lib/ansible/modules/network/eos/eos_facts.py b/lib/ansible/modules/network/eos/eos_facts.py index 5dc7b20312..ee1c54e0da 100644 --- a/lib/ansible/modules/network/eos/eos_facts.py +++ b/lib/ansible/modules/network/eos/eos_facts.py @@ -258,7 +258,8 @@ class Interfaces(FactsBase): self.facts['interfaces'] = self.populate_interfaces(data) data = self.responses[1] - self.facts['neighbors'] = self.populate_neighbors(data['lldpNeighbors']) + if data: + self.facts['neighbors'] = self.populate_neighbors(data['lldpNeighbors']) def populate_interfaces(self, data): facts = dict() diff --git a/lib/ansible/plugins/action/eos.py b/lib/ansible/plugins/action/eos.py index 9f396aaf85..e8d2a44338 100644 --- a/lib/ansible/plugins/action/eos.py +++ b/lib/ansible/plugins/action/eos.py @@ -43,13 +43,13 @@ class ActionModule(_ActionModule): socket_path = None - if self._play_context.connection == 'network_cli': + if self._play_context.connection in ('network_cli', 'httpapi'): provider = self._task.args.get('provider', {}) if any(provider.values()): - display.warning('provider is unnecessary when using network_cli and will be ignored') + display.warning('provider is unnecessary when using %s and will be ignored' % self._play_context.connection) del self._task.args['provider'] if self._task.args.get('transport'): - display.warning('transport is unnecessary when using network_cli and will be ignored') + display.warning('transport is unnecessary when using %s and will be ignored' % self._play_context.connection) del self._task.args['transport'] elif self._play_context.connection == 'local': provider = load_provider(eos_provider_spec, self._task.args) diff --git a/lib/ansible/plugins/action/nxos.py b/lib/ansible/plugins/action/nxos.py index 4b3663f8b3..d8c40638b6 100644 --- a/lib/ansible/plugins/action/nxos.py +++ b/lib/ansible/plugins/action/nxos.py @@ -43,16 +43,17 @@ class ActionModule(_ActionModule): socket_path = None - if self._task.args.get('provider', {}).get('transport') == 'nxapi' and self._task.action == 'nxos_nxapi': + if (self._play_context.connection == 'httpapi' or self._task.args.get('provider', {}).get('transport') == 'nxapi') \ + and self._task.action == 'nxos_nxapi': return {'failed': True, 'msg': "Transport type 'nxapi' is not valid for '%s' module." % (self._task.action)} - if self._play_context.connection == 'network_cli': + if self._play_context.connection in ('network_cli', 'httpapi'): provider = self._task.args.get('provider', {}) if any(provider.values()): - display.warning('provider is unnecessary when using network_cli and will be ignored') + display.warning('provider is unnecessary when using %s and will be ignored' % self._play_context.connection) del self._task.args['provider'] if self._task.args.get('transport'): - display.warning('transport is unnecessary when using network_cli and will be ignored') + display.warning('transport is unnecessary when using %s and will be ignored' % self._play_context.connection) del self._task.args['transport'] elif self._play_context.connection == 'local': provider = load_provider(nxos_provider_spec, self._task.args) diff --git a/lib/ansible/plugins/cliconf/eos.py b/lib/ansible/plugins/cliconf/eos.py index 292e79a750..d884f43af7 100644 --- a/lib/ansible/plugins/cliconf/eos.py +++ b/lib/ansible/plugins/cliconf/eos.py @@ -20,15 +20,37 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json +import time from itertools import chain +from ansible.module_utils._text import to_bytes from ansible.module_utils.network.common.utils import to_list from ansible.plugins.cliconf import CliconfBase, enable_mode +from ansible.plugins.connection.network_cli import Connection as NetworkCli class Cliconf(CliconfBase): + def send_command(self, command, prompt=None, answer=None, sendonly=False, newline=True, prompt_retry_check=False): + """Executes a cli command and returns the results + This method will execute the CLI command on the connection and return + the results to the caller. The command output will be returned as a + string + """ + kwargs = {'command': to_bytes(command), 'sendonly': sendonly, + 'newline': newline, 'prompt_retry_check': prompt_retry_check} + if prompt is not None: + kwargs['prompt'] = to_bytes(prompt) + if answer is not None: + kwargs['answer'] = to_bytes(answer) + + if isinstance(self._connection, NetworkCli): + resp = self._connection.send(**kwargs) + else: + resp = self._connection.send_request(command, **kwargs) + return resp + def get_device_info(self): device_info = {} @@ -74,3 +96,72 @@ class Cliconf(CliconfBase): result['network_api'] = 'cliconf' result['device_info'] = self.get_device_info() return json.dumps(result) + + # Imported from module_utils + def close_session(self, session): + # to close session gracefully execute abort in top level session prompt. + self.get('end') + self.get('configure session %s' % session) + self.get('abort') + + def run_commands(self, commands, check_rc=True): + """Run list of commands on remote device and return results + """ + responses = list() + multiline = False + + for cmd in to_list(commands): + if isinstance(cmd, dict): + command = cmd['command'] + prompt = cmd['prompt'] + answer = cmd['answer'] + else: + command = cmd + prompt = None + answer = None + + if command == 'end': + continue + elif command.startswith('banner') or multiline: + multiline = True + elif command == 'EOF' and multiline: + multiline = False + + out = self.get(command, prompt, answer, multiline) + + if out is not None: + try: + out = json.loads(out) + except ValueError: + out = str(out).strip() + + responses.append(out) + + return responses + + def load_config(self, commands, commit=False, replace=False): + """Loads the config commands onto the remote device + """ + session = 'ansible_%s' % int(time.time()) + result = {'session': session} + + self.get('configure session %s' % session) + if replace: + self.get('rollback clean-config') + + try: + self.run_commands(commands) + except ConnectionError: + self.close_session(session) + raise + + out = self.get('show session-config diffs') + if out: + result['diff'] = out.strip() + + if commit: + self.get('commit') + else: + self.close_session(session) + + return result diff --git a/lib/ansible/plugins/cliconf/nxos.py b/lib/ansible/plugins/cliconf/nxos.py index 44def6af1b..afd43ff689 100644 --- a/lib/ansible/plugins/cliconf/nxos.py +++ b/lib/ansible/plugins/cliconf/nxos.py @@ -23,12 +23,33 @@ import json from itertools import chain +from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils.network.common.utils import to_list from ansible.plugins.cliconf import CliconfBase +from ansible.plugins.connection.network_cli import Connection as NetworkCli class Cliconf(CliconfBase): + def send_command(self, command, prompt=None, answer=None, sendonly=False, newline=True, prompt_retry_check=False): + """Executes a cli command and returns the results + This method will execute the CLI command on the connection and return + the results to the caller. The command output will be returned as a + string + """ + kwargs = {'command': to_bytes(command), 'sendonly': sendonly, + 'newline': newline, 'prompt_retry_check': prompt_retry_check} + if prompt is not None: + kwargs['prompt'] = to_bytes(prompt) + if answer is not None: + kwargs['answer'] = to_bytes(answer) + + if isinstance(self._connection, NetworkCli): + resp = self._connection.send(**kwargs) + else: + resp = self._connection.send_request(command, **kwargs) + return resp + def get_device_info(self): device_info = {} @@ -76,3 +97,37 @@ class Cliconf(CliconfBase): result['network_api'] = 'cliconf' result['device_info'] = self.get_device_info() return json.dumps(result) + + # Migrated from module_utils + def run_commands(self, commands, check_rc=True): + """Run list of commands on remote device and return results + """ + responses = list() + + for item in to_list(commands): + if item['output'] == 'json' and not item['command'].endswith('| json'): + cmd = '%s | json' % item['command'] + elif item['output'] == 'text' and item['command'].endswith('| json'): + cmd = item['command'].rsplit('|', 1)[0] + else: + cmd = item['command'] + + try: + out = self.get(cmd) + except ConnectionError as e: + if check_rc: + raise + out = e + + try: + out = to_text(out, errors='surrogate_or_strict').strip() + except UnicodeError: + raise ConnectionError(msg=u'Failed to decode output from %s: %s' % (cmd, to_text(out))) + + try: + out = json.loads(out) + except ValueError: + pass + + responses.append(out) + return responses diff --git a/lib/ansible/plugins/connection/httpapi.py b/lib/ansible/plugins/connection/httpapi.py new file mode 100644 index 0000000000..407b05959a --- /dev/null +++ b/lib/ansible/plugins/connection/httpapi.py @@ -0,0 +1,303 @@ +# (c) 2018 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +DOCUMENTATION = """ +--- +author: Ansible Networking Team +connection: httpapi +short_description: Use httpapi to run command on network appliances +description: + - This connection plugin provides a connection to remote devices over a + HTTP(S)-based api. +version_added: "2.6" +options: + host: + description: + - Specifies the remote device FQDN or IP address to establish the SSH + connection to. + default: inventory_hostname + vars: + - name: ansible_host + port: + type: int + description: + - Specifies the port on the remote device to listening for connections + when establishing the SSH connection. + ini: + - section: defaults + key: remote_port + env: + - name: ANSIBLE_REMOTE_PORT + vars: + - name: ansible_port + network_os: + description: + - Configures the device platform network operating system. This value is + used to load the correct httpapi and cliconf plugins to communicate + with the remote device + vars: + - name: ansible_network_os + remote_user: + description: + - The username used to authenticate to the remote device when the API + connection is first established. If the remote_user is not specified, + the connection will use the username of the logged in user. + - Can be configured form the CLI via the C(--user) or C(-u) options + ini: + - section: defaults + key: remote_user + env: + - name: ANSIBLE_REMOTE_USER + vars: + - name: ansible_user + password: + description: + - Secret used to authenticate + vars: + - name: ansible_password + - name: ansible_httpapi_pass + use_ssl: + description: + - Whether to connect using SSL (HTTPS) or not (HTTP) + default: False + vars: + - name: ansible_httpapi_use_ssl + timeout: + type: int + description: + - Sets the connection time, in seconds, for the communicating with the + remote device. This timeout is used as the default timeout value for + commands when issuing a command to the network CLI. If the command + does not return in timeout seconds, the an error is generated. + default: 120 + become: + type: boolean + description: + - The become option will instruct the CLI session to attempt privilege + escalation on platforms that support it. Normally this means + transitioning from user mode to C(enable) mode in the CLI session. + If become is set to True and the remote device does not support + privilege escalation or the privilege has already been elevated, then + this option is silently ignored + - Can be configured form the CLI via the C(--become) or C(-b) options + default: False + ini: + section: privilege_escalation + key: become + env: + - name: ANSIBLE_BECOME + vars: + - name: ansible_become + become_method: + description: + - This option allows the become method to be specified in for handling + privilege escalation. Typically the become_method value is set to + C(enable) but could be defined as other values. + default: sudo + ini: + section: privilege_escalation + key: become_method + env: + - name: ANSIBLE_BECOME_METHOD + vars: + - name: ansible_become_method + persistent_connect_timeout: + type: int + description: + - Configures, in seconds, the amount of time to wait when trying to + initially establish a persistent connection. If this value expires + before the connection to the remote device is completed, the connection + will fail + default: 30 + ini: + section: persistent_connection + key: persistent_connect_timeout + env: + - name: ANSIBLE_PERSISTENT_CONNECT_TIMEOUT + persistent_command_timeout: + type: int + description: + - Configures, in seconds, the amount of time to wait for a command to + return from the remote device. If this timer is exceeded before the + command returns, the connection plugin will raise an exception and + close + default: 10 + ini: + section: persistent_connection + key: persistent_command_timeout + env: + - name: ANSIBLE_PERSISTENT_COMMAND_TIMEOUT +""" + +import os + +from ansible import constants as C +from ansible.errors import AnsibleConnectionFailure +from ansible.module_utils._text import to_bytes +from ansible.module_utils.six import PY3 +from ansible.module_utils.six.moves import cPickle +from ansible.module_utils.urls import open_url +from ansible.playbook.play_context import PlayContext +from ansible.plugins.loader import cliconf_loader, connection_loader, httpapi_loader +from ansible.plugins.connection import ConnectionBase +from ansible.utils.path import unfrackpath + +try: + from __main__ import display +except ImportError: + from ansible.utils.display import Display + display = Display() + + +class Connection(ConnectionBase): + '''Network API connection''' + + transport = 'httpapi' + has_pipelining = True + force_persistence = True + # Do not use _remote_is_local in other connections + _remote_is_local = True + + def __init__(self, play_context, new_stdin, *args, **kwargs): + super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs) + + self._matched_prompt = None + self._matched_pattern = None + self._last_response = None + self._history = list() + + self._local = connection_loader.get('local', play_context, '/dev/null') + self._local.set_options() + + self._cliconf = None + + self._ansible_playbook_pid = kwargs.get('ansible_playbook_pid') + + network_os = self._play_context.network_os + if not network_os: + raise AnsibleConnectionFailure( + 'Unable to automatically determine host network os. Please ' + 'manually configure ansible_network_os value for this host' + ) + + self._httpapi = httpapi_loader.get(network_os, self) + if self._httpapi: + display.vvvv('loaded API plugin for network_os %s' % network_os, host=self._play_context.remote_addr) + else: + raise AnsibleConnectionFailure('unable to load API plugin for network_os %s' % network_os) + + self._url = None + self._auth = None + + # reconstruct the socket_path and set instance values accordingly + self._update_connection_state() + + def __getattr__(self, name): + try: + return self.__dict__[name] + except KeyError: + if not name.startswith('_'): + for plugin in (self._httpapi, self._cliconf): + method = getattr(plugin, name, None) + if method: + return method + raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name)) + + def exec_command(self, cmd, in_data=None, sudoable=True): + return self._local.exec_command(cmd, in_data, sudoable) + + def put_file(self, in_path, out_path): + return self._local.put_file(in_path, out_path) + + def fetch_file(self, in_path, out_path): + return self._local.fetch_file(in_path, out_path) + + def update_play_context(self, pc_data): + """Updates the play context information for the connection""" + pc_data = to_bytes(pc_data) + if PY3: + pc_data = cPickle.loads(pc_data, encoding='bytes') + else: + pc_data = cPickle.loads(pc_data) + play_context = PlayContext() + play_context.deserialize(pc_data) + + messages = ['updating play_context for connection'] + if self._play_context.become is False and play_context.become is True: + self._enable = True + messages.append('authorizing connection') + + elif self._play_context.become is True and not play_context.become: + self._enable = False + messages.append('deauthorizing connection') + + self._play_context = play_context + return messages + + def _connect(self): + if self.connected: + return + network_os = self._play_context.network_os + + protocol = 'https' if self.get_option('use_ssl') else 'http' + host = self._play_context.remote_addr + port = self._play_context.port or 443 if protocol == 'https' else 80 + self._url = '%s://%s:%s' % (protocol, host, port) + + self._cliconf = cliconf_loader.get(network_os, self) + if self._cliconf: + display.vvvv('loaded cliconf plugin for network_os %s' % network_os, host=self._play_context.remote_addr) + else: + display.vvvv('unable to load cliconf for network_os %s' % network_os) + + self._connected = True + + def _update_connection_state(self): + ''' + Reconstruct the connection socket_path and check if it exists + + If the socket path exists then the connection is active and set + both the _socket_path value to the path and the _connected value + to True. If the socket path doesn't exist, leave the socket path + value to None and the _connected value to False + ''' + ssh = connection_loader.get('ssh', class_only=True) + cp = ssh._create_control_path( + self._play_context.remote_addr, self._play_context.port, + self._play_context.remote_user, self._play_context.connection, + self._ansible_playbook_pid + ) + + tmp_path = unfrackpath(C.PERSISTENT_CONTROL_PATH_DIR) + socket_path = unfrackpath(cp % dict(directory=tmp_path)) + + if os.path.exists(socket_path): + self._connected = True + self._socket_path = socket_path + + def reset(self): + ''' + Reset the connection + ''' + if self._socket_path: + display.vvvv('resetting persistent connection for socket_path %s' % self._socket_path, host=self._play_context.remote_addr) + self.close() + display.vvvv('reset call on connection instance', host=self._play_context.remote_addr) + + def close(self): + if self._connected: + self._connected = False + + def send(self, path, data, **kwargs): + ''' + Sends the command to the device over api + ''' + url_kwargs = dict(url_username=self._play_context.remote_user, url_password=self._play_context.password) + url_kwargs.update(kwargs) + response = open_url(self._url + path, data=data, **url_kwargs) + self._auth = response.info().get('Set-Cookie') + + return response diff --git a/lib/ansible/plugins/httpapi/__init__.py b/lib/ansible/plugins/httpapi/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/ansible/plugins/httpapi/eos.py b/lib/ansible/plugins/httpapi/eos.py new file mode 100644 index 0000000000..ad4fa8b0f8 --- /dev/null +++ b/lib/ansible/plugins/httpapi/eos.py @@ -0,0 +1,158 @@ +# (c) 2018 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import json +import time + +from ansible.module_utils._text import to_text +from ansible.module_utils.network.common.utils import to_list +from ansible.module_utils.connection import ConnectionError + +try: + from __main__ import display +except ImportError: + from ansible.utils.display import Display + display = Display() + + +class HttpApi: + def __init__(self, connection): + self.connection = connection + + def send_request(self, data, **message_kwargs): + if 'become' in message_kwargs: + display.vvvv('firing event: on_become') + # TODO ??? self._terminal.on_become(passwd=auth_pass) + + output = message_kwargs.get('output', 'text') + request = request_builder(data, output) + headers = {'Content-Type': 'application/json-rpc'} + + response = self.connection.send('/command-api', request, headers=headers, method='POST') + response = json.loads(to_text(response.read())) + return handle_response(response) + + def get_prompt(self): + # Hack to keep @enable_mode working + return '#' + + # Imported from module_utils + def edit_config(self, config, commit=False, replace=False): + """Loads the configuration onto the remote devices + + If the device doesn't support configuration sessions, this will + fallback to using configure() to load the commands. If that happens, + there will be no returned diff or session values + """ + session = 'ansible_%s' % int(time.time()) + result = {'session': session} + banner_cmd = None + banner_input = [] + + commands = ['configure session %s' % session] + if replace: + commands.append('rollback clean-config') + + for command in config: + if command.startswith('banner'): + banner_cmd = command + banner_input = [] + elif banner_cmd: + if command == 'EOF': + command = {'cmd': banner_cmd, 'input': '\n'.join(banner_input)} + banner_cmd = None + commands.append(command) + else: + banner_input.append(command) + continue + else: + commands.append(command) + + response = self.send_request(commands) + + commands = ['configure session %s' % session, 'show session-config diffs'] + if commit: + commands.append('commit') + else: + commands.append('abort') + + response = self.send_request(commands, output='text') + diff = response[1].strip() + if diff: + result['diff'] = diff + + return result + + def run_commands(self, commands, check_rc=True): + """Runs list of commands on remote device and returns results + """ + output = None + queue = list() + responses = list() + + def run_queue(queue, output): + response = to_list(self.send_request(queue, output=output)) + if output == 'json': + response = [json.loads(item) for item in response] + return response + + for item in to_list(commands): + cmd_output = None + if isinstance(item, dict): + command = item['command'] + if command.endswith('| json'): + command = command.replace('| json', '') + cmd_output = 'json' + elif 'output' in item: + cmd_output = item['output'] + else: + command = item + cmd_output = 'json' + + if output and output != cmd_output: + responses.extend(run_queue(queue, output)) + queue = list() + + output = cmd_output or 'json' + queue.append(command) + + if queue: + responses.extend(run_queue(queue, output)) + + return responses + + def load_config(self, config, commit=False, replace=False): + """Loads the configuration onto the remote devices + + If the device doesn't support configuration sessions, this will + fallback to using configure() to load the commands. If that happens, + there will be no returned diff or session values + """ + return self.edit_config(config, commit, replace) + + +def handle_response(response): + if 'error' in response: + error = response['error'] + raise ConnectionError(error['message'], code=error['code']) + + results = [] + for result in response['result']: + if 'messages' in result: + results.append(result['messages'][0]) + elif 'output' in result: + results.append(result['output'].strip()) + else: + results.append(json.dumps(result)) + + if len(results) == 1: + return results[0] + return results + + +def request_builder(commands, output, reqid=None): + params = dict(version=1, cmds=to_list(commands), format=output) + return json.dumps(dict(jsonrpc='2.0', id=reqid, method='runCmds', params=params)) diff --git a/lib/ansible/plugins/httpapi/nxos.py b/lib/ansible/plugins/httpapi/nxos.py new file mode 100644 index 0000000000..d6c2210b99 --- /dev/null +++ b/lib/ansible/plugins/httpapi/nxos.py @@ -0,0 +1,135 @@ +# (c) 2018 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +import json + +from ansible.module_utils._text import to_text +from ansible.module_utils.connection import ConnectionError +from ansible.module_utils.network.common.utils import to_list + +try: + from __main__ import display +except ImportError: + from ansible.utils.display import Display + display = Display() + + +class HttpApi: + def __init__(self, connection): + self.connection = connection + + def _run_queue(self, queue, output): + request = request_builder(queue, output) + + headers = {'Content-Type': 'application/json'} + response = self.connection.send('/ins', request, headers=headers, method='POST') + response = json.loads(to_text(response.read())) + return handle_response(response) + + def send_request(self, data, **message_kwargs): + output = None + queue = list() + responses = list() + + for item in to_list(data): + cmd_output = message_kwargs.get('output', 'json') + if isinstance(item, dict): + command = item['command'] + if command.endswith('| json'): + command = command.rsplit('|', 1)[0] + cmd_output = 'json' + elif 'output' in item: + cmd_output = item['output'] + else: + command = item + + if output and output != cmd_output: + responses.extend(self._run_queue(queue, output)) + queue = list() + + output = cmd_output or 'json' + queue.append(command) + + if queue: + responses.extend(self._run_queue(queue, output)) + + if len(responses) == 1: + return responses[0] + return responses + + # Migrated from module_utils + def edit_config(self, command): + responses = self.send_request(command, output='config') + return json.dumps(responses) + + def run_commands(self, commands, check_rc=True): + """Runs list of commands on remote device and returns results + """ + try: + out = self.send_request(commands) + except ConnectionError as exc: + if check_rc: + raise + out = to_text(exc) + + out = to_list(out) + for index, response in enumerate(out): + if response[0] == '{': + out[index] = json.loads(response) + return out + + +def handle_response(response): + results = [] + + if response['ins_api'].get('outputs'): + for output in to_list(response['ins_api']['outputs']['output']): + if output['code'] != '200': + raise ConnectionError('%s: %s' % (output['input'], output['msg'])) + elif 'body' in output: + result = output['body'] + if isinstance(result, dict): + result = json.dumps(result) + + results.append(result.strip()) + + return results + + +def request_builder(commands, output, version='1.0', chunk='0', sid=None): + """Encodes a NXAPI JSON request message + """ + output_to_command_type = { + 'text': 'cli_show_ascii', + 'json': 'cli_show', + 'bash': 'bash', + 'config': 'cli_conf' + } + + maybe_output = commands[0].split('|')[-1].strip() + if maybe_output in output_to_command_type: + command_type = output_to_command_type[maybe_output] + commands = [command.split('|')[0].strip() for command in commands] + else: + try: + command_type = output_to_command_type[output] + except KeyError: + msg = 'invalid format, received %s, expected one of %s' % \ + (output, ','.join(output_to_command_type.keys())) + raise ConnectionError(msg) + + if isinstance(commands, (list, set, tuple)): + commands = ' ;'.join(commands) + + msg = { + 'version': version, + 'type': command_type, + 'chunk': chunk, + 'sid': sid, + 'input': commands, + 'output_format': 'json' + } + return json.dumps(dict(ins_api=msg)) diff --git a/lib/ansible/plugins/loader.py b/lib/ansible/plugins/loader.py index 4332a5a862..8766b2d714 100644 --- a/lib/ansible/plugins/loader.py +++ b/lib/ansible/plugins/loader.py @@ -762,3 +762,10 @@ inventory_loader = PluginLoader( C.DEFAULT_INVENTORY_PLUGIN_PATH, 'inventory_plugins' ) + +httpapi_loader = PluginLoader( + 'HttpApi', + 'ansible.plugins.httpapi', + C.DEFAULT_HTTPAPI_PLUGIN_PATH, + 'httpapi_plugins', +) diff --git a/test/integration/targets/eos_banner/tasks/cli.yaml b/test/integration/targets/eos_banner/tasks/cli.yaml index a6f7ae0351..87a42971bb 100644 --- a/test/integration/targets/eos_banner/tasks/cli.yaml +++ b/test/integration/targets/eos_banner/tasks/cli.yaml @@ -14,9 +14,3 @@ 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 ansible_become=no" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_banner/tasks/eapi.yaml b/test/integration/targets/eos_banner/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_banner/tasks/eapi.yaml +++ b/test/integration/targets/eos_banner/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_banner/tests/cli/basic-login.yaml b/test/integration/targets/eos_banner/tests/cli/basic-login.yaml index beeeb2893d..55d94bbe95 100644 --- a/test/integration/targets/eos_banner/tests/cli/basic-login.yaml +++ b/test/integration/targets/eos_banner/tests/cli/basic-login.yaml @@ -45,8 +45,8 @@ - "result.commands | length == 0" # Ensure sessions contains epoc. Will fail after 18th May 2033 - "result.session_name is not defined" - -- name: remove login + +- name: Remove login eos_banner: banner: login state: absent @@ -62,7 +62,7 @@ # Ensure sessions contains epoc. Will fail after 18th May 2033 - "'ansible_1' in result.session_name" -- name: remove login (idempotent) +- name: Remove login again (idempotent) eos_banner: banner: login state: absent @@ -78,7 +78,6 @@ # Ensure sessions contains epoc. Will fail after 18th May 2033 - "result.session_name is not defined" - # FIXME add in tests for everything defined in docs # FIXME Test state:absent + test: # FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml b/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml index e72fd5c52a..50797bbb90 100644 --- a/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml +++ b/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml @@ -1,4 +1,5 @@ --- +- debug: msg="START eapi/basic-login.yaml on connection={{ ansible_connection }}" - name: Remove previous login banner eos_config: @@ -6,7 +7,7 @@ authorize: yes provider: "{{ eapi }}" -- name: Set login +- name: Create login banner eos_banner: banner: login text: | @@ -21,12 +22,11 @@ - assert: that: - "result.changed == true" - - "result.commands.0.cmd == 'banner login'" - - "result.commands.0.input == 'this is my login banner\nthat has a multiline\nstring'" + - "'banner login' in result.commands[0]" # does this break due to "contains?" # Ensure sessions contains epoc. Will fail after 18th May 2033 - "'ansible_1' in result.session_name" -- name: Set login again (idempotent) +- name: Create login banner again (idempotent) eos_banner: banner: login text: | @@ -60,7 +60,7 @@ - assert: that: - "result.changed == true" - - "result.commands.0.cmd == 'no banner login'" + - "'no banner login' in result.commands" # does this break due to "contains?" # Ensure sessions contains epoc. Will fail after 18th May 2033 - "'ansible_1' in result.session_name" diff --git a/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml b/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml index 7146d37a23..8610352f89 100644 --- a/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml +++ b/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml @@ -21,8 +21,8 @@ - assert: that: - "result.changed == true" - - "result.commands.0.cmd == 'banner motd'" - - "result.commands.0.input == 'this is my motd banner\nthat has a multiline\nstring'" + - "'this is my motd banner' in result.commands" + - "'that has a multiline' in result.commands" # Ensure sessions contains epoc. Will fail after 18th May 2033 - "'ansible_1' in result.session_name" @@ -60,7 +60,7 @@ - assert: that: - "result.changed == true" - - "result.commands.0.cmd == 'no banner motd'" + - "'no banner motd' in result.commands" # Ensure sessions contains epoc. Will fail after 18th May 2033 - "'ansible_1' in result.session_name" diff --git a/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml b/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml index 23681d76af..77e1ac8798 100644 --- a/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml +++ b/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml @@ -22,8 +22,7 @@ - assert: that: - "result.changed == true" - - "result.commands.0.cmd == 'banner motd'" - - "result.commands.0.input == 'this is my motd banner configure by net_banner'" + - "'this is my motd banner configure by net_banner' in result.commands" # Ensure sessions contains epoc. Will fail after 18th May 2033 - "'ansible_1' in result.session_name" diff --git a/test/integration/targets/eos_command/tasks/cli.yaml b/test/integration/targets/eos_command/tasks/cli.yaml index a6f7ae0351..87a42971bb 100644 --- a/test/integration/targets/eos_command/tasks/cli.yaml +++ b/test/integration/targets/eos_command/tasks/cli.yaml @@ -14,9 +14,3 @@ 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 ansible_become=no" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_command/tasks/eapi.yaml b/test/integration/targets/eos_command/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_command/tasks/eapi.yaml +++ b/test/integration/targets/eos_command/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml index 95a233caba..08b00e1384 100644 --- a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml +++ b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name foo Management" - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_command/tests/cli/contains.yaml b/test/integration/targets/eos_command/tests/cli/contains.yaml index 8a57fdaf64..3707407a73 100644 --- a/test/integration/targets/eos_command/tests/cli/contains.yaml +++ b/test/integration/targets/eos_command/tests/cli/contains.yaml @@ -5,11 +5,10 @@ eos_command: commands: - show version - - show interface Management1 | json + - show interfaces Management1 | json wait_for: - "result[0] contains EOS" - "result[1].interfaces.Management1.name contains Manage" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/equal.yaml b/test/integration/targets/eos_command/tests/cli/equal.yaml index 46adbc023c..c4ce57b756 100644 --- a/test/integration/targets/eos_command/tests/cli/equal.yaml +++ b/test/integration/targets/eos_command/tests/cli/equal.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name eq Management1" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name == Management1" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml index 576b444cc4..cc7d6f9d0a 100644 --- a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml +++ b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu gt 0" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu > 0" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml index c998de7fcf..9f4f8184c3 100644 --- a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml +++ b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu ge 0" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu >= 0" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/invalid.yaml b/test/integration/targets/eos_command/tests/cli/invalid.yaml index 9650e194cd..6005570e32 100644 --- a/test/integration/targets/eos_command/tests/cli/invalid.yaml +++ b/test/integration/targets/eos_command/tests/cli/invalid.yaml @@ -4,7 +4,6 @@ - name: run invalid command eos_command: commands: ['show foo'] - provider: "{{ cli }}" register: result ignore_errors: yes @@ -18,7 +17,6 @@ commands: - show version - show foo - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_command/tests/cli/lessthan.yaml b/test/integration/targets/eos_command/tests/cli/lessthan.yaml index 13a0aa795b..8881158601 100644 --- a/test/integration/targets/eos_command/tests/cli/lessthan.yaml +++ b/test/integration/targets/eos_command/tests/cli/lessthan.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu lt 1600" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu < 1600" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml index b790c44b7f..eef5008d0d 100644 --- a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml +++ b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu le 1600" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu <= 1600" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/notequal.yaml b/test/integration/targets/eos_command/tests/cli/notequal.yaml index 36678ee9f2..386ba3fbea 100644 --- a/test/integration/targets/eos_command/tests/cli/notequal.yaml +++ b/test/integration/targets/eos_command/tests/cli/notequal.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name neq Ethernet" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name != Ethernet" - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/output.yaml b/test/integration/targets/eos_command/tests/cli/output.yaml index d65367b561..ba217635c8 100644 --- a/test/integration/targets/eos_command/tests/cli/output.yaml +++ b/test/integration/targets/eos_command/tests/cli/output.yaml @@ -4,7 +4,6 @@ - name: get output for single command eos_command: commands: ['show version'] - provider: "{{ cli }}" register: result - assert: @@ -17,7 +16,6 @@ commands: - show version - show interfaces - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/cli/timeout.yaml b/test/integration/targets/eos_command/tests/cli/timeout.yaml index f72e1e63eb..0a90c7efef 100644 --- a/test/integration/targets/eos_command/tests/cli/timeout.yaml +++ b/test/integration/targets/eos_command/tests/cli/timeout.yaml @@ -7,7 +7,6 @@ - show version wait_for: - "result[0] contains bad_value_string" - provider: "{{ cli }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml b/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml index f184adf2f3..6398480b4c 100644 --- a/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml +++ b/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml @@ -8,7 +8,6 @@ - show interfaces Management1 wait_for: - "result[1].interfaces.Management1.name foo Management" - provider: "{{ eapi }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_command/tests/eapi/contains.yaml b/test/integration/targets/eos_command/tests/eapi/contains.yaml index 7f928ddd84..a733228f20 100644 --- a/test/integration/targets/eos_command/tests/eapi/contains.yaml +++ b/test/integration/targets/eos_command/tests/eapi/contains.yaml @@ -1,15 +1,14 @@ --- -- debug: msg="START eapi/contains.yaml" +- debug: msg="START eapi/contains.yaml on connection={{ ansible_connection }}" - name: test contains operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - - "result[0].modelName contains EOS" - - "result[1].interfaces.Management1.name contains Management" - provider: "{{ eapi }}" + - "result[0] contains EOS" + - "result[1].interfaces.Management1.name contains Manage" register: result - assert: @@ -17,4 +16,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/contains.yaml" +- debug: msg="END eapi/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/equal.yaml b/test/integration/targets/eos_command/tests/eapi/equal.yaml index 5ff5f0c224..f5e35e1f88 100644 --- a/test/integration/targets/eos_command/tests/eapi/equal.yaml +++ b/test/integration/targets/eos_command/tests/eapi/equal.yaml @@ -1,14 +1,13 @@ --- -- debug: msg="START eapi/equal.yaml" +- debug: msg="START eapi/equal.yaml on connection={{ ansible_connection }}" - name: test eq operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name eq Management1" - provider: "{{ eapi }}" register: result - assert: @@ -20,10 +19,9 @@ eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name == Management1" - provider: "{{ eapi }}" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/equal.yaml" +- debug: msg="END eapi/equal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml b/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml index 37837d815a..42d0ce14c2 100644 --- a/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml +++ b/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml @@ -1,14 +1,13 @@ --- -- debug: msg="START eapi/greaterthan.yaml" +- debug: msg="START eapi/greaterthan.yaml on connection={{ ansible_connection }}" - name: test gt operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu gt 0" - provider: "{{ eapi }}" register: result - assert: @@ -20,10 +19,9 @@ eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - - "result[1].interfaces.Management1.mtu >= 0" - provider: "{{ eapi }}" + - "result[1].interfaces.Management1.mtu > 0" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/greaterthan.yaml" +- debug: msg="END eapi/greaterthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml b/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml index 78d4bca916..d012c0c240 100644 --- a/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml +++ b/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml @@ -1,14 +1,13 @@ --- -- debug: msg="START eapi/greaterthanorequal.yaml" +- debug: msg="START eapi/greaterthanorequal.yaml on connection={{ ansible_connection }}" - name: test ge operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu ge 0" - provider: "{{ eapi }}" register: result - assert: @@ -20,10 +19,9 @@ eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.mtu >= 0" - provider: "{{ eapi }}" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/greaterthanorequal.yaml" +- debug: msg="END eapi/greaterthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/invalid.yaml b/test/integration/targets/eos_command/tests/eapi/invalid.yaml index 6c797b2088..06958414c0 100644 --- a/test/integration/targets/eos_command/tests/eapi/invalid.yaml +++ b/test/integration/targets/eos_command/tests/eapi/invalid.yaml @@ -4,7 +4,6 @@ - name: run invalid command eos_command: commands: ['show foo'] - provider: "{{ eapi }}" register: result ignore_errors: yes @@ -18,7 +17,6 @@ commands: - show version - show foo - provider: "{{ eapi }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_command/tests/eapi/lessthan.yaml b/test/integration/targets/eos_command/tests/eapi/lessthan.yaml index e157974791..96ff71abaf 100644 --- a/test/integration/targets/eos_command/tests/eapi/lessthan.yaml +++ b/test/integration/targets/eos_command/tests/eapi/lessthan.yaml @@ -1,14 +1,13 @@ --- -- debug: msg="START eapi/lessthan.yaml" +- debug: msg="START eapi/lessthan.yaml on connection={{ ansible_connection }}" - name: test lt operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - - "result[1].interfaces.Management1.mtu lt 9100" - provider: "{{ eapi }}" + - "result[1].interfaces.Management1.mtu lt 1600" register: result - assert: @@ -20,10 +19,9 @@ eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - - "result[1].interfaces.Management1.mtu < 9100" - provider: "{{ eapi }}" + - "result[1].interfaces.Management1.mtu < 1600" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/lessthan.yaml" +- debug: msg="END eapi/lessthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml b/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml index 5bc2218295..0c89c69dc7 100644 --- a/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml +++ b/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml @@ -1,14 +1,13 @@ --- -- debug: msg="START eapi/lessthanorequal.yaml" +- debug: msg="START eapi/lessthanorequal.yaml on connection={{ ansible_connection }}" - name: test le operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - - "result[1].interfaces.Management1.mtu le 9100" - provider: "{{ eapi }}" + - "result[1].interfaces.Management1.mtu le 1600" register: result - assert: @@ -20,10 +19,9 @@ eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - - "result[1].interfaces.Management1.mtu <= 9100" - provider: "{{ eapi }}" + - "result[1].interfaces.Management1.mtu <= 1600" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/lessthanorequal.yaml" +- debug: msg="END eapi/lessthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/notequal.yaml b/test/integration/targets/eos_command/tests/eapi/notequal.yaml index 1af8a8963a..fc0f5c98d8 100644 --- a/test/integration/targets/eos_command/tests/eapi/notequal.yaml +++ b/test/integration/targets/eos_command/tests/eapi/notequal.yaml @@ -1,14 +1,13 @@ --- -- debug: msg="START eapi/notequal.yaml" +- debug: msg="START eapi/notequal.yaml on connection={{ ansible_connection }}" - name: test neq operator eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name neq Ethernet" - provider: "{{ eapi }}" register: result - assert: @@ -20,10 +19,9 @@ eos_command: commands: - show version - - show interfaces Management1 + - show interfaces Management1 | json wait_for: - "result[1].interfaces.Management1.name != Ethernet" - provider: "{{ eapi }}" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END eapi/notequal.yaml" +- debug: msg="END eapi/notequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/output.yaml b/test/integration/targets/eos_command/tests/eapi/output.yaml index 8e48e127a9..6c2239c7dc 100644 --- a/test/integration/targets/eos_command/tests/eapi/output.yaml +++ b/test/integration/targets/eos_command/tests/eapi/output.yaml @@ -4,7 +4,6 @@ - name: get output for single command eos_command: commands: ['show version'] - provider: "{{ eapi }}" register: result - assert: @@ -17,7 +16,6 @@ commands: - show version - show interfaces - provider: "{{ eapi }}" register: result - assert: diff --git a/test/integration/targets/eos_command/tests/eapi/timeout.yaml b/test/integration/targets/eos_command/tests/eapi/timeout.yaml index 8665276d22..58a0d39fbd 100644 --- a/test/integration/targets/eos_command/tests/eapi/timeout.yaml +++ b/test/integration/targets/eos_command/tests/eapi/timeout.yaml @@ -8,7 +8,6 @@ wait_for: - "result[0].version foo 4.15" retries: 1 - provider: "{{ eapi }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_config/tasks/cli.yaml b/test/integration/targets/eos_config/tasks/cli.yaml index a6f7ae0351..87a42971bb 100644 --- a/test/integration/targets/eos_config/tasks/cli.yaml +++ b/test/integration/targets/eos_config/tasks/cli.yaml @@ -14,9 +14,3 @@ 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 ansible_become=no" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_config/tasks/eapi.yaml b/test/integration/targets/eos_config/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_config/tasks/eapi.yaml +++ b/test/integration/targets/eos_config/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_config/tests/cli/backup.yaml b/test/integration/targets/eos_config/tests/cli/backup.yaml index 4c582f6a48..5be63f07f9 100644 --- a/test/integration/targets/eos_config/tests/cli/backup.yaml +++ b/test/integration/targets/eos_config/tests/cli/backup.yaml @@ -9,7 +9,6 @@ parents: - interface Ethernet2 match: none - provider: "{{ cli }}" become: yes - name: collect any backup files @@ -29,7 +28,6 @@ eos_config: src: basic/config.j2 backup: yes - provider: "{{ cli }}" become: yes register: result diff --git a/test/integration/targets/eos_config/tests/cli/check_mode.yaml b/test/integration/targets/eos_config/tests/cli/check_mode.yaml index d0a6a7f00d..e15b280e10 100644 --- a/test/integration/targets/eos_config/tests/cli/check_mode.yaml +++ b/test/integration/targets/eos_config/tests/cli/check_mode.yaml @@ -6,7 +6,6 @@ lines: - ip address 119.31.1.1 255.255.255.256 parents: interface Loopback911 - provider: "{{ cli }}" become: yes check_mode: 1 environment: @@ -25,7 +24,6 @@ before: - "no ip access-list test" src: basic/cmds.j2 - provider: "{{ cli }}" become: yes check_mode: yes register: config @@ -34,7 +32,6 @@ eos_command: commands: - show configuration sessions | json - provider: "{{ cli }}" become: yes register: result @@ -47,7 +44,6 @@ lines: - ip address 119.31.1.1 255.255.255.256 parents: interface Loopback911 - provider: "{{ cli }}" become: yes check_mode: 1 environment: @@ -64,7 +60,6 @@ lines: - ip address 119.31.1.1 255.255.255.255 parents: interface Loopback911 - provider: "{{ cli }}" become: yes check_mode: yes register: result diff --git a/test/integration/targets/eos_config/tests/cli/config.yaml b/test/integration/targets/eos_config/tests/cli/config.yaml index 6f552ebce2..428326f058 100644 --- a/test/integration/targets/eos_config/tests/cli/config.yaml +++ b/test/integration/targets/eos_config/tests/cli/config.yaml @@ -5,13 +5,11 @@ eos_config: lines: hostname {{ inventory_hostname_short }} match: none - provider: "{{ cli }}" become: yes - name: get current running-config eos_command: commands: show running-config - provider: "{{ cli }}" become: yes register: config @@ -19,7 +17,6 @@ eos_config: lines: hostname foo config: "{{ config.stdout[0] }}" - provider: "{{ cli }}" become: yes register: result @@ -31,7 +28,6 @@ - name: get current running-config eos_command: commands: show running-config - provider: "{{ cli }}" become: yes register: config @@ -39,7 +35,6 @@ eos_config: lines: hostname foo config: "{{ config.stdout[0] }}" - provider: "{{ cli }}" become: yes register: result @@ -51,7 +46,6 @@ eos_config: lines: hostname {{ inventory_hostname_short }} match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/defaults.yaml b/test/integration/targets/eos_config/tests/cli/defaults.yaml index aa775721a9..cd87b4e7d3 100644 --- a/test/integration/targets/eos_config/tests/cli/defaults.yaml +++ b/test/integration/targets/eos_config/tests/cli/defaults.yaml @@ -9,14 +9,12 @@ parents: - interface Ethernet2 match: none - provider: "{{ cli }}" become: yes - name: configure device with defaults included eos_config: src: defaults/config.j2 defaults: yes - provider: "{{ cli }}" become: yes register: result @@ -31,7 +29,6 @@ eos_config: src: defaults/config.j2 defaults: yes - provider: "{{ cli }}" become: yes register: result diff --git a/test/integration/targets/eos_config/tests/cli/save.yaml b/test/integration/targets/eos_config/tests/cli/save.yaml index 55b11ddfed..58d5322028 100644 --- a/test/integration/targets/eos_config/tests/cli/save.yaml +++ b/test/integration/targets/eos_config/tests/cli/save.yaml @@ -9,14 +9,12 @@ parents: - interface Ethernet2 match: none - provider: "{{ cli }}" become: yes - name: save config always eos_config: save_when: always - provider: "{{ cli }}" become: yes register: result @@ -27,7 +25,6 @@ - name: save always again (not idempotent) eos_config: save_when: always - provider: "{{ cli }}" become: yes register: result diff --git a/test/integration/targets/eos_config/tests/cli/src_basic.yaml b/test/integration/targets/eos_config/tests/cli/src_basic.yaml index fb10b9c7eb..174d814aa0 100644 --- a/test/integration/targets/eos_config/tests/cli/src_basic.yaml +++ b/test/integration/targets/eos_config/tests/cli/src_basic.yaml @@ -9,13 +9,11 @@ parents: - interface Ethernet2 match: none - provider: "{{ cli }}" become: yes - name: configure device with config eos_config: src: basic/config.j2 - provider: "{{ cli }}" become: yes register: result @@ -29,7 +27,6 @@ eos_config: src: basic/config.j2 defaults: yes - provider: "{{ cli }}" become: yes register: result diff --git a/test/integration/targets/eos_config/tests/cli/src_invalid.yaml b/test/integration/targets/eos_config/tests/cli/src_invalid.yaml index 64bad95784..8931c7cf87 100644 --- a/test/integration/targets/eos_config/tests/cli/src_invalid.yaml +++ b/test/integration/targets/eos_config/tests/cli/src_invalid.yaml @@ -6,7 +6,6 @@ - name: configure with invalid src eos_config: src: basic/foobar.j2 - provider: "{{ cli }}" become: yes register: result ignore_errors: yes diff --git a/test/integration/targets/eos_config/tests/cli/src_match_none.yaml b/test/integration/targets/eos_config/tests/cli/src_match_none.yaml index 0d73a27e18..74c5043612 100644 --- a/test/integration/targets/eos_config/tests/cli/src_match_none.yaml +++ b/test/integration/targets/eos_config/tests/cli/src_match_none.yaml @@ -9,13 +9,11 @@ parents: - interface Ethernet2 match: none - provider: "{{ cli }}" become: yes - name: configure device with config eos_config: src: basic/config.j2 - provider: "{{ cli }}" match: none become: yes register: result @@ -30,7 +28,6 @@ eos_config: src: basic/config.j2 defaults: yes - provider: "{{ cli }}" become: yes register: result diff --git a/test/integration/targets/eos_config/tests/cli/sublevel.yaml b/test/integration/targets/eos_config/tests/cli/sublevel.yaml index 4e6f5ca3a6..289e80660c 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel.yaml @@ -5,14 +5,12 @@ eos_config: lines: no vlan 10 match: none - provider: "{{ cli }}" become: yes - name: configure sub level command eos_config: lines: name test parents: vlan 10 - provider: "{{ cli }}" become: yes register: result @@ -26,7 +24,6 @@ eos_config: lines: name test parents: vlan 10 - provider: "{{ cli }}" become: yes register: result @@ -38,7 +35,6 @@ eos_config: lines: no vlan 10 match: none - provider: "{{ cli }}" become: yes diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml index c55f7b8e69..a647faa6d8 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml @@ -11,7 +11,6 @@ before: no ip access-list test after: exit match: none - provider: "{{ cli }}" become: yes - name: configure sub level command using block resplace @@ -24,7 +23,6 @@ parents: ip access-list test replace: block after: exit - provider: "{{ cli }}" become: yes register: result @@ -47,7 +45,6 @@ parents: ip access-list test replace: block after: exit - provider: "{{ cli }}" become: yes register: result @@ -59,7 +56,6 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml index c4a9c48430..e940d74739 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml @@ -13,7 +13,6 @@ before: no ip access-list test after: exit match: none - provider: "{{ cli }}" become: yes - name: configure sub level command using exact match @@ -28,7 +27,6 @@ after: exit match: exact replace: block - provider: "{{ cli }}" become: yes register: result @@ -51,7 +49,6 @@ - 40 permit ip host 4.4.4.4 any log parents: ip access-list test match: exact - provider: "{{ cli }}" become: yes register: result @@ -63,7 +60,6 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml index 61907befcb..649af8cf1a 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml @@ -13,7 +13,6 @@ before: no ip access-list test after: exit match: none - provider: "{{ cli }}" become: yes - name: configure sub level command using strict match @@ -28,7 +27,6 @@ after: exit match: strict replace: block - provider: "{{ cli }}" become: yes register: result @@ -51,7 +49,6 @@ - 40 permit ip host 4.4.4.4 any log parents: ip access-list test match: strict - provider: "{{ cli }}" become: yes register: result @@ -63,7 +60,6 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel.yaml b/test/integration/targets/eos_config/tests/cli/toplevel.yaml index c11389135d..5679dfb29b 100644 --- a/test/integration/targets/eos_config/tests/cli/toplevel.yaml +++ b/test/integration/targets/eos_config/tests/cli/toplevel.yaml @@ -5,13 +5,11 @@ eos_config: lines: hostname veos01 match: none - provider: "{{ cli }}" become: yes - name: configure top level command eos_config: lines: hostname foo - provider: "{{ cli }}" become: yes register: result @@ -23,7 +21,6 @@ - name: configure top level command idempotent check eos_config: lines: hostname foo - provider: "{{ cli }}" become: yes register: result @@ -35,7 +32,6 @@ eos_config: lines: hostname veos01 match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml b/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml index bab44776b9..5fc287ec2e 100644 --- a/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml +++ b/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml @@ -7,14 +7,12 @@ - snmp-server contact ansible - hostname veos01 match: none - provider: "{{ cli }}" become: yes - name: configure top level command with before eos_config: lines: hostname foo after: snmp-server contact bar - provider: "{{ cli }}" become: yes register: result @@ -28,7 +26,6 @@ eos_config: lines: hostname foo after: snmp-server contact foo - provider: "{{ cli }}" become: yes register: result @@ -42,7 +39,6 @@ - no snmp-server contact - hostname veos01 match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml b/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml index 9670df1f7d..c5da9a5751 100644 --- a/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml +++ b/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml @@ -7,14 +7,12 @@ - snmp-server contact ansible - hostname veos01 match: none - provider: "{{ cli }}" become: yes - name: configure top level command with before eos_config: lines: hostname foo before: snmp-server contact bar - provider: "{{ cli }}" become: yes register: result @@ -28,7 +26,6 @@ eos_config: lines: hostname foo before: snmp-server contact foo - provider: "{{ cli }}" become: yes register: result @@ -42,7 +39,6 @@ - hostname veos01 - no snmp-server contact match: none - provider: "{{ cli }}" become: yes - debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/eapi/backup.yaml b/test/integration/targets/eos_config/tests/eapi/backup.yaml index 0ac02c288e..45dfa4e0c7 100644 --- a/test/integration/targets/eos_config/tests/eapi/backup.yaml +++ b/test/integration/targets/eos_config/tests/eapi/backup.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START eapi/backup.yaml" +- debug: msg="START eapi/backup.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -9,14 +9,14 @@ parents: - interface Ethernet2 match: none - provider: "{{ eapi }}" + become: yes - name: collect any backup files find: paths: "{{ role_path }}/backup" pattern: "{{ inventory_hostname_short }}_config*" register: backup_files - delegate_to: localhost + connection: local - name: delete backup files file: @@ -28,7 +28,7 @@ eos_config: src: basic/config.j2 backup: yes - provider: "{{ eapi }}" + become: yes register: result - assert: @@ -41,10 +41,10 @@ paths: "{{ role_path }}/backup" pattern: "{{ inventory_hostname_short }}_config*" register: backup_files - delegate_to: localhost + connection: local - assert: that: - "backup_files.files is defined" -- debug: msg="END eapi/backup.yaml" +- debug: msg="END eapi/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/eapi/defaults.yaml b/test/integration/targets/eos_config/tests/eapi/defaults.yaml index 2e295e1d09..413127e9e9 100644 --- a/test/integration/targets/eos_config/tests/eapi/defaults.yaml +++ b/test/integration/targets/eos_config/tests/eapi/defaults.yaml @@ -9,13 +9,11 @@ parents: - interface Ethernet2 match: none - provider: "{{ eapi }}" - name: configure device with defaults included eos_config: src: defaults/config.j2 defaults: yes - provider: "{{ eapi }}" register: result - debug: var=result @@ -29,7 +27,6 @@ eos_config: src: defaults/config.j2 defaults: yes - provider: "{{ eapi }}" register: result - debug: var=result diff --git a/test/integration/targets/eos_config/tests/eapi/save.yaml b/test/integration/targets/eos_config/tests/eapi/save.yaml index 121fe1a6b0..003924c858 100644 --- a/test/integration/targets/eos_config/tests/eapi/save.yaml +++ b/test/integration/targets/eos_config/tests/eapi/save.yaml @@ -9,13 +9,11 @@ parents: - interface Ethernet2 match: none - provider: "{{ eapi }}" - name: save config eos_config: save_when: always - provider: "{{ eapi }}" register: result - assert: @@ -25,7 +23,6 @@ - name: save should always run eos_config: save_when: always - provider: "{{ eapi }}" register: result - assert: diff --git a/test/integration/targets/eos_config/tests/eapi/src_basic.yaml b/test/integration/targets/eos_config/tests/eapi/src_basic.yaml index f5d0b0404d..dc1982f156 100644 --- a/test/integration/targets/eos_config/tests/eapi/src_basic.yaml +++ b/test/integration/targets/eos_config/tests/eapi/src_basic.yaml @@ -9,12 +9,10 @@ parents: - interface Ethernet2 match: none - provider: "{{ eapi }}" - name: configure device with config eos_config: src: basic/config.j2 - provider: "{{ eapi }}" register: result - assert: @@ -26,7 +24,6 @@ - name: check device with config eos_config: src: basic/config.j2 - provider: "{{ eapi }}" register: result - assert: diff --git a/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml b/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml index 25745b5eac..d3deade606 100644 --- a/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml +++ b/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml @@ -6,7 +6,6 @@ - name: configure with invalid src eos_config: src: basic/foobar.j2 - provider: "{{ eapi }}" register: result ignore_errors: yes diff --git a/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml b/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml index 6535c66026..770308b682 100644 --- a/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml +++ b/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml @@ -9,12 +9,10 @@ parents: - interface Ethernet2 match: none - provider: "{{ eapi }}" - name: configure device with config eos_config: src: basic/config.j2 - provider: "{{ eapi }}" match: none register: result @@ -27,7 +25,6 @@ - name: check device with config eos_config: src: basic/config.j2 - provider: "{{ eapi }}" register: result - assert: diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel.yaml index 7f3d3d5e59..9b1b5096a0 100644 --- a/test/integration/targets/eos_config/tests/eapi/sublevel.yaml +++ b/test/integration/targets/eos_config/tests/eapi/sublevel.yaml @@ -5,14 +5,12 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ eapi }}" - name: configure sub level command eos_config: lines: 10 permit ip any any log parents: ip access-list test after: exit - provider: "{{ eapi }}" register: result - assert: @@ -25,7 +23,6 @@ eos_config: lines: 10 permit ip any any log parents: ip access-list test - provider: "{{ eapi }}" register: result - assert: @@ -36,6 +33,5 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ cli }}" - debug: msg="END eapi/sublevel.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml index d634020291..cf6b4cbcb8 100644 --- a/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml +++ b/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml @@ -10,7 +10,6 @@ parents: ip access-list test before: no ip access-list test match: none - provider: "{{ eapi }}" - name: configure sub level command using block resplace eos_config: @@ -22,7 +21,6 @@ parents: ip access-list test after: end replace: block - provider: "{{ eapi }}" register: result - assert: @@ -43,7 +41,6 @@ - 40 permit ip host 4.4.4.4 any log parents: ip access-list test replace: block - provider: "{{ eapi }}" register: result - assert: @@ -54,6 +51,5 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ eapi }}" - debug: msg="END eapi/sublevel_block.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml index 7da723644a..a7aedf7c2b 100644 --- a/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml +++ b/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml @@ -13,7 +13,6 @@ before: no ip access-list test after: exit match: none - provider: "{{ eapi }}" - name: configure sub level command using exact match eos_config: @@ -26,7 +25,6 @@ parents: ip access-list test after: exit match: exact - provider: "{{ eapi }}" register: result - assert: @@ -49,7 +47,6 @@ before: no ip access-list test parents: ip access-list test match: exact - provider: "{{ eapi }}" register: result - assert: @@ -60,6 +57,5 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ eapi }}" - debug: msg="END eapi/sublevel_exact.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml index dbd16184c1..d544902279 100644 --- a/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml +++ b/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml @@ -11,7 +11,6 @@ - 50 permit ip host 5.5.5.5 any log parents: ip access-list test before: no ip access-list test - provider: "{{ eapi }}" match: none - name: configure sub level command using strict match @@ -26,7 +25,6 @@ after: exit match: strict replace: block - provider: "{{ eapi }}" register: result - assert: @@ -48,7 +46,6 @@ - 40 permit ip host 4.4.4.4 any log parents: ip access-list test match: strict - provider: "{{ eapi }}" register: result - assert: @@ -59,6 +56,5 @@ eos_config: lines: no ip access-list test match: none - provider: "{{ eapi }}" - debug: msg="END eapi/sublevel_strict.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/toplevel.yaml b/test/integration/targets/eos_config/tests/eapi/toplevel.yaml index 36383a94b3..be9038dfae 100644 --- a/test/integration/targets/eos_config/tests/eapi/toplevel.yaml +++ b/test/integration/targets/eos_config/tests/eapi/toplevel.yaml @@ -5,12 +5,10 @@ eos_config: lines: hostname {{ inventory_hostname_short }} match: none - provider: "{{ eapi }}" - name: configure top level command eos_config: lines: hostname foo - provider: "{{ eapi }}" register: result - assert: @@ -21,7 +19,6 @@ - name: configure top level command idempotent check eos_config: lines: hostname foo - provider: "{{ eapi }}" register: result - assert: @@ -32,6 +29,5 @@ eos_config: lines: hostname {{ inventory_hostname_short }} match: none - provider: "{{ eapi }}" - debug: msg="END eapi/toplevel.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml b/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml index 256823ccfe..c7b90e678d 100644 --- a/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml +++ b/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml @@ -7,13 +7,11 @@ - "snmp-server contact ansible" - "hostname {{ inventory_hostname_short }}" match: none - provider: "{{ eapi }}" - name: configure top level command with before eos_config: lines: hostname foo after: snmp-server contact bar - provider: "{{ eapi }}" register: result - assert: @@ -26,7 +24,6 @@ eos_config: lines: hostname foo after: snmp-server contact foo - provider: "{{ eapi }}" register: result - assert: @@ -39,6 +36,5 @@ - no snmp-server contact - hostname {{ inventory_hostname_short }} match: none - provider: "{{ eapi }}" - debug: msg="END eapi/toplevel_after.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml b/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml index 0f1ca150f9..26e2db9f8d 100644 --- a/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml +++ b/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml @@ -7,13 +7,11 @@ - "snmp-server contact ansible" - "hostname {{ inventory_hostname_short }}" match: none - provider: "{{ eapi }}" - name: configure top level command with before eos_config: lines: hostname foo before: snmp-server contact bar - provider: "{{ eapi }}" register: result - assert: @@ -26,7 +24,6 @@ eos_config: lines: hostname foo before: snmp-server contact foo - provider: "{{ eapi }}" register: result - assert: @@ -39,6 +36,5 @@ - no snmp-server contact ansible - hostname {{ inventory_hostname_short }} match: none - provider: "{{ eapi }}" - debug: msg="END eapi/toplevel_before.yaml" diff --git a/test/integration/targets/eos_facts/tasks/cli.yaml b/test/integration/targets/eos_facts/tasks/cli.yaml index a6f7ae0351..87a42971bb 100644 --- a/test/integration/targets/eos_facts/tasks/cli.yaml +++ b/test/integration/targets/eos_facts/tasks/cli.yaml @@ -14,9 +14,3 @@ 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 ansible_become=no" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_facts/tasks/eapi.yaml b/test/integration/targets/eos_facts/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_facts/tasks/eapi.yaml +++ b/test/integration/targets/eos_facts/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_facts/tests/cli/all_facts.yaml b/test/integration/targets/eos_facts/tests/cli/all_facts.yaml index 8183fed980..4a4ed164d5 100644 --- a/test/integration/targets/eos_facts/tests/cli/all_facts.yaml +++ b/test/integration/targets/eos_facts/tests/cli/all_facts.yaml @@ -4,7 +4,6 @@ - name: test getting all facts eos_facts: - provider: "{{ cli }}" gather_subset: - all become: yes diff --git a/test/integration/targets/eos_facts/tests/cli/default_facts.yaml b/test/integration/targets/eos_facts/tests/cli/default_facts.yaml index bdf6ac4793..3f5879a0c5 100644 --- a/test/integration/targets/eos_facts/tests/cli/default_facts.yaml +++ b/test/integration/targets/eos_facts/tests/cli/default_facts.yaml @@ -4,7 +4,6 @@ - name: test getting default facts eos_facts: - provider: "{{ cli }}" become: yes register: result diff --git a/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml b/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml index 0eb2d3626c..b339fcfca6 100644 --- a/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml +++ b/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml @@ -4,7 +4,6 @@ - name: test invalid subset (foobar) eos_facts: - provider: "{{ cli }}" gather_subset: - "foobar" register: result @@ -26,7 +25,6 @@ - name: test subset specified multiple times eos_facts: - provider: "{{ cli }}" gather_subset: - "!hardware" - "hardware" diff --git a/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml b/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml index 5679049b86..a2322f0cbe 100644 --- a/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml +++ b/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml @@ -4,7 +4,6 @@ - name: test not hardware eos_facts: - provider: "{{ cli }}" gather_subset: - "!hardware" become: yes diff --git a/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml b/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml index 1112148a5e..0c01a536d1 100644 --- a/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml +++ b/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml @@ -5,11 +5,9 @@ eos_config: lines: lldp run authorize: yes - provider: "{{ eapi }}" - name: test getting all facts eos_facts: - provider: "{{ eapi }}" gather_subset: - all register: result @@ -35,6 +33,5 @@ eos_config: lines: no lldp run authorize: yes - provider: "{{ eapi }}" - debug: msg="END eapi/all_facts.yaml" diff --git a/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml b/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml index 2892746671..79b5be58ba 100644 --- a/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml +++ b/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml @@ -5,11 +5,9 @@ eos_config: lines: lldp run authorize: yes - provider: "{{ eapi }}" - name: test getting default facts eos_facts: - provider: "{{ eapi }}" register: result - assert: @@ -37,6 +35,5 @@ eos_config: lines: lldp run authorize: yes - provider: "{{ eapi }}" - debug: msg="END eapi/default.yaml" diff --git a/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml b/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml index e6fba87181..ec8bc75d5a 100644 --- a/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml +++ b/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml @@ -4,7 +4,6 @@ - name: test invalid subset (foobar) eos_facts: - provider: "{{ eapi }}" gather_subset: - "foobar" register: result @@ -26,7 +25,6 @@ - name: test subset specified multiple times eos_facts: - provider: "{{ eapi }}" gather_subset: - "!hardware" - "hardware" diff --git a/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml b/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml index 46b54a6354..0b00c945c9 100644 --- a/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml +++ b/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml @@ -5,11 +5,9 @@ eos_config: lines: lldp run authorize: yes - provider: "{{ eapi }}" - name: test not hardware eos_facts: - provider: "{{ eapi }}" gather_subset: - "!hardware" register: result @@ -36,6 +34,5 @@ eos_config: lines: no lldp run authorize: yes - provider: "{{ eapi }}" - debug: msg="END eapi/not_hardware_facts.yaml" diff --git a/test/integration/targets/eos_interface/tasks/eapi.yaml b/test/integration/targets/eos_interface/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_interface/tasks/eapi.yaml +++ b/test/integration/targets/eos_interface/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_l2_interface/tasks/eapi.yaml b/test/integration/targets/eos_l2_interface/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_l2_interface/tasks/eapi.yaml +++ b/test/integration/targets/eos_l2_interface/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_l3_interface/tasks/eapi.yaml b/test/integration/targets/eos_l3_interface/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_l3_interface/tasks/eapi.yaml +++ b/test/integration/targets/eos_l3_interface/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_lldp/tasks/eapi.yaml b/test/integration/targets/eos_lldp/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_lldp/tasks/eapi.yaml +++ b/test/integration/targets/eos_lldp/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_logging/tasks/eapi.yaml b/test/integration/targets/eos_logging/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_logging/tasks/eapi.yaml +++ b/test/integration/targets/eos_logging/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_smoke/tasks/cli.yaml b/test/integration/targets/eos_smoke/tasks/cli.yaml index a6f7ae0351..c13ea76bac 100644 --- a/test/integration/targets/eos_smoke/tasks/cli.yaml +++ b/test/integration/targets/eos_smoke/tasks/cli.yaml @@ -17,6 +17,6 @@ - name: run test case (connection=local) include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no" - with_first_found: "{{ test_items }}" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_smoke/tasks/eapi.yaml b/test/integration/targets/eos_smoke/tasks/eapi.yaml index bda1df677a..6ce80b3b74 100644 --- a/test/integration/targets/eos_smoke/tasks/eapi.yaml +++ b/test/integration/targets/eos_smoke/tasks/eapi.yaml @@ -9,6 +9,12 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" + 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" with_items: "{{ test_items }}" diff --git a/test/integration/targets/eos_smoke/tests/cli/common_config.yaml b/test/integration/targets/eos_smoke/tests/cli/common_config.yaml index ca631e2b00..340e46c0a6 100644 --- a/test/integration/targets/eos_smoke/tests/cli/common_config.yaml +++ b/test/integration/targets/eos_smoke/tests/cli/common_config.yaml @@ -45,64 +45,65 @@ become: yes # hit block and diffs +- block: + - name: setup + eos_config: + lines: + - 10 permit ip host 1.1.1.1 any log + - 20 permit ip host 2.2.2.2 any log + - 30 permit ip host 3.3.3.3 any log + parents: ip access-list test + before: no ip access-list test + after: exit + match: strict + provider: "{{ cli }}" + become: yes -- name: setup - eos_config: - lines: - - 10 permit ip host 1.1.1.1 any log - - 20 permit ip host 2.2.2.2 any log - - 30 permit ip host 3.3.3.3 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: strict - provider: "{{ cli }}" - become: yes + - name: configure sub level command using block replace + eos_config: + lines: + - 10 permit ip host 1.1.1.1 any log + - 20 permit ip host 2.2.2.2 any log + - 30 permit ip host 3.3.3.3 any log + - 40 permit ip host 4.4.4.4 any log + parents: ip access-list test + replace: block + after: exit + provider: "{{ cli }}" + match: line + become: yes + register: result -- name: configure sub level command using block resplace - eos_config: - lines: - - 10 permit ip host 1.1.1.1 any log - - 20 permit ip host 2.2.2.2 any log - - 30 permit ip host 3.3.3.3 any log - - 40 permit ip host 4.4.4.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ cli }}" - match: line - become: yes - register: result + - assert: + that: + - "result.changed == true" + - "'ip access-list test' in result.updates" + - "'10 permit ip host 1.1.1.1 any log' in result.updates" + - "'20 permit ip host 2.2.2.2 any log' in result.updates" + - "'30 permit ip host 3.3.3.3 any log' in result.updates" + - "'40 permit ip host 4.4.4.4 any log' in result.updates" -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 1.1.1.1 any log' in result.updates" - - "'20 permit ip host 2.2.2.2 any log' in result.updates" - - "'30 permit ip host 3.3.3.3 any log' in result.updates" - - "'40 permit ip host 4.4.4.4 any log' in result.updates" + - name: check sub level command using block replace + eos_config: + lines: + - 10 permit ip host 1.1.1.1 any log + - 20 permit ip host 2.2.2.2 any log + - 30 permit ip host 3.3.3.3 any log + - 40 permit ip host 4.4.4.4 any log + parents: ip access-list test + replace: block + after: exit + provider: "{{ cli }}" + match: exact + become: yes + register: result -- name: check sub level command using block replace - eos_config: - lines: - - 10 permit ip host 1.1.1.1 any log - - 20 permit ip host 2.2.2.2 any log - - 30 permit ip host 3.3.3.3 any log - - 40 permit ip host 4.4.4.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ cli }}" - match: exact - become: yes - register: result - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - provider: "{{ cli }}" - become: yes + always: + - name: teardown + eos_config: + lines: no ip access-list test + match: none + provider: "{{ cli }}" + become: yes - debug: msg="END cli/common_config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml b/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml index da80c00409..05c4902872 100644 --- a/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml +++ b/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml @@ -40,60 +40,61 @@ provider: "{{ eapi }}" # hit block and diffs +- block: + - name: setup + eos_config: + lines: + - 10 permit ip host 1.1.1.1 any log + - 20 permit ip host 2.2.2.2 any log + - 30 permit ip host 3.3.3.3 any log + parents: ip access-list test + before: no ip access-list test + after: exit + match: strict + provider: "{{ eapi }}" -- name: setup - eos_config: - lines: - - 10 permit ip host 1.1.1.1 any log - - 20 permit ip host 2.2.2.2 any log - - 30 permit ip host 3.3.3.3 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: strict - provider: "{{ eapi }}" + - name: configure sub level command using block replace + eos_config: + lines: + - 10 permit ip host 1.1.1.1 any log + - 20 permit ip host 2.2.2.2 any log + - 30 permit ip host 3.3.3.3 any log + - 40 permit ip host 4.4.4.4 any log + parents: ip access-list test + replace: block + after: exit + provider: "{{ eapi }}" + match: line + register: result -- name: configure sub level command using block resplace - eos_config: - lines: - - 10 permit ip host 1.1.1.1 any log - - 20 permit ip host 2.2.2.2 any log - - 30 permit ip host 3.3.3.3 any log - - 40 permit ip host 4.4.4.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ eapi }}" - match: line - register: result + - assert: + that: + - "result.changed == true" + - "'ip access-list test' in result.updates" + - "'10 permit ip host 1.1.1.1 any log' in result.updates" + - "'20 permit ip host 2.2.2.2 any log' in result.updates" + - "'30 permit ip host 3.3.3.3 any log' in result.updates" + - "'40 permit ip host 4.4.4.4 any log' in result.updates" -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 1.1.1.1 any log' in result.updates" - - "'20 permit ip host 2.2.2.2 any log' in result.updates" - - "'30 permit ip host 3.3.3.3 any log' in result.updates" - - "'40 permit ip host 4.4.4.4 any log' in result.updates" + - name: check sub level command using block replace + eos_config: + lines: + - 10 permit ip host 1.1.1.1 any log + - 20 permit ip host 2.2.2.2 any log + - 30 permit ip host 3.3.3.3 any log + - 40 permit ip host 4.4.4.4 any log + parents: ip access-list test + replace: block + after: exit + provider: "{{ eapi }}" + match: exact + register: result -- name: check sub level command using block replace - eos_config: - lines: - - 10 permit ip host 1.1.1.1 any log - - 20 permit ip host 2.2.2.2 any log - - 30 permit ip host 3.3.3.3 any log - - 40 permit ip host 4.4.4.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ eapi }}" - match: exact - register: result - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - provider: "{{ eapi }}" + always: + - name: teardown + eos_config: + lines: no ip access-list test + match: none + provider: "{{ eapi }}" - debug: msg="END cli/common_config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_smoke/tests/eapi/misc_tests.yaml b/test/integration/targets/eos_smoke/tests/eapi/misc_tests.yaml deleted file mode 100644 index 9d089f7afc..0000000000 --- a/test/integration/targets/eos_smoke/tests/eapi/misc_tests.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- debug: msg="START cli/misc_tests.yaml on connection={{ ansible_connection }}" - - -# test become and unbecome -- block: - - name: command that does require become (should fail) - eos_command: - commands: show running-config - provider: "{{ eapi }}" - become: no - ignore_errors: yes - register: result - - - assert: - that: - - 'result.failed == true' - - '"privileged mode required" in result.module_stderr' - - - name: command that doesn't require become - eos_command: - commands: show uptime - provider: "{{ eapi }}" - become: no - - when: "ansible_connection != 'local'" diff --git a/test/integration/targets/eos_system/tasks/eapi.yaml b/test/integration/targets/eos_system/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_system/tasks/eapi.yaml +++ b/test/integration/targets/eos_system/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/eos_user/tasks/eapi.yaml b/test/integration/targets/eos_user/tasks/eapi.yaml index bda1df677a..1109c6bf6a 100644 --- a/test/integration/targets/eos_user/tasks/eapi.yaml +++ b/test/integration/targets/eos_user/tasks/eapi.yaml @@ -9,8 +9,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_aaa_server/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_aaa_server/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run 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 517c247208..bf39b62752 100644 --- a/test/integration/targets/nxos_aaa_server/tests/common/radius.yaml +++ b/test/integration/targets/nxos_aaa_server/tests/common/radius.yaml @@ -10,7 +10,6 @@ server_timeout: default directed_request: default state: default - provider: "{{ connection }}" ignore_errors: yes - block: @@ -18,7 +17,6 @@ nxos_aaa_server: &configure_default_radius server_type: radius state: present - provider: "{{ connection }}" register: result - name: "Check Idempotence" @@ -36,7 +34,6 @@ deadtime: 20 directed_request: enabled state: present - provider: "{{ connection }}" register: result - assert: &true @@ -61,7 +58,6 @@ encrypt_type: 7 global_key: test_key state: present - provider: "{{ connection }}" register: result - assert: *true @@ -80,7 +76,6 @@ global_key: default directed_request: default state: default - provider: "{{ connection }}" register: result - assert: *true 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 0ad7effb4a..4e9796397f 100644 --- a/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml +++ b/test/integration/targets/nxos_aaa_server/tests/common/tacacs.yaml @@ -7,7 +7,6 @@ nxos_feature: feature: tacacs+ state: enabled - provider: "{{ connection }}" - name: "Setup" nxos_aaa_server: &remove @@ -16,7 +15,6 @@ server_timeout: default directed_request: default state: default - provider: "{{ connection }}" ignore_errors: yes - block: @@ -24,7 +22,6 @@ nxos_aaa_server: &configure_default_tacacs server_type: tacacs state: present - provider: "{{ connection }}" register: result - name: "Check Idempotence" @@ -42,7 +39,6 @@ deadtime: 20 directed_request: enabled state: present - provider: "{{ connection }}" register: result - assert: &true @@ -67,7 +63,6 @@ encrypt_type: 7 global_key: test_key state: present - provider: "{{ connection }}" register: result - assert: *true @@ -86,7 +81,6 @@ global_key: default directed_request: default state: default - provider: "{{ connection }}" register: result - assert: *true @@ -111,6 +105,5 @@ nxos_feature: feature: tacacs+ state: disabled - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }} nxos_aaa_server tacacs.yaml sanity test" 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_aaa_server_host/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run 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 cf9a65556b..b588429fbf 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 @@ -8,7 +8,6 @@ server_type: radius address: 8.8.8.8 state: absent - provider: "{{ connection }}" ignore_errors: yes - block: @@ -17,7 +16,6 @@ server_type: radius address: 8.8.8.8 state: present - provider: "{{ connection }}" register: result - assert: &true @@ -52,7 +50,6 @@ auth_port: 2083 acct_port: 2084 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -71,7 +68,6 @@ auth_port: 1000 acct_port: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -92,7 +88,6 @@ encrypt_type: 0 key: hello state: present - provider: "{{ connection }}" register: result - assert: *true @@ -119,7 +114,6 @@ encrypt_type: 7 key: hello state: present - provider: "{{ connection }}" register: result - assert: *true @@ -140,7 +134,6 @@ encrypt_type: 7 key: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -160,7 +153,6 @@ acct_port: default key: default state: present - provider: "{{ connection }}" register: result - assert: *true 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 6307316734..8fc21ea6c1 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 @@ -7,14 +7,12 @@ nxos_feature: feature: tacacs+ state: enabled - provider: "{{ connection }}" - name: "Setup" nxos_aaa_server_host: &remove server_type: tacacs address: 8.8.8.8 state: absent - provider: "{{ connection }}" ignore_errors: yes - block: @@ -24,7 +22,6 @@ server_type: tacacs address: 8.8.8.8 state: present - provider: "{{ connection }}" register: result - assert: &true @@ -58,7 +55,6 @@ host_timeout: 25 tacacs_port: 89 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -76,7 +72,6 @@ host_timeout: default tacacs_port: 100 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -96,7 +91,6 @@ encrypt_type: 0 key: hello state: present - provider: "{{ connection }}" register: result - assert: *true @@ -122,7 +116,6 @@ encrypt_type: 7 key: hello state: present - provider: "{{ connection }}" register: result - assert: *true @@ -142,7 +135,6 @@ encrypt_type: 7 key: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -161,7 +153,6 @@ tacacs_port: default key: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -186,6 +177,5 @@ nxos_feature: feature: tacacs+ state: disabled - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }} nxos_aaa_server_host tacacs.yaml sanity test" diff --git a/test/integration/targets/nxos_acl/tasks/nxapi.yaml b/test/integration/targets/nxos_acl/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_acl/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_acl/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 83d21ab57c..3df42b8ae6 100644 --- a/test/integration/targets/nxos_acl/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_acl/tests/common/sanity.yaml @@ -11,7 +11,6 @@ name: TEST_ACL seq: 10 state: delete_acl - provider: "{{ connection }}" ignore_errors: yes - name: "Configure ACE10" @@ -38,7 +37,6 @@ syn: 'enable' time_range: "{{time_range|default(omit)}}" state: present - provider: "{{ connection }}" register: result - assert: &true @@ -77,7 +75,6 @@ syn: 'enable' time_range: "{{time_range|default(omit)}}" state: present - provider: "{{ connection }}" register: result - assert: *true @@ -95,7 +92,6 @@ action: remark remark: test_remark state: present - provider: "{{ connection }}" register: result - assert: *true @@ -113,7 +109,6 @@ action: remark remark: changed_remark state: present - provider: "{{ connection }}" register: result - assert: *true @@ -135,7 +130,6 @@ fragments: enable precedence: network state: present - provider: "{{ connection }}" register: result - assert: *true @@ -156,7 +150,6 @@ dest: any precedence: network state: present - provider: "{{ connection }}" register: result - assert: *true @@ -179,7 +172,6 @@ dest: any precedence: network state: present - provider: "{{ connection }}" register: result - assert: *true @@ -200,7 +192,6 @@ dest: any precedence: network state: present - provider: "{{ connection }}" register: result - assert: *true @@ -216,7 +207,6 @@ name: TEST_ACL seq: 30 state: absent - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_acl_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 f397c2c273..1d53cfbae7 100644 --- a/test/integration/targets/nxos_acl_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_acl_interface/tests/common/sanity.yaml @@ -13,7 +13,6 @@ nxos_config: &default lines: - "default interface {{ intname }}" - provider: "{{ connection }}" ignore_errors: yes - name: "Setup: Put interface into no switch port mode" @@ -23,7 +22,6 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" ignore_errors: yes - name: "Setup: Cleanup possibly existing acl" @@ -31,7 +29,6 @@ name: ANSIBLE_ACL seq: 10 state: delete_acl - provider: "{{ connection }}" ignore_errors: yes - name: Configure Supporting ACL @@ -42,7 +39,6 @@ proto: tcp src: 1.1.1.1/24 dest: any - provider: "{{ connection }}" - block: - name: Configure acl interface egress @@ -51,7 +47,6 @@ interface: "{{ intname }}" direction: egress state: present - provider: "{{ connection }}" register: result - assert: &true @@ -72,7 +67,6 @@ interface: "{{ intname }}" direction: ingress state: present - provider: "{{ connection }}" register: result - assert: *true @@ -89,7 +83,6 @@ interface: "{{ intname }}" direction: egress state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -106,7 +99,6 @@ interface: "{{ intname }}" direction: ingress state: absent - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_banner/tasks/nxapi.yaml b/test/integration/targets/nxos_banner/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_banner/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_banner/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml b/test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml index f795df3f58..9cdf650220 100644 --- a/test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml +++ b/test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml @@ -6,7 +6,6 @@ nxos_banner: &remove banner: exec state: absent - provider: "{{ cli }}" - name: Set exec nxos_banner: &exec @@ -16,7 +15,6 @@ that has a multiline string state: present - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml b/test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml index 18121ba3a6..1280f78696 100644 --- a/test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml +++ b/test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml @@ -5,7 +5,6 @@ nxos_banner: &remove banner: motd state: absent - provider: "{{ cli }}" - name: Set motd nxos_banner: &motd @@ -15,7 +14,6 @@ that has a multiline string state: present - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml b/test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml index 8f4368c229..e281f6e471 100644 --- a/test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml +++ b/test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml @@ -8,13 +8,11 @@ Junk motd banner over multiple lines state: present - provider: "{{ cli }}" - name: remove motd nxos_banner: &rm-motd banner: motd state: absent - provider: "{{ cli }}" register: result - assert: diff --git a/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml b/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml index 8ecc7f06a9..59dd1f7005 100644 --- a/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml +++ b/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml @@ -6,7 +6,6 @@ nxos_banner: &remove banner: exec state: absent - provider: "{{ nxapi }}" - name: Set exec nxos_banner: &exec @@ -16,7 +15,6 @@ that has a multiline string state: present - provider: "{{ nxapi }}" register: result - assert: diff --git a/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml b/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml index ac94103f24..b770b1f9d5 100644 --- a/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml +++ b/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml @@ -5,7 +5,6 @@ nxos_banner: &remove banner: motd state: absent - provider: "{{ nxapi }}" - name: Set motd nxos_banner: &motd @@ -15,7 +14,6 @@ that has a multiline string state: present - provider: "{{ nxapi }}" register: result - assert: diff --git a/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml b/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml index 69072f24cc..547b3e5405 100644 --- a/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml +++ b/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml @@ -8,13 +8,11 @@ Junk motd banner over multiple lines state: present - provider: "{{ nxapi }}" - name: remove motd nxos_banner: &rm-motd banner: motd state: absent - provider: "{{ nxapi }}" register: result - assert: diff --git a/test/integration/targets/nxos_become/tasks/nxapi.yaml b/test/integration/targets/nxos_become/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_become/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_become/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_become/tests/cli/sanity.yaml b/test/integration/targets/nxos_become/tests/cli/sanity.yaml index ad863871e3..2a97362a52 100644 --- a/test/integration/targets/nxos_become/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_become/tests/cli/sanity.yaml @@ -10,7 +10,6 @@ - username admin role priv-14 - no username admin role priv-15 - enable secret 0 cisco - provider: "{{ cli }}" - name: reset_connection meta: reset_connection @@ -18,7 +17,6 @@ - name: run commands with become nxos_command: commands: 'show privilege' - provider: "{{ cli }}" become: yes register: result @@ -33,7 +31,6 @@ - username admin role priv-15 - no username admin role priv-14 - no enable secret - provider: "{{ cli }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }}/sanity.yaml" diff --git a/test/integration/targets/nxos_bgp/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_bgp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml b/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml index 65c05043dc..602933893e 100644 --- a/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml @@ -13,14 +13,12 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable feature BGP" nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -30,7 +28,6 @@ disable_policy_batching: true disable_policy_batching_ipv4_prefix_list: v4_p disable_policy_batching_ipv6_prefix_list: v6_p - provider: "{{ connection }}" register: result when: bgp_disable_policy @@ -55,7 +52,6 @@ disable_policy_batching: false disable_policy_batching_ipv4_prefix_list: default disable_policy_batching_ipv6_prefix_list: default - provider: "{{ connection }}" register: result when: bgp_disable_policy @@ -78,7 +74,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test" diff --git a/test/integration/targets/nxos_bgp/tests/common/hels.yaml b/test/integration/targets/nxos_bgp/tests/common/hels.yaml index 74cb64071b..3bf29a477b 100644 --- a/test/integration/targets/nxos_bgp/tests/common/hels.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/hels.yaml @@ -13,7 +13,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes when: test_helsinki @@ -21,7 +20,6 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes when: test_helsinki @@ -38,7 +36,6 @@ reconnect_interval: 55 timer_bgp_hold: 110 timer_bgp_keepalive: 45 - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result when: test_helsinki @@ -70,7 +67,6 @@ reconnect_interval: default timer_bgp_hold: default timer_bgp_keepalive: default - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result when: test_helsinki @@ -95,7 +91,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes when: test_helsinki diff --git a/test/integration/targets/nxos_bgp/tests/common/isolate.yaml b/test/integration/targets/nxos_bgp/tests/common/isolate.yaml index b0ded79f66..dce603057a 100644 --- a/test/integration/targets/nxos_bgp/tests/common/isolate.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/isolate.yaml @@ -14,14 +14,12 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable feature BGP" nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -31,7 +29,6 @@ nxos_bgp: &set1 asn: 65535 isolate: false - provider: "{{ connection }}" register: result when: bgp_isolate @@ -54,7 +51,6 @@ nxos_bgp: &reset1 asn: 65535 isolate: true - provider: "{{ connection }}" register: result when: bgp_isolate @@ -77,7 +73,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test" diff --git a/test/integration/targets/nxos_bgp/tests/common/param.yaml b/test/integration/targets/nxos_bgp/tests/common/param.yaml index 5ea70bf6a6..f144be23e9 100644 --- a/test/integration/targets/nxos_bgp/tests/common/param.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/param.yaml @@ -7,14 +7,12 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable feature BGP" nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -35,7 +33,6 @@ graceful_restart_helper: true log_neighbor_changes: true maxas_limit: 50 - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -67,7 +64,6 @@ log_neighbor_changes: false maxas_limit: default router_id: default - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -85,7 +81,6 @@ asn: 65535 vrf: "{{ item }}" cluster_id: 10.0.0.1 - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -103,7 +98,6 @@ asn: 65535 vrf: "{{ item }}" cluster_id: default - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -124,7 +118,6 @@ - 16 - 22 - 18 - provider: "{{ connection }}" register: result - assert: *true @@ -140,7 +133,6 @@ asn: 65535 confederation_id: default confederation_peers: default - provider: "{{ connection }}" register: result - assert: *true @@ -161,7 +153,6 @@ - 16 - 22 - 18 - provider: "{{ connection }}" register: result - assert: *true @@ -179,7 +170,6 @@ local_as: default confederation_id: default confederation_peers: default - provider: "{{ connection }}" register: result - assert: *true @@ -196,7 +186,6 @@ vrf: myvrf local_as: 33 confederation_id: 99 - provider: "{{ connection }}" register: result - assert: *true @@ -213,7 +202,6 @@ vrf: myvrf confederation_id: default local_as: default - provider: "{{ connection }}" register: result - assert: *true @@ -235,7 +223,6 @@ fast_external_fallover: false flush_routes: true shutdown: true - provider: "{{ connection }}" register: result - assert: *true @@ -254,7 +241,6 @@ fast_external_fallover: true flush_routes: false shutdown: false - provider: "{{ connection }}" register: result - assert: *true @@ -270,7 +256,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test" diff --git a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml index 55049b02f1..0d53716947 100644 --- a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml @@ -16,14 +16,12 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Setup" nxos_bgp: &remove asn: 65535 state: absent - provider: "{{ connection }}" ignore_errors: yes register: result @@ -33,7 +31,6 @@ asn: 65535 router_id: 1.1.1.1 state: present - provider: "{{ connection }}" register: result - assert: &true @@ -95,7 +92,6 @@ event_history_periodic: size_small suppress_fib_pending: true state: present - provider: "{{ connection }}" register: result - assert: *true @@ -122,7 +118,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" rescue: - name: "Cleanup BGP" @@ -133,7 +128,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes always: diff --git a/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml b/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml index 1a27bde84e..89f7bebcc7 100644 --- a/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml +++ b/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml @@ -15,14 +15,12 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable feature BGP" nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -33,7 +31,6 @@ asn: 65535 vrf: "{{ item }}" timer_bestpath_limit: 255 - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -55,7 +52,6 @@ asn: 65535 vrf: "{{ item }}" timer_bestpath_limit: default - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -76,7 +72,6 @@ nxos_bgp: &set2 asn: 65535 suppress_fib_pending: false - provider: "{{ connection }}" register: result - assert: *true @@ -94,7 +89,6 @@ nxos_bgp: &reset2 asn: 65535 suppress_fib_pending: true - provider: "{{ connection }}" register: result - assert: *true @@ -116,7 +110,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test" diff --git a/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 c0e9239fcd..2f7f851cff 100644 --- a/test/integration/targets/nxos_bgp_af/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp_af/tests/common/sanity.yaml @@ -10,21 +10,18 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable feature nv overlay" nxos_feature: feature: nv overlay state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Setup" nxos_bgp: &remove asn: 65535 state: absent - provider: "{{ connection }}" ignore_errors: yes - block: @@ -32,7 +29,6 @@ nxos_config: lines: - nv overlay evpn - provider: "{{ connection }}" when: platform is search('N9K') - name: "Configure BGP_AF 1" @@ -43,7 +39,6 @@ safi: unicast advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}" state: present - provider: "{{ connection }}" register: result - assert: &true @@ -65,7 +60,6 @@ afi: ipv4 safi: unicast state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -84,7 +78,6 @@ client_to_client: False default_information_originate: true state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -111,7 +104,6 @@ client_to_client: True default_information_originate: False state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -131,7 +123,6 @@ afi: ipv4 safi: unicast state: absent - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -155,7 +146,6 @@ table_map: RouteMap table_map_filter: true state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -186,7 +176,6 @@ table_map: default table_map_filter: False state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -221,7 +210,6 @@ networks: [['10.0.0.0/16', 'routemap_LA'], ['192.168.1.1/32', 'Chicago'], ['192.168.2.0/24'], ['192.168.3.0/24', 'routemap_NYC']] redistribute: [['direct', 'rm_direct'], ['lisp', 'rm_lisp']] state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -249,7 +237,6 @@ networks: [['192.168.2.0/24']] redistribute: [['lisp', 'rm_lisp']] state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -277,7 +264,6 @@ networks: default redistribute: default state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -314,13 +300,11 @@ nxos_feature: &disable_bgp feature: bgp state: disabled - provider: "{{ connection }}" - name: "Disable feature nv overlay" nxos_feature: &disable_nvoverlay feature: nv overlay state: disabled - provider: "{{ connection }}" ignore_errors: yes # Some platforms will timeout if the @@ -333,7 +317,6 @@ nxos_config: lines: - no nv overlay evpn - provider: "{{ connection }}" when: platform is search('N9K') - debug: msg="END connection={{ ansible_connection }} nxos_bgp_af sanity test" diff --git a/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml b/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_neighbor/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 a899cbfec7..29d9be5c44 100644 --- a/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml @@ -19,7 +19,6 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Setup" @@ -28,7 +27,6 @@ neighbor: 3.3.3.3 vrf: "{{ item }}" state: absent - provider: "{{ connection }}" with_items: "{{ vrfs }}" ignore_errors: yes @@ -38,7 +36,6 @@ neighbor: 3.3.3.3/32 vrf: "{{ item }}" state: absent - provider: "{{ connection }}" with_items: "{{ vrfs }}" ignore_errors: yes @@ -64,7 +61,6 @@ update_source: "{{ intname.capitalize() }}" shutdown: true state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -102,7 +98,6 @@ update_source: default shutdown: False state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -137,7 +132,6 @@ description: "tested by ansible" remove_private_as: "{{remove_private_asa|default(omit)}}" state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -158,7 +152,6 @@ description: "tested by ansible" remove_private_as: "{{remove_private_asr|default(omit)}}" state: present - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -186,7 +179,6 @@ remote_as: 30 pwd: '386c0565965f89de' pwd_type: 3des - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -214,7 +206,6 @@ remote_as: 30 pwd: '386c0565965f89de' pwd_type: cisco_type_7 - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -235,7 +226,6 @@ remote_as: 30 pwd: default pwd_type: default - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -262,7 +252,6 @@ vrf: "{{ item }}" remote_as: 30 transport_passive_only: true - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -282,7 +271,6 @@ vrf: "{{ item }}" remote_as: 30 transport_passive_only: false - provider: "{{ connection }}" with_items: "{{ vrfs }}" register: result @@ -320,6 +308,5 @@ nxos_feature: &disable_bgp feature: bgp state: disabled - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }} nxos_bgp_neighbor sanity test" 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_bgp_neighbor_af/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 0089ae14a4..b174ee33bd 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 @@ -10,14 +10,12 @@ nxos_feature: &disable_bgp feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable feature BGP" nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -48,7 +46,6 @@ unsuppress_map: 'unsup_map' weight: '30' state: present - provider: "{{ connection }}" register: result - assert: &true @@ -90,7 +87,6 @@ unsuppress_map: default weight: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -108,7 +104,6 @@ afi: ipv4 safi: unicast state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -134,7 +129,6 @@ route_map_in: 'rm_in' route_map_out: 'rm_out' state: present - provider: "{{ connection }}" register: result - assert: *true @@ -160,7 +154,6 @@ route_map_in: default route_map_out: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -189,7 +182,6 @@ vrf: 'blue' neighbor: '3.3.3.3' remote_as: 2 - provider: "{{ connection }}" - name: "Configure BGP neighbor 3" nxos_bgp_neighbor_af: &configure3 @@ -205,7 +197,6 @@ soft_reconfiguration_in: "{{soft_reconfiguration_ina|default(omit)}}" soo: '3:3' state: present - provider: "{{ connection }}" register: result - assert: *true @@ -229,7 +220,6 @@ send_community: default soo: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -244,7 +234,6 @@ nxos_bgp: &remove asn: 65535 state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -254,7 +243,6 @@ asn: 65535 neighbor: '2.2.2.2' remote_as: 65535 - provider: "{{ connection }}" - name: "Configure BGP neighbor 4" nxos_bgp_neighbor_af: &configure4 @@ -263,7 +251,6 @@ afi: ipv4 safi: unicast route_reflector_client: 'true' - provider: "{{ connection }}" register: result - assert: *true @@ -281,7 +268,6 @@ afi: ipv4 safi: unicast route_reflector_client: False - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_command/tasks/cli.yaml b/test/integration/targets/nxos_command/tasks/cli.yaml index edbff7dfaf..9243812668 100644 --- a/test/integration/targets/nxos_command/tasks/cli.yaml +++ b/test/integration/targets/nxos_command/tasks/cli.yaml @@ -1,5 +1,5 @@ --- -- name: collect common cli test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -21,13 +21,7 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" + include: "{{ test_case_to_run }} ansible_connection=network_cli" 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_command/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_command/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 fc14d2d8cb..31f17b4def 100644 --- a/test/integration/targets/nxos_command/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/cli/sanity.yaml @@ -1,20 +1,16 @@ --- -- debug: msg="START TRANSPORT:CLI nxos_command sanity test" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START cli/sanity.yaml on connection={{ ansible_connection }}" - name: "Disable feature BGP" nxos_feature: feature: bgp state: disabled - provider: "{{ cli }}" - block: - name: "Run show running-config bgp - should fail" nxos_command: commands: - sh running-config bgp - provider: "{{ cli }}" ignore_errors: yes register: result @@ -26,14 +22,12 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ cli }}" - name: "Configure BGP defaults" nxos_bgp: &configure_default asn: 65535 router_id: 1.1.1.1 state: present - provider: "{{ cli }}" register: result - assert: &true @@ -44,7 +38,6 @@ nxos_command: commands: - sh running-config bgp - provider: "{{ cli }}" register: result - assert: @@ -56,7 +49,6 @@ nxos_command: commands: - show interface bief - provider: "{{ cli }}" ignore_errors: yes register: result @@ -70,6 +62,5 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ cli }}" - - debug: msg="END TRANSPORT:CLI nxos_command sanity test" +- debug: msg="END cli/sanity.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/bad_operator.yaml b/test/integration/targets/nxos_command/tests/common/bad_operator.yaml similarity index 65% rename from test/integration/targets/nxos_command/tests/cli/bad_operator.yaml rename to test/integration/targets/nxos_command/tests/common/bad_operator.yaml index 17996efe2e..6a3659093f 100644 --- a/test/integration/targets/nxos_command/tests/cli/bad_operator.yaml +++ b/test/integration/targets/nxos_command/tests/common/bad_operator.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/bad_operator.yaml" +- debug: msg="START common/bad_operator.yaml on connection={{ ansible_connection }}" - name: test bad operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.state foo up" - provider: "{{ cli }}" register: result ignore_errors: yes @@ -17,4 +16,4 @@ - "result.failed == true" - "result.msg is defined" -- debug: msg="END cli/bad_operator.yaml" +- debug: msg="END common/bad_operator.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/contains.yaml b/test/integration/targets/nxos_command/tests/common/contains.yaml similarity index 66% rename from test/integration/targets/nxos_command/tests/cli/contains.yaml rename to test/integration/targets/nxos_command/tests/common/contains.yaml index f5ada4e66d..bb6868af30 100644 --- a/test/integration/targets/nxos_command/tests/cli/contains.yaml +++ b/test/integration/targets/nxos_command/tests/common/contains.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/contains.yaml" +- debug: msg="START common/contains.yaml on connection={{ ansible_connection }}" - name: test contains operator nxos_command: @@ -9,11 +9,10 @@ wait_for: - "result[0] contains NX-OS" - "result[1].TABLE_interface.ROW_interface.interface contains mgmt" - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/contains.yaml" +- debug: msg="END common/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/equal.yaml b/test/integration/targets/nxos_command/tests/common/equal.yaml similarity index 77% rename from test/integration/targets/nxos_command/tests/cli/equal.yaml rename to test/integration/targets/nxos_command/tests/common/equal.yaml index fe80f8f049..a81eb3c5c7 100644 --- a/test/integration/targets/nxos_command/tests/cli/equal.yaml +++ b/test/integration/targets/nxos_command/tests/common/equal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/equal.yaml" +- debug: msg="START common/equal.yaml on connection={{ ansible_connection }}" - name: test eq operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.state eq up" - provider: "{{ cli }}" register: result - assert: @@ -22,11 +21,10 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.state == up" - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/equal.yaml" +- debug: msg="END common/equal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/greaterthan.yaml b/test/integration/targets/nxos_command/tests/common/greaterthan.yaml similarity index 76% rename from test/integration/targets/nxos_command/tests/cli/greaterthan.yaml rename to test/integration/targets/nxos_command/tests/common/greaterthan.yaml index 9ba3635fb3..0b8db6a90b 100644 --- a/test/integration/targets/nxos_command/tests/cli/greaterthan.yaml +++ b/test/integration/targets/nxos_command/tests/common/greaterthan.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/greaterthan.yaml" +- debug: msg="START common/greaterthan.yaml on connection={{ ansible_connection }}" - name: test gt operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask gt 0" - provider: "{{ cli }}" register: result - assert: @@ -22,11 +21,10 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask > 0" - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/greaterthan.yaml" +- debug: msg="END common/greaterthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/greaterthanorequal.yaml b/test/integration/targets/nxos_command/tests/common/greaterthanorequal.yaml similarity index 75% rename from test/integration/targets/nxos_command/tests/cli/greaterthanorequal.yaml rename to test/integration/targets/nxos_command/tests/common/greaterthanorequal.yaml index d8db151e37..3e0c27ca73 100644 --- a/test/integration/targets/nxos_command/tests/cli/greaterthanorequal.yaml +++ b/test/integration/targets/nxos_command/tests/common/greaterthanorequal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/greaterthanorequal.yaml" +- debug: msg="START common/greaterthanorequal.yaml on connection={{ ansible_connection }}" - name: test ge operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask ge 0" - provider: "{{ cli }}" register: result - assert: @@ -22,11 +21,10 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask >= 0" - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/greaterthanorequal.yaml" +- debug: msg="END common/greaterthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/invalid.yaml b/test/integration/targets/nxos_command/tests/common/invalid.yaml similarity index 70% rename from test/integration/targets/nxos_command/tests/cli/invalid.yaml rename to test/integration/targets/nxos_command/tests/common/invalid.yaml index 6f5fb5a3ab..6532a5eae0 100644 --- a/test/integration/targets/nxos_command/tests/cli/invalid.yaml +++ b/test/integration/targets/nxos_command/tests/common/invalid.yaml @@ -1,10 +1,9 @@ --- -- debug: msg="START cli/invalid.yaml" +- debug: msg="START common/invalid.yaml on connection={{ ansible_connection }}" - name: run invalid command nxos_command: commands: ['show foo'] - provider: "{{ cli }}" register: result ignore_errors: yes @@ -17,7 +16,6 @@ commands: - show version - show foo - provider: "{{ cli }}" register: result ignore_errors: yes @@ -25,4 +23,4 @@ that: - "result.failed == true" -- debug: msg="END cli/invalid.yaml" +- debug: msg="END common/invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/lessthan.yaml b/test/integration/targets/nxos_command/tests/common/lessthan.yaml similarity index 77% rename from test/integration/targets/nxos_command/tests/cli/lessthan.yaml rename to test/integration/targets/nxos_command/tests/common/lessthan.yaml index abf09324e8..7d9509b649 100644 --- a/test/integration/targets/nxos_command/tests/cli/lessthan.yaml +++ b/test/integration/targets/nxos_command/tests/common/lessthan.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/lessthan.yaml" +- debug: msg="START common/lessthan.yaml on connection={{ ansible_connection }}" - name: test lt operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask lt 33" - provider: "{{ cli }}" register: result - assert: @@ -22,11 +21,10 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask lt 33" - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/lessthan.yaml" +- debug: msg="END common/lessthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/lessthanorequal.yaml b/test/integration/targets/nxos_command/tests/common/lessthanorequal.yaml similarity index 75% rename from test/integration/targets/nxos_command/tests/cli/lessthanorequal.yaml rename to test/integration/targets/nxos_command/tests/common/lessthanorequal.yaml index b0b5f3faeb..70d0f63662 100644 --- a/test/integration/targets/nxos_command/tests/cli/lessthanorequal.yaml +++ b/test/integration/targets/nxos_command/tests/common/lessthanorequal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/lessthanorequal.yaml" +- debug: msg="START common/lessthanorequal.yaml on connection={{ ansible_connection }}" - name: test le operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask le 32" - provider: "{{ cli }}" register: result - assert: @@ -22,11 +21,10 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.eth_ip_mask <= 32" - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/lessthanorequal.yaml" +- debug: msg="END common/lessthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/common/negative.yaml b/test/integration/targets/nxos_command/tests/common/negative.yaml deleted file mode 100644 index fdc2aa54b6..0000000000 --- a/test/integration/targets/nxos_command/tests/common/negative.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- debug: msg="START connection={{ ansible_connection }}/negative.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" - -- name: run 11 commands - nxos_command: - commands: - - show version - - show version - - show version - - show version - - show version - - show version - - show version - - show version - - show version - - show version - - show version - provier: "{{ connection }}" - ignore_errors: yes - register: result - -- assert: - that: - - result.failed - - -- debug: msg="END connection={{ ansible_connection }}/negative.yaml" diff --git a/test/integration/targets/nxos_command/tests/cli/notequal.yaml b/test/integration/targets/nxos_command/tests/common/notequal.yaml similarity index 79% rename from test/integration/targets/nxos_command/tests/cli/notequal.yaml rename to test/integration/targets/nxos_command/tests/common/notequal.yaml index 52e3b2e61e..14f38431b2 100644 --- a/test/integration/targets/nxos_command/tests/cli/notequal.yaml +++ b/test/integration/targets/nxos_command/tests/common/notequal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/notequal.yaml" +- debug: msg="START common/notequal.yaml on connection={{ ansible_connection }}" - name: test neq operator nxos_command: @@ -8,7 +8,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.state neq down" - provider: "{{ cli }}" register: result - assert: @@ -23,7 +22,6 @@ - show interface mgmt0 | json wait_for: - "result[1].TABLE_interface.ROW_interface.state != down" - provider: "{{ cli }}" register: result - assert: @@ -31,4 +29,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/notequal.yaml" +- debug: msg="END common/notequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/output.yaml b/test/integration/targets/nxos_command/tests/common/output.yaml similarity index 69% rename from test/integration/targets/nxos_command/tests/cli/output.yaml rename to test/integration/targets/nxos_command/tests/common/output.yaml index 9b5cae64da..e8ee7ed9bb 100644 --- a/test/integration/targets/nxos_command/tests/cli/output.yaml +++ b/test/integration/targets/nxos_command/tests/common/output.yaml @@ -1,10 +1,9 @@ --- -- debug: msg="START cli/output.yaml" +- debug: msg="START common/output.yaml on connection={{ ansible_connection }}" - name: get output for single command nxos_command: commands: ['show version'] - provider: "{{ cli }}" register: result - assert: @@ -16,11 +15,10 @@ commands: - show version - show interface - provider: "{{ cli }}" register: result - assert: that: - "result.changed == false" -- debug: msg="END cli/output.yaml" +- debug: msg="END common/output.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/cli/timeout.yaml b/test/integration/targets/nxos_command/tests/common/timeout.yaml similarity index 62% rename from test/integration/targets/nxos_command/tests/cli/timeout.yaml rename to test/integration/targets/nxos_command/tests/common/timeout.yaml index 0b2d9f00db..a190b27be2 100644 --- a/test/integration/targets/nxos_command/tests/cli/timeout.yaml +++ b/test/integration/targets/nxos_command/tests/common/timeout.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/timeout.yaml" +- debug: msg="START common/timeout.yaml on connection={{ ansible_connection }}" - name: test bad condition nxos_command: @@ -7,7 +7,6 @@ - show version wait_for: - "result[0] contains bad_value_string" - provider: "{{ cli }}" register: result ignore_errors: yes @@ -16,4 +15,4 @@ - "result.failed == true" - "result.msg is defined" -- debug: msg="END cli/timeout.yaml" +- debug: msg="END common/timeout.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/nxapi/bad_operator.yaml b/test/integration/targets/nxos_command/tests/nxapi/bad_operator.yaml deleted file mode 100644 index 5d6ba8e907..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/bad_operator.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- debug: msg="START nxapi/bad_operator.yaml" - -- name: test bad operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.state foo up" - provider: "{{ nxapi }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END nxapi/bad_operator.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/contains.yaml b/test/integration/targets/nxos_command/tests/nxapi/contains.yaml deleted file mode 100644 index 3f3bdccc36..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/contains.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- debug: msg="START nxapi/contains.yaml" - -- name: test contains operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[0].header_str contains NX-OS" - - "result[1].TABLE_interface.ROW_interface.interface contains mgmt" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/contains.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/equal.yaml b/test/integration/targets/nxos_command/tests/nxapi/equal.yaml deleted file mode 100644 index 50ea63d1ad..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/equal.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START nxapi/equal.yaml" - -- name: test eq operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.state eq up" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test == operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.state == up" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/equal.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/greaterthan.yaml b/test/integration/targets/nxos_command/tests/nxapi/greaterthan.yaml deleted file mode 100644 index f4fdc6797d..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/greaterthan.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START nxapi/greaterthan.yaml" - -- name: test gt operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask gt 0" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test > operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask gt 0" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/greaterthan.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/greaterthanorequal.yaml b/test/integration/targets/nxos_command/tests/nxapi/greaterthanorequal.yaml deleted file mode 100644 index e8e22c3644..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/greaterthanorequal.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START nxapi/greaterthanorequal.yaml" - -- name: test ge operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask ge 0" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test >= operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask >= 0" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/greaterthanorequal.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/invalid.yaml b/test/integration/targets/nxos_command/tests/nxapi/invalid.yaml deleted file mode 100644 index 93cd31a5fd..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/invalid.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START nxapi/invalid.yaml" - -- name: run invalid command - nxos_command: - commands: ['show foo'] - provider: "{{ nxapi }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- name: run commands that include invalid command - nxos_command: - commands: - - show version - - show foo - provider: "{{ nxapi }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END nxapi/invalid.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/lessthan.yaml b/test/integration/targets/nxos_command/tests/nxapi/lessthan.yaml deleted file mode 100644 index 724c3d1fc5..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/lessthan.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START nxapi/lessthan.yaml" - -- name: test lt operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask lt 33" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test < operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask lt 33" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/lessthan.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/lessthanorequal.yaml b/test/integration/targets/nxos_command/tests/nxapi/lessthanorequal.yaml deleted file mode 100644 index 7b9efb85b9..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/lessthanorequal.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START nxapi/lessthanorequal.yaml" - -- name: test le operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask le 32" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test <= operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.eth_ip_mask <= 32" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/lessthanorequal.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/notequal.yaml b/test/integration/targets/nxos_command/tests/nxapi/notequal.yaml deleted file mode 100644 index 768e64a2f2..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/notequal.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START nxapi/notequal.yaml" - -- name: test neq operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.state neq down" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test != operator - nxos_command: - commands: - - show version - - show interface mgmt0 - wait_for: - - "result[1].TABLE_interface.ROW_interface.state != down" - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="START nxapi/notequal.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/output.yaml b/test/integration/targets/nxos_command/tests/nxapi/output.yaml deleted file mode 100644 index 9eae4e515d..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/output.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- debug: msg="START nxapi/output.yaml" - -- name: get output for single command - nxos_command: - commands: ['show version'] - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: get output for multiple commands - nxos_command: - commands: - - show version - - show interface - provider: "{{ nxapi }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END nxapi/output.yaml" diff --git a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml index f3d964a2dc..f845f6de28 100644 --- a/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_command/tests/nxapi/sanity.yaml @@ -1,20 +1,16 @@ --- -- debug: msg="START TRANSPORT:NXAPI nxos_command sanity test" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START nxapi/sanity.yaml on connection={{ ansible_connection }}" - name: "Disable feature BGP" nxos_feature: feature: bgp state: disabled - provider: "{{ nxapi }}" - block: - name: "Run show running-config bgp - should fail" nxos_command: commands: - sh running-config bgp - provider: "{{ nxapi }}" ignore_errors: yes register: result @@ -26,14 +22,12 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ nxapi }}" - name: "Configure BGP defaults" nxos_bgp: &configure_default asn: 65535 router_id: 1.1.1.1 state: present - provider: "{{ nxapi }}" register: result - assert: &true @@ -43,10 +37,7 @@ - name: "Run show running-config bgp - should pass" nxos_command: commands: - - command: sh running-config bgp - output: text - provider: "{{ nxapi }}" - timeout: 120 + - sh running-config bgp register: result - assert: @@ -58,7 +49,6 @@ nxos_command: commands: - show interface bief - provider: "{{ nxapi }}" ignore_errors: yes register: result @@ -72,6 +62,5 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ nxapi }}" - - debug: msg="END TRANSPORT:NXAPI nxos_command sanity test" +- debug: msg="END nxapi/sanity.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_command/tests/nxapi/timeout.yaml b/test/integration/targets/nxos_command/tests/nxapi/timeout.yaml deleted file mode 100644 index 2ad1763ddf..0000000000 --- a/test/integration/targets/nxos_command/tests/nxapi/timeout.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- debug: msg="START nxapi/timeout.yaml" - -- name: test bad condition - nxos_command: - commands: - - show version - wait_for: - - "result[0].header_str contains foo" - retries: 1 - provider: "{{ nxapi }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END nxapi/timeout.yaml" diff --git a/test/integration/targets/nxos_config/tasks/cli.yaml b/test/integration/targets/nxos_config/tasks/cli.yaml index edbff7dfaf..e1ad39ed47 100644 --- a/test/integration/targets/nxos_config/tasks/cli.yaml +++ b/test/integration/targets/nxos_config/tasks/cli.yaml @@ -21,13 +21,7 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" + include: "{{ test_case_to_run }} ansible_connection=network_cli" 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_config/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_config/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_config/tests/cli/multilevel.yaml b/test/integration/targets/nxos_config/tests/cli/multilevel.yaml index 648df5064c..c40624be79 100644 --- a/test/integration/targets/nxos_config/tests/cli/multilevel.yaml +++ b/test/integration/targets/nxos_config/tests/cli/multilevel.yaml @@ -4,19 +4,16 @@ - name: get config nxos_command: commands: show running-config - provider: "{{ cli }}" register: config - name: enable feature bgp nxos_config: lines: feature bgp - provider: "{{ cli }}" when: "'feature bgp' not in config.stdout[0]" - name: remove bgp nxos_config: lines: no router bgp 1 - provider: "{{ cli }}" when: "'router bgp 1' in config.stdout[0]" - name: configure multi level command @@ -25,7 +22,6 @@ parents: - router bgp 1 - address-family ipv4 unicast - provider: "{{ cli }}" register: result - assert: @@ -41,7 +37,6 @@ parents: - router bgp 1 - address-family ipv4 unicast - provider: "{{ cli }}" register: result - assert: @@ -53,6 +48,5 @@ lines: - no feature bgp match: none - provider: "{{ cli }}" - debug: msg="END cli/mulitlevel.yaml" diff --git a/test/integration/targets/nxos_config/tests/cli/sublevel.yaml b/test/integration/targets/nxos_config/tests/cli/sublevel.yaml index ce017097d7..9e186d514c 100644 --- a/test/integration/targets/nxos_config/tests/cli/sublevel.yaml +++ b/test/integration/targets/nxos_config/tests/cli/sublevel.yaml @@ -4,14 +4,12 @@ - name: setup nxos_config: lines: no ip access-list test - provider: "{{ cli }}" match: none - name: configure sub level command nxos_config: lines: 10 permit ip any any log parents: ip access-list test - provider: "{{ cli }}" register: result - assert: @@ -24,7 +22,6 @@ nxos_config: lines: 10 permit ip any any log parents: ip access-list test - provider: "{{ cli }}" register: result - assert: @@ -34,7 +31,6 @@ - name: teardown nxos_config: lines: no ip access-list test - provider: "{{ cli }}" match: none - debug: msg='END cli/sublevel.yaml' diff --git a/test/integration/targets/nxos_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/nxos_config/tests/cli/sublevel_exact.yaml index 29e517dbe9..b2d2190f82 100644 --- a/test/integration/targets/nxos_config/tests/cli/sublevel_exact.yaml +++ b/test/integration/targets/nxos_config/tests/cli/sublevel_exact.yaml @@ -11,7 +11,6 @@ - 50 permit ip 5.5.5.5/32 any log parents: ip access-list test before: no ip access-list test - provider: "{{ cli }}" match: none - name: configure sub level command using exact match @@ -23,7 +22,6 @@ - 40 permit ip 4.4.4.4/32 any log parents: ip access-list test match: exact - provider: "{{ cli }}" register: result - assert: @@ -46,7 +44,6 @@ - 50 permit ip 5.5.5.5/32 any log parents: ip access-list test match: exact - provider: "{{ cli }}" register: result - assert: @@ -56,7 +53,6 @@ - name: teardown nxos_config: lines: no ip access-list test - provider: "{{ cli }}" match: none - debug: msg='END cli/sublevel_exact.yaml' diff --git a/test/integration/targets/nxos_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/nxos_config/tests/cli/sublevel_strict.yaml index a14413d6e8..0cef240c9b 100644 --- a/test/integration/targets/nxos_config/tests/cli/sublevel_strict.yaml +++ b/test/integration/targets/nxos_config/tests/cli/sublevel_strict.yaml @@ -11,7 +11,6 @@ - 50 permit ip 5.5.5.5/32 any log parents: ip access-list test before: no ip access-list test - provider: "{{ cli }}" match: none - name: configure sub level command using strict match @@ -25,7 +24,6 @@ before: no ip access-list test match: strict replace: block - provider: "{{ cli }}" register: result - assert: @@ -47,7 +45,6 @@ - 40 permit ip 4.4.4.4/32 any log parents: ip access-list test match: strict - provider: "{{ cli }}" register: result - assert: @@ -57,7 +54,6 @@ - name: teardown nxos_config: commands: no ip access-list test - provider: "{{ cli }}" match: none - debug: msg='END cli/sublevel_strict.yaml' diff --git a/test/integration/targets/nxos_config/tests/cli/toplevel_after.yaml b/test/integration/targets/nxos_config/tests/cli/toplevel_after.yaml index cc62c01930..45bdc66cd3 100644 --- a/test/integration/targets/nxos_config/tests/cli/toplevel_after.yaml +++ b/test/integration/targets/nxos_config/tests/cli/toplevel_after.yaml @@ -6,14 +6,12 @@ lines: - "snmp-server contact ansible" - "hostname switch" - provider: "{{ cli }}" match: none - name: configure top level command with before nxos_config: lines: hostname foo after: snmp-server contact bar - provider: "{{ cli }}" register: result - assert: @@ -26,7 +24,6 @@ nxos_config: lines: hostname foo after: snmp-server contact foo - provider: "{{ cli }}" register: result - assert: @@ -38,7 +35,6 @@ lines: - "no snmp-server contact" - "hostname switch" - provider: "{{ cli }}" match: none - debug: msg='END cli/toplevel_after.yaml' diff --git a/test/integration/targets/nxos_config/tests/cli/toplevel_before.yaml b/test/integration/targets/nxos_config/tests/cli/toplevel_before.yaml index 75d88690a0..f60c43f089 100644 --- a/test/integration/targets/nxos_config/tests/cli/toplevel_before.yaml +++ b/test/integration/targets/nxos_config/tests/cli/toplevel_before.yaml @@ -6,14 +6,12 @@ lines: - "snmp-server contact ansible" - "hostname switch" - provider: "{{ cli }}" match: none - name: configure top level command with before nxos_config: lines: hostname foo before: snmp-server contact bar - provider: "{{ cli }}" register: result - assert: @@ -26,7 +24,6 @@ nxos_config: lines: hostname foo before: snmp-server contact foo - provider: "{{ cli }}" register: result - assert: @@ -38,7 +35,6 @@ lines: - "no snmp-server contact" - "hostname switch" - provider: "{{ cli }}" match: none - debug: msg='END cli/toplevel_before.yaml' diff --git a/test/integration/targets/nxos_config/tests/common/backup.yaml b/test/integration/targets/nxos_config/tests/common/backup.yaml index a9e2f1f82b..b32666e21a 100644 --- a/test/integration/targets/nxos_config/tests/common/backup.yaml +++ b/test/integration/targets/nxos_config/tests/common/backup.yaml @@ -1,7 +1,5 @@ --- -- debug: msg="START connection={{ ansible_connection }}/backup.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/backup.yaml on connection={{ ansible_connection }}" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -14,7 +12,6 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" - name: collect any backup files find: &backups @@ -37,7 +34,6 @@ parents: - "interface {{ intname }}" backup: yes - provider: "{{ connection }}" register: result - assert: @@ -54,4 +50,4 @@ that: - "backup_files.files is defined" -- debug: msg="END connection={{ ansible_connection }}/backup.yaml" +- debug: msg="END common/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/defaults.yaml b/test/integration/targets/nxos_config/tests/common/defaults.yaml index d5fd8872a2..c0a17c2011 100644 --- a/test/integration/targets/nxos_config/tests/common/defaults.yaml +++ b/test/integration/targets/nxos_config/tests/common/defaults.yaml @@ -1,7 +1,5 @@ --- -- debug: msg="START connection={{ ansible_connection }}/defaults.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/defaults.yaml on connection={{ ansible_connection }}" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -14,7 +12,6 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" - name: configure device with defaults included nxos_config: @@ -24,7 +21,6 @@ parents: - "interface {{ intname }}" defaults: yes - provider: "{{ connection }}" register: result - debug: var=result @@ -42,7 +38,6 @@ parents: - "interface {{ intname }}" defaults: yes - provider: "{{ connection }}" register: result - debug: var=result @@ -52,4 +47,4 @@ - "result.changed == false" - "result.updates is not defined" -- debug: msg="END connection={{ ansible_connection }}/defaults.yaml" +- debug: msg="END common/defaults.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/sanity.yaml b/test/integration/targets/nxos_config/tests/common/sanity.yaml index 3a8efafdbe..5d69c7268b 100644 --- a/test/integration/targets/nxos_config/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_config/tests/common/sanity.yaml @@ -1,15 +1,12 @@ --- -- debug: msg="START connection={{ ansible_connection }} nxos_config sanity test" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/sanity.yaml on connection={{ ansible_connection }}" - name: setup nxos_config: lines: ip access-list test - provider: "{{ connection }}" match: none -- name: "TRANSPORT:CLI nxos_config sanity test" +- name: "nxos_config sanity test" nxos_config: lines: - 10 permit ip 1.1.1.1/32 any log @@ -20,9 +17,8 @@ parents: ip access-list test before: no ip access-list test match: exact - provider: "{{ connection }}" -- name: "TRANSPORT:CLI nxos_config sanity test - replace block" +- name: "nxos_config sanity test - replace block" nxos_config: lines: - 10 permit ip 1.1.1.1/32 any log @@ -32,12 +28,10 @@ parents: ip access-list test before: no ip access-list test replace: block - provider: "{{ connection }}" - name: teardown nxos_config: lines: no ip access-list test - provider: "{{ connection }}" match: none -- debug: msg="END connection={{ ansible_connection }} nxos_config sanity test" +- debug: msg="END common/sanity.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/save.yaml b/test/integration/targets/nxos_config/tests/common/save.yaml index 3df6c03f33..e98ec72020 100644 --- a/test/integration/targets/nxos_config/tests/common/save.yaml +++ b/test/integration/targets/nxos_config/tests/common/save.yaml @@ -1,7 +1,5 @@ --- -- debug: msg="START connection={{ ansible_connection }}/save.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/save.yaml on connection={{ ansible_connection }}" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -14,13 +12,11 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" - name: save config nxos_config: save_when: always timeout: 300 - provider: "{{ connection }}" register: result - assert: @@ -31,11 +27,10 @@ nxos_config: save_when: always timeout: 300 - provider: "{{ connection }}" register: result - assert: that: - "result.changed == true" -- debug: msg="END connection={{ ansible_connection }}/save.yaml" +- debug: msg="END common/save.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/src_basic.yaml b/test/integration/targets/nxos_config/tests/common/src_basic.yaml index 6d9693a045..e9b6a9ac7f 100644 --- a/test/integration/targets/nxos_config/tests/common/src_basic.yaml +++ b/test/integration/targets/nxos_config/tests/common/src_basic.yaml @@ -1,7 +1,5 @@ --- -- debug: msg="START connection={{ ansible_connection }}/src_basic.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/src_basic.yaml on connection={{ ansible_connection }}" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -14,7 +12,6 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" - name: configure device with config nxos_config: @@ -24,7 +21,6 @@ parents: - "interface {{ intname }}" defaults: yes - provider: "{{ connection }}" register: result - assert: @@ -41,7 +37,6 @@ parents: - "interface {{ intname }}" defaults: yes - provider: "{{ connection }}" register: result - assert: @@ -50,4 +45,4 @@ # https://github.com/ansible/ansible-modules-core/issues/4807 - "result.updates is not defined" -- debug: msg="END connection={{ ansible_connection }}/src_basic.yaml" +- debug: msg="END common/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/src_invalid.yaml b/test/integration/targets/nxos_config/tests/common/src_invalid.yaml index 850444136c..00ff9daa1b 100644 --- a/test/integration/targets/nxos_config/tests/common/src_invalid.yaml +++ b/test/integration/targets/nxos_config/tests/common/src_invalid.yaml @@ -1,14 +1,11 @@ --- -- debug: msg="START connection={{ ansible_connection }}/src_invalid.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/src_invalid.yaml on connection={{ ansible_connection }}" # Defend https://github.com/ansible/ansible-modules-core/issues/4797 - name: configure with invalid src nxos_config: src: basic/foobar.j2 - provider: "{{ connection }}" register: result ignore_errors: yes @@ -18,4 +15,4 @@ - "result.failed == true" - "result.msg == 'path specified in src not found'" -- debug: msg="END connection={{ ansible_connection }}/src_invalid.yaml" +- debug: msg="END common/src_invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/src_match_none.yaml b/test/integration/targets/nxos_config/tests/common/src_match_none.yaml index 070826ebb5..fd2c2d2644 100644 --- a/test/integration/targets/nxos_config/tests/common/src_match_none.yaml +++ b/test/integration/targets/nxos_config/tests/common/src_match_none.yaml @@ -1,7 +1,5 @@ --- -- debug: msg="START connection={{ ansible_connection }}/src_match_none.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/src_match_none.yaml on connection={{ ansible_connection }}" # Select interface for test - set_fact: intname="{{ nxos_int1 }}" @@ -14,7 +12,6 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" - name: configure device with config nxos_config: @@ -23,7 +20,6 @@ - shutdown parents: - "interface {{ intname }}" - provider: "{{ connection }}" match: none defaults: yes register: result @@ -41,7 +37,6 @@ - shutdown parents: - "interface {{ intname }}" - provider: "{{ connection }}" defaults: yes register: result @@ -52,4 +47,4 @@ - "result.changed == false" - "result.updates is not defined" -- debug: msg="END connection={{ ansible_connection }}/src_match_none.yaml" +- debug: msg="END common/src_match_none.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml b/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml index a536458bad..3bc3fc73ce 100644 --- a/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml +++ b/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml @@ -1,12 +1,9 @@ --- -- debug: msg='START connection={{ ansible_connection }}/sublevel_block.yaml' -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg='START common/sublevel_block.yaml on connection={{ ansible_connection }}' - name: setup nxos_config: &clear lines: no ip access-list test - provider: "{{ connection }}" match: none ignore_errors: yes @@ -19,7 +16,6 @@ - 40 permit ip 4.4.4.4/32 any log parents: ip access-list test replace: block - provider: "{{ connection }}" register: result - assert: @@ -40,7 +36,6 @@ - 40 permit ip 4.4.4.4/32 any log parents: ip access-list test replace: block - provider: "{{ connection }}" register: result - assert: @@ -50,4 +45,4 @@ - name: teardown nxos_config: *clear -- debug: msg='END connection={{ ansible_connection }}/sublevel_block.yaml' +- debug: msg='END common/sublevel_block.yaml on connection={{ ansible_connection }}' diff --git a/test/integration/targets/nxos_config/tests/common/toplevel.yaml b/test/integration/targets/nxos_config/tests/common/toplevel.yaml index 44ba913ac5..3589ea7fdb 100644 --- a/test/integration/targets/nxos_config/tests/common/toplevel.yaml +++ b/test/integration/targets/nxos_config/tests/common/toplevel.yaml @@ -1,18 +1,14 @@ --- -- debug: msg='START connection={{ ansible_connection }}/toplevel.yaml' -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg='START common/toplevel.yaml on connection={{ ansible_connection }}' - name: setup nxos_config: lines: hostname switch - provider: "{{ connection }}" match: none - name: configure top level command nxos_config: lines: hostname foo - provider: "{{ connection }}" register: result - assert: @@ -23,7 +19,6 @@ - name: configure top level command idempotent check nxos_config: lines: hostname foo - provider: "{{ connection }}" register: result - assert: @@ -33,7 +28,6 @@ - name: teardown nxos_config: lines: hostname switch - provider: "{{ connection }}" match: none -- debug: msg='END connection={{ ansible_connection }}/toplevel.yaml' +- debug: msg='END common/toplevel.yaml on connection={{ ansible_connection }}' diff --git a/test/integration/targets/nxos_config/tests/common/toplevel_nonidempotent.yaml b/test/integration/targets/nxos_config/tests/common/toplevel_nonidempotent.yaml index 73010acd21..c619a7650a 100644 --- a/test/integration/targets/nxos_config/tests/common/toplevel_nonidempotent.yaml +++ b/test/integration/targets/nxos_config/tests/common/toplevel_nonidempotent.yaml @@ -1,18 +1,14 @@ --- -- debug: msg="START connection={{ ansible_connection }}/nonidempotent.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" +- debug: msg="START common/nonidempotent.yaml on connection={{ ansible_connection }}" - name: setup nxos_config: lines: hostname switch - provider: "{{ connection }}" match: none - name: configure top level command nxos_config: lines: hostname foo - provider: "{{ connection }}" match: strict register: result @@ -24,7 +20,6 @@ - name: configure top level command idempotent check nxos_config: lines: hostname foo - provider: "{{ connection }}" match: strict register: result @@ -35,7 +30,6 @@ - name: teardown nxos_config: lines: hostname switch - provider: "{{ connection }}" match: none -- debug: msg="END connection={{ ansible_connection }}/nonidempotent.yaml" +- debug: msg="END common/nonidempotent.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/nxos_config/tests/nxapi/multilevel.yaml b/test/integration/targets/nxos_config/tests/nxapi/multilevel.yaml index 12ff417a8a..892582559a 100644 --- a/test/integration/targets/nxos_config/tests/nxapi/multilevel.yaml +++ b/test/integration/targets/nxos_config/tests/nxapi/multilevel.yaml @@ -5,7 +5,6 @@ nxos_config: lines: feature bgp match: none - provider: "{{ nxapi }}" - name: configure multi level command nxos_config: @@ -13,7 +12,6 @@ parents: - router bgp 1 - address-family ipv4 unicast - provider: "{{ nxapi }}" register: result - assert: @@ -29,7 +27,6 @@ parents: - router bgp 1 - address-family ipv4 unicast - provider: "{{ nxapi }}" register: result - assert: @@ -40,6 +37,5 @@ nxos_config: lines: no feature bgp match: none - provider: "{{ nxapi }}" - debug: msg="END nxapi/mulitlevel.yaml" diff --git a/test/integration/targets/nxos_config/tests/nxapi/sublevel.yaml b/test/integration/targets/nxos_config/tests/nxapi/sublevel.yaml index ceba5d36a9..05d97670f0 100644 --- a/test/integration/targets/nxos_config/tests/nxapi/sublevel.yaml +++ b/test/integration/targets/nxos_config/tests/nxapi/sublevel.yaml @@ -4,7 +4,6 @@ - name: setup nxos_config: lines: no ip access-list test - provider: "{{ nxapi }}" match: none ignore_errors: yes @@ -12,7 +11,6 @@ nxos_config: lines: 10 permit ip any any log parents: ip access-list test - provider: "{{ nxapi }}" register: result - assert: @@ -25,7 +23,6 @@ nxos_config: lines: 10 permit ip any any log parents: ip access-list test - provider: "{{ nxapi }}" register: result - assert: @@ -35,7 +32,6 @@ - name: teardown nxos_config: lines: no ip access-list test - provider: "{{ nxapi }}" match: none - debug: msg="END nxapi/sublevel.yaml" diff --git a/test/integration/targets/nxos_config/tests/nxapi/sublevel_exact.yaml b/test/integration/targets/nxos_config/tests/nxapi/sublevel_exact.yaml index 3dd89dac1d..c927cc8147 100644 --- a/test/integration/targets/nxos_config/tests/nxapi/sublevel_exact.yaml +++ b/test/integration/targets/nxos_config/tests/nxapi/sublevel_exact.yaml @@ -10,7 +10,6 @@ - 40 permit ip 4.4.4.4/32 any log - 50 permit ip 5.5.5.5/32 any log parents: ip access-list test - provider: "{{ nxapi }}" match: none ignore_errors: yes @@ -25,7 +24,6 @@ before: no ip access-list test match: exact replace: block - provider: "{{ nxapi }}" register: result - assert: @@ -47,7 +45,6 @@ - 40 permit ip 4.4.4.4/32 any log parents: ip access-list test match: exact - provider: "{{ nxapi }}" register: result - assert: @@ -57,7 +54,6 @@ - name: teardown nxos_config: lines: no ip access-list test - provider: "{{ nxapi }}" match: none - debug: msg="END nxapi/sublevel_exact.yaml" diff --git a/test/integration/targets/nxos_config/tests/nxapi/sublevel_strict.yaml b/test/integration/targets/nxos_config/tests/nxapi/sublevel_strict.yaml index 8fb56c0398..07ebc94eea 100644 --- a/test/integration/targets/nxos_config/tests/nxapi/sublevel_strict.yaml +++ b/test/integration/targets/nxos_config/tests/nxapi/sublevel_strict.yaml @@ -10,7 +10,6 @@ - 40 permit ip 4.4.4.4/32 any log - 50 permit ip 5.5.5.5/32 any log parents: ip access-list test - provider: "{{ nxapi }}" match: none - name: configure sub level command using strict match @@ -24,7 +23,6 @@ before: no ip access-list test match: strict replace: block - provider: "{{ nxapi }}" register: result - assert: @@ -46,7 +44,6 @@ - 40 permit ip 4.4.4.4/32 any log parents: ip access-list test match: strict - provider: "{{ nxapi }}" register: result - assert: @@ -56,7 +53,6 @@ - name: teardown nxos_config: lines: no ip access-list test - provider: "{{ nxapi }}" match: none - debug: msg="END nxapi/sublevel_strict.yaml" diff --git a/test/integration/targets/nxos_config/tests/nxapi/toplevel_after.yaml b/test/integration/targets/nxos_config/tests/nxapi/toplevel_after.yaml index 0c534c5c0d..8749be5fd5 100644 --- a/test/integration/targets/nxos_config/tests/nxapi/toplevel_after.yaml +++ b/test/integration/targets/nxos_config/tests/nxapi/toplevel_after.yaml @@ -6,14 +6,12 @@ lines: - "snmp-server contact ansible" - "hostname switch" - provider: "{{ nxapi }}" match: none - name: configure top level command with before nxos_config: lines: hostname foo after: snmp-server contact bar - provider: "{{ nxapi }}" register: result - assert: @@ -26,7 +24,6 @@ nxos_config: lines: hostname foo after: snmp-server contact foo - provider: "{{ nxapi }}" register: result - assert: @@ -38,7 +35,6 @@ lines: - "no snmp-server contact ansible" - "hostname switch" - provider: "{{ nxapi }}" match: none - debug: msg="END nxapi/toplevel_after.yaml" diff --git a/test/integration/targets/nxos_config/tests/nxapi/toplevel_before.yaml b/test/integration/targets/nxos_config/tests/nxapi/toplevel_before.yaml index a5f0830499..a67530773b 100644 --- a/test/integration/targets/nxos_config/tests/nxapi/toplevel_before.yaml +++ b/test/integration/targets/nxos_config/tests/nxapi/toplevel_before.yaml @@ -6,14 +6,12 @@ lines: - "snmp-server contact ansible" - "hostname switch" - provider: "{{ nxapi }}" match: none - name: configure top level command with before nxos_config: lines: hostname foo before: snmp-server contact bar - provider: "{{ nxapi }}" register: result - assert: @@ -26,7 +24,6 @@ nxos_config: lines: hostname foo before: snmp-server contact foo - provider: "{{ nxapi }}" register: result - assert: @@ -38,7 +35,6 @@ lines: - "no snmp-server contact ansible" - "hostname switch" - provider: "{{ nxapi }}" match: none - debug: msg="END nxapi/toplevel_before.yaml" diff --git a/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml b/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_evpn_global/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 b2fb65a718..bf9d904506 100644 --- a/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_evpn_global/tests/common/sanity.yaml @@ -7,14 +7,12 @@ nxos_config: &remove_evpn_config lines: no nv overlay evpn match: none - provider: "{{ connection }}" ignore_errors: yes - name: "Disable feature nv overlay" nxos_feature: &disable_feature_nv_overlay feature: nv overlay state: disabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -22,13 +20,11 @@ nxos_feature: &enable_feature_nv_overlay feature: nv overlay state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Enable nv overlay evpn" nxos_evpn_global: &enable_evpn nv_overlay_evpn: true - provider: "{{ connection }}" register: result - assert: &true @@ -46,7 +42,6 @@ - name: "Disable nv overlay evpn" nxos_evpn_global: &disable_evpn nv_overlay_evpn: false - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml b/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_evpn_vni/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 5681731086..207a84c762 100644 --- a/test/integration/targets/nxos_evpn_vni/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_evpn_vni/tests/common/sanity.yaml @@ -6,7 +6,6 @@ - name: "Setup" nxos_config: &remove_evpn lines: no nv overlay evpn - provider: "{{ connection }}" match: none ignore_errors: yes @@ -15,12 +14,10 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" - name: "Enable nv overlay evpn" nxos_config: lines: nv overlay evpn - provider: "{{ connection }}" match: none - name: "Configure nxos_evpn_vni" @@ -35,7 +32,6 @@ - auto - "5000:10" - "1.1.1.1:43" - provider: "{{ connection }}" register: result - assert: &true @@ -56,7 +52,6 @@ route_distinguisher: "50:20" route_target_import: auto route_target_export: auto - provider: "{{ connection }}" register: result - assert: *true @@ -73,7 +68,6 @@ route_distinguisher: default route_target_import: default route_target_export: default - provider: "{{ connection }}" register: result - assert: *true @@ -88,7 +82,6 @@ nxos_evpn_vni: &rvni vni: 6000 state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -110,7 +103,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }} nxos_evpn_vni sanity test" diff --git a/test/integration/targets/nxos_facts/tasks/nxapi.yaml b/test/integration/targets/nxos_facts/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_facts/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_facts/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_facts/tests/common/all_facts.yaml b/test/integration/targets/nxos_facts/tests/common/all_facts.yaml index fdc0df2a2d..c852fb7ff3 100644 --- a/test/integration/targets/nxos_facts/tests/common/all_facts.yaml +++ b/test/integration/targets/nxos_facts/tests/common/all_facts.yaml @@ -6,7 +6,6 @@ - name: test getting all facts nxos_facts: - provider: "{{ connection }}" gather_subset: - all timeout: 60 diff --git a/test/integration/targets/nxos_facts/tests/common/default_facts.yaml b/test/integration/targets/nxos_facts/tests/common/default_facts.yaml index 7864856452..fd8ddbb110 100644 --- a/test/integration/targets/nxos_facts/tests/common/default_facts.yaml +++ b/test/integration/targets/nxos_facts/tests/common/default_facts.yaml @@ -6,7 +6,6 @@ - name: test getting default facts nxos_facts: - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_facts/tests/common/invalid_subset.yaml b/test/integration/targets/nxos_facts/tests/common/invalid_subset.yaml index bfb2d25134..8655067211 100644 --- a/test/integration/targets/nxos_facts/tests/common/invalid_subset.yaml +++ b/test/integration/targets/nxos_facts/tests/common/invalid_subset.yaml @@ -6,7 +6,6 @@ - name: test invalid subset (foobar) nxos_facts: - provider: "{{ connection }}" gather_subset: - "foobar" register: result @@ -28,7 +27,6 @@ - name: test subset specified multiple times nxos_facts: - provider: "{{ connection }}" gather_subset: - "!hardware" - "hardware" diff --git a/test/integration/targets/nxos_facts/tests/common/not_hardware.yaml b/test/integration/targets/nxos_facts/tests/common/not_hardware.yaml index a3070adb0f..8ede43bfc3 100644 --- a/test/integration/targets/nxos_facts/tests/common/not_hardware.yaml +++ b/test/integration/targets/nxos_facts/tests/common/not_hardware.yaml @@ -6,7 +6,6 @@ - name: test not hardware nxos_facts: - provider: "{{ connection }}" gather_subset: - "!hardware" timeout: 30 diff --git a/test/integration/targets/nxos_facts/tests/common/sanity.yaml b/test/integration/targets/nxos_facts/tests/common/sanity.yaml index 6b9e789ff9..4283a6de09 100644 --- a/test/integration/targets/nxos_facts/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_facts/tests/common/sanity.yaml @@ -6,7 +6,6 @@ - name: "nxos_facts gather hardware facts" nxos_facts: gather_subset: hardware - provider: "{{ connection }}" register: result - assert: @@ -31,7 +30,6 @@ - name: "nxos_facts gather config facts" nxos_facts: gather_subset: config - provider: "{{ connection }}" register: result - assert: @@ -54,7 +52,6 @@ gather_subset: - hardware - config - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_feature/tasks/cli.yaml b/test/integration/targets/nxos_feature/tasks/cli.yaml index edbff7dfaf..e1ad39ed47 100644 --- a/test/integration/targets/nxos_feature/tasks/cli.yaml +++ b/test/integration/targets/nxos_feature/tasks/cli.yaml @@ -21,13 +21,7 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli connection={}" + include: "{{ test_case_to_run }} ansible_connection=network_cli" 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_feature/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_feature/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_feature/tests/common/configure.yaml b/test/integration/targets/nxos_feature/tests/common/configure.yaml index add9763c76..2c02bea4c8 100644 --- a/test/integration/targets/nxos_feature/tests/common/configure.yaml +++ b/test/integration/targets/nxos_feature/tests/common/configure.yaml @@ -1,19 +1,15 @@ --- - debug: msg="START connection={{ ansible_connection }}/configure.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" - name: setup nxos_config: lines: no feature bgp match: none - provider: "{{ connection }}" - name: enable bgp nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" register: result - assert: @@ -24,7 +20,6 @@ nxos_feature: feature: bgp state: enabled - provider: "{{ connection }}" register: result - assert: @@ -35,7 +30,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" register: result - assert: @@ -46,7 +40,6 @@ nxos_feature: feature: bgp state: disabled - provider: "{{ connection }}" register: result - assert: @@ -57,6 +50,5 @@ nxos_config: lines: no feature bgp match: none - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }}/configure.yaml" diff --git a/test/integration/targets/nxos_feature/tests/common/invalid.yaml b/test/integration/targets/nxos_feature/tests/common/invalid.yaml index a3915b2462..477eaf6416 100644 --- a/test/integration/targets/nxos_feature/tests/common/invalid.yaml +++ b/test/integration/targets/nxos_feature/tests/common/invalid.yaml @@ -1,12 +1,9 @@ --- - debug: msg="START connection={{ ansible_connection }}/invalid.yaml" -- debug: msg="Using provider={{ connection.transport }}" - when: ansible_connection == "local" - name: configure invalid feature name nxos_feature: feature: invalid - provider: "{{ connection }}" register: result ignore_errors: yes diff --git a/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml b/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run 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 c7269d7d1c..c6ea9bd64d 100644 --- a/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml @@ -8,21 +8,18 @@ commands: - terminal dont-ask - delete network-integration.cfg - provider: "{{ cli }}" ignore_errors: yes - name: "Setup - Turn on feature scp-server" nxos_feature: feature: scp-server state: enabled - provider: "{{ cli }}" - block: - name: "Copy network-integration.cfg to bootflash" nxos_file_copy: ©_file_same_name local_file: "./network-integration.cfg" file_system: "bootflash:" - provider: "{{ cli }}" username: "{{ ansible_ssh_user }}" password: "{{ ansible_ssh_pass }}" host: "{{ ansible_host }}" @@ -50,7 +47,6 @@ local_file: "./inventory.networking.template" remote_file: "network-integration.cfg" file_system: "bootflash:" - provider: "{{ cli }}" username: "{{ ansible_ssh_user }}" password: "{{ ansible_ssh_pass }}" host: "{{ ansible_host }}" @@ -83,6 +79,5 @@ nxos_feature: feature: scp-server state: disabled - provider: "{{ cli }}" - debug: msg="END TRANSPORT:CLI nxos_file_copy sanity test" 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 24846d752e..91ea22cb6a 100644 --- a/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml @@ -10,21 +10,18 @@ output: text - command: delete network-integration.cfg output: text - provider: "{{ nxapi }}" ignore_errors: yes - name: "Setup - Turn on feature scp-server" nxos_feature: feature: scp-server state: enabled - provider: "{{ nxapi }}" - block: - name: "Copy network-integration.cfg to bootflash" nxos_file_copy: ©_file_same_name local_file: "./network-integration.cfg" file_system: "bootflash:" - provider: "{{ nxapi }}" username: "{{ ansible_ssh_user }}" password: "{{ ansible_ssh_pass }}" host: "{{ ansible_host }}" @@ -53,7 +50,6 @@ local_file: "./inventory.networking.template" remote_file: "network-integration.cfg" file_system: "bootflash:" - provider: "{{ nxapi }}" username: "{{ ansible_ssh_user }}" password: "{{ ansible_ssh_pass }}" host: "{{ ansible_host }}" @@ -87,6 +83,5 @@ nxos_feature: feature: scp-server state: disabled - provider: "{{ nxapi }}" - debug: msg="END TRANSPORT:NXAPI nxos_file_copy sanity test" diff --git a/test/integration/targets/nxos_gir/tasks/nxapi.yaml b/test/integration/targets/nxos_gir/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_gir/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_gir/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_gir/tests/common/sanity.yaml b/test/integration/targets/nxos_gir/tests/common/sanity.yaml index b875684829..3c8e1e9e40 100644 --- a/test/integration/targets/nxos_gir/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_gir/tests/common/sanity.yaml @@ -6,14 +6,12 @@ #- name: "Setup" # nxos_gir: &setup # system_mode_maintenance: false -# provider: "{{ connection }}" # ignore_errors: yes # #- block: # - name: "Put system in maintenance mode" # nxos_gir: &configure_system_mode_maintenance # system_mode_maintenance: true -# provider: "{{ connection }}" # register: result # # - assert: &true @@ -52,7 +50,6 @@ # nxos_gir: &remove_reason # system_mode_maintenance_on_reload_reset_reason: manual_reload # state: absent -# provider: "{{ connection }}" # register: result # # - assert: *true @@ -75,7 +72,6 @@ # nxos_gir: &remove_timeout # system_mode_maintenance_timeout: 30 # state: absent -# provider: "{{ connection }}" # register: result # # - assert: *true 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_gir_profile_management/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_gir_profile_management/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run 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 7f260f0a0d..44827f886d 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 @@ -7,21 +7,18 @@ nxos_gir_profile_management: &remove_maintenance mode: maintenance state: absent - provider: "{{ connection }}" ignore_errors: yes - name: "Setup - Remove normal mode profiles" nxos_gir_profile_management: &remove_normal mode: normal state: absent - provider: "{{ connection }}" ignore_errors: yes - name: "Setup - Turn on feature eigrp" nxos_feature: feature: eigrp state: enabled - provider: "{{ connection }}" ignore_errors: yes - block: @@ -32,7 +29,6 @@ - router eigrp 11 - isolate state: present - provider: "{{ connection }}" register: result - assert: &true @@ -54,7 +50,6 @@ - router eigrp 11 - isolate state: present - provider: "{{ connection }}" register: result - assert: *true @@ -107,6 +102,5 @@ nxos_feature: feature: eigrp state: disabled - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }} nxos_gir_profile_management sanity test" diff --git a/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml b/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml b/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml index 365fbe7eca..274b456e74 100644 --- a/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml @@ -12,7 +12,6 @@ nxos_feature: feature: hsrp state: enabled - provider: "{{ connection }}" - name: "change int1 mode" nxos_config: @@ -21,7 +20,6 @@ parents: - "interface {{ intname1 }}" match: none - provider: "{{ connection }}" - name: "change int2 mode" nxos_config: @@ -30,7 +28,6 @@ parents: - "interface {{ intname2 }}" match: none - provider: "{{ connection }}" - name: "configure nxos_hsrp" nxos_hsrp: &conf1000 @@ -42,7 +39,6 @@ preempt: enabled auth_type: md5 auth_string: "7 1234" - provider: "{{ connection }}" register: result - assert: &true @@ -67,7 +63,6 @@ preempt: enabled auth_type: md5 auth_string: "0 1234" - provider: "{{ connection }}" register: result - assert: *true @@ -88,7 +83,6 @@ preempt: disabled auth_type: md5 auth_string: "0 1234" - provider: "{{ connection }}" register: result - assert: *true @@ -107,7 +101,6 @@ interface: "{{ intname2 }}" auth_type: text auth_string: "1234" - provider: "{{ connection }}" register: result - assert: *true @@ -126,7 +119,6 @@ interface: "{{ intname2 }}" auth_type: text auth_string: default - provider: "{{ connection }}" register: result - assert: *true @@ -157,7 +149,6 @@ nxos_feature: feature: hsrp state: disabled - provider: "{{ connection }}" ignore_errors: yes - debug: msg="END connection={{ ansible_connection }} nxos_hsrp sanity test" diff --git a/test/integration/targets/nxos_igmp/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_igmp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 5689d996bd..f823b67533 100644 --- a/test/integration/targets/nxos_igmp/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_igmp/tests/common/sanity.yaml @@ -14,7 +14,6 @@ enforce_rtr_alert: true restart: false state: present - provider: "{{ connection }}" register: result - assert: &true @@ -35,7 +34,6 @@ enforce_rtr_alert: false restart: "{{restart|default(omit)}}" state: present - provider: "{{ connection }}" register: result - assert: *true @@ -53,7 +51,6 @@ - name: Configure igmp state as values nxos_igmp: &sdefault state: default - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run 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 3c90728666..f541da0343 100644 --- a/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml @@ -13,14 +13,12 @@ nxos_feature: feature: pim state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: Put interface in default mode nxos_config: commands: - "default interface {{ intname }}" - provider: "{{ connection }}" match: none ignore_errors: yes @@ -34,7 +32,6 @@ parents: - "interface {{ intname }}" match: none - provider: "{{ connection }}" - name: Configure igmp interface with non-default values nxos_igmp_interface: &non-default @@ -55,7 +52,6 @@ oif_prefix: 239.255.255.2 oif_source: 1.1.1.1 state: present - provider: "{{ connection }}" register: result - assert: &true @@ -88,7 +84,6 @@ - {'prefix': '238.2.2.5'} - {'source': '1.1.1.1', 'prefix': '238.2.2.5'} state: present - provider: "{{ connection }}" register: result - assert: *true @@ -103,14 +98,12 @@ nxos_igmp_interface: &restart interface: "{{ intname }}" restart: "{{restart|default(omit)}}" - provider: "{{ connection }}" - name: Configure igmp interface with default oif_ps nxos_igmp_interface: &defoif interface: "{{ intname }}" oif_ps: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -130,7 +123,6 @@ robustness: 6 oif_routemap: abcd state: present - provider: "{{ connection }}" register: result - assert: *true @@ -145,7 +137,6 @@ nxos_igmp_interface: &default interface: "{{ intname }}" state: default - provider: "{{ connection }}" register: result - assert: *true @@ -160,7 +151,6 @@ nxos_igmp_interface: &absent interface: "{{ intname }}" state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -180,13 +170,11 @@ nxos_config: commands: - "default interface {{ intname }}" - provider: "{{ connection }}" match: none - name: "Disable feature PIM" nxos_feature: feature: pim state: disabled - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }} nxos_igmp_interface sanity test" diff --git a/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run 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 21940b762d..3c48b496c3 100644 --- a/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml @@ -23,7 +23,6 @@ report_supp: false v3_report_supp: true state: present - provider: "{{ connection }}" register: result - assert: &true @@ -43,7 +42,6 @@ nxos_igmp_snooping: &defgt group_timeout: "{{def_group_timeout|default(omit)}}" state: present - provider: "{{ connection }}" register: result - assert: *true @@ -60,7 +58,6 @@ - name: Configure igmp snooping with default values nxos_igmp_snooping: &default state: default - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_interface/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 c91847c037..dc934b08af 100644 --- a/test/integration/targets/nxos_interface/tests/common/intent.yaml +++ b/test/integration/targets/nxos_interface/tests/common/intent.yaml @@ -10,7 +10,6 @@ lines: - "default interface {{ testint1 }}" - "default interface {{ testint2 }}" - provider: "{{ connection }}" ignore_errors: yes - name: Check intent arguments @@ -19,7 +18,6 @@ admin_state: up tx_rate: ge(0) rx_rate: ge(0) - provider: "{{ connection }}" register: result - assert: @@ -32,7 +30,6 @@ admin_state: down tx_rate: gt(0) rx_rate: lt(0) - provider: "{{ connection }}" ignore_errors: yes register: result @@ -47,7 +44,6 @@ aggregate: - { name: "{{ testint1 }}", description: "Test aggregation on first interface" } - { name: "{{ testint2 }}", mode: layer3 } - provider: "{{ connection }}" register: result - assert: @@ -59,7 +55,6 @@ lines: - "default interface {{ testint1 }}" - "default interface {{ testint2 }}" - provider: "{{ connection }}" ignore_errors: yes - 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 03b5294beb..0c6b51d74b 100644 --- a/test/integration/targets/nxos_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_interface/tests/common/sanity.yaml @@ -9,14 +9,12 @@ nxos_feature: feature: interface-vlan state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Setup: Put interface {{ testint }} into a default state" nxos_config: &intcleanup lines: - "default interface {{ testint }}" - provider: "{{ connection }}" ignore_errors: yes - name: "Setup: Remove possibly existing vlan interfaces" @@ -26,7 +24,6 @@ - "no interface vlan 710" - "no interface vlan 711" - "no interface vlan 712" - provider: "{{ connection }}" ignore_errors: yes - block: @@ -37,7 +34,6 @@ description: 'Configured by Ansible - Layer3' admin_state: up state: present - provider: "{{ connection }}" register: result - assert: &true @@ -59,7 +55,6 @@ description: 'Configured by Ansible - Layer2' admin_state: down state: present - provider: "{{ connection }}" register: result - assert: *true @@ -74,7 +69,6 @@ nxos_interface: &createvlans interface: "{{ item.os_svi_int }}" description: "{{ item.os_svi_desc }}" - provider: "{{ connection }}" with_items: &vlanitems - {os_svi_int: vlan2, os_svi_desc: SVI_VLAN2} - {os_svi_int: vlan710, os_svi_desc: SVI_VLAN710} @@ -90,7 +84,6 @@ addr: "{{ item.ipv4_addr }}" mask: "{{ item.ipv4_mask }}" version: "{{ item.ipv4_ver }}" - provider: "{{ connection }}" with_items: &vlanips - {os_svi_int: vlan2, ipv4_addr: 192.168.2.1, ipv4_mask: 24, ipv4_ver: v4} - {os_svi_int: vlan710, ipv4_addr: 192.168.3.1, ipv4_mask: 24, ipv4_ver: v4} @@ -126,7 +119,6 @@ nxos_feature: feature: interface-vlan state: disabled - provider: "{{ connection }}" ignore_errors: yes always: diff --git a/test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml b/test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml index 3eb1307863..2d66826d38 100644 --- a/test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml +++ b/test/integration/targets/nxos_interface/tests/common/set_state_absent.yaml @@ -7,13 +7,11 @@ nxos_config: lines: - interface Loopback1 - provider: "{{ connection }}" - name: set state=absent nxos_interface: interface: Loopback1 state: absent - provider: "{{ connection }}" register: result - assert: @@ -24,7 +22,6 @@ nxos_interface: interface: Loopback1 state: absent - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml b/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml index 986146597d..3463185546 100644 --- a/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml +++ b/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml @@ -7,7 +7,6 @@ nxos_config: lines: - no interface Loopback1 - provider: "{{ connection }}" ignore_errors: yes # Fails if the interface is already absent - name: set state=present @@ -15,7 +14,6 @@ interface: Loopback1 state: present description: 'Configured by Ansible - Layer3' - provider: "{{ connection }}" register: result - assert: @@ -27,7 +25,6 @@ interface: Loopback1 state: present description: 'Configured by Ansible - Layer3' - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_interface/tests/common/sub_int.yaml b/test/integration/targets/nxos_interface/tests/common/sub_int.yaml index 27b1ccf19e..8351e22cde 100644 --- a/test/integration/targets/nxos_interface/tests/common/sub_int.yaml +++ b/test/integration/targets/nxos_interface/tests/common/sub_int.yaml @@ -22,7 +22,6 @@ description: "sub-interface Configured by Ansible" admin_state: up mtu: 800 - provider: "{{ connection }}" register: result - assert: @@ -43,7 +42,6 @@ description: "sub-interface Configured by Ansible" admin_state: down mtu: 800 - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml b/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_interface_ospf/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 014683fb34..d3442d7695 100644 --- a/test/integration/targets/nxos_interface_ospf/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_interface_ospf/tests/common/sanity.yaml @@ -9,21 +9,18 @@ nxos_feature: &disable feature: ospf state: disabled - provider: "{{ connection }}" ignore_errors: yes - name: "Setup - Enable feature OSPF" nxos_feature: &enable feature: ospf state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: "Put interface into default state" nxos_config: &intdefault lines: - "default interface {{ testint }}" - provider: "{{ connection }}" ignore_errors: yes - name: "Remove switchport config" @@ -32,7 +29,6 @@ - no switchport parents: - "interface {{ testint }}" - provider: "{{ connection }}" ignore_errors: yes - name: "Remove possibly existing port-channel and loopback ints" @@ -42,7 +38,6 @@ - no interface port-channel11 - no interface loopback55 - no interface loopback77 - provider: "{{ connection }}" ignore_errors: yes - block: @@ -56,7 +51,6 @@ hello_interval: 15 dead_interval: 75 state: present - provider: "{{ connection }}" register: result - assert: &true @@ -81,7 +75,6 @@ hello_interval: 17 dead_interval: 70 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -101,7 +94,6 @@ hello_interval: 10 dead_interval: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -123,7 +115,6 @@ message_digest_encryption_type: 3des message_digest_password: b69f7bc54725b1bfd1ea93afa7b09400 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -145,7 +136,6 @@ message_digest_encryption_type: default message_digest_password: default state: present - provider: "{{ connection }}" register: result - assert: *true @@ -164,7 +154,6 @@ - interface loopback55 - interface loopback77 match: none - provider: "{{ connection }}" - name: "Ensure port-channels are layer3" nxos_config: @@ -172,7 +161,6 @@ - no switchport parents: - "interface {{ item }}" - provider: "{{ connection }}" with_items: - port-channel10 - port-channel11 @@ -187,7 +175,6 @@ hello_interval: 15 dead_interval: 75 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -208,7 +195,6 @@ hello_interval: 15 dead_interval: 75 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -228,7 +214,6 @@ hello_interval: 15 dead_interval: 75 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -248,7 +233,6 @@ hello_interval: 45 dead_interval: 75 state: present - provider: "{{ connection }}" register: result - assert: *true @@ -269,7 +253,6 @@ hello_interval: 15 dead_interval: 75 state: absent - provider: "{{ connection }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ip_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 81135dafe2..4dd42e6668 100644 --- a/test/integration/targets/nxos_ip_interface/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_ip_interface/tests/cli/sanity.yaml @@ -10,14 +10,12 @@ nxos_config: &intdefault1 lines: - "default interface {{ testint1 }}" - provider: "{{ cli }}" ignore_errors: yes - name: "Put interface {{testint2}} into default state" nxos_config: &intdefault2 lines: - "default interface {{ testint2 }}" - provider: "{{ cli }}" ignore_errors: yes - name: "Make {{testint1}} a layer3 interface" @@ -27,7 +25,6 @@ description: 'Configured by Ansible - Layer3' admin_state: 'up' state: present - provider: "{{ cli }}" - name: "Make {{testint2}} a layer3 interface" nxos_interface: &l3int2 @@ -36,7 +33,6 @@ description: 'Configured by Ansible - Layer3' admin_state: 'up' state: present - provider: "{{ cli }}" # For titanium - name: Clear interface v4 @@ -46,7 +42,6 @@ state: absent addr: 20.20.20.20 mask: 24 - provider: "{{ cli }}" # For titanium - name: Clear interface v6 @@ -56,7 +51,6 @@ state: absent addr: 'fd56:31f7:e4ad:5585::1' mask: 64 - provider: "{{ cli }}" - name: Ensure ipv4 address is configured nxos_ip_interface: &ipv4 @@ -65,7 +59,6 @@ state: present addr: 20.20.20.20 mask: 24 - provider: "{{ cli }}" register: result - assert: &true @@ -87,7 +80,6 @@ state: present addr: 'fd56:31f7:e4ad:5585::1' mask: 64 - provider: "{{ cli }}" register: result - assert: *true 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 bc8c528e87..b4d6bf8a0e 100644 --- a/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml @@ -10,14 +10,12 @@ nxos_config: &intdefault1 lines: - "default interface {{ testint1 }}" - provider: "{{ nxapi }}" ignore_errors: yes - name: "Put interface {{testint2}} into default state" nxos_config: &intdefault2 lines: - "default interface {{ testint2 }}" - provider: "{{ nxapi }}" ignore_errors: yes - name: "Make {{testint1}} a layer3 interface" @@ -27,7 +25,6 @@ description: 'Configured by Ansible - Layer3' admin_state: 'up' state: present - provider: "{{ nxapi }}" - name: "Make {{testint2}} a layer3 interface" nxos_interface: &l3int2 @@ -36,7 +33,6 @@ description: 'Configured by Ansible - Layer3' admin_state: 'up' state: present - provider: "{{ nxapi }}" # For titanium - name: Clear interface v4 @@ -46,7 +42,6 @@ state: absent addr: 20.20.20.20 mask: 24 - provider: "{{ nxapi }}" # For titanium - name: Clear interface v6 @@ -56,7 +51,6 @@ state: absent addr: 'fd56:31f7:e4ad:5585::1' mask: 64 - provider: "{{ nxapi }}" - name: Ensure ipv4 address is configured nxos_ip_interface: &ipv4 @@ -65,7 +59,6 @@ state: present addr: 20.20.20.20 mask: 24 - provider: "{{ nxapi }}" register: result - assert: &true @@ -87,7 +80,6 @@ state: present addr: 'fd56:31f7:e4ad:5585::1' mask: 64 - provider: "{{ nxapi }}" register: result - assert: *true diff --git a/test/integration/targets/nxos_l2_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_l2_interface/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_l2_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_l2_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 1ea069f14e..b06bfbf9b4 100644 --- a/test/integration/targets/nxos_l2_interface/tests/common/agg.yaml +++ b/test/integration/targets/nxos_l2_interface/tests/common/agg.yaml @@ -10,7 +10,6 @@ - name: "Setup vlans" nxos_vlan: vlan_range: "6,15" - provider: "{{ connection }}" - name: Setup - Ensure interfaces are layer2 nxos_interface: @@ -25,7 +24,6 @@ - { name: "{{ intname1 }}", mode: access, access_vlan: 6 } - { name: "{{ intname2 }}", mode: access, access_vlan: 15 } state: absent - provider: "{{ connection }}" - name: Sleep for 2 seconds on Fretta Platform wait_for: timeout=2 @@ -37,7 +35,6 @@ aggregate: - { name: "{{ intname1 }}", mode: access, access_vlan: 6 } - { name: "{{ intname2 }}", mode: access, access_vlan: 15 } - provider: "{{ connection }}" register: result - assert: @@ -61,7 +58,6 @@ aggregate: - { name: "{{ intname1 }}", mode: access, access_vlan: 6 } - { name: "{{ intname2 }}", mode: access, access_vlan: 15 } - provider: "{{ connection }}" state: absent register: result @@ -86,7 +82,6 @@ nxos_vlan: vlan_range: "6,15" state: absent - provider: "{{ connection }}" ignore_errors: yes - name: "Remove interface aggregate after testing" @@ -95,7 +90,6 @@ - { name: "{{ intname1 }}", mode: access, access_vlan: 6 } - { name: "{{ intname2 }}", mode: access, access_vlan: 15 } state: absent - provider: "{{ connection }}" ignore_errors: yes - 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 16dc7604da..1aea2bfd58 100644 --- a/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_l2_interface/tests/common/sanity.yaml @@ -13,33 +13,28 @@ nxos_config: &default lines: - "default interface {{ intname }}" - provider: "{{ connection }}" ignore_errors: yes - name: Setup - Ensure interface is layer2 nxos_interface: interface: "{{ intname }}" mode: layer2 - provider: "{{ connection }}" - name: "Setup vlans" nxos_vlan: vlan_range: "5-10,20" - provider: "{{ connection }}" - block: - name: Ensure interface is in its default switchport state nxos_l2_interface: &def_swi name: "{{ intname }}" state: unconfigured - provider: "{{ connection }}" - name: Ensure interface is configured for access vlan 20 nxos_l2_interface: &acc_vl name: "{{ intname }}" mode: access access_vlan: 20 - provider: "{{ connection }}" register: result - assert: &true @@ -64,7 +59,6 @@ mode: trunk native_vlan: 10 trunk_allowed_vlans: 5-10 - provider: "{{ connection }}" register: result - assert: *true @@ -81,7 +75,6 @@ mode: trunk native_vlan: 10 trunk_vlans: 2-50 - provider: "{{ connection }}" register: result - assert: *true @@ -98,7 +91,6 @@ mode: trunk trunk_vlans: 2-50 state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -127,7 +119,6 @@ mode: trunk trunk_vlans: 30-4094 state: absent - provider: "{{ connection }}" register: result - assert: *true @@ -155,7 +146,6 @@ nxos_vlan: vlan_range: "5-10,20" state: absent - provider: "{{ connection }}" ignore_errors: yes - name: "default interface" diff --git a/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_l3_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 080aad6bfa..949dcd8829 100644 --- a/test/integration/targets/nxos_l3_interface/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_l3_interface/tests/cli/sanity.yaml @@ -17,7 +17,6 @@ - no ip address 192.168.22.1/24 parents: no switchport before: "interface {{ testint2 }}" - provider: "{{ cli }}" ignore_errors: yes - name: Setup - remove address from interface prior to testing(Part2) @@ -27,7 +26,6 @@ - no ipv6 address 33:db::2/8 parents: no switchport before: "interface {{ testint3 }}" - provider: "{{ cli }}" ignore_errors: yes - name: Setup - Ensure interfaces are layer3 @@ -36,13 +34,11 @@ - name: "{{ testint2 }}" - name: "{{ testint3 }}" mode: layer3 - provider: "{{ cli }}" - name: Configure ipv4 address to interface nxos_l3_interface: &conf name: "{{ testint2 }}" ipv4: 192.168.22.1/24 - provider: "{{ cli }}" register: result - assert: @@ -61,7 +57,6 @@ nxos_l3_interface: &rm name: "{{ testint2 }}" ipv4: 192.168.22.1/24 - provider: "{{ cli }}" state: absent register: result @@ -82,7 +77,6 @@ aggregate: - { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 } - { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" } - provider: "{{ cli }}" register: result - assert: @@ -102,7 +96,6 @@ aggregate: - { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 } - { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" } - provider: "{{ cli }}" state: absent register: result 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 e9e20fbe6b..1b2aa93d85 100644 --- a/test/integration/targets/nxos_l3_interface/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_l3_interface/tests/nxapi/sanity.yaml @@ -16,7 +16,6 @@ aggregate: - { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 } - { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" } - provider: "{{ nxapi }}" state: absent ignore_errors: yes @@ -26,13 +25,11 @@ - name: "{{ testint2 }}" - name: "{{ testint3 }}" mode: layer3 - provider: "{{ nxapi }}" - name: Configure ipv4 address to interface nxos_l3_interface: &conf name: "{{ testint2 }}" ipv4: 192.168.22.1/24 - provider: "{{ nxapi }}" register: result - assert: @@ -51,7 +48,6 @@ nxos_l3_interface: &rm name: "{{ testint2 }}" ipv4: 192.168.22.1/24 - provider: "{{ nxapi }}" state: absent register: result @@ -72,7 +68,6 @@ aggregate: - { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 } - { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" } - provider: "{{ nxapi }}" register: result - assert: @@ -92,7 +87,6 @@ aggregate: - { name: "{{ testint2 }}", ipv4: 192.168.22.1/24 } - { name: "{{ testint3 }}", ipv4: 192.168.20.1/24, ipv6: "{{ ipv6_address }}" } - provider: "{{ nxapi }}" state: absent register: result diff --git a/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml b/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_linkagg/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" 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 b508986b94..6600f293dd 100644 --- a/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_linkagg/tests/common/sanity.yaml @@ -10,7 +10,6 @@ nxos_feature: feature: lacp state: enabled - provider: "{{ connection }}" ignore_errors: yes - name: setup - remove config used in test(part1) @@ -18,13 +17,11 @@ lines: - no interface port-channel 20 - no interface port-channel 100 - provider: "{{ connection }}" - name: setup - remove config used in test(part2) nxos_config: lines: - no channel-group 20 - provider: "{{ connection }}" parents: "{{ item }}" ignore_errors: yes loop: @@ -43,7 +40,6 @@ nxos_linkagg: &create group: 20 state: present - provider: "{{ connection }}" register: result - assert: @@ -67,7 +63,6 @@ members: - "{{ testint1 }}" - "{{ testint2 }}" - provider: "{{ connection }}" register: result - assert: @@ -93,7 +88,6 @@ force: True members: - "{{ testint2 }}" - provider: "{{ connection }}" register: result - assert: @@ -114,7 +108,6 @@ nxos_linkagg: &remove group: 20 state: absent - provider: "{{ connection }}" register: result - assert: @@ -135,7 +128,6 @@ aggregate: - { group: 20, min_links: 3 } - { group: 100, min_links: 4 } - provider: "{{ connection }}" register: result - assert: @@ -159,7 +151,6 @@ aggregate: - { group: 20, min_links: 3 } - { group: 100, min_links: 4 } - provider: "{{ connection }}" state: absent register: result @@ -182,13 +173,11 @@ lines: - no interface port-channel 20 - no interface port-channel 100 - provider: "{{ connection }}" - name: teardown - remove config used in test(part2) nxos_config: lines: - no channel-group 20 - provider: "{{ connection }}" parents: "{{ item }}" ignore_errors: yes loop: @@ -200,6 +189,5 @@ feature: lacp state: disabled timeout: 60 - provider: "{{ connection }}" - debug: msg="END connection={{ ansible_connection }} nxos_linkagg sanity test" diff --git a/test/integration/targets/nxos_lldp/tasks/nxapi.yaml b/test/integration/targets/nxos_lldp/tasks/nxapi.yaml index 378db2f016..653bcfefe9 100644 --- a/test/integration/targets/nxos_lldp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_lldp/tasks/nxapi.yaml @@ -1,14 +1,16 @@ --- -- name: collect common nxapi test cases +- name: collect common 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" + 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=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 e5a21d2775..98c4c9e5a5 100644 --- a/test/integration/targets/nxos_lldp/tests/cli/sanity.yaml +++ b/test/integration/targets/nxos_lldp/tests/cli/sanity.yaml @@ -7,12 +7,10 @@ nxos_feature: feature: lldp state: disabled - provider: "{{ connection }}" - name: Enable LLDP service nxos_lldp: state: present - provider: "{{ connection }}" register: result - assert: @@ -23,7 +21,6 @@ - name: Enable LLDP service again (idempotent) nxos_lldp: state: present - provider: "{{ connection }}" register: result - assert: @@ -33,7 +30,6 @@ - name: Disable LLDP service nxos_lldp: state: absent - provider: "{{ connection }}" register: result - assert: @@ -44,7 +40,6 @@ - name: Disable LLDP service (idempotent) nxos_lldp: state: absent - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml index e44daa7234..398e713338 100644 --- a/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml +++ b/test/integration/targets/nxos_lldp/tests/nxapi/sanity.yaml @@ -7,12 +7,10 @@ nxos_feature: feature: lldp state: disabled - provider: "{{ connection }}" - name: Enable LLDP service nxos_lldp: state: present - provider: "{{ connection }}" register: result - assert: @@ -23,7 +21,6 @@ - name: Enable LLDP service again (idempotent) nxos_lldp: state: present - provider: "{{ connection }}" register: result - assert: @@ -33,7 +30,6 @@ - name: Disable LLDP service nxos_lldp: state: absent - provider: "{{ connection }}" register: result - assert: @@ -44,7 +40,6 @@ - name: Disable LLDP service (idempotent) nxos_lldp: state: absent - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_logging/tasks/nxapi.yaml b/test/integration/targets/nxos_logging/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_logging/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_logging/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_logging/tests/common/basic.yaml b/test/integration/targets/nxos_logging/tests/common/basic.yaml index f9bbb2c410..28eeddc730 100644 --- a/test/integration/targets/nxos_logging/tests/common/basic.yaml +++ b/test/integration/targets/nxos_logging/tests/common/basic.yaml @@ -8,7 +8,6 @@ dest: console dest_level: 0 state: present - provider: "{{ connection }}" register: result - assert: @@ -30,7 +29,6 @@ name: test dest_level: 1 state: present - provider: "{{ connection }}" register: result - assert: @@ -48,7 +46,6 @@ nxos_logging: &molog dest: module dest_level: 2 - provider: "{{ connection }}" register: result - assert: @@ -66,7 +63,6 @@ nxos_logging: &mlog dest: monitor dest_level: 3 - provider: "{{ connection }}" register: result - assert: @@ -84,7 +80,6 @@ nxos_logging: &flog facility: daemon facility_level: 4 - provider: "{{ connection }}" register: result - assert: @@ -107,7 +102,6 @@ - { dest: logfile, dest_level: 1, name: test } - { facility: daemon, facility_level: 4 } state: absent - provider: "{{ connection }}" register: result - assert: diff --git a/test/integration/targets/nxos_logging/tests/common/net_logging.yaml b/test/integration/targets/nxos_logging/tests/common/net_logging.yaml index f2ec87d70a..6f84551e34 100644 --- a/test/integration/targets/nxos_logging/tests/common/net_logging.yaml +++ b/test/integration/targets/nxos_logging/tests/common/net_logging.yaml @@ -11,7 +11,6 @@ dest: console dest_level: 0 state: absent - provider: "{{ connection }}" register: result - name: Set up console logging using platform agnostic module @@ -19,7 +18,6 @@ dest: console dest_level: 0 state: present - provider: "{{ connection }}" register: result - assert: @@ -32,7 +30,6 @@ dest: console dest_level: 0 state: absent - provider: "{{ connection }}" register: result diff --git a/test/integration/targets/nxos_ntp/tasks/nxapi.yaml b/test/integration/targets/nxos_ntp/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_ntp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ntp/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_nxapi/tasks/cli.yaml b/test/integration/targets/nxos_nxapi/tasks/cli.yaml index 5832987a51..9243812668 100644 --- a/test/integration/targets/nxos_nxapi/tasks/cli.yaml +++ b/test/integration/targets/nxos_nxapi/tasks/cli.yaml @@ -25,9 +25,3 @@ 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_nxapi/tasks/nxapi.yaml b/test/integration/targets/nxos_nxapi/tasks/nxapi.yaml index ab3ad41c47..961c399152 100644 --- a/test/integration/targets/nxos_nxapi/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_nxapi/tasks/nxapi.yaml @@ -20,7 +20,13 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=local) +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" + with_items: "{{ test_items }}" + loop_control: + loop_var: 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: diff --git a/test/integration/targets/nxos_ospf/tasks/nxapi.yaml b/test/integration/targets/nxos_ospf/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_ospf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ospf/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_ospf_vrf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_ospf_vrf/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_overlay_global/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_overlay_global/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_pim/tasks/nxapi.yaml b/test/integration/targets/nxos_pim/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_pim/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_pim/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_pim_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_pim_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_pim_rp_address/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_pim_rp_address/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_portchannel/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_portchannel/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_rollback/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_rollback/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_smoke/tasks/cli.yaml b/test/integration/targets/nxos_smoke/tasks/cli.yaml index f53eac3a47..7caac69767 100644 --- a/test/integration/targets/nxos_smoke/tasks/cli.yaml +++ b/test/integration/targets/nxos_smoke/tasks/cli.yaml @@ -26,8 +26,8 @@ loop_control: loop_var: test_case_to_run -- name: run test case (connection=local) +- name: run test cases (connection=local) include: "{{ test_case_to_run }} ansible_connection=local connection={{ cli }}" - with_first_found: "{{ test_items }}" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_smoke/tasks/nxapi.yaml b/test/integration/targets/nxos_smoke/tasks/nxapi.yaml index 68e96a2942..65955f4f20 100644 --- a/test/integration/targets/nxos_smoke/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_smoke/tasks/nxapi.yaml @@ -20,6 +20,12 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ nxapi }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + - name: run test cases (connection=local) include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" with_items: "{{ test_items }}" diff --git a/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml b/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snmp_community/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_community/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_contact/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_contact/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snmp_contact/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_contact/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snmp_host/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_host/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_snmp_traps/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_traps/tasks/nxapi.yaml index 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snmp_traps/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_traps/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_static_route/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_static_route/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_switchport/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_switchport/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_system/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_system/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_udld/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_udld/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_udld_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_udld_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_user/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_user/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vlan/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vlan/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vpc/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vpc/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vpc_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vpc_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vrf/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrf/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vrf_af/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrf_af/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrf_interface/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vrrp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vrrp/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vtp_domain/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vtp_password/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vtp_version/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ 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 68e96a2942..653bcfefe9 100644 --- a/test/integration/targets/nxos_vxlan_vtep_vni/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_vxlan_vtep_vni/tasks/nxapi.yaml @@ -1,5 +1,5 @@ --- -- name: collect common nxapi test cases +- name: collect common test cases find: paths: "{{ role_path }}/tests/common" patterns: "{{ testcase }}.yaml" @@ -20,8 +20,8 @@ - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}" +- name: run test cases (connection=httpapi) + include: "{{ test_case_to_run }} ansible_connection=httpapi" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run