From 065c80c0810d99e6a1bae6cb65e0e8dfd4785f34 Mon Sep 17 00:00:00 2001 From: rahushen Date: Mon, 14 Aug 2017 11:58:09 -0400 Subject: [PATCH] Add nxos_igmp IT (#28020) --- .../targets/nxos_igmp/defaults/main.yaml | 2 + .../targets/nxos_igmp/meta/main.yml | 2 + .../targets/nxos_igmp/tasks/cli.yaml | 15 ++++++ .../targets/nxos_igmp/tasks/main.yaml | 7 +++ .../targets/nxos_igmp/tasks/nxapi.yaml | 28 +++++++++++ .../targets/nxos_igmp/tests/cli/sanity.yaml | 4 ++ .../nxos_igmp/tests/common/sanity.yaml | 46 +++++++++++++++++++ .../targets/nxos_igmp/tests/nxapi/sanity.yaml | 4 ++ 8 files changed, 108 insertions(+) create mode 100644 test/integration/targets/nxos_igmp/defaults/main.yaml create mode 100644 test/integration/targets/nxos_igmp/meta/main.yml create mode 100644 test/integration/targets/nxos_igmp/tasks/cli.yaml create mode 100644 test/integration/targets/nxos_igmp/tasks/main.yaml create mode 100644 test/integration/targets/nxos_igmp/tasks/nxapi.yaml create mode 100644 test/integration/targets/nxos_igmp/tests/cli/sanity.yaml create mode 100644 test/integration/targets/nxos_igmp/tests/common/sanity.yaml create mode 100644 test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml diff --git a/test/integration/targets/nxos_igmp/defaults/main.yaml b/test/integration/targets/nxos_igmp/defaults/main.yaml new file mode 100644 index 0000000000..5f709c5aac --- /dev/null +++ b/test/integration/targets/nxos_igmp/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/test/integration/targets/nxos_igmp/meta/main.yml b/test/integration/targets/nxos_igmp/meta/main.yml new file mode 100644 index 0000000000..ae741cbdc7 --- /dev/null +++ b/test/integration/targets/nxos_igmp/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_igmp/tasks/cli.yaml b/test/integration/targets/nxos_igmp/tasks/cli.yaml new file mode 100644 index 0000000000..d675462dd0 --- /dev/null +++ b/test/integration/targets/nxos_igmp/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/nxos_igmp/tasks/main.yaml b/test/integration/targets/nxos_igmp/tasks/main.yaml new file mode 100644 index 0000000000..fea9337c14 --- /dev/null +++ b/test/integration/targets/nxos_igmp/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +# Use block to ensure that both cli and nxapi tests +# will run even if there are failures or errors. +- block: + - { include: cli.yaml, tags: ['cli'] } + always: + - { include: nxapi.yaml, tags: ['nxapi'] } diff --git a/test/integration/targets/nxos_igmp/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml new file mode 100644 index 0000000000..ea525379f7 --- /dev/null +++ b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml @@ -0,0 +1,28 @@ +--- +- name: collect all nxapi test cases + find: + paths: "{{ role_path }}/tests/nxapi" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- 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 }}" + 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/tests/cli/sanity.yaml b/test/integration/targets/nxos_igmp/tests/cli/sanity.yaml new file mode 100644 index 0000000000..6417e21c08 --- /dev/null +++ b/test/integration/targets/nxos_igmp/tests/cli/sanity.yaml @@ -0,0 +1,4 @@ +--- +- set_fact: connection="{{ cli }}" + +- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml diff --git a/test/integration/targets/nxos_igmp/tests/common/sanity.yaml b/test/integration/targets/nxos_igmp/tests/common/sanity.yaml new file mode 100644 index 0000000000..2e2a4fbd6f --- /dev/null +++ b/test/integration/targets/nxos_igmp/tests/common/sanity.yaml @@ -0,0 +1,46 @@ +--- +- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp sanity test" + +- block: + + - name: Configure igmp with non-default values + nxos_igmp: &non-default + flush_routes: true + enforce_rtr_alert: 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: *non-default + register: result + + - assert: &false + that: + - "result.changed == false" + + - name: Configure igmp with default values + nxos_igmp: &default + state: default + provider: "{{ connection }}" + register: result + + - assert: *true + + - name: "Check Idempotence - Configure igmp with default values" + nxos_igmp: *default + register: result + + - assert: *false + + always: + - name: Configure igmp with default values + nxos_igmp: *default + register: result + + - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp sanity test" diff --git a/test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml new file mode 100644 index 0000000000..39aa2810b2 --- /dev/null +++ b/test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml @@ -0,0 +1,4 @@ +--- +- set_fact: connection="{{ nxapi }}" + +- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml