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 cli/bad_operator.yaml"
- name: test bad operator
nxos_command:
commands:
- show version
- show interface mgmt0 | json
wait_for:
- "result[1].TABLE_interface.ROW_interface.state foo up"
provider: "{{ cli }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END cli/bad_operator.yaml"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,27 @@
---
- debug: msg="START cli/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: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- result.failed
- debug: msg="END cli/negative.yaml"

View file

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

View file

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

View file

@ -0,0 +1,19 @@
---
- debug: msg="START cli/timeout.yaml"
- name: test bad condition
nxos_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"