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,21 @@
---
- debug: msg="START netconf_text/bad_operator.yaml"
- name: test bad operator with text encoding
junos_command:
commands:
- show version
- show interfaces fxp0
wait_for:
- "result[1].interface-information[0].physical-interface[0].name[0].data foo fxp0"
encoding: text
provider: "{{ netconf }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END netconf_text/bad_operator.yaml"

View file

@ -0,0 +1,22 @@
---
- debug: msg="START netconf_text/contains.yaml"
- name: test contains operator with text encoding
junos_command:
commands:
- show version
- show interfaces fxp0
display: text
wait_for:
- "result[0] contains vsrx01"
- "result[1] contains fxp0"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_text/contains.yaml"

View file

@ -0,0 +1,34 @@
---
- debug: msg="START netconf_text/invalid.yaml"
- name: run invalid command
junos_command:
commands: show foo
display: text
provider: "{{ netconf }}"
register: result
ignore_errors: yes
- debug: var=result
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- name: run commands that include invalid command
junos_command:
commands:
- show version
- show foo
display: text
provider: "{{ netconf }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END netconf_text/invalid.yaml"

View file

@ -0,0 +1,32 @@
---
- debug: msg="START netconf_text/output.yaml"
- name: get output for single command
junos_command:
commands: show version
display: text
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for multiple commands
junos_command:
commands:
- show version
- show route
display: text
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_text/output.yaml"

View file

@ -0,0 +1,20 @@
---
- debug: msg="START netconf_text/timeout.yaml"
- name: test bad condition
junos_command:
commands:
- show version
wait_for:
- "result[0] contains bad_value_string"
display: text
provider: "{{ netconf }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END netconf_text/timeout.yaml"

View file

@ -0,0 +1,21 @@
---
- debug: msg="START netconf_xml/bad_operator.yaml"
- name: test bad operator with xml encoding
junos_command:
commands:
- show version
- show interfaces fxp0
wait_for:
- "result[1].interface-information[0].physical-interface[0].name[0].data foo fxp0"
format: xml
provider: "{{ netconf }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END netconf_xml/bad_operator.yaml"

View file

@ -0,0 +1,22 @@
---
- debug: msg="START netconf_xml/contains.yaml"
- name: test contains operator with xml encoding
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[0].software-information.host-name contains vsrx01"
- "result[1].interface-information.physical-interface.name contains fxp0"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/contains.yaml"

View file

@ -0,0 +1,40 @@
---
- debug: msg="START netconf_xml/equal.yaml"
- name: test == operator with xml encoding
junos_command:
commands:
- show version
- show interfaces fxp0
wait_for:
- "result[0].software-information.host-name == vsrx01"
- "result[1].interface-information.physical-interface.name == fxp0"
format: xml
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: test eq operator with json encoding
junos_command:
commands:
- show version
- show interfaces fxp0
wait_for:
- "result[0].software-information.host-name eq vsrx01"
- "result[1].interface-information.physical-interface.name eq fxp0"
format: xml
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/equal.yaml"

View file

@ -0,0 +1,38 @@
---
- debug: msg="START netconf_xml/greaterthan.yaml"
- name: test gt operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu gt 1500"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: test > operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu > 1500"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/greaterthan.yaml"

View file

@ -0,0 +1,38 @@
---
- debug: msg="START netconf_xml/greaterthanorequal.yaml"
- name: test ge operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu ge 1514"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: test >= operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu >= 1514"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/greaterthanorequal.yaml"

View file

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

View file

@ -0,0 +1,38 @@
---
- debug: msg="START netconf_xml/lessthan.yaml"
- name: test lt operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu lt 9000"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: test < operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu lt 9000"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/lessthan.yaml"

View file

@ -0,0 +1,38 @@
---
- debug: msg="START netconf_xml/lessthanorequal.yaml"
- name: test le operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu le 1514"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: test <= operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[1].interface-information.physical-interface.mtu <= 1514"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/lessthanorequal.yaml"

View file

@ -0,0 +1,38 @@
---
- debug: msg="START netconf_xml/notequal.yaml"
- name: test neq operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[0].software-information.host-name neq localhost"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: test != operator
junos_command:
commands:
- show version
- show interfaces fxp0
format: xml
wait_for:
- "result[0].software-information.host-name != localhost"
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/notequal.yaml"

View file

@ -0,0 +1,32 @@
---
- debug: msg="START netconf_xml/output.yaml"
- name: get output for single command
junos_command:
commands: ['show version']
format: xml
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for multiple commands
junos_command:
commands:
- show version
- show route
format: xml
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/output.yaml"

View file

@ -0,0 +1,19 @@
---
- debug: msg="START netconf_xml/timeout.yaml"
- name: test bad condition
junos_command:
commands:
- show version
wait_for:
- "result[0] contains bad_value_string"
provider: "{{ netconf }}"
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- debug: msg="END netconf_xml/timeout.yaml"