mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
nxos_vxlan_vtep fixes and integration tests (#27405)
* fix issue 27404 * conflict resolve
This commit is contained in:
@@ -213,6 +213,15 @@
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_portchannel' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_vxlan_vtep
|
||||
when: "limit_to in ['*', 'nxos_vxlan_vtep']"
|
||||
rescue:
|
||||
- set_fact:
|
||||
failed_modules: "{{ failed_modules }} + [ 'nxos_vxlan_vtep' ]"
|
||||
test_failed: true
|
||||
|
||||
- block:
|
||||
- include_role:
|
||||
name: nxos_logging
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
||||
2
test/integration/targets/nxos_vxlan_vtep/meta/main.yml
Normal file
2
test/integration/targets/nxos_vxlan_vtep/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
||||
15
test/integration/targets/nxos_vxlan_vtep/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_vxlan_vtep/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
|
||||
3
test/integration/targets/nxos_vxlan_vtep/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_vxlan_vtep/tasks/main.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
||||
28
test/integration/targets/nxos_vxlan_vtep/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_vxlan_vtep/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 }}"
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: targets/nxos_vxlan_vtep/tests/common/sanity.yaml
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
- - debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep sanity test"
|
||||
|
||||
- block:
|
||||
- name: "Enable feature nv overlay"
|
||||
nxos_config:
|
||||
commands:
|
||||
- feature nv overlay
|
||||
provider: "{{ connection }}"
|
||||
match: none
|
||||
|
||||
- name: configure vxlan_vtep
|
||||
nxos_vxlan_vtep: &configure
|
||||
interface: nve1
|
||||
description: default
|
||||
host_reachability: true
|
||||
source_interface: Loopback0
|
||||
source_interface_hold_down_time: 30
|
||||
shutdown: true
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vxlan_vtep: *configure
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: remove vxlan_vtep
|
||||
nxos_vxlan_vtep: &remove
|
||||
interface: nve1
|
||||
description: default
|
||||
host_reachability: true
|
||||
source_interface: Loopback0
|
||||
source_interface_hold_down_time: 30
|
||||
shutdown: true
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Remove Idempotence"
|
||||
nxos_vxlan_vtep: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
when: (platform | search('N9K'))
|
||||
|
||||
always:
|
||||
- name: "Disable feature nv overlay"
|
||||
nxos_feature:
|
||||
feature: nve
|
||||
state: disabled
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep sanity test"
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: targets/nxos_vxlan_vtep/tests/common/sanity.yaml
|
||||
Reference in New Issue
Block a user