summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/nxos/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/nxos/tests/integration')
-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
32 files changed, 361 insertions, 1267 deletions
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)