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:
rahushen 2017-08-10 05:29:13 -04:00 committed by Nathaniel Case
parent 7e2169f6d5
commit 85fc4c67ef
37 changed files with 1509 additions and 128 deletions

View file

@ -265,6 +265,27 @@
rescue: rescue:
- set_fact: test_failed=true - set_fact: test_failed=true
- block:
- include_role:
name: nxos_bgp
when: "limit_to in ['*', 'nxos_bgp']"
rescue:
- set_fact: test_failed=true
- block:
- include_role:
name: nxos_bgp_af
when: "limit_to in ['*', 'nxos_bgp_af']"
rescue:
- set_fact: test_failed=true
- block:
- include_role:
name: nxos_bgp_neighbor
when: "limit_to in ['*', 'nxos_bgp_neighbor']"
rescue:
- set_fact: test_failed=true
########### ###########
- debug: var=failed_modules - debug: var=failed_modules
when: test_failed when: test_failed

View file

@ -0,0 +1,2 @@
---
testcase: "*"

View file

@ -0,0 +1,2 @@
dependencies:
- prepare_nxos_tests

View 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

View file

@ -0,0 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View 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 }}"

View 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"

View 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"

View file

@ -0,0 +1,2 @@
---
testcase: "*"

View file

@ -0,0 +1,2 @@
dependencies:
- prepare_nxos_tests

View 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

View file

@ -0,0 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View 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 }}"

View 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"

View 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"

View file

@ -0,0 +1,2 @@
---
testcase: "*"

View file

@ -0,0 +1,2 @@
dependencies:
- prepare_nxos_tests

View 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

View file

@ -0,0 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View 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 }}"

View file

@ -0,0 +1,203 @@
---
- debug: msg="START TRANSPORT:CLI nxos_bgp_neighbor sanity test"
- set_fact: intname="{{ nxos_int1 }}"
- set_fact: log_neighbor_changes="enable"
when: (titanium is defined) and not ((titanium | search('true')))
- set_fact: remove_private_as="all"
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
- block:
- name: "Configure BGP neighbor defaults"
nxos_bgp_neighbor: &configure_default
asn: 65535
neighbor: 3.3.3.3
local_as: 20
remote_as: 30
description: "just a description"
update_source: "{{ intname.capitalize() }}"
state: present
provider: "{{ cli }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_bgp_neighbor: *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 neighbor non-defaults"
nxos_bgp_neighbor: &configure_non_default
asn: 65535
neighbor: 3.3.3.3
description: "tested by ansible"
connected_check: true
capability_negotiation: true
dynamic_capability: true
ebgp_multihop: 2
log_neighbor_changes: "{{log_neighbor_changes|default(omit)}}"
low_memory_exempt: true
remote_as: 12.1
remove_private_as: "{{remove_private_as|default(omit)}}"
shutdown: true
suppress_4_byte_as: true
timers_keepalive: 90
timers_holdtime: 270
update_source: loopback151
state: present
provider: "{{ cli }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_non_default
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor 3des password"
nxos_bgp_neighbor: &configure_3des_password
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
pwd: '386c0565965f89de'
pwd_type: 3des
provider: "{{ cli }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_3des_password
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor type 7 password"
nxos_bgp_neighbor: &configure_type7_password
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
pwd: '386c0565965f89de'
pwd_type: cisco_type_7
provider: "{{ cli }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_type7_password
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor transport type passive"
nxos_bgp_neighbor: &configure_transport_passive
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
transport_passive_only: true
provider: "{{ cli }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_transport_passive
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor transport type default"
nxos_bgp_neighbor: &configure_transport_default
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
transport_passive_only: false
provider: "{{ cli }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_transport_default
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
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 }}"
- debug: msg="END TRANSPORT:CLI nxos_bgp_neighbor sanity test"

View file

@ -0,0 +1,203 @@
---
- debug: msg="START TRANSPORT:NXAPI nxos_bgp_neighbor sanity test"
- set_fact: intname="{{ nxos_int1 }}"
- set_fact: log_neighbor_changes="enable"
when: (titanium is defined) and not ((titanium | search('true')))
- set_fact: remove_private_as="all"
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
- block:
- name: "Configure BGP neighbor defaults"
nxos_bgp_neighbor: &configure_default
asn: 65535
neighbor: 3.3.3.3
local_as: 20
remote_as: 30
description: "just a description"
update_source: "{{ intname.capitalize() }}"
state: present
provider: "{{ nxapi }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_bgp_neighbor: *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 neighbor non-defaults"
nxos_bgp_neighbor: &configure_non_default
asn: 65535
neighbor: 3.3.3.3
description: "tested by ansible"
connected_check: true
capability_negotiation: true
dynamic_capability: true
ebgp_multihop: 2
log_neighbor_changes: "{{log_neighbor_changes|default(omit)}}"
low_memory_exempt: true
remote_as: 12.1
remove_private_as: "{{remove_private_as|default(omit)}}"
shutdown: true
suppress_4_byte_as: true
timers_keepalive: 90
timers_holdtime: 270
update_source: loopback151
state: present
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_non_default
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor 3des password"
nxos_bgp_neighbor: &configure_3des_password
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
pwd: '386c0565965f89de'
pwd_type: 3des
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_3des_password
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor type 7 password"
nxos_bgp_neighbor: &configure_type7_password
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
pwd: '386c0565965f89de'
pwd_type: cisco_type_7
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_type7_password
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor transport type passive"
nxos_bgp_neighbor: &configure_transport_passive
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
transport_passive_only: true
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_transport_passive
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
- name: "Configure BGP neighbor transport type default"
nxos_bgp_neighbor: &configure_transport_default
asn: 65535
neighbor: 3.3.3.3
remote_as: 30
transport_passive_only: false
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_bgp_neighbor: *configure_transport_default
register: result
- assert: *false
- name: "Remove BGP"
nxos_bgp: *remove
register: result
- assert: *true
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 }}"
- debug: msg="END TRANSPORT:NXAPI nxos_bgp_neighbor sanity test"

View file

@ -1,50 +0,0 @@
---
- debug: msg="START cli/nv_overlay_evpn"
- name: setup
nxos_config:
lines: no nv overlay evpn
match: none
provider: "{{ cli }}"
- name: enable nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- name: verify nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == false"
- name: disable nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: no
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- name: verify nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: no
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == false"
- debug: msg="END cli/nv_overlay_evpn"

View file

@ -0,0 +1,73 @@
---
- debug: msg="START TRANSPORT:CLI nxos_evpn_global sanity test"
- name: "Setup"
nxos_config: &remove_evpn_config
lines: no nv overlay evpn
match: none
provider: "{{ cli }}"
ignore_errors: yes
- name: "Disable feature nv overlay"
nxos_feature: &disable_feature_nv_overlay
feature: nv overlay
state: disabled
provider: "{{ cli }}"
ignore_errors: yes
- block:
- name: "Enable feature nv overlay"
nxos_feature: &enable_feature_nv_overlay
feature: nv overlay
state: enabled
provider: "{{ cli }}"
ignore_errors: yes
- name: "Enable nv overlay evpn"
nxos_evpn_global: &enable_evpn
nv_overlay_evpn: true
provider: "{{ cli }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "CHECK IDEMPOTENCE - enable nv overlay evpn"
nxos_evpn_global: *enable_evpn
register: result
- assert: &false
that:
- "result.changed == false"
- name: "Disable nv overlay evpn"
nxos_evpn_global: &disable_evpn
nv_overlay_evpn: false
provider: "{{ cli }}"
register: result
- assert: *true
- name: "CHECK DEMPOTENCE - Disable nv overlay evpn"
nxos_evpn_global: *disable_evpn
register: result
- assert: *false
when: not (platform | search('N3K'))
rescue:
- debug: msg="TRANSPORT:CLI nxos_evpn_global sanity test - FALURE ENCOUNTERED"
always:
- name: "Cleanup - Disable nv overlay evpn"
nxos_config: *remove_evpn_config
ignore_errors: yes
- name: "Cleanup - Disable feature nv overlay"
nxos_feature: *disable_feature_nv_overlay
ignore_errors: yes
- debug: msg="END TRANSPORT:CLI nxos_evpn_global sanity test"

View file

@ -1,50 +0,0 @@
---
- debug: msg="START nxapi/nv_overlay_evpn"
- name: setup
nxos_config:
lines: no nv overlay evpn
match: none
provider: "{{ nxapi }}"
- name: enable nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: yes
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == true"
- name: verify nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: yes
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- name: disable nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: no
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == true"
- name: verify nv overlay evpn
nxos_evpn_global:
nv_overlay_evpn: no
provider: "{{ nxapi }}"
register: result
- assert:
that:
- "result.changed == false"
- debug: msg="END nxapi/nv_overlay_evpn"

View file

@ -0,0 +1,73 @@
---
- debug: msg="START TRANSPORT:NXAPI nxos_evpn_global sanity test"
- name: "Setup"
nxos_config: &remove_evpn_config
lines: no nv overlay evpn
match: none
provider: "{{ nxapi }}"
ignore_errors: yes
- name: "Disable feature nv overlay"
nxos_feature: &disable_feature_nv_overlay
feature: nv overlay
state: disabled
provider: "{{ nxapi }}"
ignore_errors: yes
- block:
- name: "Enable feature nv overlay"
nxos_feature: &enable_feature_nv_overlay
feature: nv overlay
state: enabled
provider: "{{ nxapi }}"
ignore_errors: yes
- name: "Enable nv overlay evpn"
nxos_evpn_global: &enable_evpn
nv_overlay_evpn: true
provider: "{{ nxapi }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "CHECK IDEMPOTENCE - enable nv overlay evpn"
nxos_evpn_global: *enable_evpn
register: result
- assert: &false
that:
- "result.changed == false"
- name: "Disable nv overlay evpn"
nxos_evpn_global: &disable_evpn
nv_overlay_evpn: false
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "CHECK DEMPOTENCE - Disable nv overlay evpn"
nxos_evpn_global: *disable_evpn
register: result
- assert: *false
when: not (platform | search('N3K'))
rescue:
- debug: msg="TRANSPORT:NXAPI nxos_evpn_global sanity test - FALURE ENCOUNTERED"
always:
- name: "Cleanup - Disable nv overlay evpn"
nxos_config: *remove_evpn_config
ignore_errors: yes
- name: "Cleanup - Disable feature nv overlay"
nxos_feature: *disable_feature_nv_overlay
ignore_errors: yes
- debug: msg="END TRANSPORT:NXAPI nxos_evpn_global sanity test"

View file

@ -24,6 +24,10 @@
# Items from those subsets are present # Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined" - "result.ansible_facts.ansible_net_filesystems is defined"
- "result.ansible_facts.ansible_net_interfaces is defined"
- "result.ansible_facts.ansible_net_config is defined"
- "result.ansible_facts.ansible_net_model is defined"
# Check that these facts not only are present, but are valid (positive integers) # Check that these facts not only are present, but are valid (positive integers)
- "result.ansible_facts.ansible_net_memfree_mb > 1" - "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1" - "result.ansible_facts.ansible_net_memtotal_mb > 1"

View file

@ -23,6 +23,8 @@
# Items from those subsets are present # Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined" #hw - "result.ansible_facts.ansible_net_filesystems is defined" #hw
- "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw - "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw
- "result.ansible_facts.ansible_net_model is defined" #default
- "result.ansible_facts.ansible_net_interfaces is defined" #interfaces
# FIXME # FIXME
# - "result.ansible_facts.ansible_net_interfaces.Ethernet1.ipv4.masklen > 1" # interfaces # - "result.ansible_facts.ansible_net_interfaces.Ethernet1.ipv4.masklen > 1" # interfaces

View file

@ -16,9 +16,9 @@
# Correct subsets are present # Correct subsets are present
- "'config' in result.ansible_facts.ansible_net_gather_subset" - "'config' in result.ansible_facts.ansible_net_gather_subset"
- "'default' in result.ansible_facts.ansible_net_gather_subset" - "'default' in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
# ... and not present # ... and not present
- "'hardware' not in result.ansible_facts.ansible_net_gather_subset" - "'hardware' not in result.ansible_facts.ansible_net_gather_subset"

View file

@ -0,0 +1,78 @@
---
- debug: msg="START TRANSPORT:CLI nxos_facts sanity test"
- name: "nxos_facts gather hardware facts"
nxos_facts:
gather_subset: hardware
provider: "{{ cli }}"
register: result
- assert:
that:
# _facts modules should never report a change
- "result.changed == false"
# Correct subsets are present
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
# Other facts are not present
- "'config' not in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' not in result.ansible_facts.ansible_net_gather_subset"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined"
# Check that these facts not only are present, but are valid (positive integers)
- "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1"
- name: "nxos_facts gather config facts"
nxos_facts:
gather_subset: config
provider: "{{ cli }}"
register: result
- assert:
that:
# _facts modules should never report a change
- "result.changed == false"
# Correct subsets are present
- "'config' in result.ansible_facts.ansible_net_gather_subset"
# Other facts are not present
- "'hardware' not in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' not in result.ansible_facts.ansible_net_gather_subset"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_config is defined"
- name: "nxos_facts gather config and hardware facts"
nxos_facts:
gather_subset:
- hardware
- config
provider: "{{ cli }}"
register: result
- assert:
that:
# _facts modules should never report a change
- "result.changed == false"
# Correct subsets are present
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
- "'config' in result.ansible_facts.ansible_net_gather_subset"
# Other facts are not present
- "'interfaces' not in result.ansible_facts.ansible_net_gather_subset"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined"
- "result.ansible_facts.ansible_net_config is defined"
# Check that these facts not only are present, but are valid (positive integers)
- "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1"
- debug: msg="END TRANSPORT:CLI nxos_facts sanity test"

View file

@ -25,6 +25,10 @@
# Items from those subsets are present # Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined" - "result.ansible_facts.ansible_net_filesystems is defined"
- "result.ansible_facts.ansible_net_interfaces is defined"
- "result.ansible_facts.ansible_net_config is defined"
- "result.ansible_facts.ansible_net_model is defined"
# Check that these facts not only are present, but are valid (positive integers) # Check that these facts not only are present, but are valid (positive integers)
- "result.ansible_facts.ansible_net_memfree_mb > 1" - "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1" - "result.ansible_facts.ansible_net_memtotal_mb > 1"

View file

@ -23,6 +23,8 @@
# Items from those subsets are present # Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined" #hw - "result.ansible_facts.ansible_net_filesystems is defined" #hw
- "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw - "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw
- "result.ansible_facts.ansible_net_model is defined" #default
- "result.ansible_facts.ansible_net_interfaces is defined" #interfaces
# FIXME # FIXME
# - "result.ansible_facts.ansible_net_interfaces.Ethernet1.ipv4.masklen > 1" # interfaces # - "result.ansible_facts.ansible_net_interfaces.Ethernet1.ipv4.masklen > 1" # interfaces

View file

@ -17,9 +17,9 @@
# Correct subsets are present # Correct subsets are present
- "'config' in result.ansible_facts.ansible_net_gather_subset" - "'config' in result.ansible_facts.ansible_net_gather_subset"
- "'default' in result.ansible_facts.ansible_net_gather_subset" - "'default' in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - "'interfaces' in result.ansible_facts.ansible_net_gather_subset"
# ... and not present # ... and not present
- "'hardware' not in result.ansible_facts.ansible_net_gather_subset" - "'hardware' not in result.ansible_facts.ansible_net_gather_subset"

View file

@ -0,0 +1,78 @@
---
- debug: msg="START TRANSPORT:NXAPI nxos_facts sanity test"
- name: "nxos_facts gather hardware facts"
nxos_facts:
gather_subset: hardware
provider: "{{ nxapi }}"
register: result
- assert:
that:
# _facts modules should never report a change
- "result.changed == false"
# Correct subsets are present
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
# Other facts are not present
- "'config' not in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' not in result.ansible_facts.ansible_net_gather_subset"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined"
# Check that these facts not only are present, but are valid (positive integers)
- "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1"
- name: "nxos_facts gather config facts"
nxos_facts:
gather_subset: config
provider: "{{ nxapi }}"
register: result
- assert:
that:
# _facts modules should never report a change
- "result.changed == false"
# Correct subsets are present
- "'config' in result.ansible_facts.ansible_net_gather_subset"
# Other facts are not present
- "'hardware' not in result.ansible_facts.ansible_net_gather_subset"
- "'interfaces' not in result.ansible_facts.ansible_net_gather_subset"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_config is defined"
- name: "nxos_facts gather config and hardware facts"
nxos_facts:
gather_subset:
- hardware
- config
provider: "{{ nxapi }}"
register: result
- assert:
that:
# _facts modules should never report a change
- "result.changed == false"
# Correct subsets are present
- "'hardware' in result.ansible_facts.ansible_net_gather_subset"
- "'config' in result.ansible_facts.ansible_net_gather_subset"
# Other facts are not present
- "'interfaces' not in result.ansible_facts.ansible_net_gather_subset"
# Items from those subsets are present
- "result.ansible_facts.ansible_net_filesystems is defined"
- "result.ansible_facts.ansible_net_config is defined"
# Check that these facts not only are present, but are valid (positive integers)
- "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1"
- debug: msg="END TRANSPORT:NXAPI nxos_facts sanity test"

View file

@ -3,13 +3,13 @@
- name: setup - name: setup
nxos_config: nxos_config:
lines: no feature vn-segment-vlan-based lines: no feature bgp
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
- name: enable vn-segment-vlan-based - name: enable bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: enabled state: enabled
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -18,9 +18,9 @@
that: that:
- "result.changed == true" - "result.changed == true"
- name: verify vn-segment-vlan-based - name: verify bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: enabled state: enabled
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -29,9 +29,9 @@
that: that:
- "result.changed == false" - "result.changed == false"
- name: disable vn-segment-vlan-based - name: disable bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: disabled state: disabled
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -40,9 +40,9 @@
that: that:
- "result.changed == true" - "result.changed == true"
- name: verify vn-segment-vlan-based - name: verify bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: disabled state: disabled
provider: "{{ cli }}" provider: "{{ cli }}"
register: result register: result
@ -53,7 +53,7 @@
- name: teardown - name: teardown
nxos_config: nxos_config:
lines: no feature vn-segment-vlan-based lines: no feature bgp
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"

View file

@ -3,13 +3,13 @@
- name: setup - name: setup
nxos_config: nxos_config:
lines: no feature vn-segment-vlan-based lines: no feature bgp
match: none match: none
provider: "{{ nxapi }}" provider: "{{ nxapi }}"
- name: enable vn-segment-vlan-based - name: enable bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: enabled state: enabled
provider: "{{ nxapi }}" provider: "{{ nxapi }}"
register: result register: result
@ -18,9 +18,9 @@
that: that:
- "result.changed == true" - "result.changed == true"
- name: verify vn-segment-vlan-based - name: verify bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: enabled state: enabled
provider: "{{ nxapi }}" provider: "{{ nxapi }}"
register: result register: result
@ -29,9 +29,9 @@
that: that:
- "result.changed == false" - "result.changed == false"
- name: disable vn-segment-vlan-based - name: disable bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: disabled state: disabled
provider: "{{ nxapi }}" provider: "{{ nxapi }}"
register: result register: result
@ -40,9 +40,9 @@
that: that:
- "result.changed == true" - "result.changed == true"
- name: verify vn-segment-vlan-based - name: verify bgp
nxos_feature: nxos_feature:
feature: vn-segment-vlan-based feature: bgp
state: disabled state: disabled
provider: "{{ nxapi }}" provider: "{{ nxapi }}"
register: result register: result
@ -53,7 +53,7 @@
- name: teardown - name: teardown
nxos_config: nxos_config:
lines: no feature vn-segment-vlan-based lines: no feature bgp
match: none match: none
provider: "{{ nxapi }}" provider: "{{ nxapi }}"

View file

@ -1,13 +1,31 @@
--- ---
# NXAPI is enabled differently on NX-OS platforms. # There is a bug currently where the nxapi server can get
# Try both commands to enable NXAPI and ignore any errors. # stuck in a bad state when enabling/disabling rapidly by
- name: enable nxapi on remote device # the integration tests.
nxos_feature: #
feature: nxapi # Toggle the command off/on as mitigation.
state: enabled - name: Toggle feature nxapi - Disable
nxos_config:
lines:
- no feature nxapi
provider: "{{ cli }}" provider: "{{ cli }}"
ignore_errors: yes ignore_errors: yes
# Pause after disabling nxapi
- pause:
seconds: 3
- name: Toggle feature nxapi - Enable
nxos_config:
lines:
- feature nxapi
provider: "{{ cli }}"
ignore_errors: yes
# Pause after enabling nxapi
- pause:
seconds: 3
# Gather the list of interfaces on this device and make the list # Gather the list of interfaces on this device and make the list
# available for integration tests that need them. # available for integration tests that need them.
# #
@ -52,3 +70,7 @@
# Set platform to N9K-F for fretta # Set platform to N9K-F for fretta
- set_fact: platform="N9K-F" - set_fact: platform="N9K-F"
when: (platform | match("N9K")) and (fretta | search("true")) when: (platform | match("N9K")) and (fretta | search("true"))
# Check if platform is titanium
- set_fact: titanium={% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if 'NX-OSv' in row['desc']%}"true"{% endfor %}
when: platform | match("N7K")