1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml
rahushen ab84718a01 NXOS: Integration tests to Ansible (part 3) (#29030)
* Add nxos_file_copy IT

* Restructure nxos_igmp tests

* add nxos_igmp_interface IT

* add nxos_igmp_snooping IT

* add nxos_ntp_auth IT

* Add nxos_ntp_options IT

* update nxos.yaml with new tests

* update nxos_ntp_options test

* update nxos_ntp_auth IT
2017-10-25 11:41:23 -04:00

84 lines
2.1 KiB
YAML

---
- debug: msg="START TRANSPORT:CLI nxos_file_copy sanity test"
- name: "Setup - Remove existing file"
nxos_command: &remove_file
commands:
- terminal dont-ask
- delete nxos.yaml
provider: "{{ cli }}"
ignore_errors: yes
- name: "Setup - Turn on feature scp-server"
nxos_feature:
feature: scp-server
state: enabled
provider: "{{ cli }}"
- block:
- name: "Copy nxos.yaml to bootflash"
nxos_file_copy: &copy_file_same_name
local_file: "./nxos.yaml"
file_system: "bootflash:"
provider: "{{ cli }}"
username: "{{ nxos_cli_user | default('admin') }}"
password: "{{ nxos_cli_pass | default('admin') }}"
host: "{{ inventory_hostname }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence - Copy nxos.yaml to bootflash"
nxos_file_copy: *copy_file_same_name
register: result
- assert: &false
that:
- "result.changed == false"
- name: "Setup - Remove existing file"
nxos_command: *remove_file
register: result
- name: "Copy ios.yaml to bootflash as another name"
nxos_file_copy: &copy_file_different_name
local_file: "./ios.yaml"
remote_file: "nxos.yaml"
file_system: "bootflash:"
provider: "{{ cli }}"
username: "{{ nxos_cli_user | default('admin') }}"
password: "{{ nxos_cli_pass | default('admin') }}"
host: "{{ inventory_hostname }}"
register: result
- assert: *true
- name: "Check Idempotence - Copy ios.yaml to bootflash as another name"
nxos_file_copy: *copy_file_different_name
register: result
- assert: *false
- name: "Setup - Remove existing file"
nxos_command: *remove_file
register: result
rescue:
- debug: msg="TRANSPORT:CLI nxos_file_copy failure detected"
always:
- name: "Remove file"
nxos_command: *remove_file
ignore_errors: yes
- name: "Turn off feature scp-server"
nxos_feature:
feature: scp-server
state: disabled
provider: "{{ cli }}"
- debug: msg="END TRANSPORT:CLI nxos_file_copy sanity test"