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:
John R Barker 2016-10-28 19:50:29 +01:00 committed by GitHub
commit e0cc7b3415
489 changed files with 13144 additions and 2 deletions

View file

@ -0,0 +1,20 @@
---
- debug: msg="START nxapi/bad_operator.yaml"
- name: test bad operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.state foo up"
provider: "{{ nxapi }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END nxapi/bad_operator.yaml"

View file

@ -0,0 +1,20 @@
---
- debug: msg="START nxapi/contains.yaml"
- name: test contains operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[0].header_str contains NX-OS"
- "result[1].TABLE_interface.ROW_interface.interface contains mgmt"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/contains.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START nxapi/equal.yaml"
- name: test eq operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.state eq up"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test == operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.state == up"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/equal.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START nxapi/greaterthan.yaml"
- name: test gt operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask gt 0"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test > operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask gt 0"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/greaterthan.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START nxapi/greaterthanorequal.yaml"
- name: test ge operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask ge 0"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test >= operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask >= 0"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/greaterthanorequal.yaml"

View file

@ -0,0 +1,30 @@
---
- debug: msg="START nxapi/invalid.yaml"
- name: run invalid command
nxos_command:
commands: ['show foo']
provider: "{{ nxapi }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- name: run commands that include invalid command
nxos_command:
commands:
- show version
- show foo
provider: "{{ nxapi }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END nxapi/invalid.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START nxapi/lessthan.yaml"
- name: test lt operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask lt 33"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test < operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask lt 33"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/lessthan.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START nxapi/lessthanorequal.yaml"
- name: test le operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask le 32"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test <= operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.eth_ip_mask <= 32"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/lessthanorequal.yaml"

View file

@ -0,0 +1,27 @@
---
- debug: msg="START nxapi/negative.yaml"
- name: run 11 commands
nxos_command:
commands:
- show version
- show version
- show version
- show version
- show version
- show version
- show version
- show version
- show version
- show version
- show version
provier: "{{ nxapi }}"
ignore_errors: yes
register: result
- assert:
that:
- result.failed
- debug: msg="END nxapi/negative.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START nxapi/notequal.yaml"
- name: test neq operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.state neq down"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: test != operator
nxos_command:
commands:
- show version
- show interface mgmt0
wait_for:
- "result[1].TABLE_interface.ROW_interface.state != down"
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="START nxapi/notequal.yaml"

View file

@ -0,0 +1,28 @@
---
- debug: msg="START nxapi/output.yaml"
- name: get output for single command
nxos_command:
commands: ['show version']
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: get output for multiple commands
nxos_command:
commands:
- show version
- show interface
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- debug: msg="END nxapi/output.yaml"

View file

@ -0,0 +1,20 @@
---
- debug: msg="START nxapi/timeout.yaml"
- name: test bad condition
nxos_command:
commands:
- show version
wait_for:
- "result[0].header_str contains foo"
retries: 1
provider: "{{ nxapi }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END nxapi/timeout.yaml"