diff options
Diffstat (limited to 'test/integration/targets/eos_command/tests/cli')
11 files changed, 321 insertions, 0 deletions
diff --git a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml new file mode 100644 index 0000000000..3e40a3ba7e --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/bad_operator.yaml" + +- name: test bad operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.name foo Management" + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- debug: msg="END cli/bad_operator.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/contains.yaml b/test/integration/targets/eos_command/tests/cli/contains.yaml new file mode 100644 index 0000000000..5ce87ce893 --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/contains.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/contains.yaml" + +- name: test contains operator + eos_command: + commands: + - show version + - show interface Management1 | json + wait_for: + - "result[0] contains EOS" + - "result[1].interfaces.Management1.name contains Manage" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/contains.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/equal.yaml b/test/integration/targets/eos_command/tests/cli/equal.yaml new file mode 100644 index 0000000000..7041e767d3 --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/equal.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/equal.yaml" + +- name: test eq operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.name eq Management1" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: test == operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.name == Management1" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/equal.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml new file mode 100644 index 0000000000..18b5a0af65 --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/greaterthan.yaml" + +- name: test gt operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu gt 0" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: test > operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu > 0" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/greaterthan.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml new file mode 100644 index 0000000000..a258a4ef0c --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/greaterthanorequal.yaml" + +- name: test ge operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu ge 0" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: test >= operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu >= 0" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/greaterthanorequal.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/invalid.yaml b/test/integration/targets/eos_command/tests/cli/invalid.yaml new file mode 100644 index 0000000000..ed01459aaa --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/invalid.yaml @@ -0,0 +1,30 @@ +--- +- debug: msg="START cli/invalid.yaml" + +- name: run invalid command + eos_command: + commands: ['show foo'] + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- name: run commands that include invalid command + eos_command: + commands: + - show version + - show foo + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + - "result.msg is defined" + +- debug: msg="END cli/invalid.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/lessthan.yaml b/test/integration/targets/eos_command/tests/cli/lessthan.yaml new file mode 100644 index 0000000000..b0ed69ea8b --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/lessthan.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/lessthan.yaml" + +- name: test lt operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu lt 1600" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: test < operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu < 1600" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/lessthan.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml new file mode 100644 index 0000000000..35085e62ee --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/lessthanorequal.yaml" + +- name: test le operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu le 1600" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: test <= operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.mtu <= 1600" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/lessthanorequal.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/notequal.yaml b/test/integration/targets/eos_command/tests/cli/notequal.yaml new file mode 100644 index 0000000000..beab4c0ed0 --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/notequal.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/notequal.yaml" + +- name: test neq operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.name neq Ethernet" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: test != operator + eos_command: + commands: + - show version + - show interfaces Management1 | json + wait_for: + - "result[1].interfaces.Management1.name != Ethernet" + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/notequal.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/output.yaml b/test/integration/targets/eos_command/tests/cli/output.yaml new file mode 100644 index 0000000000..43e7eb1236 --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/output.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/output.yaml" + +- name: get output for single command + eos_command: + commands: ['show version'] + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- name: get output for multiple commands + eos_command: + commands: + - show version + - show interfaces + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + +- debug: msg="END cli/output.yaml" diff --git a/test/integration/targets/eos_command/tests/cli/timeout.yaml b/test/integration/targets/eos_command/tests/cli/timeout.yaml new file mode 100644 index 0000000000..02d49ea9cb --- /dev/null +++ b/test/integration/targets/eos_command/tests/cli/timeout.yaml @@ -0,0 +1,19 @@ +--- +- debug: msg="START cli/timeout.yaml" + +- name: test bad condition + eos_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" |