summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/incidental_ios_file/tests/cli/net_put.yaml
blob: 215b524db5e42845b6b91b6ed47e6417e967a0fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
- debug:
    msg: "START ios cli/net_put.yaml on connection={{ ansible_connection }}"

# Add minimal testcase to check args are passed correctly to
# implementation module and module run is successful.

- name: setup
  cisco.ios.ios_config:
    lines:
      - ip ssh version 2
      - ip scp server enable
      - username {{ ansible_ssh_user }} privilege 15
    match: none

- name: Delete existing files if present on remote host
  cisco.ios.ios_command:
     commands: "{{ item }}"
  loop:
     - delete /force ios1.cfg
     - delete /force ios.cfg
     - delete /force nonascii.bin
  ignore_errors: true

- name: copy file from controller to ios + scp (Default)
  ansible.netcommon.net_put:
    src: ios1.cfg
  register: result

- assert:
    that:
      - result.changed == true

- name: Idempotency Check
  ansible.netcommon.net_put:
    src: ios1.cfg
  register: result

- assert:
    that:
      - result.changed == false

- name: copy file from controller to ios + dest specified
  ansible.netcommon.net_put:
    src: ios1.cfg
    dest: ios.cfg
  register: result

- assert:
    that:
      - result.changed == true

- name: copy file with non-ascii characters to ios in template mode(Fail case)
  ansible.netcommon.net_put:
    src: nonascii.bin
    mode: 'text'
  register: result
  ignore_errors: true

- assert:
    that:
      - result.failed == true

- name: copy file with non-ascii characters to ios in default mode(binary)
  ansible.netcommon.net_put:
    src: nonascii.bin
  register: result

- assert:
    that:
      - result.changed == true

- debug: msg="END ios cli/net_put.yaml on connection={{ ansible_connection }}"