mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 12:03:58 -07:00
Add integration tests for nxos_facts, nxos_bgp, nxos_bgp_af, nxos_bgp_neighbor, and nxos_evpn_global (#26924)
* Add new ITs for nxos_bgp, nxos_bgp_af, nxos_bgp_neighbor, and nxos_evpn_global * Add nxos_facts IT and enhance existing tests * switch nxos_feature tests to use bgp * misc. test fixes * Add checks for titanium in IT * Handle non-titanium case in tests
This commit is contained in:
parent
7e2169f6d5
commit
85fc4c67ef
37 changed files with 1509 additions and 128 deletions
2
test/integration/targets/nxos_bgp_af/defaults/main.yaml
Normal file
2
test/integration/targets/nxos_bgp_af/defaults/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_bgp_af/meta/main.yml
Normal file
2
test/integration/targets/nxos_bgp_af/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
15
test/integration/targets/nxos_bgp_af/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_bgp_af/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_bgp_af/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_bgp_af/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { include: nxapi.yaml, tags: ['nxapi'] }
|
28
test/integration/targets/nxos_bgp_af/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_bgp_af/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 }}"
|
149
test/integration/targets/nxos_bgp_af/tests/cli/sanity.yaml
Normal file
149
test/integration/targets/nxos_bgp_af/tests/cli/sanity.yaml
Normal file
|
@ -0,0 +1,149 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_bgp_af sanity test"
|
||||
|
||||
- set_fact: advertise_l2vpn_evpn="true"
|
||||
when: platform | search('N9K')
|
||||
|
||||
- name: "Enable feature BGP"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Enable feature nv overlay"
|
||||
nxos_feature:
|
||||
feature: nv overlay
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Setup"
|
||||
nxos_bgp: &remove
|
||||
asn: 65535
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
- name: "Enable nv overlay evpn"
|
||||
nxos_config:
|
||||
lines:
|
||||
- nv overlay evpn
|
||||
provider: "{{ cli }}"
|
||||
when: platform | search('N9K')
|
||||
|
||||
- name: "Configure BGP_AF defaults"
|
||||
nxos_bgp_af: &configure_default
|
||||
asn: 65535
|
||||
vrf: TESTING
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}"
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure_default
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Configure BGP_AF non defaults"
|
||||
nxos_bgp_af: &configure_non_default
|
||||
asn: 65535
|
||||
vrf: TESTING
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
additional_paths_install: true
|
||||
additional_paths_receive: true
|
||||
additional_paths_selection: RouteMap
|
||||
additional_paths_send: true
|
||||
advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}"
|
||||
client_to_client: false
|
||||
dampen_igp_metric: 200
|
||||
dampening_half_time: 1
|
||||
dampening_max_suppress_time: 4
|
||||
dampening_reuse_time: 2
|
||||
dampening_suppress_time: 3
|
||||
default_information_originate: true
|
||||
default_metric: 50
|
||||
distance_ebgp: 30
|
||||
distance_ibgp: 60
|
||||
distance_local: 90
|
||||
maximum_paths: 9
|
||||
maximum_paths_ibgp: 9
|
||||
next_hop_route_map: RouteMap
|
||||
suppress_inactive: true
|
||||
table_map: RouteMap
|
||||
table_map_filter: true
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure_non_default
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
rescue:
|
||||
- name: "Cleanup BGP"
|
||||
nxos_bgp: *remove
|
||||
ignore_errors: yes
|
||||
|
||||
always:
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature: &disable_bgp
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: "Disable feature nv overlay"
|
||||
nxos_feature: &disable_nvoverlay
|
||||
feature: nv overlay
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Remove nv overlay evpn"
|
||||
nxos_config:
|
||||
lines:
|
||||
- no nv overlay evpn
|
||||
provider: "{{ cli }}"
|
||||
when: platform | search('N9K')
|
||||
|
||||
- debug: msg="END TRANSPORT:CLI nxos_bgp_af sanity test"
|
149
test/integration/targets/nxos_bgp_af/tests/nxapi/sanity.yaml
Normal file
149
test/integration/targets/nxos_bgp_af/tests/nxapi/sanity.yaml
Normal file
|
@ -0,0 +1,149 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_bgp_af sanity test"
|
||||
|
||||
- set_fact: advertise_l2vpn_evpn="true"
|
||||
when: platform | search('N9K')
|
||||
|
||||
- name: "Enable feature BGP"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Enable feature nv overlay"
|
||||
nxos_feature:
|
||||
feature: nv overlay
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Setup"
|
||||
nxos_bgp: &remove
|
||||
asn: 65535
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- block:
|
||||
- name: "Enable nv overlay evpn"
|
||||
nxos_config:
|
||||
lines:
|
||||
- nv overlay evpn
|
||||
provider: "{{ nxapi }}"
|
||||
when: platform | search('N9K')
|
||||
|
||||
- name: "Configure BGP_AF defaults"
|
||||
nxos_bgp_af: &configure_default
|
||||
asn: 65535
|
||||
vrf: TESTING
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}"
|
||||
state: present
|
||||
provider: "{{ nxapi }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure_default
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Configure BGP_AF non defaults"
|
||||
nxos_bgp_af: &configure_non_default
|
||||
asn: 65535
|
||||
vrf: TESTING
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
additional_paths_install: true
|
||||
additional_paths_receive: true
|
||||
additional_paths_selection: RouteMap
|
||||
additional_paths_send: true
|
||||
advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}"
|
||||
client_to_client: false
|
||||
dampen_igp_metric: 200
|
||||
dampening_half_time: 1
|
||||
dampening_max_suppress_time: 4
|
||||
dampening_reuse_time: 2
|
||||
dampening_suppress_time: 3
|
||||
default_information_originate: true
|
||||
default_metric: 50
|
||||
distance_ebgp: 30
|
||||
distance_ibgp: 60
|
||||
distance_local: 90
|
||||
maximum_paths: 9
|
||||
maximum_paths_ibgp: 9
|
||||
next_hop_route_map: RouteMap
|
||||
suppress_inactive: true
|
||||
table_map: RouteMap
|
||||
table_map_filter: true
|
||||
state: present
|
||||
provider: "{{ nxapi }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure_non_default
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *remove
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
rescue:
|
||||
- name: "Cleanup BGP"
|
||||
nxos_bgp: *remove
|
||||
ignore_errors: yes
|
||||
|
||||
always:
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature: &disable_bgp
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
- name: "Disable feature nv overlay"
|
||||
nxos_feature: &disable_nvoverlay
|
||||
feature: nv overlay
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Remove nv overlay evpn"
|
||||
nxos_config:
|
||||
lines:
|
||||
- no nv overlay evpn
|
||||
provider: "{{ cli }}"
|
||||
when: platform | search('N9K')
|
||||
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_bgp_af sanity test"
|
Loading…
Add table
Add a link
Reference in a new issue