2017-08-10 09:29:13 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_bgp sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-08-10 09:29:13 +00:00
|
|
|
|
|
|
|
- set_fact: neighbor_down_fib_accelerate="true"
|
2018-02-03 05:07:10 +00:00
|
|
|
when: (not titanium) and ((imagetag != 'N1') and (imagetag != 'D1'))
|
2017-08-10 09:29:13 +00:00
|
|
|
|
|
|
|
- set_fact: reconnect_interval="55"
|
2018-02-03 05:07:10 +00:00
|
|
|
when: (not titanium) and ((imagetag != 'N1') and (imagetag != 'D1'))
|
|
|
|
|
|
|
|
- set_fact: isolate="false"
|
|
|
|
when: platform is not match("N35")
|
2017-08-10 09:29:13 +00:00
|
|
|
|
|
|
|
- name: "Enable feature BGP"
|
2017-08-17 08:40:54 +00:00
|
|
|
nxos_feature:
|
2017-08-10 09:29:13 +00:00
|
|
|
feature: bgp
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-10 09:29:13 +00:00
|
|
|
state: enabled
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Setup"
|
|
|
|
nxos_bgp: &remove
|
|
|
|
asn: 65535
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-10 09:29:13 +00:00
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Configure BGP defaults"
|
|
|
|
nxos_bgp: &configure_default
|
|
|
|
asn: 65535
|
2018-05-30 17:03:20 +00:00
|
|
|
router_id: 192.0.2.1
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-10 09:29:13 +00:00
|
|
|
state: present
|
|
|
|
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
|
2017-08-17 08:40:54 +00:00
|
|
|
|
2017-08-10 09:29:13 +00:00
|
|
|
- name: "Configure BGP non defaults"
|
|
|
|
nxos_bgp: &configure_non_default
|
|
|
|
asn: 65535
|
2018-05-30 17:03:20 +00:00
|
|
|
router_id: 192.0.2.1
|
2017-08-10 09:29:13 +00:00
|
|
|
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
|
2018-02-03 05:07:10 +00:00
|
|
|
isolate: "{{isolate|default(omit)}}"
|
2017-08-10 09:29:13 +00:00
|
|
|
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
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-10 09:29:13 +00:00
|
|
|
state: present
|
|
|
|
register: result
|
2017-08-17 08:40:54 +00:00
|
|
|
|
2017-08-10 09:29:13 +00:00
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_bgp: *configure_non_default
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Remove BGP"
|
|
|
|
nxos_bgp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
2017-08-17 08:40:54 +00:00
|
|
|
|
2017-08-10 09:29:13 +00:00
|
|
|
- name: "Check Idempotence"
|
|
|
|
nxos_bgp: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2017-08-17 08:40:54 +00:00
|
|
|
|
2017-08-10 09:29:13 +00:00
|
|
|
- name: "Disable feature bgp"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-10 09:29:13 +00:00
|
|
|
state: disabled
|
|
|
|
|
|
|
|
rescue:
|
|
|
|
- name: "Cleanup BGP"
|
|
|
|
nxos_bgp: *remove
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Disable feature bgp"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-10 09:29:13 +00:00
|
|
|
state: disabled
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
always:
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_bgp sanity test"
|