mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-21 19:43:59 -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/defaults/main.yaml
Normal file
2
test/integration/targets/nxos_bgp/defaults/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
testcase: "*"
|
2
test/integration/targets/nxos_bgp/meta/main.yml
Normal file
2
test/integration/targets/nxos_bgp/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_nxos_tests
|
15
test/integration/targets/nxos_bgp/tasks/cli.yaml
Normal file
15
test/integration/targets/nxos_bgp/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/tasks/main.yaml
Normal file
3
test/integration/targets/nxos_bgp/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/tasks/nxapi.yaml
Normal file
28
test/integration/targets/nxos_bgp/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 }}"
|
135
test/integration/targets/nxos_bgp/tests/cli/sanity.yaml
Normal file
135
test/integration/targets/nxos_bgp/tests/cli/sanity.yaml
Normal file
|
@ -0,0 +1,135 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:CLI nxos_bgp sanity test"
|
||||
|
||||
- set_fact: neighbor_down_fib_accelerate="true"
|
||||
when: (titanium is defined) and not ((titanium | search('true')))
|
||||
|
||||
- set_fact: reconnect_interval="55"
|
||||
when: (titanium is defined) and not ((titanium | search('true')))
|
||||
|
||||
- name: "Enable feature BGP"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Setup"
|
||||
nxos_bgp: &remove
|
||||
asn: 65535
|
||||
state: absent
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
|
||||
- block:
|
||||
- name: "Configure BGP defaults"
|
||||
nxos_bgp: &configure_default
|
||||
asn: 65535
|
||||
router_id: 1.1.1.1
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *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 non defaults"
|
||||
nxos_bgp: &configure_non_default
|
||||
asn: 65535
|
||||
router_id: 1.1.1.1
|
||||
bestpath_always_compare_med: true
|
||||
bestpath_aspath_multipath_relax: true
|
||||
bestpath_compare_routerid: true
|
||||
bestpath_cost_community_ignore: true
|
||||
bestpath_med_confed: true
|
||||
bestpath_med_missing_as_worst: true
|
||||
bestpath_med_non_deterministic: true
|
||||
cluster_id: 10.0.0.1
|
||||
confederation_id: 99
|
||||
disable_policy_batching: true
|
||||
enforce_first_as: false
|
||||
fast_external_fallover: false
|
||||
flush_routes: true
|
||||
graceful_restart_helper: true
|
||||
graceful_restart_timers_restart: 130
|
||||
graceful_restart_timers_stalepath_time: 310
|
||||
isolate: false
|
||||
log_neighbor_changes: true
|
||||
maxas_limit: 50
|
||||
neighbor_down_fib_accelerate: "{{neighbor_down_fib_accelerate|default(omit)}}"
|
||||
reconnect_interval: "{{reconnect_interval|default(omit)}}"
|
||||
shutdown: true
|
||||
timer_bestpath_limit: 255
|
||||
timer_bgp_hold: 110
|
||||
timer_bgp_keepalive: 45
|
||||
event_history_cli: size_medium
|
||||
event_history_detail: size_large
|
||||
event_history_events: size_medium
|
||||
event_history_periodic: size_small
|
||||
suppress_fib_pending: true
|
||||
state: present
|
||||
provider: "{{ cli }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *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
|
||||
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
|
||||
rescue:
|
||||
- name: "Cleanup BGP"
|
||||
nxos_bgp: *remove
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ cli }}"
|
||||
ignore_errors: yes
|
||||
|
||||
always:
|
||||
- debug: msg="END TRANSPORT:CLI nxos_bgp sanity test"
|
135
test/integration/targets/nxos_bgp/tests/nxapi/sanity.yaml
Normal file
135
test/integration/targets/nxos_bgp/tests/nxapi/sanity.yaml
Normal file
|
@ -0,0 +1,135 @@
|
|||
---
|
||||
- debug: msg="START TRANSPORT:NXAPI nxos_bgp sanity test"
|
||||
|
||||
- set_fact: neighbor_down_fib_accelerate="true"
|
||||
when: (titanium is defined) and not ((titanium | search('true')))
|
||||
|
||||
- set_fact: reconnect_interval="55"
|
||||
when: (titanium is defined) and not ((titanium | search('true')))
|
||||
|
||||
- name: "Enable feature BGP"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: enabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Setup"
|
||||
nxos_bgp: &remove
|
||||
asn: 65535
|
||||
state: absent
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
register: result
|
||||
|
||||
- block:
|
||||
- name: "Configure BGP defaults"
|
||||
nxos_bgp: &configure_default
|
||||
asn: 65535
|
||||
router_id: 1.1.1.1
|
||||
state: present
|
||||
provider: "{{ nxapi }}"
|
||||
register: result
|
||||
|
||||
- assert: &true
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *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 non defaults"
|
||||
nxos_bgp: &configure_non_default
|
||||
asn: 65535
|
||||
router_id: 1.1.1.1
|
||||
bestpath_always_compare_med: true
|
||||
bestpath_aspath_multipath_relax: true
|
||||
bestpath_compare_routerid: true
|
||||
bestpath_cost_community_ignore: true
|
||||
bestpath_med_confed: true
|
||||
bestpath_med_missing_as_worst: true
|
||||
bestpath_med_non_deterministic: true
|
||||
cluster_id: 10.0.0.1
|
||||
confederation_id: 99
|
||||
disable_policy_batching: true
|
||||
enforce_first_as: false
|
||||
fast_external_fallover: false
|
||||
flush_routes: true
|
||||
graceful_restart_helper: true
|
||||
graceful_restart_timers_restart: 130
|
||||
graceful_restart_timers_stalepath_time: 310
|
||||
isolate: false
|
||||
log_neighbor_changes: true
|
||||
maxas_limit: 50
|
||||
neighbor_down_fib_accelerate: "{{neighbor_down_fib_accelerate|default(omit)}}"
|
||||
reconnect_interval: "{{reconnect_interval|default(omit)}}"
|
||||
shutdown: true
|
||||
timer_bestpath_limit: 255
|
||||
timer_bgp_hold: 110
|
||||
timer_bgp_keepalive: 45
|
||||
event_history_cli: size_medium
|
||||
event_history_detail: size_large
|
||||
event_history_events: size_medium
|
||||
event_history_periodic: size_small
|
||||
suppress_fib_pending: true
|
||||
state: present
|
||||
provider: "{{ nxapi }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *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
|
||||
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
|
||||
rescue:
|
||||
- name: "Cleanup BGP"
|
||||
nxos_bgp: *remove
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Disable feature bgp"
|
||||
nxos_feature:
|
||||
feature: bgp
|
||||
state: disabled
|
||||
provider: "{{ nxapi }}"
|
||||
ignore_errors: yes
|
||||
|
||||
always:
|
||||
- debug: msg="END TRANSPORT:NXAPI nxos_bgp sanity test"
|
Loading…
Add table
Add a link
Reference in a new issue