summaryrefslogtreecommitdiff
path: root/test/integration/targets/eos_system
diff options
context:
space:
mode:
authorPeter Sprygada <privateip@users.noreply.github.com>2017-03-02 21:20:17 -0600
committerGitHub <noreply@github.com>2017-03-02 21:20:17 -0600
commit6c8025ce5c60167b7889a239a05d025d8a51f9bb (patch)
tree970366695edb3ed2003fb5ff861002e5029c2ca8 /test/integration/targets/eos_system
parent30b6ed837791c06d43e3b4001d62d30c7a0cb877 (diff)
downloadansible-6c8025ce5c60167b7889a239a05d025d8a51f9bb.tar.gz
adds eos_system integration tests (#22214)
* adds integration test cases * updates eos_system with minor bug fixes
Diffstat (limited to 'test/integration/targets/eos_system')
-rw-r--r--test/integration/targets/eos_system/meta/main.yml2
-rw-r--r--test/integration/targets/eos_system/tasks/cli.yaml15
-rw-r--r--test/integration/targets/eos_system/tasks/eapi.yaml28
-rw-r--r--test/integration/targets/eos_system/tasks/main.yaml3
-rw-r--r--test/integration/targets/eos_system/tests/cli/set_domain_list.yaml122
-rw-r--r--test/integration/targets/eos_system/tests/cli/set_domain_name.yaml36
-rw-r--r--test/integration/targets/eos_system/tests/cli/set_hostname.yaml36
-rw-r--r--test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml68
-rw-r--r--test/integration/targets/eos_system/tests/cli/set_name_servers.yaml93
-rw-r--r--test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml122
-rw-r--r--test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml36
-rw-r--r--test/integration/targets/eos_system/tests/eapi/set_hostname.yaml36
-rw-r--r--test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml68
-rw-r--r--test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml93
14 files changed, 758 insertions, 0 deletions
diff --git a/test/integration/targets/eos_system/meta/main.yml b/test/integration/targets/eos_system/meta/main.yml
new file mode 100644
index 0000000000..e5c8cd02f0
--- /dev/null
+++ b/test/integration/targets/eos_system/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_eos_tests
diff --git a/test/integration/targets/eos_system/tasks/cli.yaml b/test/integration/targets/eos_system/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/eos_system/tasks/cli.yaml
@@ -0,0 +1,15 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: "{{ role_path }}/tests/cli"
+ patterns: "{{ testcase }}.yaml"
+ register: test_cases
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: run test case
+ include: "{{ test_case_to_run }}"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/test/integration/targets/eos_system/tasks/eapi.yaml b/test/integration/targets/eos_system/tasks/eapi.yaml
new file mode 100644
index 0000000000..26c247320b
--- /dev/null
+++ b/test/integration/targets/eos_system/tasks/eapi.yaml
@@ -0,0 +1,28 @@
+---
+- name: collect all eapi test cases
+ find:
+ paths: "{{ role_path }}/tests/eapi"
+ patterns: "{{ testcase }}.yaml"
+ register: test_cases
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: enable eapi
+ nxos_config:
+ lines:
+ - feature eapi
+ - eapi http port 80
+ provider: "{{ cli }}"
+
+- name: run test case
+ include: "{{ test_case_to_run }}"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
+
+- name: disable eapi
+ nxos_config:
+ lines:
+ - no feature eapi
+ provider: "{{ cli }}"
diff --git a/test/integration/targets/eos_system/tasks/main.yaml b/test/integration/targets/eos_system/tasks/main.yaml
new file mode 100644
index 0000000000..970e74171e
--- /dev/null
+++ b/test/integration/targets/eos_system/tasks/main.yaml
@@ -0,0 +1,3 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
+- { include: eapi.yaml, tags: ['eapi'] }
diff --git a/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml b/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml
new file mode 100644
index 0000000000..b605c3097f
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml
@@ -0,0 +1,122 @@
+---
+- debug: msg="START cli/set_domain_list.yaml"
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ match: none
+ provider: "{{ cli }}"
+
+- name: configure domain_list
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain-list ansible.com' in result.commands"
+ - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify domain_list
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'no ip domain-list redhat.com' in result.commands"
+
+- name: verify remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: add one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify add one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: add and remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - eng.ansible.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'no ip domain-list redhat.com' in result.commands"
+ - "'ip domain-list eng.ansible.com' in result.commands"
+ - result.commands|length == 2
+
+- name: verify add and remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - eng.ansible.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ - no ip domain-list eng.ansible.com
+ match: none
+ provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_list.yaml"
diff --git a/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml b/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml
new file mode 100644
index 0000000000..ecaa4668a6
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START cli/set_domain_name.yaml"
+
+- name: setup
+ eos_config:
+ lines: no ip domain-name
+ match: none
+ provider: "{{ cli }}"
+
+- name: configure domain_name
+ eos_system:
+ domain_name: eng.ansible.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify domain_name
+ eos_system:
+ domain_name: eng.ansible.com
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: teardown
+ eos_config:
+ lines: no ip domain-name
+ match: none
+ provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_name.yaml"
diff --git a/test/integration/targets/eos_system/tests/cli/set_hostname.yaml b/test/integration/targets/eos_system/tests/cli/set_hostname.yaml
new file mode 100644
index 0000000000..db80a97b3c
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/cli/set_hostname.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START cli/set_hostname.yaml"
+
+- name: setup
+ eos_config:
+ lines: hostname switch
+ match: none
+ provider: "{{ cli }}"
+
+- name: configure hostname
+ eos_system:
+ hostname: foo
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify hostname
+ eos_system:
+ hostname: foo
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: teardown
+ eos_config:
+ lines: "hostname {{ inventory_hostname }}"
+ match: none
+ provider: "{{ cli }}"
+
+- debug: msg="END cli/set_hostname.yaml"
diff --git a/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml
new file mode 100644
index 0000000000..9e65367726
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml
@@ -0,0 +1,68 @@
+---
+- debug: msg="START cli/set_lookup_source.yaml"
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip domain lookup source-interface
+ - vrf definition ansible
+ match: none
+ provider: "{{ cli }}"
+
+- name: configure lookup_source
+ eos_system:
+ lookup_source: Management1
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain lookup source-interface Management1' in result.commands"
+
+- name: verify lookup_source
+ eos_system:
+ lookup_source: Management1
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: change to vrf
+ eos_system:
+ lookup_source:
+ - interface: Management1
+ vrf: ansible
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'no ip domain lookup source-interface Management1' in result.commands"
+ - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
+ - result.commands|length == 2
+
+- name: verify change to vrf
+ eos_system:
+ lookup_source:
+ - interface: Management1
+ vrf: ansible
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain lookup source-interface
+ - no vrf definition ansible
+ match: none
+ provider: "{{ cli }}"
+
+- debug: msg="END cli/set_lookup_source.yaml"
diff --git a/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml b/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml
new file mode 100644
index 0000000000..bdd3d17c48
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml
@@ -0,0 +1,93 @@
+---
+- debug: msg="START cli/set_name_servers.yaml"
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip name-server
+ - vrf definition ansible
+ match: none
+ provider: "{{ cli }}"
+
+- name: configure name_servers
+ eos_system:
+ name_servers:
+ - 1.1.1.1
+ - 2.2.2.2
+ - 3.3.3.3
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - result.commands|length == 3
+ - "'ip name-server 1.1.1.1' in result.commands"
+ - "'ip name-server 2.2.2.2' in result.commands"
+ - "'ip name-server 3.3.3.3' in result.commands"
+
+- name: verify name_servers
+ eos_system:
+ name_servers:
+ - 1.1.1.1
+ - 2.2.2.2
+ - 3.3.3.3
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+#- name: change to vrf
+# eos_system:
+# name_servers:
+# - 1.1.1.1
+# - { server: 2.2.2.2, vrf: ansible }
+# - 3.3.3.3
+# provider: "{{ cli }}"
+# register: result
+
+#- assert:
+# that:
+# - result.changed == true
+# - result.commands|length == 2
+# - "'no ip name-server 2.2.2.2' in result.commands"
+# - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
+
+#- name: verify change to vrf
+# eos_system:
+# name_servers:
+# - 1.1.1.1
+# - { server: 2.2.2.2, vrf: ansible }
+# - 3.3.3.3
+# provider: "{{ cli }}"
+# register: result
+#
+#- assert:
+# that:
+# - result.changed == false
+
+- name: remove one
+ eos_system:
+ name_servers:
+ - 1.1.1.1
+ - 2.2.2.2
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - result.commands|length == 1
+ - "'no ip name-server 3.3.3.3' in result.commands"
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain lookup source-interface
+ - no vrf definition ansible
+ match: none
+ provider: "{{ cli }}"
+
+- debug: msg="END cli/set_name_servers.yaml"
diff --git a/test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml b/test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml
new file mode 100644
index 0000000000..80020c3435
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml
@@ -0,0 +1,122 @@
+---
+- debug: msg="START eapi/set_domain_list.yaml"
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ match: none
+ provider: "{{ eapi }}"
+
+- name: configure domain_list
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain-list ansible.com' in result.commands"
+ - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify domain_list
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'no ip domain-list redhat.com' in result.commands"
+
+- name: verify remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: add one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify add one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: add and remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - eng.ansible.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'no ip domain-list redhat.com' in result.commands"
+ - "'ip domain-list eng.ansible.com' in result.commands"
+ - result.commands|length == 2
+
+- name: verify add and remove one entry
+ eos_system:
+ domain_list:
+ - ansible.com
+ - eng.ansible.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ - no ip domain-list eng.ansible.com
+ match: none
+ provider: "{{ eapi }}"
+
+- debug: msg="END eapi/set_domain_list.yaml"
diff --git a/test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml b/test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml
new file mode 100644
index 0000000000..fedd674e4d
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START eapi/set_domain_name.yaml"
+
+- name: setup
+ eos_config:
+ lines: no ip domain-name
+ match: none
+ provider: "{{ eapi }}"
+
+- name: configure domain_name
+ eos_system:
+ domain_name: eng.ansible.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify domain_name
+ eos_system:
+ domain_name: eng.ansible.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: teardown
+ eos_config:
+ lines: no ip domain-name
+ match: none
+ provider: "{{ eapi }}"
+
+- debug: msg="END eapi/set_domain_name.yaml"
diff --git a/test/integration/targets/eos_system/tests/eapi/set_hostname.yaml b/test/integration/targets/eos_system/tests/eapi/set_hostname.yaml
new file mode 100644
index 0000000000..d26d9105b8
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/eapi/set_hostname.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START eapi/set_hostname.yaml"
+
+- name: setup
+ eos_config:
+ lines: hostname switch
+ match: none
+ provider: "{{ eapi }}"
+
+- name: configure hostname
+ eos_system:
+ hostname: foo
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify hostname
+ eos_system:
+ hostname: foo
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: teardown
+ eos_config:
+ lines: "hostname {{ inventory_hostname }}"
+ match: none
+ provider: "{{ eapi }}"
+
+- debug: msg="END eapi/set_hostname.yaml"
diff --git a/test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml b/test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml
new file mode 100644
index 0000000000..57399004df
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml
@@ -0,0 +1,68 @@
+---
+- debug: msg="START eapi/set_lookup_source.yaml"
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip domain lookup source-interface
+ - vrf definition ansible
+ match: none
+ provider: "{{ eapi }}"
+
+- name: configure lookup_source
+ eos_system:
+ lookup_source: Management1
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain lookup source-interface Management1' in result.commands"
+
+- name: verify lookup_source
+ eos_system:
+ lookup_source: Management1
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: change to vrf
+ eos_system:
+ lookup_source:
+ - interface: Management1
+ vrf: ansible
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'no ip domain lookup source-interface Management1' in result.commands"
+ - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
+ - result.commands|length == 2
+
+- name: verify change to vrf
+ eos_system:
+ lookup_source:
+ - interface: Management1
+ vrf: ansible
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain lookup source-interface
+ - no vrf definition ansible
+ match: none
+ provider: "{{ eapi }}"
+
+- debug: msg="END eapi/set_lookup_source.yaml"
diff --git a/test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml b/test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml
new file mode 100644
index 0000000000..19822591c5
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml
@@ -0,0 +1,93 @@
+---
+- debug: msg="START eapi/set_name_servers.yaml"
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip name-server
+ - vrf definition ansible
+ match: none
+ provider: "{{ eapi }}"
+
+- name: configure name_servers
+ eos_system:
+ name_servers:
+ - 1.1.1.1
+ - 2.2.2.2
+ - 3.3.3.3
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - result.commands|length == 3
+ - "'ip name-server 1.1.1.1' in result.commands"
+ - "'ip name-server 2.2.2.2' in result.commands"
+ - "'ip name-server 3.3.3.3' in result.commands"
+
+- name: verify name_servers
+ eos_system:
+ name_servers:
+ - 1.1.1.1
+ - 2.2.2.2
+ - 3.3.3.3
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == false
+
+#- name: change to vrf
+# eos_system:
+# name_servers:
+# - 1.1.1.1
+# - { server: 2.2.2.2, vrf: ansible }
+# - 3.3.3.3
+# provider: "{{ eapi }}"
+# register: result
+
+#- assert:
+# that:
+# - result.changed == true
+# - result.commands|length == 2
+# - "'no ip name-server 2.2.2.2' in result.commands"
+# - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
+
+#- name: verify change to vrf
+# eos_system:
+# name_servers:
+# - 1.1.1.1
+# - { server: 2.2.2.2, vrf: ansible }
+# - 3.3.3.3
+# provider: "{{ eapi }}"
+# register: result
+
+#- assert:
+# that:
+# - result.changed == false
+
+- name: remove one
+ eos_system:
+ name_servers:
+ - 1.1.1.1
+ - 2.2.2.2
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - result.commands|length == 1
+ - "'no ip name-server 3.3.3.3' in result.commands"
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain lookup source-interface
+ - no vrf definition ansible
+ match: none
+ provider: "{{ eapi }}"
+
+- debug: msg="END eapi/set_name_servers.yaml"