Integration Tests only: nxos_udld, nxos_udld_interface, nxos_vxlan_vtep_vni (#29143)

* it cases for vxlan_vtep_vni, udld

* platform specific testing

* fix vxlan_vtep for n7k

* fix udld_intf setup

* skip udld tests on titanium n7k

* remove hardcoding

* fix udld tests for titanium
pull/27005/merge
saichint 7 years ago committed by Trishna Guha
parent ba0aade8f4
commit aef50eaa40

@ -78,6 +78,33 @@
failed_modules: "{{ failed_modules }} + [ 'nxos_feature' ]" failed_modules: "{{ failed_modules }} + [ 'nxos_feature' ]"
test_failed: true test_failed: true
- block:
- include_role:
name: nxos_udld
when: "limit_to in ['*', 'nxos_udld']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'nxos_udld' ]"
test_failed: true
- block:
- include_role:
name: nxos_udld_interface
when: "limit_to in ['*', 'nxos_udld_interface']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'nxos_udld_interface' ]"
test_failed: true
- block:
- include_role:
name: nxos_vxlan_vtep_vni
when: "limit_to in ['*', 'nxos_vxlan_vtep_vni']"
rescue:
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'nxos_vxlan_vtep_vni' ]"
test_failed: true
- block: - block:
- include_role: - include_role:
name: nxos_mtu name: nxos_mtu

@ -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,4 @@
---
- set_fact: connection="{{ cli }}"
- import_tasks: targets/nxos_udld/tests/common/sanity.yaml

@ -0,0 +1,67 @@
---
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_udld sanity test"
- set_fact: udld_run="true"
- set_fact: udld_run="false"
when: ((platform | search('N9K-F')) and (imagetag and (imagetag | version_compare('F3', 'lt'))))
- set_fact: udld_run="false"
when: titanium
- block:
- name: "Enable feature udld"
nxos_feature:
feature: udld
state: enabled
provider: "{{ connection }}"
- name: Reset udld
nxos_udld:
reset: True
provider: "{{ connection }}"
- name: Ensure udld agg mode is globally disabled and msg time is 20
nxos_udld: &conf1
aggressive: disabled
msg_time: 20
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf1 Idempotence"
nxos_udld: *conf1
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure udld agg mode is globally enabled and msg time is 15
nxos_udld: &conf2
aggressive: enabled
msg_time: 15
provider: "{{ connection }}"
register: result
- assert: *true
- name: "conf2 Idempotence"
nxos_udld: *conf2
register: result
- assert: *false
when: udld_run
always:
- name: "Disable udld"
nxos_feature:
feature: udld
state: disabled
provider: "{{ connection }}"
ignore_errors: yes
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_udld sanity test"

@ -0,0 +1,4 @@
---
- set_fact: connection="{{ nxapi }}"
- import_tasks: targets/nxos_udld/tests/common/sanity.yaml

@ -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,4 @@
---
- set_fact: connection="{{ cli }}"
- import_tasks: targets/nxos_udld_interface/tests/common/sanity.yaml

@ -0,0 +1,74 @@
---
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_udld_interface sanity test"
- set_fact: udld_run="true"
- set_fact: udld_run="false"
when: ((platform | search('N9K-F')) and (imagetag and (imagetag | version_compare('F3', 'lt'))))
- set_fact: udld_run="false"
when: titanium
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
- block:
- name: "Enable feature udld"
nxos_feature:
feature: udld
state: enabled
provider: "{{ connection }}"
- name: "put the interface into default state"
nxos_config:
commands:
- "default interface {{intname}}"
provider: "{{ connection }}"
match: none
- name: ensure interface is configured to be in aggressive mode
nxos_udld_interface: &conf1
interface: "{{ intname }}"
mode: aggressive
state: present
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf1 Idempotence"
nxos_udld_interface: *conf1
register: result
- assert: &false
that:
- "result.changed == false"
- name: ensure interface has mode enabled
nxos_udld_interface: &conf2
interface: "{{ intname }}"
mode: enabled
state: present
provider: "{{ connection }}"
register: result
- assert: *true
- name: Remove the config
nxos_udld_interface: &remove
interface: "{{ intname }}"
mode: enabled
state: absent
provider: "{{ connection }}"
when: udld_run
always:
- name: "Disable udld"
nxos_feature:
feature: udld
state: disabled
provider: "{{ connection }}"
ignore_errors: yes
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_udld_interface sanity test"

@ -0,0 +1,4 @@
---
- set_fact: connection="{{ nxapi }}"
- import_tasks: targets/nxos_udld_interface/tests/common/sanity.yaml

@ -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: "{{ cli }}"
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: "{{ cli }}"
ignore_errors: yes
- name: Previous command is asynchronous can take a while. Allow time for it to complete
pause:
seconds: 45

@ -0,0 +1,32 @@
---
- name: "Get default vdc id"
nxos_command:
commands: ['show vdc current-vdc | json']
provider: "{{ cli }}"
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: "{{ cli }}"
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: "{{ cli }}"
ignore_errors: yes
- name: Previous command is asynchronous and can take a while. Allow time for it to complete
pause:
seconds: 45

@ -2,6 +2,10 @@
- - debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep sanity test" - - debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep sanity test"
- block: - block:
- name: "Apply N7K specific setup config"
include: targets/nxos_vxlan_vtep/tasks/platform/n7k/setup.yaml
when: platform | match('N7K')
- name: "Enable feature nv overlay" - name: "Enable feature nv overlay"
nxos_config: nxos_config:
commands: commands:
@ -9,28 +13,56 @@
provider: "{{ connection }}" provider: "{{ connection }}"
match: none match: none
- name: configure vxlan_vtep - block:
nxos_vxlan_vtep: &configure - name: configure vxlan_vtep
interface: nve1 nxos_vxlan_vtep: &configure9
description: default interface: nve1
host_reachability: true description: default
source_interface: Loopback0 host_reachability: true
source_interface_hold_down_time: 30 source_interface: Loopback0
shutdown: true source_interface_hold_down_time: 30
provider: "{{ connection }}" shutdown: true
register: result provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vxlan_vtep: *configure9
register: result
- assert: &true - assert: &false
that: that:
- "result.changed == true" - "result.changed == false"
- name: "Conf Idempotence" when: (platform | search('N9K'))
nxos_vxlan_vtep: *configure
register: result
- assert: &false - block:
that: - name: configure vxlan_vtep
- "result.changed == false" nxos_vxlan_vtep: &configure7
interface: nve1
description: default
host_reachability: true
source_interface: Loopback0
shutdown: true
provider: "{{ connection }}"
register: result
- assert:
that:
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vxlan_vtep: *configure7
register: result
- assert:
that:
- "result.changed == false"
when: (platform | search('N7K'))
- name: remove vxlan_vtep - name: remove vxlan_vtep
nxos_vxlan_vtep: &remove nxos_vxlan_vtep: &remove
@ -44,17 +76,25 @@
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
- assert: *true - assert:
that:
- "result.changed == true"
- name: "Remove Idempotence" - name: "Remove Idempotence"
nxos_vxlan_vtep: *remove nxos_vxlan_vtep: *remove
register: result register: result
- assert: *false - assert:
that:
- "result.changed == false"
when: (platform | search('N9K')) when: (platform | search("N7K|N9K"))
always: always:
- name: "Apply N7K specific cleanup config"
include: targets/nxos_vxlan_vtep/tasks/platform/n7k/cleanup.yaml
when: platform | match('N7K')
- name: "Disable feature nv overlay" - name: "Disable feature nv overlay"
nxos_feature: nxos_feature:
feature: nve feature: nve

@ -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,4 @@
---
- set_fact: connection="{{ cli }}"
- import_tasks: targets/nxos_vxlan_vtep_vni/tests/common/sanity.yaml

@ -0,0 +1,137 @@
---
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vxlan_vtep_vni sanity test"
- block:
- name: "Apply N7K specific setup config"
include: targets/nxos_vxlan_vtep/tasks/platform/n7k/setup.yaml
when: platform | match('N7K')
- name: "Enable feature nv overlay"
nxos_config:
commands:
- feature nv overlay
provider: "{{ connection }}"
match: none
- name: configure vxlan_vtep
nxos_vxlan_vtep:
interface: nve1
host_reachability: True
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni assoc-vrf
nxos_vxlan_vtep_vni: &conf1
interface: nve1
vni: 6000
assoc_vrf: True
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf 1 Idempotence"
nxos_vxlan_vtep_vni: *conf1
register: result
- assert: &false
that:
- "result.changed == false"
- name: remove vxlan_vtep_vni
nxos_vxlan_vtep_vni:
interface: nve1
vni: 6000
assoc_vrf: True
state: absent
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni mcast
nxos_vxlan_vtep_vni: &conf2
interface: nve1
vni: 8000
multicast_group: 224.1.1.1
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Conf 2 Idempotence"
nxos_vxlan_vtep_vni: *conf2
register: result
- assert: *false
- name: "remove config"
nxos_vxlan_vtep_vni: &remove
interface: nve1
vni: 8000
state: absent
provider: "{{ connection }}"
- name: configure vxlan_vtep
nxos_vxlan_vtep:
interface: nve1
host_reachability: False
provider: "{{ connection }}"
- block:
- name: configure vxlan_vtep_vni peer-list
nxos_vxlan_vtep_vni: &conf3
interface: nve1
vni: 8000
peer_list:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
- 4.4.4.4
ingress_replication: static
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Conf 3 Idempotence"
nxos_vxlan_vtep_vni: *conf3
register: result
- assert: *false
- name: remove vxlan_vtep_vni
nxos_vxlan_vtep_vni: *remove
register: result
- assert: *true
- name: "remove Idempotence"
nxos_vxlan_vtep_vni: *remove
register: result
- assert: *false
when: (platform | search('N9K'))
when: (platform | search("N7K|N9K"))
always:
- name: "Apply N7K specific cleanup config"
include: targets/nxos_vxlan_vtep/tasks/platform/n7k/cleanup.yaml
when: platform | match('N7K')
- name: remove vxlan_vtep
nxos_vxlan_vtep:
interface: nve1
shutdown: true
state: absent
provider: "{{ connection }}"
ignore_errors: yes
- 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_vni sanity test"

@ -0,0 +1,4 @@
---
- set_fact: connection="{{ nxapi }}"
- import_tasks: targets/nxos_vxlan_vtep_vni/tests/common/sanity.yaml
Loading…
Cancel
Save