mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- debug: msg="START cli/all_facts.yaml"
|
||||
|
||||
|
||||
- name: test getting all facts
|
||||
iosxr_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- all
|
||||
register: result
|
||||
|
||||
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# _facts modules should never report a change
|
||||
- "result.changed == false"
|
||||
|
||||
# Correct subsets are present
|
||||
- "'config' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'default' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined"
|
||||
|
||||
- debug: msg="END cli/all_facts.yaml"
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- debug: msg="START cli/default_facts.yaml"
|
||||
|
||||
|
||||
- name: test getting default facts
|
||||
iosxr_facts:
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# _facts modules should never report a change
|
||||
- "result.changed == false"
|
||||
|
||||
# Correct subsets are present
|
||||
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'default' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined"
|
||||
# ... and not present
|
||||
- "'config' not in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_filesystems is defined" # hardware
|
||||
- "result.ansible_facts.ansible_net_interfaces | length > 1" # more than one interface returned
|
||||
|
||||
# ... and not present
|
||||
- "result.ansible_facts.ansible_net_config is not defined" # config
|
||||
|
||||
- debug: msg="END cli/default.yaml"
|
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
- debug: msg="START cli/invalid_subset.yaml"
|
||||
|
||||
|
||||
- name: test invalid subset (foobar)
|
||||
iosxr_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- "foobar"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# Failures shouldn't return changes
|
||||
- "result.changed == false"
|
||||
# It's a failure
|
||||
- "result.failed == true"
|
||||
# Sensible Failure message
|
||||
- "result.msg == 'Bad subset'"
|
||||
|
||||
###############
|
||||
# FIXME Future
|
||||
# We may in the future want to add a test for
|
||||
|
||||
- name: test subset specified multiple times
|
||||
iosxr_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- "!hardware"
|
||||
- "hardware"
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# Failures shouldn't return changes
|
||||
- "result.changed == false"
|
||||
# It's a failure
|
||||
- "result.failed == true"
|
||||
# Sensible Failure message
|
||||
- "result.msg == 'Bad subset'"
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
|
||||
- debug: msg="END cli/invalid_subset.yaml"
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- debug: msg="START cli/not_hardware_facts.yaml"
|
||||
|
||||
|
||||
- name: test not hardware
|
||||
iosxr_facts:
|
||||
provider: "{{ cli }}"
|
||||
gather_subset:
|
||||
- "!hardware"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
# _facts modules should never report a change
|
||||
- "result.changed == false"
|
||||
|
||||
# Correct subsets are present
|
||||
- "'config' in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
- "'default' in result.ansible_facts.ansible_net_gather_subset"
|
||||
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
|
||||
# ... and not present
|
||||
- "'hardware' not in result.ansible_facts.ansible_net_gather_subset"
|
||||
|
||||
# Items from those subsets are present
|
||||
- "result.ansible_facts.ansible_net_interfaces | length > 1" # more than one interface returned
|
||||
# ... and not present
|
||||
- "result.ansible_facts.ansible_net_filesystems is not defined"
|
||||
|
||||
- debug: msg="END cli/not_hardware_facts.yaml"
|
Loading…
Add table
Add a link
Reference in a new issue