diff --git a/test/integration/nxos.yaml b/test/integration/nxos.yaml index c79969eea39..cff1ad08ee9 100644 --- a/test/integration/nxos.yaml +++ b/test/integration/nxos.yaml @@ -311,6 +311,60 @@ failed_modules: "{{ failed_modules }} + [ 'nxos_ip_interface' ]" test_failed: true + - block: + - include_role: + name: nxos_file_copy + when: "limit_to in ['*', 'nxos_file_copy']" + rescue: + - set_fact: + failed_modules: "{{ failed_modules }} + [ 'nxos_file_copy' ]" + test_failed: true + + - block: + - include_role: + name: nxos_igmp_interface + when: "limit_to in ['*', 'nxos_igmp_interface']" + rescue: + - set_fact: + failed_modules: "{{ failed_modules }} + [ 'nxos_igmp_interface' ]" + test_failed: true + + - block: + - include_role: + name: nxos_igmp + when: "limit_to in ['*', 'nxos_igmp']" + rescue: + - set_fact: + failed_modules: "{{ failed_modules }} + [ 'nxos_igmp' ]" + test_failed: true + + - block: + - include_role: + name: nxos_igmp_snooping + when: "limit_to in ['*', 'nxos_igmp_snooping']" + rescue: + - set_fact: + failed_modules: "{{ failed_modules }} + [ 'nxos_igmp_snooping' ]" + test_failed: true + + - block: + - include_role: + name: nxos_ntp_auth + when: "limit_to in ['*', 'nxos_ntp_auth']" + rescue: + - set_fact: + failed_modules: "{{ failed_modules }} + [ 'nxos_ntp_auth' ]" + test_failed: true + + - block: + - include_role: + name: nxos_ntp_options + when: "limit_to in ['*', 'nxos_ntp_options']" + rescue: + - set_fact: + failed_modules: "{{ failed_modules }} + [ 'nxos_ntp_options' ]" + test_failed: true + - block: - include_role: name: nxos_logging diff --git a/test/integration/targets/nxos_file_copy/defaults/main.yaml b/test/integration/targets/nxos_file_copy/defaults/main.yaml new file mode 100644 index 00000000000..5f709c5aac1 --- /dev/null +++ b/test/integration/targets/nxos_file_copy/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/test/integration/targets/nxos_file_copy/meta/main.yml b/test/integration/targets/nxos_file_copy/meta/main.yml new file mode 100644 index 00000000000..ae741cbdc71 --- /dev/null +++ b/test/integration/targets/nxos_file_copy/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_file_copy/tasks/cli.yaml b/test/integration/targets/nxos_file_copy/tasks/cli.yaml new file mode 100644 index 00000000000..0ab3f8f9086 --- /dev/null +++ b/test/integration/targets/nxos_file_copy/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_file_copy/tasks/main.yaml b/test/integration/targets/nxos_file_copy/tasks/main.yaml new file mode 100644 index 00000000000..4b0f8c64d90 --- /dev/null +++ b/test/integration/targets/nxos_file_copy/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- { include: cli.yaml, tags: ['cli'] } +- { include: nxapi.yaml, tags: ['nxapi'] } diff --git a/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml b/test/integration/targets/nxos_file_copy/tasks/nxapi.yaml new file mode 100644 index 00000000000..e071f293a2b --- /dev/null +++ b/test/integration/targets/nxos_file_copy/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_file_copy/tests/cli/sanity.yaml b/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml new file mode 100644 index 00000000000..b621782796f --- /dev/null +++ b/test/integration/targets/nxos_file_copy/tests/cli/sanity.yaml @@ -0,0 +1,84 @@ +--- +- debug: msg="START TRANSPORT:CLI nxos_file_copy sanity test" + +- name: "Setup - Remove existing file" + nxos_command: &remove_file + commands: + - terminal dont-ask + - delete nxos.yaml + provider: "{{ cli }}" + ignore_errors: yes + +- name: "Setup - Turn on feature scp-server" + nxos_feature: + feature: scp-server + state: enabled + provider: "{{ cli }}" + +- block: + - name: "Copy nxos.yaml to bootflash" + nxos_file_copy: ©_file_same_name + local_file: "./nxos.yaml" + file_system: "bootflash:" + provider: "{{ cli }}" + username: "{{ nxos_cli_user | default('admin') }}" + password: "{{ nxos_cli_pass | default('admin') }}" + host: "{{ inventory_hostname }}" + register: result + + - assert: &true + that: + - "result.changed == true" + + - name: "Check Idempotence - Copy nxos.yaml to bootflash" + nxos_file_copy: *copy_file_same_name + register: result + + - assert: &false + that: + - "result.changed == false" + + - name: "Setup - Remove existing file" + nxos_command: *remove_file + register: result + + - name: "Copy ios.yaml to bootflash as another name" + nxos_file_copy: ©_file_different_name + local_file: "./ios.yaml" + remote_file: "nxos.yaml" + file_system: "bootflash:" + provider: "{{ cli }}" + username: "{{ nxos_cli_user | default('admin') }}" + password: "{{ nxos_cli_pass | default('admin') }}" + host: "{{ inventory_hostname }}" + register: result + + - assert: *true + + - name: "Check Idempotence - Copy ios.yaml to bootflash as another name" + nxos_file_copy: *copy_file_different_name + register: result + + - assert: *false + + - name: "Setup - Remove existing file" + nxos_command: *remove_file + register: result + + rescue: + + - debug: msg="TRANSPORT:CLI nxos_file_copy failure detected" + + always: + + - name: "Remove file" + nxos_command: *remove_file + ignore_errors: yes + + - name: "Turn off feature scp-server" + nxos_feature: + feature: scp-server + state: disabled + provider: "{{ cli }}" + + - debug: msg="END TRANSPORT:CLI nxos_file_copy sanity test" diff --git a/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml new file mode 100644 index 00000000000..e9f2c8796e8 --- /dev/null +++ b/test/integration/targets/nxos_file_copy/tests/nxapi/sanity.yaml @@ -0,0 +1,88 @@ +--- +- debug: msg="START TRANSPORT:NXAPI nxos_file_copy sanity test" + +- name: "Setup - Remove existing file" + nxos_command: &remove_file + commands: + - command: terminal dont-ask + output: text + - command: delete nxos.yaml + output: text + provider: "{{ nxapi }}" + ignore_errors: yes + +- name: "Setup - Turn on feature scp-server" + nxos_feature: + feature: scp-server + state: enabled + provider: "{{ nxapi }}" + +- block: + - name: "Copy nxos.yaml to bootflash" + nxos_file_copy: ©_file_same_name + local_file: "./nxos.yaml" + file_system: "bootflash:" + provider: "{{ nxapi }}" + username: "{{ nxos_nxapi_user | default('admin') }}" + password: "{{ nxos_nxapi_pass | default('admin') }}" + host: "{{ inventory_hostname }}" + register: result + + - assert: &true + that: + - "result.changed == true" + + - name: "Check Idempotence - Copy nxos.yaml to bootflash" + nxos_file_copy: *copy_file_same_name + register: result + + - assert: &false + that: + - "result.changed == false" + + - name: "Setup - Remove existing file" + nxos_command: *remove_file + register: result + ignore_errors: yes + + - name: "Copy ios.yaml to bootflash as another name" + nxos_file_copy: ©_file_different_name + local_file: "./ios.yaml" + remote_file: "nxos.yaml" + file_system: "bootflash:" + provider: "{{ nxapi }}" + username: "{{ nxos_nxapi_user | default('admin') }}" + password: "{{ nxos_nxapi_pass | default('admin') }}" + host: "{{ inventory_hostname }}" + register: result + + - assert: *true + + - name: "Check Idempotence - Copy ios.yaml to bootflash as another name" + nxos_file_copy: *copy_file_different_name + register: result + + - assert: *false + + - name: "Setup - Remove existing file" + nxos_command: *remove_file + register: result + ignore_errors: yes + + rescue: + + - debug: msg="TRANSPORT:NXAPI nxos_file_copy failure detected" + + always: + + - name: "Remove file" + nxos_command: *remove_file + ignore_errors: yes + + - name: "Turn off feature scp-server" + nxos_feature: + feature: scp-server + state: disabled + provider: "{{ nxapi }}" + + - debug: msg="END TRANSPORT:NXAPI nxos_file_copy sanity test" diff --git a/test/integration/targets/nxos_igmp/tasks/cli.yaml b/test/integration/targets/nxos_igmp/tasks/cli.yaml index d675462dd02..0ab3f8f9086 100644 --- a/test/integration/targets/nxos_igmp/tasks/cli.yaml +++ b/test/integration/targets/nxos_igmp/tasks/cli.yaml @@ -1,15 +1,25 @@ --- -- name: collect all cli test cases +- name: collect common cli test cases find: - paths: "{{ role_path }}/tests/cli" + 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 }}" + 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/tasks/main.yaml b/test/integration/targets/nxos_igmp/tasks/main.yaml index fea9337c14c..4b0f8c64d90 100644 --- a/test/integration/targets/nxos_igmp/tasks/main.yaml +++ b/test/integration/targets/nxos_igmp/tasks/main.yaml @@ -1,7 +1,3 @@ --- -# 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'] } +- { include: cli.yaml, tags: ['cli'] } +- { 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 index 148d8d64862..378db2f016e 100644 --- a/test/integration/targets/nxos_igmp/tasks/nxapi.yaml +++ b/test/integration/targets/nxos_igmp/tasks/nxapi.yaml @@ -1,15 +1,25 @@ --- -- name: collect all nxapi test cases +- name: collect common nxapi test cases find: - paths: "{{ role_path }}/tests/nxapi" + 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: run test case - include: "{{ test_case_to_run }}" + include: "{{ test_case_to_run }} connection={{ nxapi }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_igmp/tests/cli/sanity.yaml b/test/integration/targets/nxos_igmp/tests/cli/sanity.yaml deleted file mode 100644 index 6417e21c08f..00000000000 --- a/test/integration/targets/nxos_igmp/tests/cli/sanity.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- set_fact: connection="{{ cli }}" - -- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml diff --git a/test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml deleted file mode 100644 index 39aa2810b21..00000000000 --- a/test/integration/targets/nxos_igmp/tests/nxapi/sanity.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- set_fact: connection="{{ nxapi }}" - -- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml 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 00000000000..5f709c5aac1 --- /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 00000000000..ae741cbdc71 --- /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 00000000000..0ab3f8f9086 --- /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 00000000000..4b0f8c64d90 --- /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 00000000000..e071f293a2b --- /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 00000000000..6290687e9ae --- /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" diff --git a/test/integration/targets/nxos_igmp_snooping/defaults/main.yaml b/test/integration/targets/nxos_igmp_snooping/defaults/main.yaml new file mode 100644 index 00000000000..5f709c5aac1 --- /dev/null +++ b/test/integration/targets/nxos_igmp_snooping/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/test/integration/targets/nxos_igmp_snooping/meta/main.yml b/test/integration/targets/nxos_igmp_snooping/meta/main.yml new file mode 100644 index 00000000000..ae741cbdc71 --- /dev/null +++ b/test/integration/targets/nxos_igmp_snooping/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml b/test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml new file mode 100644 index 00000000000..0ab3f8f9086 --- /dev/null +++ b/test/integration/targets/nxos_igmp_snooping/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_snooping/tasks/main.yaml b/test/integration/targets/nxos_igmp_snooping/tasks/main.yaml new file mode 100644 index 00000000000..4b0f8c64d90 --- /dev/null +++ b/test/integration/targets/nxos_igmp_snooping/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_snooping/tasks/nxapi.yaml b/test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml new file mode 100644 index 00000000000..e071f293a2b --- /dev/null +++ b/test/integration/targets/nxos_igmp_snooping/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_snooping/tests/common/sanity.yaml b/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml new file mode 100644 index 00000000000..e6691d320bd --- /dev/null +++ b/test/integration/targets/nxos_igmp_snooping/tests/common/sanity.yaml @@ -0,0 +1,48 @@ +--- +- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_igmp_snooping sanity test" + +- block: + + - name: Configure igmp snooping with non-default values + nxos_igmp_snooping: &non-default + snooping: true + group_timeout: never + link_local_grp_supp: true + report_supp: true + v3_report_supp: true + state: present + provider: "{{ connection }}" + register: result + + - assert: &true + that: + - "result.changed == true" + + - name: "Check Idempotence - Configure igmp snooping with non-default values" + nxos_igmp_snooping: *non-default + register: result + + - assert: &false + that: + - "result.changed == false" + + - name: Configure igmp snooping with default values + nxos_igmp_snooping: &default + state: default + provider: "{{ connection }}" + register: result + + - assert: *true + + - name: "Check Idempotence - Configure igmp snooping with default values" + nxos_igmp_snooping: *default + register: result + + - assert: *false + + always: + - name: Configure igmp snooping with default values + nxos_igmp_snooping: *default + register: result + + - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_igmp_snooping sanity test" diff --git a/test/integration/targets/nxos_ntp_auth/defaults/main.yaml b/test/integration/targets/nxos_ntp_auth/defaults/main.yaml new file mode 100644 index 00000000000..5f709c5aac1 --- /dev/null +++ b/test/integration/targets/nxos_ntp_auth/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/test/integration/targets/nxos_ntp_auth/meta/main.yml b/test/integration/targets/nxos_ntp_auth/meta/main.yml new file mode 100644 index 00000000000..ae741cbdc71 --- /dev/null +++ b/test/integration/targets/nxos_ntp_auth/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_ntp_auth/tasks/cli.yaml b/test/integration/targets/nxos_ntp_auth/tasks/cli.yaml new file mode 100644 index 00000000000..0ab3f8f9086 --- /dev/null +++ b/test/integration/targets/nxos_ntp_auth/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_ntp_auth/tasks/main.yaml b/test/integration/targets/nxos_ntp_auth/tasks/main.yaml new file mode 100644 index 00000000000..4b0f8c64d90 --- /dev/null +++ b/test/integration/targets/nxos_ntp_auth/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- { include: cli.yaml, tags: ['cli'] } +- { include: nxapi.yaml, tags: ['nxapi'] } diff --git a/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml b/test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml new file mode 100644 index 00000000000..e071f293a2b --- /dev/null +++ b/test/integration/targets/nxos_ntp_auth/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_ntp_auth/tests/common/sanity.yaml b/test/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml new file mode 100644 index 00000000000..cf7877c9a95 --- /dev/null +++ b/test/integration/targets/nxos_ntp_auth/tests/common/sanity.yaml @@ -0,0 +1,87 @@ +--- +- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ntp_auth sanity test" + +- name: Configure text ntp authentication + nxos_ntp_auth: &setup + key_id: 32 + md5string: hello + state: absent + provider: "{{ connection }}" + ignore_errors: yes + +- block: + + - name: Configure text ntp authentication + nxos_ntp_auth: &configure_text + key_id: 32 + md5string: hello + auth_type: text + trusted_key: true + authentication: on + state: present + provider: "{{ connection }}" + register: result + + - assert: &true + that: + - "result.changed == true" + + - name: "Check Idempotence - Configure text ntp authentication" + nxos_ntp_auth: *configure_text + register: result + + - assert: &false + that: + - "result.changed == false" + + - name: Remove text ntp authentication + nxos_ntp_auth: &remove_text + key_id: 32 + md5string: hello + auth_type: text + trusted_key: true + authentication: on + state: absent + provider: "{{ connection }}" + register: result + + - assert: *true + + - name: Configure encrypt ntp authentication + nxos_ntp_auth: &configure_encrypt + key_id: 32 + md5string: hello + auth_type: encrypt + trusted_key: true + authentication: on + state: present + provider: "{{ connection }}" + register: result + + - assert: *true + + - name: "Check Idempotence - Configure encrypt ntp authentication" + nxos_ntp_auth: *configure_encrypt + register: result + + - assert: *false + + - name: Remove encrypt ntp authentication + nxos_ntp_auth: &remove_encrypt + key_id: 32 + md5string: hello + auth_type: encrypt + trusted_key: true + authentication: on + state: absent + provider: "{{ connection }}" + register: result + + - assert: *true + + always: + - name: Cleanup ntp auth config + nxos_ntp_auth: *setup + ignore_errors: yes + + - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ntp_auth sanity test" diff --git a/test/integration/targets/nxos_ntp_options/defaults/main.yaml b/test/integration/targets/nxos_ntp_options/defaults/main.yaml new file mode 100644 index 00000000000..5f709c5aac1 --- /dev/null +++ b/test/integration/targets/nxos_ntp_options/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: "*" diff --git a/test/integration/targets/nxos_ntp_options/meta/main.yml b/test/integration/targets/nxos_ntp_options/meta/main.yml new file mode 100644 index 00000000000..ae741cbdc71 --- /dev/null +++ b/test/integration/targets/nxos_ntp_options/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_ntp_options/tasks/cli.yaml b/test/integration/targets/nxos_ntp_options/tasks/cli.yaml new file mode 100644 index 00000000000..0ab3f8f9086 --- /dev/null +++ b/test/integration/targets/nxos_ntp_options/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_ntp_options/tasks/main.yaml b/test/integration/targets/nxos_ntp_options/tasks/main.yaml new file mode 100644 index 00000000000..4b0f8c64d90 --- /dev/null +++ b/test/integration/targets/nxos_ntp_options/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- { include: cli.yaml, tags: ['cli'] } +- { include: nxapi.yaml, tags: ['nxapi'] } diff --git a/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml b/test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml new file mode 100644 index 00000000000..e071f293a2b --- /dev/null +++ b/test/integration/targets/nxos_ntp_options/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_ntp_options/tests/common/sanity.yaml b/test/integration/targets/nxos_ntp_options/tests/common/sanity.yaml new file mode 100644 index 00000000000..000096c3097 --- /dev/null +++ b/test/integration/targets/nxos_ntp_options/tests/common/sanity.yaml @@ -0,0 +1,74 @@ +--- +- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ntp_options sanity test" + +- name: "Apply default ntp config" + nxos_ntp_options: &default + state: absent + provider: "{{ connection }}" + ignore_errors: yes + +- block: + + - name: Configure ntp with master and default stratum + nxos_ntp_options: &configure_master_default_stratum + master: true + logging: true + state: present + provider: "{{ connection }}" + register: result + + - assert: &true + that: + - "result.changed == true" + + - name: "Check Idempotence - Configure ntp with master and default stratum" + nxos_ntp_options: *configure_master_default_stratum + register: result + + - assert: &false + that: + - "result.changed == false" + + - name: Remove ntp with master and default stratum + nxos_ntp_options: &remove_master_default_stratum + logging: true + master: true + state: absent + provider: "{{ connection }}" + register: result + + - assert: *true + + - name: Configure ntp with master and non-default stratum + nxos_ntp_options: &configure_master_non_default_stratum + master: true + logging: true + stratum: 10 + state: present + provider: "{{ connection }}" + register: result + + - assert: *true + + - name: "Check Idempotence - Configure ntp with master and non-default stratum" + nxos_ntp_options: *configure_master_non_default_stratum + register: result + + - assert: *false + + - name: Remove ntp with master and non-default stratum + nxos_ntp_options: &remove_master_non_default_stratum + logging: true + master: true + state: absent + provider: "{{ connection }}" + register: result + + - assert: *true + + always: + - name: Cleanup ntp config + nxos_ntp_options: *default + register: result + + - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ntp_options sanity test"