mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 20:13:59 -07:00
fix for nxos_ospf_vrf invalid cmd and ntp errors (#27977)
* fix for nxos_ospf_vrf invalid cmd * fix for nxos_ntp issues
This commit is contained in:
parent
19a6000d97
commit
9d84a4e530
20 changed files with 271 additions and 13 deletions
2
test/integration/targets/nxos_ntp/defaults/main.yaml
Normal file
2
test/integration/targets/nxos_ntp/defaults/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_ntp/meta/main.yml
Normal file
2
test/integration/targets/nxos_ntp/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
15
test/integration/targets/nxos_ntp/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_ntp/tasks/cli.yaml
Normal file
|
@ -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
|
7
test/integration/targets/nxos_ntp/tasks/main.yaml
Normal file
7
test/integration/targets/nxos_ntp/tasks/main.yaml
Normal file
|
@ -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'] }
|
28
test/integration/targets/nxos_ntp/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_ntp/tasks/nxapi.yaml
Normal file
|
@ -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 }}"
|
4
test/integration/targets/nxos_ntp/tests/cli/sanity.yaml
Normal file
4
test/integration/targets/nxos_ntp/tests/cli/sanity.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_ntp/tests/common/sanity.yaml
|
56
test/integration/targets/nxos_ntp/tests/common/sanity.yaml
Normal file
56
test/integration/targets/nxos_ntp/tests/common/sanity.yaml
Normal file
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_ntp sanity test"
|
||||
|
||||
- name: Setup - Remove ntp if configured
|
||||
nxos_ntp: &remove
|
||||
server: 1.2.3.4
|
||||
key_id: 32
|
||||
prefer: disabled
|
||||
vrf_name: management
|
||||
source_addr: 5.5.5.5
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
|
||||
- name: Configure ntp
|
||||
nxos_ntp: &config
|
||||
server: 1.2.3.4
|
||||
key_id: 32
|
||||
prefer: enabled
|
||||
vrf_name: management
|
||||
source_addr: 5.5.5.5
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: Idempotence Check
|
||||
nxos_ntp: *config
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Remove ntp config
|
||||
nxos_ntp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: Remove Idempotence Check
|
||||
nxos_ntp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: Remove ntp config
|
||||
nxos_ntp: *remove
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_ntp sanity test"
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_ntp/tests/common/sanity.yaml
|
Loading…
Add table
Add a link
Reference in a new issue