mirror of https://github.com/ansible/ansible.git
Fix nxos_overlay_global networking modules (#28943)
(cherry picked from commit 7292dd20ed
)
pull/30342/head
parent
ef9c3eb628
commit
0130da1773
@ -0,0 +1,2 @@
|
||||
---
|
||||
testcase: "*"
|
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_nxos_tests
|
@ -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
|
@ -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'] }
|
@ -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,24 @@
|
||||
---
|
||||
- name: "Unconfigure VDC setting limit-resource module-type f3"
|
||||
nxos_config:
|
||||
commands:
|
||||
- 'terminal dont-ask ; vdc {{ vdcid }} ; no limit-resource module-type f3'
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Previous command is asynchronous and can take a while. Allow time for it to complete
|
||||
pause:
|
||||
seconds: 45
|
||||
|
||||
- name: "Configure VDC setting allocate interface unallocated-interfaces"
|
||||
nxos_config: &allocate
|
||||
commands:
|
||||
- 'terminal dont-ask ; vdc {{ vdcid }} ; allocate interface unallocated-interfaces'
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Previous command is asynchronous can take a while. Allow time for it to complete
|
||||
pause:
|
||||
seconds: 45
|
@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: "Get default vdc id"
|
||||
nxos_command:
|
||||
commands: ['show vdc current-vdc | json']
|
||||
provider: "{{ connection }}"
|
||||
register: vdcout
|
||||
|
||||
- set_fact: vdcid="{{ vdcout.stdout_lines[0].name }}"
|
||||
|
||||
- name: "Configure VDC setting limit-resource module-type f3"
|
||||
nxos_config:
|
||||
commands:
|
||||
- "terminal dont-ask ; vdc {{ vdcid }} ; limit-resource module-type f3"
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Previous command is asynchronous and can take a while. Allow time for it to complete
|
||||
pause:
|
||||
seconds: 45
|
||||
|
||||
- name: "Configure VDC setting allocate interface unallocated-interfaces"
|
||||
nxos_config: &allocate
|
||||
commands:
|
||||
- "terminal dont-ask ; vdc {{ vdcid }} ; allocate interface unallocated-interfaces"
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Previous command is asynchronous and can take a while. Allow time for it to complete
|
||||
pause:
|
||||
seconds: 45
|
||||
|
||||
- name: "Configure Additional N7K requiste features"
|
||||
nxos_config:
|
||||
commands:
|
||||
- feature-set fabric
|
||||
- feature fabric forwarding
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ cli }}"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"
|
@ -0,0 +1,104 @@
|
||||
---
|
||||
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_overlay_global sanity test"
|
||||
|
||||
- set_fact: overlay_global_supported="false"
|
||||
- set_fact: overlay_global_supported="true"
|
||||
when: platform | search("N35NG|N7K|^N9K$") or
|
||||
(platform | match("N9k-F") and imagetag | version_compare('F3', 'ne'))
|
||||
|
||||
- debug: msg="Platform {{ platform }} running Image version {{ image_version }} supports nxos_overlay_global"
|
||||
when: overlay_global_supported
|
||||
|
||||
# Setup Block
|
||||
- block:
|
||||
- name: "Enable nv overlay evpn"
|
||||
nxos_evpn_global: &enable_evpn
|
||||
nv_overlay_evpn: true
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: "Apply N7K specific setup config"
|
||||
include: targets/nxos_overlay_global/tasks/platform/n7k/setup.yaml
|
||||
when: platform | match('N7K')
|
||||
|
||||
- name: "Configure Additional N7K requiste features"
|
||||
nxos_config:
|
||||
commands:
|
||||
- feature-set fabric
|
||||
- feature fabric forwarding
|
||||
match: none
|
||||
provider: "{{ connection }}"
|
||||
when: platform | match('N7K')
|
||||
|
||||
- name: "Remove possibly existing mac"
|
||||
nxos_overlay_global:
|
||||
anycast_gateway_mac: "default"
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
when: overlay_global_supported
|
||||
|
||||
# Test execution block
|
||||
- block:
|
||||
|
||||
- name: Configure overlay global
|
||||
nxos_overlay_global: &configure
|
||||
anycast_gateway_mac: "b.b.b"
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_overlay_global: *configure
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Update anycast gateway mac
|
||||
nxos_overlay_global: &update
|
||||
anycast_gateway_mac: "a.a.a"
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_overlay_global: *update
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
|
||||
- name: Remove anycast gateway mac
|
||||
nxos_overlay_global: &remove
|
||||
anycast_gateway_mac: "default"
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_overlay_global: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
when: overlay_global_supported
|
||||
|
||||
always:
|
||||
- name: "Apply N7K specific cleanup config"
|
||||
include: targets/nxos_overlay_global/tasks/platform/n7k/cleanup.yaml
|
||||
when: platform | match('N7K')
|
||||
|
||||
- name: "Disable nv overlay evpn"
|
||||
nxos_evpn_global: &disable_evpn
|
||||
nv_overlay_evpn: false
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
when: overlay_global_supported
|
||||
|
||||
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_overlay_global sanity test"
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
- set_fact: connection="{{ nxapi }}"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"
|
Loading…
Reference in New Issue