summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/nxos/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/nxos/tests')
-rw-r--r--ansible_collections/cisco/nxos/tests/__init__.py (renamed from ansible_collections/cisco/nxos/tests/unit/compat/__init__.py)0
-rw-r--r--ansible_collections/cisco/nxos/tests/config.yml2
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/__init__.py0
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/labs/single.yaml241
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/remove_config.yaml6
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/rtt.yml3
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_facts/tests/common/interface_facts.yaml62
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_file_copy/tests/cli/sanity.yaml12
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/defaults/main.yaml2
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/meta/main.yaml3
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/cli.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/main.yaml19
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/nxapi.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/basic.yaml485
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/purge.yaml111
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/defaults/main.yaml2
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/meta/main.yml3
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/cli.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/main.yaml12
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/nxapi.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tests/common/sanity.yaml114
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/defaults/main.yaml2
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/meta/main.yml3
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/cli.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/main.yaml10
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml133
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/defaults/main.yaml2
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/meta/main.yml3
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/cli.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/main.yaml10
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/nxapi.yaml31
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tests/common/sanity.yaml99
-rw-r--r--ansible_collections/cisco/nxos/tests/integration/test_integration.py43
-rw-r--r--ansible_collections/cisco/nxos/tests/sanity/ignore-2.10.txt34
-rw-r--r--ansible_collections/cisco/nxos/tests/sanity/ignore-2.11.txt34
-rw-r--r--ansible_collections/cisco/nxos/tests/sanity/ignore-2.12.txt36
-rw-r--r--ansible_collections/cisco/nxos/tests/sanity/ignore-2.18.txt (renamed from ansible_collections/cisco/nxos/tests/sanity/ignore-2.13.txt)0
-rw-r--r--ansible_collections/cisco/nxos/tests/sanity/ignore-2.9.txt55
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/compat/mock.py127
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/compat/unittest.py41
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/mock/path.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/mock/procenv.py5
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py15
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py48
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py6
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py8
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py4
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py23
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py2
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py149
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py3
-rw-r--r--ansible_collections/cisco/nxos/tests/unit/modules/utils.py8
95 files changed, 635 insertions, 1714 deletions
diff --git a/ansible_collections/cisco/nxos/tests/unit/compat/__init__.py b/ansible_collections/cisco/nxos/tests/__init__.py
index e69de29bb..e69de29bb 100644
--- a/ansible_collections/cisco/nxos/tests/unit/compat/__init__.py
+++ b/ansible_collections/cisco/nxos/tests/__init__.py
diff --git a/ansible_collections/cisco/nxos/tests/config.yml b/ansible_collections/cisco/nxos/tests/config.yml
index 41f529264..c26ea5966 100644
--- a/ansible_collections/cisco/nxos/tests/config.yml
+++ b/ansible_collections/cisco/nxos/tests/config.yml
@@ -1,3 +1,3 @@
---
modules:
- python_requires: ">=3.6"
+ python_requires: ">=3.9"
diff --git a/ansible_collections/cisco/nxos/tests/integration/__init__.py b/ansible_collections/cisco/nxos/tests/integration/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/cisco/nxos/tests/integration/__init__.py
diff --git a/ansible_collections/cisco/nxos/tests/integration/labs/single.yaml b/ansible_collections/cisco/nxos/tests/integration/labs/single.yaml
new file mode 100644
index 000000000..7f3e4d96f
--- /dev/null
+++ b/ansible_collections/cisco/nxos/tests/integration/labs/single.yaml
@@ -0,0 +1,241 @@
+lab:
+ description: ""
+ notes: ""
+ title: cisco.nxos.nxos
+ version: 0.2.0
+links:
+ - id: l0
+ n1: n0
+ n2: n1
+ i1: i1
+ i2: i0
+ label: nxos9000-0-mgmt0<->ext-conn-0-port
+nodes:
+ - boot_disk_size: null
+ configuration: |2-
+
+ !Command: show running-config
+ !Running configuration last done at: Mon Feb 12 07:11:33 2024
+ !Time: Mon Feb 12 07:11:33 2024
+
+ version 10.3(1) Bios:version
+ hostname R1
+ vdc R1 id 1
+ limit-resource vlan minimum 16 maximum 4094
+ limit-resource vrf minimum 2 maximum 4096
+ limit-resource port-channel minimum 0 maximum 511
+ limit-resource m4route-mem minimum 58 maximum 58
+ limit-resource m6route-mem minimum 8 maximum 8
+
+ no password strength-check
+ username admin password 5 $5$AADOBF$GVXUV2cvmlZH42xDu6wnqfBpV9gXF61WGVNrGF5Gk6C role network-admin
+ username ansible password 5 $5$GHBNKA$8ccD8KWjmP6NzxzkIRufl7giaUWjrhAn4SRrVWYZ4R1 role network-admin
+ username ansible passphrase lifetime 99999 warntime 14 gracetime 3
+ ssh key rsa 2048
+ ip domain-lookup
+ snmp-server user admin network-admin auth md5 040F90283AEB9A92CCAF81F5CDA2639FFFCD priv aes-128 006084272498F8CD8F98DE888DEC6899C6D0 localizedV2key
+ snmp-server user ansible network-admin auth md5 5207BA419F48B4EB39149FDC00BE411BC828 priv aes-128 041EED4A876CACFD7656EA885CE15D3CE108 localizedV2key
+ rmon event 1 log trap public description FATAL(1) owner PMON@FATAL
+ rmon event 2 log trap public description CRITICAL(2) owner PMON@CRITICAL
+ rmon event 3 log trap public description ERROR(3) owner PMON@ERROR
+ rmon event 4 log trap public description WARNING(4) owner PMON@WARNING
+ rmon event 5 log trap public description INFORMATION(5) owner PMON@INFO
+
+ vlan 1
+
+ vrf context management
+ ip name-server 192.168.255.1
+ ip route 0.0.0.0/0 192.168.255.1
+
+ interface Ethernet1/1
+
+ interface Ethernet1/2
+
+ interface Ethernet1/3
+
+ interface Ethernet1/4
+
+ interface Ethernet1/5
+
+ interface Ethernet1/6
+
+ interface Ethernet1/7
+
+ interface Ethernet1/8
+
+ interface Ethernet1/9
+
+ interface Ethernet1/10
+
+ interface Ethernet1/11
+
+ interface Ethernet1/12
+
+ interface Ethernet1/13
+
+ interface Ethernet1/14
+
+ interface Ethernet1/15
+
+ interface Ethernet1/16
+
+ interface Ethernet1/17
+
+ interface Ethernet1/18
+
+ interface Ethernet1/19
+
+ interface Ethernet1/20
+
+ interface Ethernet1/21
+
+ interface Ethernet1/22
+
+ interface Ethernet1/23
+
+ interface Ethernet1/24
+
+ interface Ethernet1/25
+
+ interface Ethernet1/26
+
+ interface Ethernet1/27
+
+ interface Ethernet1/28
+
+ interface Ethernet1/29
+
+ interface Ethernet1/30
+
+ interface Ethernet1/31
+
+ interface Ethernet1/32
+
+ interface Ethernet1/33
+
+ interface Ethernet1/34
+
+ interface Ethernet1/35
+
+ interface Ethernet1/36
+
+ interface Ethernet1/37
+
+ interface Ethernet1/38
+
+ interface Ethernet1/39
+
+ interface Ethernet1/40
+
+ interface Ethernet1/41
+
+ interface Ethernet1/42
+
+ interface Ethernet1/43
+
+ interface Ethernet1/44
+
+ interface Ethernet1/45
+
+ interface Ethernet1/46
+
+ interface Ethernet1/47
+
+ interface Ethernet1/48
+
+ interface Ethernet1/49
+
+ interface Ethernet1/50
+
+ interface Ethernet1/51
+
+ interface Ethernet1/52
+
+ interface Ethernet1/53
+
+ interface Ethernet1/54
+
+ interface Ethernet1/55
+
+ interface Ethernet1/56
+
+ interface Ethernet1/57
+
+ interface Ethernet1/58
+
+ interface Ethernet1/59
+
+ interface Ethernet1/60
+
+ interface Ethernet1/61
+
+ interface Ethernet1/62
+
+ interface Ethernet1/63
+
+ interface Ethernet1/64
+
+ interface mgmt0
+ ip address dhcp
+ vrf member management
+ icam monitor scale
+
+ line console
+ exec-timeout 0
+ line vty
+ exec-timeout 0
+ boot nxos bootflash:/nxos64-cs.10.3.1.F.bin
+
+ no logging console
+ cpu_limit: null
+ cpus: null
+ data_volume: null
+ hide_links: false
+ id: n0
+ image_definition: null
+ label: nxos9000-0
+ node_definition: nxosv9000
+ ram: null
+ tags: []
+ x: -1750
+ y: -250
+ interfaces:
+ - id: i0
+ label: Loopback0
+ type: loopback
+ - id: i1
+ label: mgmt0
+ slot: 0
+ type: physical
+ - id: i2
+ label: Ethernet1/1
+ slot: 1
+ type: physical
+ - id: i3
+ label: Ethernet1/2
+ slot: 2
+ type: physical
+ - id: i4
+ label: Ethernet1/3
+ slot: 3
+ type: physical
+ - boot_disk_size: null
+ configuration: virbr0
+ cpu_limit: null
+ cpus: null
+ data_volume: null
+ hide_links: false
+ id: n1
+ image_definition: null
+ label: ext-conn-0
+ node_definition: external_connector
+ ram: null
+ tags: []
+ x: -2250
+ y: -250
+ interfaces:
+ - id: i0
+ label: port
+ slot: 0
+ type: physical
+annotations: []
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/remove_config.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/remove_config.yaml
index 3cad7ce53..f76058818 100644
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/remove_config.yaml
+++ b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/remove_config.yaml
@@ -22,6 +22,7 @@
- name: Remove configuration - 3
cisco.nxos.nxos_config:
lines:
+ - no switchport
- no ip access-group ACL1v4 out
parents: interface Ethernet1/3
ignore_errors: true
@@ -41,3 +42,8 @@
- no ip port access-group PortACL in
parents: interface Ethernet1/6
ignore_errors: true
+
+- name: Remove configuration - 6
+ cisco.nxos.nxos_config:
+ lines: no interface loopback1
+ ignore_errors: true
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/rtt.yml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/rtt.yml
index 90f72fb39..d42b4b19a 100644
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/rtt.yml
+++ b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_acl_interfaces/tests/common/rtt.yml
@@ -83,6 +83,9 @@
- "'no ip port access-group PortACL in' in result.commands"
- "'ipv6 port traffic-filter NewACLv6 in' in result.commands"
+ - ansible.builtin.debug:
+ msg: "{{ ansible_facts['network_resources']['acl_interfaces'] }}"
+
- name: Revert back to base configuration using facts round trip
register: result
cisco.nxos.nxos_acl_interfaces:
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_facts/tests/common/interface_facts.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_facts/tests/common/interface_facts.yaml
new file mode 100644
index 000000000..2c237d360
--- /dev/null
+++ b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_facts/tests/common/interface_facts.yaml
@@ -0,0 +1,62 @@
+---
+- ansible.builtin.debug:
+ msg: START connection={{ ansible_connection }}/interface_facts.yaml
+
+- name: Setup
+ cisco.nxos.nxos_config: &default
+ lines:
+ - default interface Ethernet1/1
+ - default interface Ethernet1/2
+
+- block:
+ - name: Make sure interfaces are L3
+ cisco.nxos.nxos_interfaces:
+ config:
+ - name: Ethernet1/1
+ mode: layer3
+ - name: Ethernet1/2
+ mode: layer3
+
+ # since the | json output renders differently when only one
+ # interface has IPv6 address vs when more than one interface
+ # has IPv6 address, we need to test them separately
+
+ - name: Assign IPv6 address to interface - 1
+ register: result
+ cisco.nxos.nxos_l3_interfaces:
+ config:
+ - name: Ethernet1/1
+ ipv6:
+ - address: 2001:db8::2/32
+
+ - name: Gather interface facts
+ cisco.nxos.nxos_facts:
+ gather_subset:
+ - "interfaces"
+
+ - name: Assert that IPv6 address was found
+ ansible.builtin.assert:
+ that:
+ - "'2001:db8::2/32' in ansible_net_all_ipv6_addresses"
+
+ - name: Assign IPv6 address to interface - 2
+ register: result
+ cisco.nxos.nxos_l3_interfaces:
+ config:
+ - name: Ethernet1/2
+ ipv6:
+ - address: 2001:db8::3/32
+
+ - name: Gather interface facts
+ cisco.nxos.nxos_facts:
+ gather_subset:
+ - "interfaces"
+
+ - name: Assert that IPv6 address was found
+ ansible.builtin.assert:
+ that:
+ - "'2001:db8::2/32' in ansible_net_all_ipv6_addresses"
+ - "'2001:db8::3/32' in ansible_net_all_ipv6_addresses"
+ always:
+ - name: Teardown
+ cisco.nxos.nxos_config: *default
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_file_copy/tests/cli/sanity.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_file_copy/tests/cli/sanity.yaml
index 70c450c39..0f2bdbb0f 100644
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_file_copy/tests/cli/sanity.yaml
+++ b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_file_copy/tests/cli/sanity.yaml
@@ -132,11 +132,11 @@
- result.changed == true
- "'copy scp:' in result.copy_cmd"
- "'bootflash:' in result.file_system"
- - "'bootflash:dir1/dir2/dir3/{{ test_destination_file }}_copy' in result.local_file"
- - "'/{{ test_destination_file }}' in result.remote_file"
+ - "'bootflash:dir1/dir2/dir3/test_destination_file_copy' in result.local_file"
+ - "'/test_destination_file' in result.remote_file"
- "'Received: File copied/pulled to nxos device from remote scp server.' in result.transfer_status"
- - "'{{ mgmt0_ip }}' in result.remote_scp_server"
+ - mgmt0_ip in result.remote_scp_server
- ansible.builtin.pause:
seconds: 60
@@ -169,11 +169,11 @@
- result.changed == true
- "'copy sftp:' in result.copy_cmd"
- "'bootflash:' in result.file_system"
- - "'bootflash:dir1/dir2/dir3/{{ test_destination_file }}_another_copy' in result.local_file"
- - "'/bootflash/{{ test_destination_file }}' in result.remote_file"
+ - "'bootflash:dir1/dir2/dir3/test_destination_file_another_copy' in result.local_file"
+ - "'/bootflash/test_destination_file' in result.remote_file"
- "'Received: File copied/pulled to nxos device from remote scp server.' in result.transfer_status"
- - "'{{ mgmt0_ip }}' in result.remote_scp_server"
+ - mgmt0_ip in result.remote_scp_server
always:
- name: Remove file
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/defaults/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/meta/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/meta/main.yaml
deleted file mode 100644
index f504a6ab2..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/meta/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_nxos_tests
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/cli.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/cli.yaml
deleted file mode 100644
index d3d521f2a..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/cli.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect CLI test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: cli_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + cli_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection network_cli
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.network_cli
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/main.yaml
deleted file mode 100644
index ccb324f33..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/main.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: Run the CLI and NX-API tests
- block:
- - name: Include the CLI tasks
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - cli
-
- - name: Include the NX-API tasks
- ansible.builtin.include_tasks: nxapi.yaml
- tags:
- - nxapi
- always:
- - name: Set baud rate back to 9600 so our tests don't break
- connection: ansible.netcommon.network_cli
- cisco.nxos.nxos_config:
- lines:
- - speed 9600
- parents: line console
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/nxapi.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/nxapi.yaml
deleted file mode 100644
index 5fec0f43b..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tasks/nxapi.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect NX-API test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/nxapi"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: nxapi_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + nxapi_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection httpapi
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.httpapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/basic.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/basic.yaml
deleted file mode 100644
index 72bf146d1..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/basic.yaml
+++ /dev/null
@@ -1,485 +0,0 @@
----
-- ansible.builtin.debug:
- msg: START connection={{ ansible_connection }} nxos_logging basic test
-
-- name: Workaround to clear logging logfile size
- ignore_errors: true
- cisco.nxos.nxos_config:
- lines:
- - logging logfile test 1 size 4194304
-
-- name: Purge logging configuration first
- cisco.nxos.nxos_logging:
- purge: true
-
-- name: Set up console logging
- register: result
- cisco.nxos.nxos_logging: &id001
- dest: console
- dest_level: 0
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging console 0" in result.commands'
-
-- name: Set up console logging again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id001
-
-- ansible.builtin.assert: &id003
- that:
- - result.changed == false
-
-- name: Set up console logging with level 2 (edge case)
- register: result
- cisco.nxos.nxos_logging: &id002
- dest: console
- dest_level: 2
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging console 2" in result.commands'
-
-- name: Set up console logging with level 2 (edge case) (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id002
-
-- ansible.builtin.assert: *id003
-
-- block:
- - name: Logfile logging with level
- register: result
- cisco.nxos.nxos_logging: &id004
- dest: logfile
- name: test
- dest_level: 1
- state: present
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging logfile test 1" in result.commands'
-
- - name: Logfile logging with level (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id004
-
- - ansible.builtin.assert: *id003
- when: platform is not search('N5K|N7K') and imagetag is not search("A8")
-
-- name: Configure module with level
- register: result
- cisco.nxos.nxos_logging: &id005
- dest: module
- dest_level: 2
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging module 2" in result.commands'
-
-- name: Configure module with level (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id005
-
-- ansible.builtin.assert: *id003
-
-- name: Configure monitor with level
- register: result
- cisco.nxos.nxos_logging: &id006
- dest: monitor
- dest_level: 3
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging monitor 3" in result.commands'
-
-- name: Configure monitor with level (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id006
-
-- ansible.builtin.assert: *id003
-
-- name: Configure monitor with level 5 (edge case)
- register: result
- cisco.nxos.nxos_logging: &id007
- dest: monitor
- dest_level: 5
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging monitor 5" in result.commands'
-
-- name: Configure monitor with level 5 (edge case) (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id007
-
-- ansible.builtin.assert: *id003
-
-- name: Configure facility with level
- register: result
- cisco.nxos.nxos_logging: &id008
- facility: daemon
- facility_level: 4
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging level daemon 4" in result.commands'
-
-- name: Configure facility with level (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id008
-
-- ansible.builtin.assert: *id003
-
-- name: Configure remote logging
- register: result
- cisco.nxos.nxos_logging: &id009
- dest: server
- remote_server: test-syslogserver.com
- facility: auth
- facility_level: 1
- use_vrf: management
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging server test-syslogserver.com 1 facility auth use-vrf management" in result.commands'
-
-- name: Configure remote logging (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id009
-
-- ansible.builtin.assert: *id003
-
-- name: Configure source interface for logging
- register: result
- cisco.nxos.nxos_logging: &id010
- interface: mgmt0
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging source-interface mgmt 0" in result.commands'
-
-- name: Configure source interface for logging (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id010
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Remove logging as collection teardown
- register: result
- cisco.nxos.nxos_logging: &id011
- aggregate:
- - dest: console
- dest_level: 3
-
- - dest: module
- dest_level: 2
-
- - dest: monitor
- dest_level: 5
-
- - dest: logfile
- dest_level: 1
- name: test
-
- - facility: daemon
- facility_level: 4
-
- - dest: server
- remote_server: test-syslogserver.com
- facility: auth
- facility_level: 1
- use_vrf: management
-
- - interface: mgmt0
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging logfile" in result.commands'
- - '"no logging level daemon 4" in result.commands'
- - '"no logging monitor" in result.commands'
- - '"no logging module" in result.commands'
- - '"no logging server test-syslogserver.com" in result.commands'
- - '"no logging source-interface" in result.commands'
- when: platform is not search('N5K|N7K') and imagetag is not search("A8")
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging level daemon 4" in result.commands'
- - '"no logging monitor" in result.commands'
- - '"no logging module" in result.commands'
- - '"no logging server test-syslogserver.com" in result.commands'
- - '"no logging source-interface" in result.commands'
- when: platform is search('N5K|N7K') or imagetag is search("A8")
-
-- name: Remove aggregate logging (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id011
-
-- ansible.builtin.assert: *id003
-
-- block:
- - name: Configure logging message
- register: result
- cisco.nxos.nxos_logging: &id012
- interface_message: add-interface-description
- state: present
-
- - ansible.builtin.assert: &id013
- that:
- - result.changed == true
-
- - name: Configure logging message (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id012
-
- - ansible.builtin.assert: *id003
-
- - name: Remove logging message
- register: result
- cisco.nxos.nxos_logging:
- interface_message: add-interface-description
- state: absent
-
- - ansible.builtin.assert: *id013
- when: platform is not search('N5K') and imagetag is not search("A8")
-
-- name: Logfile logging with level and size
- register: result
- cisco.nxos.nxos_logging: &id014
- dest: logfile
- name: test
- dest_level: 1
- file_size: 16384
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging logfile test 1 size 16384" in result.commands'
-
-- name: Logfile logging with level and size (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id014
-
-- ansible.builtin.assert: *id003
-
-- name: Remove logfile logging with level and size
- register: result
- cisco.nxos.nxos_logging:
- dest: logfile
- name: test
- dest_level: 1
- file_size: 16384
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Set up logging event link enable
- register: result
- cisco.nxos.nxos_logging: &id015
- event: link-enable
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging event link-status enable" in result.commands'
-
-- name: Set up logging event link enable again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id015
-
-- ansible.builtin.assert: *id003
-
-- name: Remove logging event link enable
- register: result
- cisco.nxos.nxos_logging: &id016
- event: link-enable
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Remove logging event link enable again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id016
-
-- ansible.builtin.assert: *id003
-
-- name: Set up logging event link default
- register: result
- cisco.nxos.nxos_logging: &id017
- event: link-default
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging event link-status default" in result.commands'
-
-- name: Set up logging event link default again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id017
-
-- ansible.builtin.assert: *id003
-
-- name: Remove logging event link default
- register: result
- cisco.nxos.nxos_logging: &id018
- event: link-default
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Remove logging event link default again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id018
-
-- ansible.builtin.assert: *id003
-
-- name: Set up logging event trunk enable
- register: result
- cisco.nxos.nxos_logging: &id019
- event: trunk-enable
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging event trunk-status enable" in result.commands'
-
-- name: Set up logging event trunk enable again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id019
-
-- ansible.builtin.assert: *id003
-
-- name: Remove logging event trunk enable
- register: result
- cisco.nxos.nxos_logging: &id020
- event: trunk-enable
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Remove logging event trunk enable again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id020
-
-- ansible.builtin.assert: *id003
-
-- name: Set up logging event trunk default
- register: result
- cisco.nxos.nxos_logging: &id021
- event: trunk-default
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging event trunk-status default" in result.commands'
-
-- name: Set up logging event trunk default again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id021
-
-- ansible.builtin.assert: *id003
-
-- name: Remove logging event trunk default
- register: result
- cisco.nxos.nxos_logging: &id022
- event: trunk-default
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Remove logging event trunk default again (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id022
-
-- ansible.builtin.assert: *id003
-
-- name: Set up logging timestamp
- register: result
- cisco.nxos.nxos_logging: &id023
- timestamp: microseconds
- state: present
-
-- ansible.builtin.assert: *id013
-
-- name: Set up logging timestamp (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id023
-
-- ansible.builtin.assert: *id003
-
-- name: Remove logging timestamp
- register: result
- cisco.nxos.nxos_logging:
- timestamp: microseconds
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Set up facility ethpm link up error
- register: result
- cisco.nxos.nxos_logging: &id024
- facility: ethpm
- facility_link_status: link-up-error
- state: present
-
-- ansible.builtin.assert: *id013
-
-- name: Set up facility ethpm link up error (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id024
-
-- ansible.builtin.assert: *id003
-
-- name: Remove facility ethpm link up error
- register: result
- cisco.nxos.nxos_logging:
- facility: ethpm
- facility_link_status: link-up-error
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- name: Set up facility ethpm link down error
- register: result
- cisco.nxos.nxos_logging: &id025
- facility: ethpm
- facility_link_status: link-down-error
- state: present
-
-- ansible.builtin.assert: *id013
-
-- name: Set up facility ethpm link down error (idempotent)
- register: result
- cisco.nxos.nxos_logging: *id025
-
-- ansible.builtin.assert: *id003
-
-- name: Remove facility ethpm link down error
- register: result
- cisco.nxos.nxos_logging:
- facility: ethpm
- facility_link_status: link-down-error
- state: absent
-
-- ansible.builtin.assert: *id013
-
-- ansible.builtin.debug:
- msg: END connection={{ ansible_connection }} nxos_logging basic test
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/purge.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/purge.yaml
deleted file mode 100644
index fa773b58a..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_logging/tests/common/purge.yaml
+++ /dev/null
@@ -1,111 +0,0 @@
----
-- ansible.builtin.debug:
- msg: START connection={{ ansible_connection }} nxos_logging purge test
-
-- name: Purge logging configuration first
- cisco.nxos.nxos_logging:
- purge: true
-
-- block:
- - name: Set up console logging
- register: result
- cisco.nxos.nxos_logging:
- dest: console
- dest_level: 0
- state: present
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging console 0" in result.commands'
-
- - name: Set up logging timestamp
- register: result
- cisco.nxos.nxos_logging:
- timestamp: microseconds
- state: present
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging timestamp microseconds" in result.commands'
-
- - name: Configure monitor with level
- register: result
- cisco.nxos.nxos_logging:
- dest: monitor
- dest_level: 3
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging monitor 3" in result.commands'
-
- - name: Configure facility with level
- register: result
- cisco.nxos.nxos_logging:
- facility: daemon
- facility_level: 4
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging level daemon 4" in result.commands'
-
- - name: Configure logging level virtual-service 7 using nxos_config
- register: result
- cisco.nxos.nxos_config:
- lines: logging level virtual-service 7
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
-
- - name: Purge the outliers
- register: result
- cisco.nxos.nxos_logging:
- purge: true
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging level virtual-service 7" in result.commands'
-
- - block:
- - name: Purge the outliers (idempotent)
- register: result
- cisco.nxos.nxos_logging:
- purge: true
-
- - assert:
- that:
- - result.changed == false
- when: imagetag is not search("A8")
-
- - name: Remove logging as collection teardown
- register: result
- cisco.nxos.nxos_logging:
- aggregate:
- - dest: console
- dest_level: 0
-
- - dest: monitor
- dest_level: 3
-
- - timestamp: microseconds
-
- - facility: daemon
- facility_level: 4
- state: absent
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging console" in result.commands'
- - '"no logging timestamp microseconds" in result.commands'
- - '"no logging level daemon 4" in result.commands'
- - '"no logging monitor" in result.commands'
- when: ansible_connection != "local"
-
-- ansible.builtin.debug:
- msg: END connection={{ ansible_connection }} nxos_logging purge test
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/defaults/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/meta/main.yml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/meta/main.yml
deleted file mode 100644
index f504a6ab2..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_nxos_tests
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/cli.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/cli.yaml
deleted file mode 100644
index d3d521f2a..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/cli.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect CLI test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: cli_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + cli_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection network_cli
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.network_cli
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/main.yaml
deleted file mode 100644
index c9e70304e..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/main.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
----
-- name: Run the CLI and NX-API tests
- block:
- - name: Include the CLI tasks
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - cli
- always:
- - name: Include the NX-API tasks
- ansible.builtin.include_tasks: nxapi.yaml
- tags:
- - nxapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/nxapi.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/nxapi.yaml
deleted file mode 100644
index 5fec0f43b..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tasks/nxapi.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect NX-API test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/nxapi"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: nxapi_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + nxapi_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection httpapi
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.httpapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tests/common/sanity.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tests/common/sanity.yaml
deleted file mode 100644
index f22c99f55..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp/tests/common/sanity.yaml
+++ /dev/null
@@ -1,114 +0,0 @@
----
-- ansible.builtin.debug:
- msg: START connection={{ ansible_connection }} nxos_ntp sanity test
-
-- name: Setup - remove ntp if configured
- ignore_errors: true
- cisco.nxos.nxos_ntp: &id005
- server: 1.2.3.4
- key_id: 32
- prefer: disabled
- vrf_name: management
- source_addr: 192.0.2.5
- state: absent
-
-- block:
- - name: Configure ntp
- register: result
- cisco.nxos.nxos_ntp: &id001
- server: 1.2.3.4
- key_id: 32
- prefer: enabled
- vrf_name: management
- source_addr: 192.0.2.5
- state: present
-
- - ansible.builtin.assert: &id002
- that:
- - result.changed == true
-
- - name: Idempotence check
- register: result
- cisco.nxos.nxos_ntp: *id001
-
- - ansible.builtin.assert: &id004
- that:
- - result.changed == false
-
- - name: Configure ntp with some defaults
- register: result
- cisco.nxos.nxos_ntp: &id003
- peer: 1.2.3.4
- key_id: default
- prefer: enabled
- vrf_name: default
- source_addr: default
- state: present
-
- - ansible.builtin.assert: *id002
-
- - name: Idempotence check
- register: result
- cisco.nxos.nxos_ntp: *id003
-
- - ansible.builtin.assert: *id004
-
- - name: Remove ntp configuration
- register: result
- cisco.nxos.nxos_ntp: *id005
-
- - ansible.builtin.assert: *id002
-
- - name: Remove idempotence check
- register: result
- cisco.nxos.nxos_ntp: *id005
-
- - ansible.builtin.assert: *id004
-
- - name: Configure ntp again
- register: result
- cisco.nxos.nxos_ntp: &id006
- source_int: Ethernet1/3
- peer: 1.2.3.4
- prefer: enabled
- state: present
-
- - ansible.builtin.assert: *id002
-
- - name: Idempotence check
- register: result
- cisco.nxos.nxos_ntp: *id006
-
- - ansible.builtin.assert: *id004
-
- - name: Remove source interface
- register: result
- cisco.nxos.nxos_ntp: &id007
- source_int: default
- state: present
-
- - ansible.builtin.assert: *id002
-
- - name: Idempotence check
- register: result
- cisco.nxos.nxos_ntp: *id007
-
- - ansible.builtin.assert: *id004
-
- - name: Remove ntp
- register: result
- cisco.nxos.nxos_ntp: *id005
-
- - ansible.builtin.assert: *id002
-
- - name: Remove idempotence check
- register: result
- cisco.nxos.nxos_ntp: *id005
-
- - ansible.builtin.assert: *id004
- always:
- - name: Remove ntp configuration
- cisco.nxos.nxos_ntp: *id005
-
- - ansible.builtin.debug:
- msg: END connection={{ ansible_connection }} nxos_ntp sanity test
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/defaults/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/meta/main.yml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/meta/main.yml
deleted file mode 100644
index f504a6ab2..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_nxos_tests
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/cli.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/cli.yaml
deleted file mode 100644
index d3d521f2a..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/cli.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect CLI test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: cli_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + cli_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection network_cli
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.network_cli
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/main.yaml
deleted file mode 100644
index a1da90e57..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/main.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-- name: Include the CLI tasks
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - cli
-
-- name: Include the NX-API tasks
- ansible.builtin.include_tasks: nxapi.yaml
- tags:
- - nxapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml
deleted file mode 100644
index 5fec0f43b..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect NX-API test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/nxapi"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: nxapi_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + nxapi_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection httpapi
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.httpapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml
deleted file mode 100644
index 3ceb9e122..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml
+++ /dev/null
@@ -1,133 +0,0 @@
----
-- ansible.builtin.debug:
- msg: START connection={{ ansible_connection }} nxos_ntp_auth sanity test
-
-- name: Configure text ntp authentication
- ignore_errors: true
- cisco.nxos.nxos_ntp_auth: &id009
- key_id: 32
- md5string: hello
- state: absent
-
-- block:
- - name: Configure text ntp authentication
- register: result
- cisco.nxos.nxos_ntp_auth:
- key_id: 32
- md5string: hello
- authentication: false
- state: present
-
- - ansible.builtin.assert: &id001
- that:
- - result.changed == true
-
- - name: Remove text ntp authentication
- register: result
- cisco.nxos.nxos_ntp_auth:
- key_id: 32
- md5string: hello
- authentication: false
- state: absent
-
- - ansible.builtin.assert: *id001
-
- - name: Configure encrypt ntp authentication
- register: result
- cisco.nxos.nxos_ntp_auth: &id002
- key_id: 32
- md5string: hello
- auth_type: encrypt
- state: present
-
- - ansible.builtin.assert: *id001
-
- - name: Check idempotence - configure encrypt ntp authentication
- register: result
- cisco.nxos.nxos_ntp_auth: *id002
-
- - ansible.builtin.assert: &id004
- that:
- - result.changed == false
-
- - name: Turn on authentication
- register: result
- cisco.nxos.nxos_ntp_auth: &id003
- authentication: true
- state: present
-
- - ansible.builtin.assert: *id001
-
- - name: Check idempotence - turn on authentication
- register: result
- cisco.nxos.nxos_ntp_auth: *id003
-
- - ansible.builtin.assert: *id004
-
- - name: Turn off authentication
- register: result
- cisco.nxos.nxos_ntp_auth: &id005
- authentication: false
- state: present
-
- - ansible.builtin.assert: *id001
-
- - name: Check idempotence - turn off authentication
- register: result
- cisco.nxos.nxos_ntp_auth: *id005
-
- - ansible.builtin.assert: *id004
-
- - name: Add trusted key
- register: result
- cisco.nxos.nxos_ntp_auth: &id006
- key_id: 32
- trusted_key: true
- state: present
-
- - ansible.builtin.assert: *id001
-
- - name: Check idempotence - add trusted key
- register: result
- cisco.nxos.nxos_ntp_auth: *id006
-
- - ansible.builtin.assert: *id004
-
- - name: Remove trusted key
- register: result
- cisco.nxos.nxos_ntp_auth: &id007
- key_id: 32
- trusted_key: false
- state: present
-
- - ansible.builtin.assert: *id001
-
- - name: Check idempotence - remove trusted key
- register: result
- cisco.nxos.nxos_ntp_auth: *id007
-
- - ansible.builtin.assert: *id004
-
- - name: Remove encrypt ntp authentication
- register: result
- cisco.nxos.nxos_ntp_auth: &id008
- key_id: 32
- md5string: hello
- auth_type: encrypt
- authentication: true
- state: absent
-
- - ansible.builtin.assert: *id001
-
- - name: Check idempotence - remove encrypt ntp authentication
- register: result
- cisco.nxos.nxos_ntp_auth: *id008
-
- - ansible.builtin.assert: *id004
- always:
- - name: Cleanup ntp auth configuration
- ignore_errors: true
- cisco.nxos.nxos_ntp_auth: *id009
-
- - ansible.builtin.debug:
- msg: END connection={{ ansible_connection }} nxos_ntp_auth sanity test
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/defaults/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/meta/main.yml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/meta/main.yml
deleted file mode 100644
index f504a6ab2..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_nxos_tests
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/cli.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/cli.yaml
deleted file mode 100644
index d3d521f2a..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/cli.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect CLI test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: cli_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + cli_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection network_cli
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.network_cli
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/main.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/main.yaml
deleted file mode 100644
index a1da90e57..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/main.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-- name: Include the CLI tasks
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - cli
-
-- name: Include the NX-API tasks
- ansible.builtin.include_tasks: nxapi.yaml
- tags:
- - nxapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/nxapi.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/nxapi.yaml
deleted file mode 100644
index 5fec0f43b..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tasks/nxapi.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-- name: Collect common test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/common"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: test_cases
-
-- name: Collect NX-API test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/nxapi"
- patterns: "{{ testcase }}.yaml"
- connection: local
- register: nxapi_cases
-
-- name: Set a fact for 'test_cases'
- ansible.builtin.set_fact:
- test_cases:
- files: "{{ test_cases.files + nxapi_cases.files }}"
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases with connection httpapi
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.httpapi
diff --git a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tests/common/sanity.yaml b/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tests/common/sanity.yaml
deleted file mode 100644
index 1ee9433ef..000000000
--- a/ansible_collections/cisco/nxos/tests/integration/targets/nxos_ntp_options/tests/common/sanity.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
----
-- ansible.builtin.debug:
- msg: START connection={{ ansible_connection }} nxos_ntp_options sanity test
-
-- name: Apply default ntp configuration
- ignore_errors: true
- cisco.nxos.nxos_ntp_options: &id007
- state: absent
-
-- block:
- - name: Configure ntp with master and default stratum
- register: result
- cisco.nxos.nxos_ntp_options: &id001
- master: true
- logging: true
- state: present
-
- - ansible.builtin.assert: &id002
- that:
- - result.changed == true
-
- - name: Check idempotence - configure ntp with master and default stratum
- register: result
- cisco.nxos.nxos_ntp_options: *id001
-
- - ansible.builtin.assert: &id004
- that:
- - result.changed == false
-
- - name: Configure ntp with master and non-default stratum
- register: result
- cisco.nxos.nxos_ntp_options: &id003
- master: true
- stratum: 10
- state: present
-
- - ansible.builtin.assert: *id002
-
- - name: Check idempotence - configure ntp with master and non-default stratum
- register: result
- cisco.nxos.nxos_ntp_options: *id003
-
- - ansible.builtin.assert: *id004
-
- - name: Configure ntp with master and no logging
- register: result
- cisco.nxos.nxos_ntp_options: &id005
- master: true
- stratum: 10
- logging: false
- state: present
-
- - ansible.builtin.assert: *id002
-
- - name: Check idempotence - configure ntp with master and no logging
- register: result
- cisco.nxos.nxos_ntp_options: *id005
-
- - ansible.builtin.assert: *id004
-
- - name: Configure ntp with logging and no master
- register: result
- cisco.nxos.nxos_ntp_options: &id006
- master: false
- logging: true
- state: present
-
- - ansible.builtin.assert: *id002
-
- - name: Check idempotence - configure ntp with logging and no master
- register: result
- cisco.nxos.nxos_ntp_options: *id006
-
- - ansible.builtin.assert: *id004
-
- - name: Configure ntp with master and non-default stratum again
- register: result
- cisco.nxos.nxos_ntp_options: *id003
-
- - ansible.builtin.assert: *id002
-
- - name: Remove ntp options
- register: result
- cisco.nxos.nxos_ntp_options: *id007
-
- - ansible.builtin.assert: *id002
-
- - name: Check idempotence - remove
- register: result
- cisco.nxos.nxos_ntp_options: *id007
-
- - ansible.builtin.assert: *id004
- always:
- - name: Cleanup ntp configuration
- register: result
- cisco.nxos.nxos_ntp_options: *id007
-
- - ansible.builtin.debug:
- msg: END connection={{ ansible_connection }} nxos_ntp_options sanity test
diff --git a/ansible_collections/cisco/nxos/tests/integration/test_integration.py b/ansible_collections/cisco/nxos/tests/integration/test_integration.py
new file mode 100644
index 000000000..aed5c0548
--- /dev/null
+++ b/ansible_collections/cisco/nxos/tests/integration/test_integration.py
@@ -0,0 +1,43 @@
+import subprocess
+
+import pytest
+
+
+def run(ansible_project, environment):
+ __tracebackhide__ = True
+ args = [
+ "ansible-navigator",
+ "run",
+ str(ansible_project.playbook),
+ "-i",
+ str(ansible_project.inventory),
+ "--ee",
+ "false",
+ "--mode",
+ "stdout",
+ "--pas",
+ str(ansible_project.playbook_artifact),
+ "--ll",
+ "debug",
+ "--lf",
+ str(ansible_project.log_file),
+ "--skip-tags",
+ "local,nxapi",
+ ]
+ process = subprocess.run(
+ args=args,
+ env=environment,
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ check=False,
+ shell=False,
+ )
+ if process.returncode:
+ print(process.stdout.decode("utf-8"))
+ print(process.stderr.decode("utf-8"))
+
+ pytest.fail(reason=f"Integration test failed: {ansible_project.role}")
+
+
+def test_integration(ansible_project, environment):
+ run(ansible_project, environment)
diff --git a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.10.txt b/ansible_collections/cisco/nxos/tests/sanity/ignore-2.10.txt
deleted file mode 100644
index 4f8c291ee..000000000
--- a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.10.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py import-2.6!skip
-plugins/modules/nxos_bgp_global.py import-2.6!skip
-plugins/modules/nxos_ospf_interfaces.py import-2.6!skip
-plugins/modules/nxos_ospfv2.py import-2.6!skip
-plugins/modules/nxos_ospfv3.py import-2.6!skip
-plugins/modules/nxos_route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py import-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_address_family.py import-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py compile-2.6!skip
-plugins/modules/nxos_logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py import-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py compile-2.6!skip
diff --git a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.11.txt b/ansible_collections/cisco/nxos/tests/sanity/ignore-2.11.txt
deleted file mode 100644
index 4f8c291ee..000000000
--- a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.11.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py import-2.6!skip
-plugins/modules/nxos_bgp_global.py import-2.6!skip
-plugins/modules/nxos_ospf_interfaces.py import-2.6!skip
-plugins/modules/nxos_ospfv2.py import-2.6!skip
-plugins/modules/nxos_ospfv3.py import-2.6!skip
-plugins/modules/nxos_route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py import-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_address_family.py import-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py compile-2.6!skip
-plugins/modules/nxos_logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py import-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py compile-2.6!skip
diff --git a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.12.txt b/ansible_collections/cisco/nxos/tests/sanity/ignore-2.12.txt
deleted file mode 100644
index d7b9bbd97..000000000
--- a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.12.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py import-2.6!skip
-plugins/modules/nxos_bgp_global.py import-2.6!skip
-plugins/modules/nxos_ospf_interfaces.py import-2.6!skip
-plugins/modules/nxos_ospfv2.py import-2.6!skip
-plugins/modules/nxos_ospfv3.py import-2.6!skip
-plugins/modules/nxos_route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py import-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_address_family.py import-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py compile-2.6!skip
-plugins/modules/nxos_logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ntp_global/ntp_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ntp_global/ntp_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py import-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py compile-2.6!skip
diff --git a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.13.txt b/ansible_collections/cisco/nxos/tests/sanity/ignore-2.18.txt
index 46cfbc643..46cfbc643 100644
--- a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.13.txt
+++ b/ansible_collections/cisco/nxos/tests/sanity/ignore-2.18.txt
diff --git a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.9.txt b/ansible_collections/cisco/nxos/tests/sanity/ignore-2.9.txt
deleted file mode 100644
index ada896a7b..000000000
--- a/ansible_collections/cisco/nxos/tests/sanity/ignore-2.9.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-plugins/modules/nxos_logging.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_logging.py validate-modules:invalid-documentation # removed_at_date not
-plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
-plugins/modules/nxos_ntp.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_ntp.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_ntp_auth.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_ntp_auth.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_ntp_options.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_ntp_options.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_snmp_community.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_snmp_community.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_snmp_contact.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_snmp_contact.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_snmp_host.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_snmp_host.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_snmp_location.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_snmp_location.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_snmp_traps.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_snmp_traps.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/modules/nxos_snmp_user.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
-plugins/modules/nxos_snmp_user.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_global/bgp_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv2/ospfv2.py import-2.6!skip
-plugins/module_utils/network/nxos/config/ospfv3/ospfv3.py import-2.6!skip
-plugins/modules/nxos_bgp_global.py import-2.6!skip
-plugins/modules/nxos_ospf_interfaces.py import-2.6!skip
-plugins/modules/nxos_ospfv2.py import-2.6!skip
-plugins/modules/nxos_ospfv3.py import-2.6!skip
-plugins/modules/nxos_route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py import-2.6!skip
-plugins/module_utils/network/nxos/config/route_maps/route_maps.py compile-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_address_family/bgp_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_address_family.py import-2.6!skip
-plugins/module_utils/network/nxos/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_bgp_neighbor_address_family.py import-2.6!skip
-plugins/modules/nxos_prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py import-2.6!skip
-plugins/module_utils/network/nxos/config/prefix_lists/prefix_lists.py compile-2.6!skip
-plugins/modules/nxos_logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py import-2.6!skip
-plugins/module_utils/network/nxos/config/logging_global/logging_global.py compile-2.6!skip
-plugins/modules/nxos_snmp_server.py import-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py import-2.6!skip
-plugins/module_utils/network/nxos/config/snmp_server/snmp_server.py compile-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py import-2.6!skip
-plugins/module_utils/network/nxos/utils/utils.py compile-2.6!skip
diff --git a/ansible_collections/cisco/nxos/tests/unit/compat/mock.py b/ansible_collections/cisco/nxos/tests/unit/compat/mock.py
deleted file mode 100644
index 50583cd6f..000000000
--- a/ansible_collections/cisco/nxos/tests/unit/compat/mock.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
-# Make coding more python3-ish
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-"""
-Compat module for Python3.x's unittest.mock module
-"""
-import sys
-
-
-# Python 2.7
-
-# Note: Could use the pypi mock library on python3.x as well as python2.x. It
-# is the same as the python3 stdlib mock library
-
-try:
- # Allow wildcard import because we really do want to import all of mock's
- # symbols into this compat shim
- # pylint: disable=wildcard-import,unused-wildcard-import
- from unittest.mock import *
-except ImportError:
- # Python 2
- # pylint: disable=wildcard-import,unused-wildcard-import
- try:
- from mock import *
- except ImportError:
- print("You need the mock library installed on python2.x to run tests")
-
-
-# Prior to 3.4.4, mock_open cannot handle binary read_data
-if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
- file_spec = None
-
- def _iterate_read_data(read_data):
- # Helper for mock_open:
- # Retrieve lines from read_data via a generator so that separate calls to
- # readline, read, and readlines are properly interleaved
- sep = b"\n" if isinstance(read_data, bytes) else "\n"
- data_as_list = [l + sep for l in read_data.split(sep)]
-
- if data_as_list[-1] == sep:
- # If the last line ended in a newline, the list comprehension will have an
- # extra entry that's just a newline. Remove this.
- data_as_list = data_as_list[:-1]
- else:
- # If there wasn't an extra newline by itself, then the file being
- # emulated doesn't have a newline to end the last line remove the
- # newline that our naive format() added
- data_as_list[-1] = data_as_list[-1][:-1]
-
- for line in data_as_list:
- yield line
-
- def mock_open(mock=None, read_data=""):
- """
- A helper function to create a mock to replace the use of `open`. It works
- for `open` called directly or used as a context manager.
-
- The `mock` argument is the mock object to configure. If `None` (the
- default) then a `MagicMock` will be created for you, with the API limited
- to methods or attributes available on standard file handles.
-
- `read_data` is a string for the `read` methoddline`, and `readlines` of the
- file handle to return. This is an empty string by default.
- """
-
- def _readlines_side_effect(*args, **kwargs):
- if handle.readlines.return_value is not None:
- return handle.readlines.return_value
- return list(_data)
-
- def _read_side_effect(*args, **kwargs):
- if handle.read.return_value is not None:
- return handle.read.return_value
- return type(read_data)().join(_data)
-
- def _readline_side_effect():
- if handle.readline.return_value is not None:
- while True:
- yield handle.readline.return_value
- for line in _data:
- yield line
-
- global file_spec
- if file_spec is None:
- import _io
-
- file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
-
- if mock is None:
- mock = MagicMock(name="open", spec=open)
-
- handle = MagicMock(spec=file_spec)
- handle.__enter__.return_value = handle
-
- _data = _iterate_read_data(read_data)
-
- handle.write.return_value = None
- handle.read.return_value = None
- handle.readline.return_value = None
- handle.readlines.return_value = None
-
- handle.read.side_effect = _read_side_effect
- handle.readline.side_effect = _readline_side_effect()
- handle.readlines.side_effect = _readlines_side_effect
-
- mock.return_value = handle
- return mock
diff --git a/ansible_collections/cisco/nxos/tests/unit/compat/unittest.py b/ansible_collections/cisco/nxos/tests/unit/compat/unittest.py
deleted file mode 100644
index df4266ec9..000000000
--- a/ansible_collections/cisco/nxos/tests/unit/compat/unittest.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
-# Make coding more python3-ish
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-"""
-Compat module for Python2.7's unittest module
-"""
-
-import sys
-
-
-# Allow wildcard import because we really do want to import all of
-# unittests's symbols into this compat shim
-# pylint: disable=wildcard-import,unused-wildcard-import
-if sys.version_info < (2, 7):
- try:
- # Need unittest2 on python2.6
- from unittest2 import *
- except ImportError:
- print("You need unittest2 installed on python2.6.x to run tests")
-else:
- from unittest import *
diff --git a/ansible_collections/cisco/nxos/tests/unit/mock/path.py b/ansible_collections/cisco/nxos/tests/unit/mock/path.py
index d15430fde..6053b30f2 100644
--- a/ansible_collections/cisco/nxos/tests/unit/mock/path.py
+++ b/ansible_collections/cisco/nxos/tests/unit/mock/path.py
@@ -2,9 +2,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
-from ansible.utils.path import unfrackpath
+from unittest.mock import MagicMock
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import MagicMock
+from ansible.utils.path import unfrackpath
mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x)
diff --git a/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py b/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py
index e14ad0ece..e6e09464b 100644
--- a/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py
+++ b/ansible_collections/cisco/nxos/tests/unit/mock/procenv.py
@@ -27,12 +27,11 @@ import sys
from contextlib import contextmanager
from io import BytesIO, StringIO
+from unittest import TestCase
from ansible.module_utils._text import to_bytes
from ansible.module_utils.six import PY3
-from ansible_collections.cisco.nxos.tests.unit.compat import unittest
-
@contextmanager
def swap_stdin_and_argv(stdin_data="", argv_data=tuple()):
@@ -78,7 +77,7 @@ def swap_stdout():
sys.stdout = old_stdout
-class ModuleTestCase(unittest.TestCase):
+class ModuleTestCase(TestCase):
def setUp(self, module_args=None):
if module_args is None:
module_args = {
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py
index fd5cdb36f..25f3dfe62 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos.py
@@ -29,13 +29,14 @@ try:
except ImportError:
from mock import MagicMock
+from unittest import TestCase
+
from ansible.module_utils._text import to_bytes, to_text
from ansible_collections.cisco.nxos.plugins.cliconf import nxos
-from ansible_collections.cisco.nxos.tests.unit.compat import unittest
-class TestPluginCLIConfNXOS(unittest.TestCase):
+class TestPluginCLIConfNXOS(TestCase):
"""Test class for NXOS CLI Conf Methods"""
def setUp(self):
@@ -112,13 +113,19 @@ class TestPluginCLIConfNXOS(unittest.TestCase):
def test_get_command_with_output_nxos(self):
"""Test _get_command_with_output for nxos"""
self._prepare()
- cmd = self._cliconf._get_command_with_output(command="show version", output="json")
+ cmd = self._cliconf._get_command_with_output(
+ command="show version",
+ output="json",
+ )
self.assertEqual(cmd, "show version | json")
def test_get_command_with_output_mds(self):
"""Test _get_command_with_output for mds"""
self._prepare(platform="mds")
- cmd = self._cliconf._get_command_with_output(command="show version", output="json")
+ cmd = self._cliconf._get_command_with_output(
+ command="show version",
+ output="json",
+ )
self.assertEqual(cmd, "show version | json native")
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py
index ae56208fd..0c262d6a3 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acl_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_acl_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import set_module_args
from .nxos_module import TestNxosModule
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py
index b7c0e8663..de3595cef 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_acls.py
@@ -9,9 +9,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_acls
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import set_module_args
from .nxos_module import TestNxosModule
@@ -475,22 +475,33 @@ class TestNxosAclsModule(TestNxosModule):
self.assertEqual(result["parsed"], compare_list, result["parsed"])
def test_nxos_acls_gathered(self):
+ self.execute_show_command.return_value = dedent(
+ """\
+ ip access-list ACL1v4
+ 10 permit ip any any
+ 20 deny udp any any
+ ip access-list ComplicatedAcl
+ 10 permit tcp any range 1024 65500 192.168.0.0 0.0.0.255 eq 1700
+ ipv6 access-list ACL1v6
+ 10 permit sctp any any
+ """,
+ )
set_module_args(dict(config=[], state="gathered"))
result = self.execute_module(changed=False)
compare_list = [
{
"acls": [
{
+ "name": "ACL1v6",
"aces": [
{
- "destination": {"any": True},
"sequence": 10,
+ "grant": "permit",
"protocol": "sctp",
"source": {"any": True},
- "grant": "permit",
+ "destination": {"any": True},
},
],
- "name": "ACL1v6",
},
],
"afi": "ipv6",
@@ -498,23 +509,42 @@ class TestNxosAclsModule(TestNxosModule):
{
"acls": [
{
+ "name": "ACL1v4",
"aces": [
{
- "destination": {"any": True},
"sequence": 10,
+ "grant": "permit",
"protocol": "ip",
"source": {"any": True},
- "grant": "permit",
+ "destination": {"any": True},
},
{
- "destination": {"any": True},
"sequence": 20,
+ "grant": "deny",
"protocol": "udp",
"source": {"any": True},
- "grant": "deny",
+ "destination": {"any": True},
+ },
+ ],
+ },
+ {
+ "name": "ComplicatedAcl",
+ "aces": [
+ {
+ "sequence": 10,
+ "grant": "permit",
+ "protocol": "tcp",
+ "source": {
+ "any": True,
+ "port_protocol": {"range": {"start": "1024", "end": "65500"}},
+ },
+ "destination": {
+ "address": "192.168.0.0",
+ "wildcard_bits": "0.0.0.255",
+ "port_protocol": {"eq": "1700"},
+ },
},
],
- "name": "ACL1v4",
},
],
"afi": "ipv4",
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py
index c9d564ddb..9f5a63a92 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_banner.py
@@ -20,8 +20,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_banner
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py
index e0e48ac7a..1ccc9dacf 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_global.py
@@ -22,6 +22,8 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
# TBD: These imports / import checks are only needed as a workaround for
# shippable, which fails this test due to import yaml & import ordereddict.
import pytest
@@ -30,7 +32,6 @@ from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos impor
nxosCmdRef_import_check,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_bfd_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py
index e40f5fc2e..848788c46 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bfd_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bfd_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py
index d9c6c2357..10140e776 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_address_family.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_address_family
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -2314,7 +2314,7 @@ class TestNxosBGPAddressFamilyModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_bgp_af_delete(self):
+ def test_nxos_bgp_af_delete_1(self):
# test gathered
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py
index 22c9378eb..acf79b77e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_global.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -233,7 +233,7 @@ class TestNxosBgpGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_bgp_global_bfd(self):
+ def test_nxos_bgp_global_bfd_1(self):
run_cfg = dedent(
"""\
router bgp 65536
@@ -1046,7 +1046,7 @@ class TestNxosBgpGlobalModule(TestNxosModule):
result = self.execute_module(changed=False)
self.assertEqual(result["commands"], [])
- def test_nxos_bgp_global_purged(self):
+ def test_nxos_bgp_global_purged_1(self):
run_cfg = dedent(
"""\
router bgp 65001
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py
index b3943f370..0b325d2e8 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_neighbor_address_family.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_neighbor_address_family
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -868,7 +868,7 @@ class TestNxosBGPNeighborAddressFamilyModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_bgp_nbr_af_originate_peer_as_merged(self):
+ def test_nxos_bgp_nbr_af_originate_peer_as_merged_1(self):
# test merged for default_originate, disable_peer_as_check
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py
index 8d2fd74b5..2eedccaf8 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_bgp_templates.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_bgp_templates
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py
index cb7c40ba9..9a0714e9c 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_command.py
@@ -24,8 +24,9 @@ __metaclass__ = type
import json
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_command
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py
index ce5c987c7..be762de23 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_config.py
@@ -22,9 +22,10 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import MagicMock, patch
+
from ansible_collections.cisco.nxos.plugins.cliconf.nxos import Cliconf
from ansible_collections.cisco.nxos.plugins.modules import nxos_config
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import MagicMock, patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py
index 640bcd150..d034a3aaa 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_devicealias.py
@@ -7,10 +7,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
import pytest
from ansible_collections.cisco.nxos.plugins.modules import nxos_devicealias
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import AnsibleFailJson
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py
index c9fa7911e..55e2a4151 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_global.py
@@ -23,8 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_evpn_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py
index 0211a5a31..9b08b6164 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_evpn_vni.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_evpn_vni
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py
index 098a5b7ff..18cef069a 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_fc_interfaces.py
@@ -29,13 +29,13 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.rm_templates.fc_interfaces import (
allowed_port_modes,
allowed_speed_values,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_fc_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py
index 1c79537f1..e98fbce1e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_feature.py
@@ -24,8 +24,9 @@ __metaclass__ = type
import json
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_feature
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py
index 732f59e7a..9ddb9e306 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hostname.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_hostname
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py
index 4ffcc43f3..794ecd896 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_hsrp
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py
index e4f21a825..8bbe79ae4 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_hsrp_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_hsrp_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py
index fb8dae234..e0b0b55ce 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -84,7 +84,7 @@ class TestNxosInterfacesModule(TestNxosModule):
self.edit_config.return_value = None
if device == "legacy":
# call execute_module() with device='legacy' to use this codepath
- self.get_platform.return_value = "N3K-Cxxx"
+ self.get_platform.return_value = "N5K-Cxxx"
else:
self.get_platform.return_value = "N9K-Cxxx"
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
index 289c36ffd..7bb5da30e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_l3_interfaces.py
@@ -23,12 +23,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import PropertyMock, patch
from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.config.l3_interfaces.l3_interfaces import (
L3_interfaces,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_l3_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import PropertyMock, patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py
index e6850278a..3e9c0c64d 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lacp_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_lacp_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py
index c2acfcc49..c2292a3cb 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_lldp_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_lldp_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import set_module_args
from .nxos_module import TestNxosModule
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py
index aea13fc94..465ea0116 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_logging_global.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_logging_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -190,7 +190,7 @@ class TestNxosLoggingGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_logging_global_linear_replaced(self):
+ def test_nxos_logging_global_linear_replaced_1(self):
# test replaced for linear attributes
self.get_config.return_value = dedent(
"""\
@@ -464,7 +464,7 @@ class TestNxosLoggingGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_logging_global_event_merged(self):
+ def test_nxos_logging_global_event_merged_1(self):
# test merged for `event`
self.get_config.return_value = dedent(
"""\
@@ -731,7 +731,7 @@ class TestNxosLoggingGlobalModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_logging_global_event_replaced_2(self):
+ def test_nxos_logging_global_event_replaced_3(self):
# test replaced for `event` - 2
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py
index 7c49d8668..d931a357b 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ntp_global.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ntp_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -268,7 +268,7 @@ class TestNxosNtpGlobalModule(TestNxosModule):
result = self.execute_module(changed=False)
self.assertEqual(result["commands"], [])
- def test_nxos_ntp_global_complex_merged_idempotent(self):
+ def test_nxos_ntp_global_complex_merged_idempotent_1(self):
# test merged for complex attributes
self.get_config.return_value = dedent(
"""\
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py
index 7eb12a21c..12ceeac82 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_nxapi.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_nxapi
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py
index f22889574..159086004 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospf_interfaces.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ospf_interfaces
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py
index 175570499..80234c11a 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv2.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ospfv2
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py
index 70a2ae47e..ea8759c20 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ospfv3.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_ospfv3
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py
index 976aa0964..1368ab240 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_overlay_global.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_overlay_global
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py
index eea384836..cb427c967 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_pim
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py
index b746b8b46..9cc7b48ed 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_interface.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_pim_interface
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py
index f4dbd13ac..a03b78026 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_pim_rp_address.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_pim_rp_address
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py
index bdaabe881..e92649b74 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_ping.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_ping
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py
index d94f0b3e0..f93f9b8f4 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_prefix_lists.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_prefix_lists
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py
index 06d76fe38..d247c02b4 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_route_maps.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_route_maps
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py
index 1b7672775..a15562b10 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_snmp_server.py
@@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_snmp_server
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
@@ -391,7 +391,7 @@ class TestNxosSnmpServerModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_traps_replaced(self):
+ def test_nxos_snmp_server_traps_replaced_1(self):
# test replaced for traps
self.get_config.return_value = dedent(
"""\
@@ -482,7 +482,7 @@ class TestNxosSnmpServerModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_hosts_merged(self):
+ def test_nxos_snmp_server_hosts_merged_1(self):
# test merged for hosts
self.get_config.return_value = dedent(
"""\
@@ -591,7 +591,7 @@ class TestNxosSnmpServerModule(TestNxosModule):
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_users_merged(self):
+ def test_nxos_snmp_server_users_merged_1(self):
# test merged for users
self.get_config.return_value = dedent(
"""\
@@ -662,18 +662,19 @@ class TestNxosSnmpServerModule(TestNxosModule):
)
commands = [
"snmp-server user snmp_user_2 network-admin auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv 0x5632724fb8ac3699296af26281e1d0f1"
- " localizedkey engineID 2:2:2:2:2",
+ " localizedV2key engineID 2:2:2:2:2",
"snmp-server user snmp_user_3 network-admin auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128"
- " 0x5632724fb8ac3699296af26281e1d0f1 localizedV2key engineID 3:3:3:3:3",
+ " 0x5632724fb8ac3699296af26281e1d0f1 localizedkey engineID 3:3:3:3:3",
"snmp-server user snmp_user_1 network-admin auth md5 0x5632724fb8ac3699296af26281e1d0f1"
" localizedkey engineID 1:1:1:1:1",
"snmp-server user snmp_user_4 network-admin auth sha-256 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128"
" 0x5632724fb8ac3699296af26281e1d0f1 localizedkey engineID 4:4:4:4:4",
]
result = self.execute_module(changed=True)
+ print(result["commands"])
self.assertEqual(set(result["commands"]), set(commands))
- def test_nxos_snmp_server_users_merged(self):
+ def test_nxos_snmp_server_users_merged_2(self):
# test merged for users
self.get_config.return_value = dedent(
"""\
@@ -705,7 +706,9 @@ class TestNxosSnmpServerModule(TestNxosModule):
algorithm="md5",
password="0x5632724fb8ac3699296af262",
engine_id="2:2:2:2:2",
- priv=dict(privacy_password="0x5632724fb8ac3699296af262"),
+ priv=dict(
+ privacy_password="0x5632724fb8ac3699296af262",
+ ),
localizedv2_key=True,
),
),
@@ -906,7 +909,9 @@ class TestNxosSnmpServerModule(TestNxosModule):
algorithm="md5",
password="0x7d425fbf09417c44bca69e1d9e9ce889",
localized_key=True,
- priv=dict(privacy_password="0x7d425fbf09417c44bca69e1d9e9ce889"),
+ priv=dict(
+ privacy_password="0x7d425fbf09417c44bca69e1d9e9ce889",
+ ),
),
),
dict(
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py
index 76ed4a3a9..7cd021314 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_static_routes.py
@@ -9,9 +9,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
from ansible_collections.cisco.nxos.plugins.modules import nxos_static_routes
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py
index ea7eec95c..634f69758 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_system.py
@@ -23,8 +23,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_system
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py
index 160804c11..2c8027443 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_telemetry.py
@@ -23,6 +23,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from textwrap import dedent
+from unittest.mock import patch
# TBD: These imports / import checks are only needed as a workaround for
# shippable, which fails this test due to import yaml & import ordereddict.
@@ -32,7 +33,6 @@ from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxos impor
nxosCmdRef_import_check,
)
from ansible_collections.cisco.nxos.plugins.modules import nxos_telemetry
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import AnsibleFailJson
from .nxos_module import TestNxosModule, load_fixture, set_module_args
@@ -183,7 +183,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_global_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS global config is present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -205,7 +208,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS global config is present
# Change certificate
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -233,7 +239,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS global config is present
# Change interface
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -262,7 +271,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS global config is present
# Change source_interface, vrf and cert
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -314,14 +326,19 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Parameter <id> under <destination_groups> is required" in str(testdata["msg"])
+ assert "Parameter <id> under <destination_groups> is required" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_destgroup_input_validation_2(self):
# Parameter 'destination' is not a dict.
self.execute_show_command.return_value = None
self.get_platform_shortname.return_value = "N9K"
- args = build_args([{"id": "88", "destination": "192.168.1.1"}], "destination_groups")
+ args = build_args(
+ [{"id": "88", "destination": "192.168.1.1"}],
+ "destination_groups",
+ )
set_module_args(args, ignore_provider_arg)
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
@@ -343,7 +360,9 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Playbook entry contains unrecongnized parameters" in str(testdata["msg"])
+ assert "Playbook entry contains unrecongnized parameters" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_destgroup_merged_n9k(self):
@@ -460,7 +479,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS destgroup config is not present.
# Configure only identifier
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -483,7 +505,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Assumes feature telemetry is enabled
# TMS destgroup config is not present.
# Configure only identifier
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args([{"id": "2"}], "destination_groups")
set_module_args(args, ignore_provider_arg)
@@ -492,7 +517,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_destgroup_merged_aggregate_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS destgroup config is present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -523,7 +551,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_destgroup_change_n9k(self):
# TMS destgroup config is not present.
# Change protocol and encoding for dest group 2
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -562,7 +593,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# TMS destgroup config is not present.
# Add destinations to destgroup 10
# Add new destgroup 55 and 56
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -705,7 +739,9 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Parameter <id> under <sensor_groups> is required" in str(testdata["msg"])
+ assert "Parameter <id> under <sensor_groups> is required" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_sensorgroup_input_validation_2(self):
@@ -730,7 +766,9 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Parameter <path> under <sensor_groups> requires <name> key" in str(testdata["msg"])
+ assert "Parameter <path> under <sensor_groups> requires <name> key" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_tms_sensorgroup_resource_key_n9k(self):
@@ -857,7 +895,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_merged_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS sensorgroup config is not present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -880,7 +921,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_quotes_merged_idempotent_n9k(self):
# Assumes feature telemetry is enabled
# TMS sensorgroup config is present with quotes in NX-API path.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K_SGs.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K_SGs.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -906,7 +950,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_vxlan_idempotent_n9k(self):
# TMS sensorgroup config present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[{"id": "56", "data_source": "DME", "path": {"name": "vxlan"}}],
@@ -917,7 +964,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_idempotent_variable1_n9k(self):
# TMS sensorgroup config is present with path key name.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -936,7 +986,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_idempotent_variable2_n9k(self):
# TMS sensorgroup config is present with path key name and depth.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -953,7 +1006,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_sensorgroup_idempotent_resource_key_n9k(self):
# TMS sensorgroup config is present resource key only.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args([{"id": "55"}], "sensor_groups")
set_module_args(args, ignore_provider_arg)
@@ -1013,7 +1069,7 @@ class TestNxosTelemetryModule(TestNxosModule):
],
)
- def test_tms_sensorgroup_present_path_interface_n9k(self):
+ def test_tms_sensorgroup_present_path_interface_n9k_1(self):
# TMS sensorgroup config is not present.
# Path name 'resources' test
self.execute_show_command.return_value = None
@@ -1080,7 +1136,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_subscription_merged_idempotent_n9k(self):
# TMS subscription config is not present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -1104,7 +1163,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_subscription_merged_change1_n9k(self):
# TMS subscription config present.
# Change sample interval for sensor group 2
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -1135,7 +1197,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_subscription_add_n9k(self):
# TMS subscription config present.
# Add new destination_group and sensor_group to subscription 5
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
args = build_args(
[
@@ -1322,7 +1387,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_telemetry_deleted_input_validation_n9k(self):
# State is 'deleted' and 'config' key present.
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -1342,14 +1410,19 @@ class TestNxosTelemetryModule(TestNxosModule):
with pytest.raises(AnsibleFailJson) as errinfo:
self.execute_module()
testdata = errinfo.value.args[0]
- assert "Remove config key from playbook when state is <deleted>" in str(testdata["msg"])
+ assert "Remove config key from playbook when state is <deleted>" in str(
+ testdata["msg"],
+ )
assert testdata["failed"]
def test_telemetry_deleted_n9k(self):
# Assumes feature telemetry is enabled
# TMS global config is present.
# Make absent with all playbook keys provided
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(dict(state="deleted"), ignore_provider_arg)
self.execute_module(changed=True, commands=["no telemetry"])
@@ -1366,7 +1439,10 @@ class TestNxosTelemetryModule(TestNxosModule):
def test_tms_replaced1_n9k(self):
# Assumes feature telemetry is enabled
# Modify global config and remove everything else
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
dict(
@@ -1409,7 +1485,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# Modify destination-group 10, add 11 and 99, remove 2
# Modify sensor-group 55, 56
# remove all subscriptions
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
{
@@ -1525,7 +1604,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# remove all other destination-groups
# Modify sensor-group 55 and delete all others
# Modify subscription 7, add 10 and delete all others
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
{
@@ -1616,7 +1698,10 @@ class TestNxosTelemetryModule(TestNxosModule):
# remove all other destination-groups
# Modify sensor-group 55 and delete all others
# Modify subscription 7, add 10 and delete all others
- self.execute_show_command.return_value = load_fixture("nxos_telemetry", "N9K.cfg")
+ self.execute_show_command.return_value = load_fixture(
+ "nxos_telemetry",
+ "N9K.cfg",
+ )
self.get_platform_shortname.return_value = "N9K"
set_module_args(
{
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py
index c397c82cb..ba0d43756 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_user.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_user
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py
index 97870e76d..d686e74fb 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vlans.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vlans
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py
index a74525e86..5475b52e7 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vpc
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py
index de7ad79bd..4ccb31994 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vpc_interface.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vpc_interface
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py
index 8f2a2ae1d..e69cdc2aa 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vrf
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py
index bfc2adef8..f104fc295 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vrf_af.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vrf_af
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py
index af9ee7ad3..66e04ba79 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vsan.py
@@ -7,10 +7,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
import pytest
from ansible_collections.cisco.nxos.plugins.modules import nxos_vsan
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from ansible_collections.cisco.nxos.tests.unit.modules.utils import AnsibleFailJson
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py
index f6862a77e..e30c5c01f 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vxlan_vtep
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
index c6dc6e8d8..2592b1a6a 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
@@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_vxlan_vtep_vni
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py
index 6afe78a5b..381eef8a6 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/network/nxos/test_nxos_zone_zoneset.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.cisco.nxos.plugins.modules import nxos_zone_zoneset
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
from .nxos_module import TestNxosModule, load_fixture, set_module_args
diff --git a/ansible_collections/cisco/nxos/tests/unit/modules/utils.py b/ansible_collections/cisco/nxos/tests/unit/modules/utils.py
index cd3b7b05f..87be9cf8e 100644
--- a/ansible_collections/cisco/nxos/tests/unit/modules/utils.py
+++ b/ansible_collections/cisco/nxos/tests/unit/modules/utils.py
@@ -4,12 +4,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
import json
+from unittest import TestCase
+from unittest.mock import patch
+
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
-from ansible_collections.cisco.nxos.tests.unit.compat import unittest
-from ansible_collections.cisco.nxos.tests.unit.compat.mock import patch
-
def set_module_args(args):
if "_ansible_remote_tmp" not in args:
@@ -40,7 +40,7 @@ def fail_json(*args, **kwargs):
raise AnsibleFailJson(kwargs)
-class ModuleTestCase(unittest.TestCase):
+class ModuleTestCase(TestCase):
def setUp(self):
self.mock_module = patch.multiple(
basic.AnsibleModule,