mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
nxos_banner: test file cleanup (#55992)
- Created `sanity.yaml` to contain all of the tests previously kept in separate files - Removed `cli` and `nxapi` test directories - Tested on current supported platforms and versions: `N3K,N6K,N7K,N9K,N3K-F,N9K-F`
This commit is contained in:
parent
2e8a3efccb
commit
cf585831b4
7 changed files with 86 additions and 192 deletions
|
@ -1,39 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START cli/nxos_banner exec test"
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: setup - remove exec
|
|
||||||
nxos_banner: &remove
|
|
||||||
banner: exec
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Set exec
|
|
||||||
nxos_banner: &exec
|
|
||||||
banner: exec
|
|
||||||
text: |
|
|
||||||
this is my exec banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'banner exec @\nthis is my exec banner\nthat has a multiline\nstring\n@' in result.commands"
|
|
||||||
|
|
||||||
- name: Set exec again (idempotent)
|
|
||||||
nxos_banner: *exec
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
- "result.commands | length == 0"
|
|
||||||
|
|
||||||
- name: teardown - remove exec
|
|
||||||
nxos_banner: *remove
|
|
||||||
|
|
||||||
when: platform is match("N7K")
|
|
||||||
|
|
||||||
- debug: msg="END cli/nxos_banner exec test"
|
|
|
@ -1,35 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START cli/nxos_banner motd test"
|
|
||||||
|
|
||||||
- name: setup - remove motd
|
|
||||||
nxos_banner: &remove
|
|
||||||
banner: motd
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Set motd
|
|
||||||
nxos_banner: &motd
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
this is my motd banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'banner motd @\nthis is my motd banner\nthat has a multiline\nstring\n@' in result.commands"
|
|
||||||
|
|
||||||
- name: Set motd again (idempotent)
|
|
||||||
nxos_banner: *motd
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
|
|
||||||
- name: teardown - remove motd
|
|
||||||
nxos_banner: *remove
|
|
||||||
|
|
||||||
- debug: msg="END cli/nxos_banner motd test"
|
|
|
@ -1,32 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START cli/nxos_banner no-motd test"
|
|
||||||
|
|
||||||
- name: Setup
|
|
||||||
nxos_banner:
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
Junk motd banner
|
|
||||||
over multiple lines
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: remove motd
|
|
||||||
nxos_banner: &rm-motd
|
|
||||||
banner: motd
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'no banner motd' in result.commands"
|
|
||||||
|
|
||||||
- name: remove motd (idempotent)
|
|
||||||
nxos_banner: *rm-motd
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == false"
|
|
||||||
- "result.commands | length == 0"
|
|
||||||
|
|
||||||
- debug: msg="END cli/nxos_banner no-motd test"
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
---
|
||||||
|
- debug: msg="START connection={{ ansible_connection }} nxos_banner sanity test"
|
||||||
|
- debug: msg="Using provider={{ connection.transport }}"
|
||||||
|
when: ansible_connection == "local"
|
||||||
|
|
||||||
|
- set_fact: banner_exec_image_ok
|
||||||
|
# N5K/N6K/N9K-F support banner exec but have image defects
|
||||||
|
when: platform is search("N7K|N3K-F")
|
||||||
|
|
||||||
|
- set_fact: banner_motd_image_ok
|
||||||
|
# multiline banner issues
|
||||||
|
when: imagetag is not search("I7") and ansible_connection != "httpapi"
|
||||||
|
|
||||||
|
|
||||||
|
# banner exec tests
|
||||||
|
- block:
|
||||||
|
- debug: msg="START nxos_banner exec tests"
|
||||||
|
- name: setup exec
|
||||||
|
nxos_banner: &remove_exec
|
||||||
|
banner: exec
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Set exec
|
||||||
|
nxos_banner: &exec
|
||||||
|
banner: exec
|
||||||
|
text: |
|
||||||
|
this is my exec banner
|
||||||
|
that has a multiline
|
||||||
|
string
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'banner exec @\nthis is my exec banner\nthat has a multiline\nstring\n@' in result.commands"
|
||||||
|
|
||||||
|
- name: Set exec again (idempotent)
|
||||||
|
nxos_banner: *exec
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == false"
|
||||||
|
- "result.commands | length == 0"
|
||||||
|
|
||||||
|
- name: teardown exec
|
||||||
|
nxos_banner: *remove_exec
|
||||||
|
|
||||||
|
when: banner_exec_image_ok is defined
|
||||||
|
|
||||||
|
# banner motd tests
|
||||||
|
- block:
|
||||||
|
- name: setup motd
|
||||||
|
nxos_banner: &remove_motd
|
||||||
|
banner: motd
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Set motd
|
||||||
|
nxos_banner: &motd
|
||||||
|
banner: motd
|
||||||
|
text: |
|
||||||
|
Junk motd banner
|
||||||
|
over multiple lines
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'banner motd @\nJunk motd banner\nover multiple lines\n@' in result.commands"
|
||||||
|
|
||||||
|
- name: Set motd again (idempotent)
|
||||||
|
nxos_banner: *motd
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == false"
|
||||||
|
|
||||||
|
- name: teardown motd
|
||||||
|
nxos_banner: *remove_motd
|
||||||
|
|
||||||
|
when: banner_motd_image_ok is defined
|
||||||
|
|
||||||
|
- debug: msg="END connection={{ ansible_connection }} nxos_banner sanity test"
|
|
@ -1,32 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START nxapi/nxos_banner exec test"
|
|
||||||
|
|
||||||
- block:
|
|
||||||
- name: setup - remove exec
|
|
||||||
nxos_banner: &remove
|
|
||||||
banner: exec
|
|
||||||
provider: "{{ connection }}"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Set exec
|
|
||||||
nxos_banner: &exec
|
|
||||||
banner: exec
|
|
||||||
text: |
|
|
||||||
this is my exec banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
provider: "{{ connection }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'banner exec @\nthis is my exec banner\nthat has a multiline\nstring\n@' in result.commands"
|
|
||||||
|
|
||||||
- name: teardown - remove exec
|
|
||||||
nxos_banner: *remove
|
|
||||||
|
|
||||||
when: platform is match("N7K")
|
|
||||||
|
|
||||||
- debug: msg="END nxapi/nxos_banner exec test"
|
|
|
@ -1,29 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START nxapi/nxos_banner motd test"
|
|
||||||
|
|
||||||
- name: setup - remove motd
|
|
||||||
nxos_banner: &remove
|
|
||||||
banner: motd
|
|
||||||
provider: "{{ connection }}"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Set motd
|
|
||||||
nxos_banner: &motd
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
this is my motd banner
|
|
||||||
that has a multiline
|
|
||||||
string
|
|
||||||
provider: "{{ connection }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'banner motd @\nthis is my motd banner\nthat has a multiline\nstring\n@' in result.commands"
|
|
||||||
|
|
||||||
- name: teardown - remove motd
|
|
||||||
nxos_banner: *remove
|
|
||||||
|
|
||||||
- debug: msg="END nxapi/nxos_banner motd test"
|
|
|
@ -1,25 +0,0 @@
|
||||||
---
|
|
||||||
- debug: msg="START nxapi/nxos_banner no-motd test"
|
|
||||||
|
|
||||||
- name: Setup
|
|
||||||
nxos_banner:
|
|
||||||
banner: motd
|
|
||||||
text: |
|
|
||||||
Junk motd banner
|
|
||||||
over multiple lines
|
|
||||||
provider: "{{ connection }}"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: remove motd
|
|
||||||
nxos_banner: &rm-motd
|
|
||||||
banner: motd
|
|
||||||
provider: "{{ connection }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
|
||||||
that:
|
|
||||||
- "result.changed == true"
|
|
||||||
- "'no banner motd' in result.commands"
|
|
||||||
|
|
||||||
- debug: msg="END nxapi/nxos_banner no-motd test"
|
|
Loading…
Reference in a new issue