You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/nxos_gir/tests/common/sanity.yaml

113 lines
2.5 KiB
YAML

---
- debug: msg="START connection={{ ansible_connection }} nxos_gir sanity test"
- set_fact: gir_run='{{ true if (platform is not search("N35")) else false }}'
- name: Setup0
nxos_config: &cleanup0
lines:
- no system mode maintenance timeout 30
- no configure maintenance profile normal-mode
- no configure maintenance profile maintenance-mode
match: none
ignore_errors: yes
- name: Setup1
nxos_gir:
system_mode_maintenance: false
ignore_errors: yes
- block:
- name: "Put system in maintenance mode with reload reset reason"
nxos_gir: &reset_reason
system_mode_maintenance_on_reload_reset_reason: manual_reload
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_gir: *reset_reason
register: result
- assert: &false
that:
- "result.changed == false"
- name: "Remove reload reason"
nxos_gir: &remove_reason
system_mode_maintenance_on_reload_reset_reason: manual_reload
state: absent
register: result
- assert: *true
- name: "Check Idempotence"
nxos_gir: *remove_reason
register: result
- assert: *false
- name: "Put system in maintenance mode with timeout"
nxos_gir: &mtime
system_mode_maintenance_timeout: 30
register: result
- assert: *true
- name: "Check Idempotence"
nxos_gir: *mtime
register: result
- assert: *false
- name: "Remove maintenance mode timeout"
nxos_gir: &remove_timeout
system_mode_maintenance_timeout: 30
state: absent
register: result
- assert: *true
- name: "Check Idempotence"
nxos_gir: *remove_timeout
register: result
- assert: *false
- name: "Put system in maintenance mode"
nxos_gir: &configure_system_mode_maintenance
system_mode_maintenance: true
register: result
- assert: *true
when: gir_run
rescue:
- debug: msg="connection={{ ansible_connection }} nxos_gir failure detected"
always:
- name: "Remove snapshots"
nxos_snapshot:
action: delete_all
ignore_errors: yes
- name: Teardown0
nxos_config: *cleanup0
ignore_errors: yes
- name: "Put system back in normal mode"
nxos_gir:
system_mode_maintenance: false
# Try again if cli is blocking while changing modes
retries: 3
delay: 30
register: result
until: result is not failed
ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_gir sanity test"