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
This commit is contained in:
parent
279b7ce671
commit
ab84718a01
37 changed files with 903 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_file_copy/meta/main.yml
Normal file
2
test/integration/targets/nxos_file_copy/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
25
test/integration/targets/nxos_file_copy/tasks/cli.yaml
Normal file
25
test/integration/targets/nxos_file_copy/tasks/cli.yaml
Normal file
|
@ -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
|
3
test/integration/targets/nxos_file_copy/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_file_copy/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
38
test/integration/targets/nxos_file_copy/tasks/nxapi.yaml
Normal file
38
test/integration/targets/nxos_file_copy/tasks/nxapi.yaml
Normal file
|
@ -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 }}"
|
|
@ -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"
|
|
@ -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"
|
|
@ -1,15 +1,25 @@
|
|||
---
|
||||
- name: collect all cli test cases
|
||||
- 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: test_cases
|
||||
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
|
||||
|
|
|
@ -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'] }
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
---
|
||||
- name: collect all nxapi test cases
|
||||
- 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: test_cases
|
||||
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
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_igmp/tests/common/sanity.yaml
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
25
test/integration/targets/nxos_igmp_interface/tasks/cli.yaml
Normal file
25
test/integration/targets/nxos_igmp_interface/tasks/cli.yaml
Normal file
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
|
@ -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 }}"
|
|
@ -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"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
25
test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml
Normal file
25
test/integration/targets/nxos_igmp_snooping/tasks/cli.yaml
Normal file
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
38
test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml
Normal file
38
test/integration/targets/nxos_igmp_snooping/tasks/nxapi.yaml
Normal file
|
@ -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 }}"
|
|
@ -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"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_ntp_auth/meta/main.yml
Normal file
2
test/integration/targets/nxos_ntp_auth/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
25
test/integration/targets/nxos_ntp_auth/tasks/cli.yaml
Normal file
25
test/integration/targets/nxos_ntp_auth/tasks/cli.yaml
Normal file
|
@ -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
|
3
test/integration/targets/nxos_ntp_auth/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_ntp_auth/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
38
test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml
Normal file
38
test/integration/targets/nxos_ntp_auth/tasks/nxapi.yaml
Normal file
|
@ -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 }}"
|
|
@ -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"
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_ntp_options/meta/main.yml
Normal file
2
test/integration/targets/nxos_ntp_options/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
25
test/integration/targets/nxos_ntp_options/tasks/cli.yaml
Normal file
25
test/integration/targets/nxos_ntp_options/tasks/cli.yaml
Normal file
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
38
test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml
Normal file
38
test/integration/targets/nxos_ntp_options/tasks/nxapi.yaml
Normal file
|
@ -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 }}"
|
|
@ -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"
|
Loading…
Reference in a new issue