summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/nxos_igmp_interface
diff options
context:
space:
mode:
authorrahushen <rahul.shenoy.86@gmail.com>2017-10-25 17:41:23 +0200
committerNathaniel Case <this.is@nathanielca.se>2017-10-25 17:41:23 +0200
commitab84718a016daa65eca1d4f918b7e3d1bd43944f (patch)
tree6f0ffd5cb52f4ff38d0d36ec802c174646f38dcf /test/integration/targets/nxos_igmp_interface
parentAdd DO SSH key facts module to changelog (diff)
downloadansible-ab84718a016daa65eca1d4f918b7e3d1bd43944f.tar.xz
ansible-ab84718a016daa65eca1d4f918b7e3d1bd43944f.zip
NXOS: Integration tests to Ansible (part 3) (#29030)
* Add nxos_file_copy IT * Restructure nxos_igmp tests * add nxos_igmp_interface IT * add nxos_igmp_snooping IT * add nxos_ntp_auth IT * Add nxos_ntp_options IT * update nxos.yaml with new tests * update nxos_ntp_options test * update nxos_ntp_auth IT
Diffstat (limited to 'test/integration/targets/nxos_igmp_interface')
-rw-r--r--test/integration/targets/nxos_igmp_interface/defaults/main.yaml2
-rw-r--r--test/integration/targets/nxos_igmp_interface/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_igmp_interface/tasks/cli.yaml25
-rw-r--r--test/integration/targets/nxos_igmp_interface/tasks/main.yaml3
-rw-r--r--test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml38
-rw-r--r--test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml90
6 files changed, 160 insertions, 0 deletions
diff --git a/test/integration/targets/nxos_igmp_interface/defaults/main.yaml b/test/integration/targets/nxos_igmp_interface/defaults/main.yaml
new file mode 100644
index 0000000000..5f709c5aac
--- /dev/null
+++ b/test/integration/targets/nxos_igmp_interface/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: "*"
diff --git a/test/integration/targets/nxos_igmp_interface/meta/main.yml b/test/integration/targets/nxos_igmp_interface/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_igmp_interface/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml b/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml
new file mode 100644
index 0000000000..0ab3f8f908
--- /dev/null
+++ b/test/integration/targets/nxos_igmp_interface/tasks/cli.yaml
@@ -0,0 +1,25 @@
+---
+- name: collect common cli test cases
+ find:
+ paths: "{{ role_path }}/tests/common"
+ patterns: "{{ testcase }}.yaml"
+ register: test_cases
+
+- name: collect cli test cases
+ find:
+ paths: "{{ role_path }}/tests/cli"
+ patterns: "{{ testcase }}.yaml"
+ register: cli_cases
+
+- set_fact:
+ test_cases:
+ files: "{{ test_cases.files }} + {{ cli_cases.files }}"
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: run test case
+ include: "{{ test_case_to_run }} connection={{ cli }}"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/test/integration/targets/nxos_igmp_interface/tasks/main.yaml b/test/integration/targets/nxos_igmp_interface/tasks/main.yaml
new file mode 100644
index 0000000000..4b0f8c64d9
--- /dev/null
+++ b/test/integration/targets/nxos_igmp_interface/tasks/main.yaml
@@ -0,0 +1,3 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
+- { include: nxapi.yaml, tags: ['nxapi'] }
diff --git a/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml
new file mode 100644
index 0000000000..e071f293a2
--- /dev/null
+++ b/test/integration/targets/nxos_igmp_interface/tasks/nxapi.yaml
@@ -0,0 +1,38 @@
+---
+- name: collect common nxapi test cases
+ find:
+ paths: "{{ role_path }}/tests/common"
+ patterns: "{{ testcase }}.yaml"
+ register: test_cases
+
+- name: collect nxapi test cases
+ find:
+ paths: "{{ role_path }}/tests/nxapi"
+ patterns: "{{ testcase }}.yaml"
+ register: nxapi_cases
+
+- set_fact:
+ test_cases:
+ files: "{{ test_cases.files }} + {{ nxapi_cases.files }}"
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: enable nxapi
+ nxos_config:
+ lines:
+ - feature nxapi
+ - nxapi http port 80
+ provider: "{{ cli }}"
+
+- name: run test case
+ include: "{{ test_case_to_run }} connection={{ nxapi }}"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
+
+- name: disable nxapi
+ nxos_config:
+ lines:
+ - no feature nxapi
+ provider: "{{ cli }}"
diff --git a/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml b/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml
new file mode 100644
index 0000000000..6290687e9a
--- /dev/null
+++ b/test/integration/targets/nxos_igmp_interface/tests/common/sanity.yaml
@@ -0,0 +1,90 @@
+---
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp_interface sanity test"
+
+# Select interface for test
+- set_fact: intname="{{ nxos_int1 }}"
+
+- name: "Enable feature PIM"
+ nxos_feature:
+ feature: pim
+ state: enabled
+ provider: "{{ connection }}"
+ ignore_errors: yes
+
+- block:
+
+ - name: put interface in L3 and enable PIM
+ nxos_config:
+ commands:
+ - no switchport
+ - ip pim sparse-mode
+ parents:
+ - "interface {{ intname }}"
+ match: none
+ provider: "{{ connection }}"
+
+ - name: Configure igmp interface with non-default values
+ nxos_igmp_interface: &non-default
+ interface: "{{ intname }}"
+ version: 3
+ startup_query_interval: 60
+ startup_query_count: 5
+ robustness: 6
+ querier_timeout: 2000
+ query_mrt: 12
+ query_interval: 200
+ last_member_qrt: 2
+ last_member_query_count: 4
+ report_llg: true
+ immediate_leave: true
+ restart: false
+ state: present
+ provider: "{{ connection }}"
+ register: result
+
+ - assert: &true
+ that:
+ - "result.changed == true"
+
+ - name: "Check Idempotence - Configure igmp interface with non-default values"
+ nxos_igmp_interface: *non-default
+ register: result
+
+ - assert: &false
+ that:
+ - "result.changed == false"
+
+ - name: Configure igmp interface with default value
+ nxos_igmp_interface: &default
+ interface: "{{ intname }}"
+ state: default
+ provider: "{{ connection }}"
+ register: result
+
+ - assert: *true
+
+ - name: "Check Idempotence - Configure igmp interface with default value"
+ nxos_igmp_interface: *default
+ register: result
+
+ - assert: *false
+
+ always:
+ - name: Configure igmp interface with default value
+ nxos_igmp_interface: *default
+ register: result
+
+ - name: Put interface in default mode
+ nxos_config:
+ commands:
+ - "default interface {{ intname }}"
+ provider: "{{ connection }}"
+ match: none
+
+ - name: "Disable feature PIM"
+ nxos_feature:
+ feature: pim
+ state: disabled
+ provider: "{{ connection }}"
+
+ - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp_interface sanity test"