Migrate Network Tests into ansible/ansible (#18233)
* Docs Networking tests * Copy networking tests from test-network-modules * Networking transport settings - group_vars * Network playbooks * Debug should be off by default * Update nxos.yaml * Remove items from top level * Use dependencies, not pre-tasks * Remove trailing blank lines * Remove backup files * newlines
This commit is contained in:
parent
4a067c3f50
commit
e0cc7b3415
489 changed files with 13144 additions and 2 deletions
|
@ -22,8 +22,6 @@ Integration test layer, constructed using playbooks.
|
|||
Some tests may require cloud credentials, others will not, and destructive tests are separated from non-destructive so a subset
|
||||
can be run on development machines.
|
||||
|
||||
Tests for network modules can be found in https://github.com/ansible/test-network-modules/
|
||||
|
||||
learn more
|
||||
----------
|
||||
|
||||
|
|
13
test/integration/asa.yaml
Normal file
13
test/integration/asa.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: asa
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: asa_command, when: "limit_to in ['*', 'asa_command']" }
|
||||
- { role: asa_config, when: "limit_to in ['*', 'asa_config']" }
|
||||
- { role: asa_acl, when: "limit_to in ['*', 'asa_acl']" }
|
13
test/integration/dellos10.yaml
Normal file
13
test/integration/dellos10.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: dellos10
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: dellos10_command, when: "limit_to in ['*', 'dellos10_command']" }
|
||||
- { role: dellos10_config, when: "limit_to in ['*', 'dellos10_config']" }
|
||||
- { role: dellos10_facts, when: "limit_to in ['*', 'dellos10_facts']" }
|
13
test/integration/dellos6.yaml
Normal file
13
test/integration/dellos6.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: dellos6
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: dellos6_command, when: "limit_to in ['*', 'dellos6_command']" }
|
||||
- { role: dellos6_config, when: "limit_to in ['*', 'dellos6_config']" }
|
||||
- { role: dellos6_facts, when: "limit_to in ['*', 'dellos6_facts']" }
|
13
test/integration/dellos9.yaml
Normal file
13
test/integration/dellos9.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- hosts: dellos9
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: dellos9_command, when: "limit_to in ['*', 'dellos9_command']" }
|
||||
- { role: dellos9_config, when: "limit_to in ['*', 'dellos9_config']" }
|
||||
- { role: dellos9_facts, when: "limit_to in ['*', 'dellos9_facts']" }
|
15
test/integration/eos.yaml
Normal file
15
test/integration/eos.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- hosts: eos
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: eos_command, when: "limit_to in ['*', 'eos_command']" }
|
||||
- { role: eos_config, when: "limit_to in ['*', 'eos_config']" }
|
||||
- { role: eos_template, when: "limit_to in ['*', 'eos_template']" }
|
||||
- { role: eos_facts, when: "limit_to in ['*', 'eos_facts']" }
|
||||
- { role: eos_eapi, debug: yes, when: "limit_to in ['*', 'eos_eapi']" }
|
8
test/integration/group_vars/asa.yaml
Normal file
8
test/integration/group_vars/asa.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ inventory_hostname }}"
|
||||
username: "{{ asa_cli_user | default('cisco') }}"
|
||||
password: "{{ asa_cli_pass | default('cisco') }}"
|
||||
transport: cli
|
||||
authorize: yes
|
||||
auth_pass: "{{ asa_auth_pass | default('cisco') }}"
|
6
test/integration/group_vars/dellos10.yaml
Normal file
6
test/integration/group_vars/dellos10.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ ansible_host }}"
|
||||
username: "{{ dellos10_cli_user | default('admin') }}"
|
||||
password: "{{ dellos10_cli_pass | default('admin') }}"
|
||||
transport: cli
|
8
test/integration/group_vars/dellos6.yaml
Normal file
8
test/integration/group_vars/dellos6.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ ansible_host }}"
|
||||
username: "{{ dellos_cli_user | default('admin') }}"
|
||||
password: "{{ dellos_cli_pass | default('admin') }}"
|
||||
authorize: true
|
||||
auth_pass: "{{ dellos_cli_auth_pass | default('calvin') }}"
|
||||
transport: cli
|
8
test/integration/group_vars/dellos9.yaml
Normal file
8
test/integration/group_vars/dellos9.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ ansible_host }}"
|
||||
username: "{{ dellos9_cli_user | default('admin') }}"
|
||||
password: "{{ dellos9_cli_pass | default('admin') }}"
|
||||
authorize: true
|
||||
auth_pass: "{{ dellos9_cli_en_pass | default('calvin') }}"
|
||||
transport: cli
|
15
test/integration/group_vars/eos.yaml
Normal file
15
test/integration/group_vars/eos.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ ansible_host }}"
|
||||
username: "{{ eos_cli_user | default('admin') }}"
|
||||
password: "{{ eos_cli_pass | default('admin') }}"
|
||||
transport: cli
|
||||
authorize: yes
|
||||
|
||||
eapi:
|
||||
host: "{{ ansible_host }}"
|
||||
username: "{{ eos_eapi_user | default('admin') }}"
|
||||
password: "{{ eos_eapi_pass | default('admin') }}"
|
||||
transport: eapi
|
||||
use_ssl: no
|
||||
authorize: yes
|
6
test/integration/group_vars/ios.yaml
Normal file
6
test/integration/group_vars/ios.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ inventory_hostname }}"
|
||||
username: "{{ ios_cli_user | default('cisco') }}"
|
||||
password: "{{ ios_cli_pass | default('cisco') }}"
|
||||
transport: cli
|
6
test/integration/group_vars/iosxr.yaml
Normal file
6
test/integration/group_vars/iosxr.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ inventory_hostname }}"
|
||||
username: "{{ iosxr_cli_user | default('root') }}"
|
||||
password: "{{ iosxr_cli_pass | default('root') }}"
|
||||
transport: cli
|
12
test/integration/group_vars/junos.yaml
Normal file
12
test/integration/group_vars/junos.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
netconf:
|
||||
host: "{{ ansible_ssh_host }}"
|
||||
username: "{{ junos_cli_user | default('ansible') }}"
|
||||
password: "{{ junos_cli_pass | default('Ansible') }}"
|
||||
transport: netconf
|
||||
|
||||
cli:
|
||||
host: "{{ ansible_ssh_host }}"
|
||||
username: "{{ junos_cli_user | default('ansible') }}"
|
||||
password: "{{ junos_cli_pass | default('Ansible') }}"
|
||||
transport: cli
|
13
test/integration/group_vars/nxos.yaml
Normal file
13
test/integration/group_vars/nxos.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ inventory_hostname }}"
|
||||
username: "{{ nxos_cli_user | default('admin') }}"
|
||||
password: "{{ nxos_cli_pass | default('admin') }}"
|
||||
transport: cli
|
||||
|
||||
nxapi:
|
||||
host: "{{ inventory_hostname }}"
|
||||
username: "{{ nxos_nxapi_user | default('admin') }}"
|
||||
password: "{{ nxos_nxapi_pass | default('admin') }}"
|
||||
transport: nxapi
|
||||
use_ssl: no
|
6
test/integration/group_vars/vyos.yaml
Normal file
6
test/integration/group_vars/vyos.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
cli:
|
||||
host: "{{ ansible_ssh_host }}"
|
||||
username: vyos
|
||||
password: vyos
|
||||
transport: cli
|
14
test/integration/ios.yaml
Normal file
14
test/integration/ios.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- hosts: ios
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: ios_command, when: "limit_to in ['*', 'ios_command']" }
|
||||
- { role: ios_config, when: "limit_to in ['*', 'ios_config']" }
|
||||
- { role: ios_facts, when: "limit_to in ['*', 'ios_facts']" }
|
||||
- { role: ios_template, when: "limit_to in ['*', 'ios_template']" }
|
14
test/integration/iosxr.yaml
Normal file
14
test/integration/iosxr.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- hosts: iosxr
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: iosxr_command, when: "limit_to in ['*', 'iosxr_command']" }
|
||||
- { role: iosxr_config, when: "limit_to in ['*', 'iosxr_config']" }
|
||||
- { role: iosxr_facts, when: "limit_to in ['*', 'iosxr_facts']" }
|
||||
- { role: iosxr_template, when: "limit_to in ['*', 'iosxr_template']" }
|
14
test/integration/junos.yaml
Normal file
14
test/integration/junos.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- hosts: junos
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: junos_command, when: "limit_to in ['*', 'junos_command']" }
|
||||
- { role: junos_config, when: "limit_to in ['*', 'junos_config']" }
|
||||
- { role: junos_netconf, when: "limit_to in ['*', 'junos_netconf']" }
|
||||
- { role: junos_template, when: "limit_to in ['*', 'junos_template']" }
|
10
test/integration/network-all.yaml
Normal file
10
test/integration/network-all.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- { include: asa.yaml }
|
||||
- { include: eos.yaml }
|
||||
- { include: ios.yaml }
|
||||
- { include: iosxr.yaml }
|
||||
- { include: nxos.yaml }
|
||||
- { include: junos.yaml }
|
||||
- { include: dellos10.yaml }
|
||||
- { include: dellos9.yaml }
|
||||
- { include: dellos6.yaml }
|
15
test/integration/nxos.yaml
Normal file
15
test/integration/nxos.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
- hosts: nxos
|
||||
gather_facts: no
|
||||
connection: local
|
||||
|
||||
vars:
|
||||
limit_to: "*"
|
||||
debug: false
|
||||
|
||||
roles:
|
||||
- { role: nxos_command, when: "limit_to in ['*', 'nxos_command']" }
|
||||
- { role: nxos_config, when: "limit_to in ['*', 'nxos_config']" }
|
||||
- { role: nxos_facts, when: "limit_to in ['*', 'nxos_facts']" }
|
||||
- { role: nxos_template, when: "limit_to in ['*', 'nxos_template']" }
|
||||
- { role: nxos_nxapi, when: "limit_to in ['*', 'nxos_nxapi']" }
|
3
test/integration/targets/asa_acl/defaults/main.yaml
Normal file
3
test/integration/targets/asa_acl/defaults/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "*"
|
||||
test_items: []
|
16
test/integration/targets/asa_acl/tasks/cli.yaml
Normal file
16
test/integration/targets/asa_acl/tasks/cli.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
3
test/integration/targets/asa_acl/tasks/main.yaml
Normal file
3
test/integration/targets/asa_acl/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
41
test/integration/targets/asa_acl/tests/cli/basic.yaml
Normal file
41
test/integration/targets/asa_acl/tests/cli/basic.yaml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- debug: msg="START cli/basic.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- clear configure access-list ACL-BASIC
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Basic ACL
|
||||
asa_acl:
|
||||
provider: "{{ cli }}"
|
||||
lines:
|
||||
- access-list ACL-BASIC extended permit tcp any any eq www
|
||||
- access-list ACL-BASIC extended permit tcp any any eq https
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: Basic ACL idempotency
|
||||
asa_acl:
|
||||
provider: "{{ cli }}"
|
||||
lines:
|
||||
- access-list ACL-BASIC extended permit tcp any any eq www
|
||||
- access-list ACL-BASIC extended permit tcp any any eq https
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- clear configure access-list ACL-BASIC
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/basic.yaml"
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
- debug: msg="START cli/full_name_match.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- clear configure access-list ACL-BASIC
|
||||
- clear configure access-list ACL-BASIC2
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Basic ACL
|
||||
asa_acl:
|
||||
provider: "{{ cli }}"
|
||||
lines:
|
||||
- access-list ACL-BASIC2 extended permit tcp any any eq www
|
||||
- access-list ACL-BASIC2 extended permit tcp any any eq https
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: Should not match for ACL-BASIC2
|
||||
asa_acl:
|
||||
provider: "{{ cli }}"
|
||||
lines:
|
||||
- access-list ACL-BASIC extended permit tcp any any eq www
|
||||
- access-list ACL-BASIC extended permit tcp any any eq https
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- clear configure access-list ACL-BASIC
|
||||
- clear configure access-list ACL-BASIC2
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/full_name_match.yaml"
|
51
test/integration/targets/asa_acl/tests/cli/insert.yaml
Normal file
51
test/integration/targets/asa_acl/tests/cli/insert.yaml
Normal file
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
- debug: msg="START cli/insert.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- clear configure access-list ACL-INSERT
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Create ACL
|
||||
asa_acl:
|
||||
provider: "{{ cli }}"
|
||||
lines:
|
||||
- access-list ACL-INSERT extended permit tcp any any eq www
|
||||
- access-list ACL-INSERT extended permit tcp any any eq https
|
||||
register: result
|
||||
|
||||
- name: Insert on first line
|
||||
asa_acl:
|
||||
provider: "{{ cli }}"
|
||||
lines:
|
||||
- access-list ACL-INSERT extended permit tcp any any eq www
|
||||
- access-list ACL-INSERT extended permit tcp any any eq https
|
||||
- access-list ACL-INSERT line 1 extended permit tcp any any eq ssh
|
||||
register: result
|
||||
|
||||
- name: Show ACL
|
||||
asa_command:
|
||||
provider: "{{ cli }}"
|
||||
commands: "show run access-list ACL-INSERT"
|
||||
register: result
|
||||
|
||||
- name: Show me
|
||||
debug:
|
||||
var: result
|
||||
|
||||
- name:
|
||||
assert:
|
||||
that:
|
||||
- result.stdout_lines[0][0].rstrip() == 'access-list ACL-INSERT extended permit tcp any any eq ssh'
|
||||
|
||||
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- clear configure access-list ACL-INSERT
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/insert.yaml"
|
3
test/integration/targets/asa_command/defaults/main.yaml
Normal file
3
test/integration/targets/asa_command/defaults/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "*"
|
||||
test_items: []
|
17
test/integration/targets/asa_command/tasks/cli.yaml
Normal file
17
test/integration/targets/asa_command/tasks/cli.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/asa_command/tasks/main.yaml
Normal file
3
test/integration/targets/asa_command/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
|
||||
- name: test bad operator
|
||||
asa_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces GigabitEthernet 0/0
|
||||
wait_for:
|
||||
- result[0] contains 'Description: Foo'
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/bad_operator.yaml"
|
20
test/integration/targets/asa_command/tests/cli/contains.yaml
Normal file
20
test/integration/targets/asa_command/tests/cli/contains.yaml
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
|
||||
- name: test contains operator
|
||||
asa_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface
|
||||
wait_for:
|
||||
- "result[0] contains 'Cisco Adaptive Security Appliance Software Version'"
|
||||
- "result[1] contains 'Hardware'"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
30
test/integration/targets/asa_command/tests/cli/invalid.yaml
Normal file
30
test/integration/targets/asa_command/tests/cli/invalid.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
|
||||
- name: run invalid command
|
||||
asa_command:
|
||||
commands: ['show foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed"
|
||||
|
||||
- name: run commands that include invalid command
|
||||
asa_command:
|
||||
commands:
|
||||
- show version
|
||||
- show foo
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed"
|
||||
# FIXME bug https://github.com/ansible/ansible-modules-extras/issues/3048
|
||||
ignore_errors: true
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
29
test/integration/targets/asa_command/tests/cli/output.yaml
Normal file
29
test/integration/targets/asa_command/tests/cli/output.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
|
||||
- name: get output for single command
|
||||
asa_command:
|
||||
commands: ['show version']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- name: get output for multiple commands
|
||||
asa_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
- "result.stdout | length == 2"
|
||||
|
||||
- debug: msg="END cli/output.yaml"
|
19
test/integration/targets/asa_command/tests/cli/timeout.yaml
Normal file
19
test/integration/targets/asa_command/tests/cli/timeout.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
|
||||
- name: test bad condition
|
||||
asa_command:
|
||||
commands:
|
||||
- show version
|
||||
wait_for:
|
||||
- "result[0] contains bad_value_string"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/timeout.yaml"
|
3
test/integration/targets/asa_config/defaults/main.yaml
Normal file
3
test/integration/targets/asa_config/defaults/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "*"
|
||||
test_items: []
|
17
test/integration/targets/asa_config/tasks/cli.yaml
Normal file
17
test/integration/targets/asa_config/tasks/cli.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/asa_config/tasks/main.yaml
Normal file
3
test/integration/targets/asa_config/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object-group network OG-ANSIBLE-TEMPLATE
|
||||
description this is a test
|
||||
network-object host 192.168.99.12
|
|
@ -0,0 +1,4 @@
|
|||
object-group network OG-ANSIBLE-TEMPLATE-DEFAULT
|
||||
description this is a test
|
||||
network-object 10.0.0.0 255.255.255.0
|
||||
network-object 10.1.0.0 255.255.255.0
|
53
test/integration/targets/asa_config/tests/cli/backup.yaml
Normal file
53
test/integration/targets/asa_config/tests/cli/backup.yaml
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
- debug: msg="START cli/backup.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: collect any backup files
|
||||
find:
|
||||
paths: "{{ role_path }}/backup"
|
||||
pattern: "{{ inventory_hostname }}_config*"
|
||||
register: backup_files
|
||||
delegate_to: localhost
|
||||
|
||||
- name: delete backup files
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
with_items: "{{backup_files.files|default([])}}"
|
||||
|
||||
- name: configure device with config
|
||||
asa_config:
|
||||
src: basic/config.j2
|
||||
backup: yes
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "result.updates is defined"
|
||||
|
||||
- name: collect any backup files
|
||||
find:
|
||||
paths: "{{ role_path }}/backup"
|
||||
pattern: "{{ inventory_hostname }}_config*"
|
||||
register: backup_files
|
||||
delegate_to: localhost
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "backup_files.files is defined"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/backup.yaml"
|
39
test/integration/targets/asa_config/tests/cli/basic.yaml
Normal file
39
test/integration/targets/asa_config/tests/cli/basic.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- debug: msg="START cli/basic.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: configure device with config
|
||||
asa_config:
|
||||
src: basic/config.j2
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "result.updates is defined"
|
||||
|
||||
- name: check device with config
|
||||
asa_config:
|
||||
src: basic/config.j2
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.updates is not defined"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/basic.yaml"
|
45
test/integration/targets/asa_config/tests/cli/defaults.yaml
Normal file
45
test/integration/targets/asa_config/tests/cli/defaults.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
- debug: msg="START cli/defaults.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: configure device with defaults included
|
||||
asa_config:
|
||||
src: defaults/config.j2
|
||||
defaults: yes
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- debug: var=result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "result.updates is defined"
|
||||
|
||||
- name: check device with defaults included
|
||||
asa_config:
|
||||
src: defaults/config.j2
|
||||
defaults: yes
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- debug: var=result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.updates is not defined"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/defaults.yaml"
|
41
test/integration/targets/asa_config/tests/cli/force.yaml
Normal file
41
test/integration/targets/asa_config/tests/cli/force.yaml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- debug: msg="START cli/force.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: configure device with config
|
||||
asa_config:
|
||||
src: basic/config.j2
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "result.updates is defined"
|
||||
|
||||
- name: check device with config
|
||||
asa_config:
|
||||
src: basic/config.j2
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "result.updates is defined"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
commands:
|
||||
- no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/force.yaml"
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
- debug: msg="START cli/more_system.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines:
|
||||
- "clear configure tunnel-group 1.1.1.1"
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
|
||||
- name: Prepare tunnel-group
|
||||
asa_config:
|
||||
before: tunnel-group 1.1.1.1 type ipsec-l2l
|
||||
lines:
|
||||
- "tunnel-group 1.1.1.1 ipsec-attributes"
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Setup tunnel-group
|
||||
asa_config:
|
||||
parents: tunnel-group 1.1.1.1 ipsec-attributes
|
||||
lines:
|
||||
- "ikev1 pre-shared-key abc123"
|
||||
passwords: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Test idempotency
|
||||
asa_config:
|
||||
parents: tunnel-group 1.1.1.1 ipsec-attributes
|
||||
lines:
|
||||
- "ikev1 pre-shared-key abc123"
|
||||
passwords: yes
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- "clear configure tunnel-group 1.1.1.1"
|
||||
provider: "{{ cli }}"
|
||||
|
||||
|
||||
- debug: msg="END cli/more_system.yaml"
|
40
test/integration/targets/asa_config/tests/cli/sublevel.yaml
Normal file
40
test/integration/targets/asa_config/tests/cli/sublevel.yaml
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel.yaml"
|
||||
|
||||
- name: setup test
|
||||
asa_config:
|
||||
lines:
|
||||
- 'no object-group network OG-ANSIBLE-SUBLEVEL'
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure sub level command
|
||||
asa_config:
|
||||
lines: ['network-object host 192.168.10.1']
|
||||
parents: ['object-group network OG-ANSIBLE-SUBLEVEL']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'object-group network OG-ANSIBLE-SUBLEVEL' in result.updates"
|
||||
- "'network-object host 192.168.10.1' in result.updates"
|
||||
|
||||
- name: configure sub level command idempotent check
|
||||
asa_config:
|
||||
lines: ['network-object host 192.168.10.1']
|
||||
parents: ['object-group network OG-ANSIBLE-SUBLEVEL']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- 'no object-group network OG-ANSIBLE-SUBLEVEL'
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/sublevel.yaml"
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_block.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_command:
|
||||
commands:
|
||||
- show run object-group
|
||||
provider: "{{ cli }}"
|
||||
register: object_group
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines:
|
||||
- no object-group network OG-ANSIBLE
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
#when: "'object-group network OG-ANSIBLE\n' in {{ object_group.stdout }}"
|
||||
|
||||
- name: configure sub level command using block replace
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'object-group network OG-ANSIBLE' in result.updates"
|
||||
- "'network-object 192.168.10.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.20.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.30.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.40.0 255.255.255.0' in result.updates"
|
||||
|
||||
- name: check sub level command using block replace
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- no object-group network OG-ANSIBLE
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/sublevel_block.yaml"
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_exact.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
- network-object 192.168.50.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE-EXACT']
|
||||
before: ['no object-group network OG-ANSIBLE-EXACT']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure sub level command using exact match
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE-EXACT']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'object-group network OG-ANSIBLE-EXACT' in result.updates"
|
||||
- "'network-object 192.168.10.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.20.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.30.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.40.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.50.0 255.255.255.0' not in result.updates"
|
||||
|
||||
- name: check sub level command using exact match
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
- network-object 192.168.50.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE-EXACT']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- no object-group network OG-ANSIBLE-EXACT
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/sublevel_exact.yaml"
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_strict.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
- network-object 192.168.50.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE-STRICT']
|
||||
before: ['no object-group network OG-ANSIBLE-STRICT']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure sub level command using strict match
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.20.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.40.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE-STRICT']
|
||||
match: strict
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: check sub level command using strict match
|
||||
asa_config:
|
||||
lines:
|
||||
- network-object 192.168.10.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
- network-object 192.168.30.0 255.255.255.0
|
||||
parents: ['object-group network OG-ANSIBLE-STRICT']
|
||||
after: ['exit']
|
||||
match: strict
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'object-group network OG-ANSIBLE-STRICT' in result.updates"
|
||||
- "'network-object 192.168.10.0 255.255.255.0' not in result.updates"
|
||||
- "'network-object 192.168.30.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.30.0 255.255.255.0' in result.updates"
|
||||
- "'network-object 192.168.40.0 255.255.255.0' not in result.updates"
|
||||
- "'network-object 192.168.50.0 255.255.255.0' not in result.updates"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- no object-group network OG-ANSIBLE-STRICT
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/sublevel_strict.yaml"
|
35
test/integration/targets/asa_config/tests/cli/toplevel.yaml
Normal file
35
test/integration/targets/asa_config/tests/cli/toplevel.yaml
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines: ['hostname firewall']
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure top level command
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
|
||||
- name: configure top level command idempotent check
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/toplevel.yaml"
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_after.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines:
|
||||
- "snmp-server contact ansible"
|
||||
- "hostname firewall"
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure top level command with before
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
after: ['snmp-server contact bar']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
- "'snmp-server contact bar' in result.updates"
|
||||
|
||||
- name: configure top level command with before idempotent check
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
after: ['snmp-server contact foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- "no snmp-server contact"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/toplevel_after.yaml"
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_before.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
lines:
|
||||
- "snmp-server contact ansible"
|
||||
- "hostname firewall"
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure top level command with before
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
before: ['snmp-server contact bar']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
- "'snmp-server contact bar' in result.updates"
|
||||
|
||||
- name: configure top level command with before idempotent check
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
before: ['snmp-server contact foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines:
|
||||
- "no snmp-server contact"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/toplevel_before.yaml"
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_nonidempotent.yaml"
|
||||
|
||||
- name: setup
|
||||
asa_config:
|
||||
backup: true
|
||||
# lines: ['hostname firewall']
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: configure top level command
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
|
||||
- name: configure top level command idempotent check
|
||||
asa_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: teardown
|
||||
asa_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/toplevel_nonidempotent.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
18
test/integration/targets/dellos10_command/tasks/cli.yaml
Normal file
18
test/integration/targets/dellos10_command/tasks/cli.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact:
|
||||
test_items: "{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
|
||||
- name: test bad operator
|
||||
dellos10_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface ethernet 1/1/1
|
||||
wait_for:
|
||||
- "result[0] contains 'Description : blah'"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/bad_operator.yaml"
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
|
||||
- name: test contains operator
|
||||
dellos10_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface ethernet 1/1/1
|
||||
wait_for:
|
||||
- "result[0] contains OS10-Premium"
|
||||
- "result[1] contains Ethernet "
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
|
||||
- name: run invalid command
|
||||
dellos10_command:
|
||||
commands: ['show foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'Error: Unrecognized command' in result.stdout"
|
||||
|
||||
- name: run commands that include invalid command
|
||||
dellos10_command:
|
||||
commands:
|
||||
- show version
|
||||
- show foo
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'Error: Unrecognized command' in result.stdout"
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
|
||||
- name: get output for single command
|
||||
dellos10_command:
|
||||
commands: ['show version']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- name: get output for multiple commands
|
||||
dellos10_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interface Eth 1/1/1
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
- "result.stdout | length == 2"
|
||||
|
||||
- debug: msg="END cli/output.yaml"
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
|
||||
- name: test bad condition
|
||||
dellos10_command:
|
||||
commands:
|
||||
- show version
|
||||
wait_for:
|
||||
- "result[0] contains bad_value_string"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/timeout.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
17
test/integration/targets/dellos10_config/tasks/cli.yaml
Normal file
17
test/integration/targets/dellos10_config/tasks/cli.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/dellos10_config/tasks/main.yaml
Normal file
3
test/integration/targets/dellos10_config/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel.yaml"
|
||||
|
||||
- name: setup test
|
||||
dellos10_config:
|
||||
lines:
|
||||
- 'no ip access-list test'
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command
|
||||
dellos10_config:
|
||||
lines: ['seq 5 permit ip any any count byte']
|
||||
parents: ['ip access-list test']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'seq 5 permit ip any any count byte' in result.updates"
|
||||
|
||||
- name: configure sub level command idempotent check
|
||||
dellos10_config:
|
||||
lines: ['seq 5 permit ip any any count byte']
|
||||
parents: ['ip access-list test']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines:
|
||||
- 'no ip access-list test'
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel.yaml"
|
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_block.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
parents: ['ip access-list test']
|
||||
before: ['no ip access-list test']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using block resplace
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
parents: ['ip access-list test']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'seq 5 permit ip host 1.1.1.1 any count byte' in result.updates"
|
||||
- "'seq 10 permit ip host 2.2.2.2 any count byte' in result.updates"
|
||||
- "'seq 15 permit ip host 3.3.3.3 any count byte' in result.updates"
|
||||
- "'seq 20 permit ip host 4.4.4.4 any count byte' in result.updates"
|
||||
|
||||
- name: check sub level command using block replace
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
parents: ['ip access-list test']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines:
|
||||
- no ip access-list test
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/sublevel_block.yaml"
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_exact.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
- seq 25 permit ip host 5.5.5.5 any count byte
|
||||
parents: ['ip access-list test']
|
||||
before: ['no ip access-list test']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using exact match
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
parents: ['ip access-list test']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'seq 5 permit ip host 1.1.1.1 any count byte' in result.updates"
|
||||
- "'seq 10 permit ip host 2.2.2.2 any count byte' in result.updates"
|
||||
- "'seq 15 permit ip host 3.3.3.3 any count byte' in result.updates"
|
||||
- "'seq 20 permit ip host 4.4.4.4 any count byte' in result.updates"
|
||||
- "'seq 25 permit ip host 5.5.5.5 any count byte' not in result.updates"
|
||||
|
||||
- name: check sub level command using exact match
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
- seq 25 permit ip host 5.5.5.5 any count byte
|
||||
parents: ['ip access-list test']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines:
|
||||
- no ip access-list test
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_exact.yaml"
|
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_strict.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
- seq 25 permit ip host 5.5.5.5 any count byte
|
||||
parents: ['ip access-list test']
|
||||
before: ['no ip access-list test']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using strict match
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 20 permit ip host 4.4.4.4 any count byte
|
||||
parents: ['ip access-list test']
|
||||
match: strict
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: check sub level command using strict match
|
||||
dellos10_config:
|
||||
lines:
|
||||
- seq 5 permit ip host 1.1.1.1 any count byte
|
||||
- seq 15 permit ip host 3.3.3.3 any count byte
|
||||
- seq 10 permit ip host 2.2.2.2 any count byte
|
||||
parents: ['ip access-list test']
|
||||
after: ['exit']
|
||||
match: strict
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'seq 5 permit ip host 1.1.1.1 any count byte' not in result.updates"
|
||||
- "'seq 10 permit ip host 2.2.2.2 any count byte' in result.updates"
|
||||
- "'seq 15 permit ip host 3.3.3.3 any count byte' in result.updates"
|
||||
- "'seq 20 permit ip host 4.4.4.4 any count byte' not in result.updates"
|
||||
- "'seq 25 permit ip host 5.5.5.5 any count byte' not in result.updates"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines:
|
||||
- no ip access-list test
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_strict.yaml"
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
|
||||
- name: configure top level command idempotent check
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel.yaml"
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_after.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines:
|
||||
- "snmp-server contact ansible"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command with before
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
after: ['snmp-server contact bar']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
- "'snmp-server contact bar' in result.updates"
|
||||
|
||||
- name: configure top level command with before idempotent check
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
after: ['snmp-server contact foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines:
|
||||
- "no snmp-server contact"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_after.yaml"
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_before.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines:
|
||||
- "snmp-server contact ansible"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command with before
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
before: ['snmp-server contact bar']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
- "'snmp-server contact bar' in result.updates"
|
||||
|
||||
- name: configure top level command with before idempotent check
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
before: ['snmp-server contact foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines:
|
||||
- "no snmp-server contact"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_before.yaml"
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_nonidempotent.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos10_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
|
||||
- name: configure top level command idempotent check
|
||||
dellos10_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: teardown
|
||||
dellos10_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_nonidempotent.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
18
test/integration/targets/dellos10_facts/tasks/cli.yaml
Normal file
18
test/integration/targets/dellos10_facts/tasks/cli.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact:
|
||||
test_items: "{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/dellos10_facts/tasks/main.yaml
Normal file
3
test/integration/targets/dellos10_facts/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
48
test/integration/targets/dellos10_facts/tests/cli/facts.yaml
Normal file
48
test/integration/targets/dellos10_facts/tests/cli/facts.yaml
Normal file
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
- debug: msg="START cli/facts.yaml"
|
||||
|
||||
- name: test all facts
|
||||
dellos10_facts:
|
||||
gather_subset:
|
||||
- all
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.ansible_facts is defined"
|
||||
- "result.ansible_facts.ansible_net_interfaces is defined"
|
||||
- "result.ansible_facts.ansible_net_memfree_mb is defined"
|
||||
- "result.ansible_facts.ansible_net_model is defined"
|
||||
- "result.ansible_facts.ansible_net_servicetag is defined"
|
||||
- "result.ansible_facts.ansible_net_version is defined"
|
||||
|
||||
- name: test all facts except hardware
|
||||
dellos10_facts:
|
||||
gather_subset:
|
||||
- "!hardware"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.ansible_facts.ansible_net_interfaces is defined"
|
||||
- "result.ansible_facts.ansible_net_memfree_mb is not defined"
|
||||
|
||||
- name: test interface facts
|
||||
dellos10_facts:
|
||||
gather_subset:
|
||||
- interfaces
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.ansible_facts.ansible_net_interfaces is defined"
|
||||
- "result.ansible_facts.ansible_net_memfree_mb is not defined"
|
||||
|
||||
|
||||
- debug: msg="END cli/facts.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
17
test/integration/targets/dellos6_command/tasks/cli.yaml
Normal file
17
test/integration/targets/dellos6_command/tasks/cli.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/dellos6_command/tasks/main.yaml
Normal file
3
test/integration/targets/dellos6_command/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/bad_operator.yaml"
|
||||
|
||||
- name: test bad operator
|
||||
dellos6_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces GigabitEthernet 1/0/1
|
||||
wait_for:
|
||||
- "result[0] contains 'Description: Foo'"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/bad_operator.yaml"
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- debug: msg="START cli/contains.yaml"
|
||||
|
||||
- name: test contains operator
|
||||
dellos6_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces GigabitEthernet 1/0/1
|
||||
wait_for:
|
||||
- "result[0] contains 5"
|
||||
- "result[1] contains Access"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- debug: msg="END cli/contains.yaml"
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid.yaml"
|
||||
|
||||
- name: run invalid command
|
||||
dellos6_command:
|
||||
commands: ['show foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed"
|
||||
|
||||
- name: run commands that include invalid command
|
||||
dellos6_command:
|
||||
commands:
|
||||
- show version
|
||||
- show foo
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed"
|
||||
|
||||
- debug: msg="END cli/invalid.yaml"
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- debug: msg="START cli/output.yaml"
|
||||
|
||||
- name: get output for single command
|
||||
dellos6_command:
|
||||
commands: ['show version']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
|
||||
- name: get output for multiple commands
|
||||
dellos6_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.stdout is defined"
|
||||
- "result.stdout | length == 2"
|
||||
|
||||
- debug: msg="END cli/output.yaml"
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- debug: msg="START cli/timeout.yaml"
|
||||
|
||||
- name: test bad condition
|
||||
dellos6_command:
|
||||
commands:
|
||||
- show version
|
||||
wait_for:
|
||||
- "result[0] contains bad_value_string"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.failed == true"
|
||||
- "result.msg is defined"
|
||||
|
||||
- debug: msg="END cli/timeout.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
17
test/integration/targets/dellos6_config/tasks/cli.yaml
Normal file
17
test/integration/targets/dellos6_config/tasks/cli.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/dellos6_config/tasks/main.yaml
Normal file
3
test/integration/targets/dellos6_config/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel.yaml"
|
||||
|
||||
- name: setup test
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 'no ip access-list test'
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command
|
||||
dellos6_config:
|
||||
lines: ['1000 permit every log']
|
||||
parents: ['ip access-list test']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'1000 permit every log' in result.updates"
|
||||
|
||||
- name: configure sub level command idempotent check
|
||||
dellos6_config:
|
||||
lines: ['1000 permit every log']
|
||||
parents: ['ip access-list test']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 'no ip access-list test'
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel.yaml"
|
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_block.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines:
|
||||
- permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- permit ip 3.3.3.3 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
before: ['no ip access-list test']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using block resplace
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 1000 permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- 1010 permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- 1020 permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- 1030 permit ip 4.4.4.4 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'1000 permit ip 1.1.1.1 0.0.0.0 any log' in result.updates"
|
||||
- "'1010 permit ip 2.2.2.2 0.0.0.0 any log' in result.updates"
|
||||
- "'1020 permit ip 3.3.3.3 0.0.0.0 any log' in result.updates"
|
||||
- "'1030 permit ip 4.4.4.4 0.0.0.0 any log' in result.updates"
|
||||
|
||||
- name: check sub level command using block replace
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 1000 permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- 1010 permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- 1020 permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- 1030 permit ip 4.4.4.4 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
replace: block
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines:
|
||||
- no ip access-list test
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- debug: msg="END cli/sublevel_block.yaml"
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_exact.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines:
|
||||
- permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- permit ip 4.4.4.4 0.0.0.0 any log
|
||||
- permit ip 5.5.5.5 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
before: ['no ip access-list test']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using exact match
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 1000 permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- 1010 permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- 1020 permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- 1030 permit ip 4.4.4.4 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'1000 permit ip 1.1.1.1 0.0.0.0 any log' in result.updates"
|
||||
- "'1010 permit ip 2.2.2.2 0.0.0.0 any log' in result.updates"
|
||||
- "'1020 permit ip 3.3.3.3 0.0.0.0 any log' in result.updates"
|
||||
- "'1030 permit ip 4.4.4.4 0.0.0.0 any log' in result.updates"
|
||||
- "'1040 permit ip 5.5.5.5 0.0.0.0 any log' not in result.updates"
|
||||
|
||||
- name: check sub level command using exact match
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 1000 permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- 1010 permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- 1020 permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- 1030 permit ip 4.4.4.4 0.0.0.0 any log
|
||||
- 1040 permit ip 5.5.5.5 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
after: ['exit']
|
||||
match: exact
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines:
|
||||
- no ip access-list test
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_exact.yaml"
|
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
- debug: msg="START cli/sublevel_strict.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines:
|
||||
- permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- permit ip 4.4.4.4 0.0.0.0 any log
|
||||
- permit ip 5.5.5.5 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
before: ['no ip access-list test']
|
||||
after: ['exit']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure sub level command using strict match
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 1000 permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- 1010 permit ip 2.2.2.2 0.0.0.0 any log
|
||||
- 1020 permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- 1030 permit ip 4.4.4.4 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
match: strict
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: check sub level command using strict match
|
||||
dellos6_config:
|
||||
lines:
|
||||
- 1000 permit ip 1.1.1.1 0.0.0.0 any log
|
||||
- 1010 permit ip 3.3.3.3 0.0.0.0 any log
|
||||
- 1020 permit ip 2.2.2.2 0.0.0.0 any log
|
||||
parents: ['ip access-list test']
|
||||
after: ['exit']
|
||||
match: strict
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'ip access-list test' in result.updates"
|
||||
- "'1000 permit ip 1.1.1.1 0.0.0.0 any log' not in result.updates"
|
||||
- "'1020 permit ip 2.2.2.2 0.0.0.0 any log' in result.updates"
|
||||
- "'1010 permit ip 3.3.3.3 0.0.0.0 any log' in result.updates"
|
||||
- "'1030 permit ip 4.4.4.4 0.0.0.0 any log' not in result.updates"
|
||||
- "'1040 permit ip 5.5.5.5 0.0.0.0 any log' not in result.updates"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines:
|
||||
- no ip access-list test
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/sublevel_strict.yaml"
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command
|
||||
dellos6_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
|
||||
- name: configure top level command idempotent check
|
||||
dellos6_config:
|
||||
lines: ['hostname "foo"']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel.yaml"
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_after.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines:
|
||||
- "snmp-server contact ansible"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command with before
|
||||
dellos6_config:
|
||||
lines: ['hostname foo']
|
||||
after: ['snmp-server contact bar']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
- "'snmp-server contact bar' in result.updates"
|
||||
|
||||
- name: configure top level command with before idempotent check
|
||||
dellos6_config:
|
||||
lines: ['hostname "foo"']
|
||||
after: ['snmp-server contact foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines:
|
||||
- "no snmp-server contact"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_after.yaml"
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_before.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines:
|
||||
- "snmp-server contact ansible"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command with before
|
||||
dellos6_config:
|
||||
lines: ['hostname foo']
|
||||
before: ['snmp-server contact bar']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
- "'snmp-server contact bar' in result.updates"
|
||||
|
||||
- name: configure top level command with before idempotent check
|
||||
dellos6_config:
|
||||
lines: ['hostname "foo"']
|
||||
before: ['snmp-server contact foo']
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines:
|
||||
- "no snmp-server contact"
|
||||
- "hostname {{ inventory_hostname }}"
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_before.yaml"
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- debug: msg="START cli/toplevel_nonidempotent.yaml"
|
||||
|
||||
- name: setup
|
||||
dellos6_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- name: configure top level command
|
||||
dellos6_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'hostname foo' in result.updates"
|
||||
|
||||
- name: configure top level command idempotent check
|
||||
dellos6_config:
|
||||
lines: ['hostname foo']
|
||||
provider: "{{ cli }}"
|
||||
match: strict
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: teardown
|
||||
dellos6_config:
|
||||
lines: ['hostname {{ inventory_hostname }}']
|
||||
provider: "{{ cli }}"
|
||||
match: none
|
||||
|
||||
- debug: msg="END cli/toplevel_nonidempotent.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
18
test/integration/targets/dellos6_facts/tasks/cli.yaml
Normal file
18
test/integration/targets/dellos6_facts/tasks/cli.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/cli"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact:
|
||||
test_items: "{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case
|
||||
include: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
|
3
test/integration/targets/dellos6_facts/tasks/main.yaml
Normal file
3
test/integration/targets/dellos6_facts/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
|
42
test/integration/targets/dellos6_facts/tests/cli/facts.yaml
Normal file
42
test/integration/targets/dellos6_facts/tests/cli/facts.yaml
Normal file
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
- debug: msg="START cli/facts.yaml"
|
||||
|
||||
- name: test all facts
|
||||
dellos6_facts:
|
||||
gather_subset:
|
||||
- all
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.ansible_facts is defined"
|
||||
|
||||
- name: test all facts except hardware
|
||||
dellos6_facts:
|
||||
gather_subset:
|
||||
- "!hardware"
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.ansible_facts.ansible_net_memfree_mb is not defined"
|
||||
|
||||
- name: test interface facts
|
||||
dellos6_facts:
|
||||
gather_subset:
|
||||
- interfaces
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
- "result.ansible_facts.ansible_net_interfaces is defined"
|
||||
- "result.ansible_facts.ansible_net_memfree_mb is not defined"
|
||||
|
||||
|
||||
- debug: msg="END cli/facts.yaml"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue