ansible/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml
Nathaniel Case e9d7fa0418
HTTP(S) API connection plugin (#39224)
* HTTPAPI connection

* Punt run_commands to cliconf or httpapi

* Fake enable_mode on eapi

* Pull changes to nxos

* Move load_config to edit_config for future-preparedness

* Don't fail on lldp disabled

* Re-enable check_rc on nxos' run_commands

* Reorganize nxos httpapi plugin for compatibility

* draft docs for connection: httpapi

* restores docs for connection:local for eapi

* Add _remote_is_local to httpapi
2018-05-17 18:47:15 -04:00

83 lines
2.2 KiB
YAML

---
- debug: msg="START TRANSPORT:CLI nxos_file_copy sanity test"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: "Setup - Remove existing file"
nxos_command: &remove_file
commands:
- terminal dont-ask
- delete network-integration.cfg
ignore_errors: yes
- name: "Setup - Turn on feature scp-server"
nxos_feature:
feature: scp-server
state: enabled
- block:
- name: "Copy network-integration.cfg to bootflash"
nxos_file_copy: &copy_file_same_name
local_file: "./network-integration.cfg"
file_system: "bootflash:"
username: "{{ ansible_ssh_user }}"
password: "{{ ansible_ssh_pass }}"
host: "{{ ansible_host }}"
connect_ssh_port: "{{ ansible_ssh_port }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence - Copy network-integration.cfg 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 inventory.networking.template to bootflash as another name"
nxos_file_copy: &copy_file_different_name
local_file: "./inventory.networking.template"
remote_file: "network-integration.cfg"
file_system: "bootflash:"
username: "{{ ansible_ssh_user }}"
password: "{{ ansible_ssh_pass }}"
host: "{{ ansible_host }}"
connect_ssh_port: "{{ ansible_ssh_port }}"
register: result
- assert: *true
- name: "Check Idempotence - Copy inventory.networking.template 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
- debug: msg="END TRANSPORT:CLI nxos_file_copy sanity test"