mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Skip iosxr_bgp tests if device is not running XR 6.1.3 (#56123)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
parent
33d6f6f2dd
commit
fef1a10efc
1 changed files with 195 additions and 187 deletions
|
@ -1,226 +1,234 @@
|
||||||
---
|
---
|
||||||
- debug: msg="START iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}"
|
- debug: msg="START iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
||||||
- name: Clear existing BGP config
|
- name: Check IOS-XR version
|
||||||
iosxr_bgp:
|
iosxr_facts:
|
||||||
operation: delete
|
gather_subset: default
|
||||||
ignore_errors: yes
|
register: facts
|
||||||
|
|
||||||
- name: Configure BGP with AS 64496 and a router-id
|
- block:
|
||||||
iosxr_bgp: &config
|
- name: Clear existing BGP config
|
||||||
operation: merge
|
iosxr_bgp:
|
||||||
config:
|
operation: delete
|
||||||
bgp_as: 64496
|
ignore_errors: yes
|
||||||
router_id: 192.0.2.2
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- name: Configure BGP with AS 64496 and a router-id
|
||||||
that:
|
iosxr_bgp: &config
|
||||||
- 'result.changed == true'
|
operation: merge
|
||||||
- "'router bgp 64496' in result.commands"
|
config:
|
||||||
- "'bgp router-id 192.0.2.2' in result.commands"
|
bgp_as: 64496
|
||||||
|
router_id: 192.0.2.2
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: Configure BGP with AS 64496 and a router-id (idempotent)
|
- assert:
|
||||||
iosxr_bgp: *config
|
that:
|
||||||
register: result
|
- 'result.changed == true'
|
||||||
|
- "'router bgp 64496' in result.commands"
|
||||||
|
- "'bgp router-id 192.0.2.2' in result.commands"
|
||||||
|
|
||||||
- assert:
|
- name: Configure BGP with AS 64496 and a router-id (idempotent)
|
||||||
that:
|
iosxr_bgp: *config
|
||||||
- 'result.changed == false'
|
register: result
|
||||||
|
|
||||||
- name: Configure BGP neighbors
|
- assert:
|
||||||
iosxr_bgp: &nbr
|
that:
|
||||||
operation: merge
|
- 'result.changed == false'
|
||||||
config:
|
|
||||||
bgp_as: 64496
|
|
||||||
neighbors:
|
|
||||||
- neighbor: 192.0.2.10
|
|
||||||
remote_as: 64496
|
|
||||||
description: IBGP_NBR_1
|
|
||||||
advertisement_interval: 120
|
|
||||||
timers:
|
|
||||||
keepalive: 300
|
|
||||||
holdtime: 360
|
|
||||||
|
|
||||||
- neighbor: 192.0.2.15
|
- name: Configure BGP neighbors
|
||||||
remote_as: 64496
|
iosxr_bgp: &nbr
|
||||||
description: IBGP_NBR_2
|
operation: merge
|
||||||
tcp_mss: 1500
|
config:
|
||||||
register: result
|
bgp_as: 64496
|
||||||
|
neighbors:
|
||||||
|
- neighbor: 192.0.2.10
|
||||||
|
remote_as: 64496
|
||||||
|
description: IBGP_NBR_1
|
||||||
|
advertisement_interval: 120
|
||||||
|
timers:
|
||||||
|
keepalive: 300
|
||||||
|
holdtime: 360
|
||||||
|
|
||||||
- assert:
|
- neighbor: 192.0.2.15
|
||||||
that:
|
remote_as: 64496
|
||||||
- 'result.changed == true'
|
description: IBGP_NBR_2
|
||||||
- "'router bgp 64496' in result.commands"
|
tcp_mss: 1500
|
||||||
- "'neighbor 192.0.2.10' in result.commands"
|
register: result
|
||||||
- "'remote-as 64496' in result.commands"
|
|
||||||
- "'description IBGP_NBR_1' in result.commands"
|
|
||||||
- "'timers 300 360' in result.commands"
|
|
||||||
- "'advertisement-interval 120' in result.commands"
|
|
||||||
- "'neighbor 192.0.2.15' in result.commands"
|
|
||||||
- "'remote-as 64496' in result.commands"
|
|
||||||
- "'description IBGP_NBR_2' in result.commands"
|
|
||||||
- "'tcp mss 1500' in result.commands"
|
|
||||||
|
|
||||||
- name: Configure BGP neighbors (idempotent)
|
- assert:
|
||||||
iosxr_bgp: *nbr
|
that:
|
||||||
register: result
|
- 'result.changed == true'
|
||||||
|
- "'router bgp 64496' in result.commands"
|
||||||
|
- "'neighbor 192.0.2.10' in result.commands"
|
||||||
|
- "'remote-as 64496' in result.commands"
|
||||||
|
- "'description IBGP_NBR_1' in result.commands"
|
||||||
|
- "'timers 300 360' in result.commands"
|
||||||
|
- "'advertisement-interval 120' in result.commands"
|
||||||
|
- "'neighbor 192.0.2.15' in result.commands"
|
||||||
|
- "'remote-as 64496' in result.commands"
|
||||||
|
- "'description IBGP_NBR_2' in result.commands"
|
||||||
|
- "'tcp mss 1500' in result.commands"
|
||||||
|
|
||||||
- assert:
|
- name: Configure BGP neighbors (idempotent)
|
||||||
that:
|
iosxr_bgp: *nbr
|
||||||
- 'result.changed == false'
|
register: result
|
||||||
|
|
||||||
- name: Configure BGP neighbors with operation replace
|
- assert:
|
||||||
iosxr_bgp: &nbr_rplc
|
that:
|
||||||
operation: replace
|
- 'result.changed == false'
|
||||||
config:
|
|
||||||
bgp_as: 64496
|
|
||||||
neighbors:
|
|
||||||
- neighbor: 192.0.2.15
|
|
||||||
remote_as: 64496
|
|
||||||
description: IBGP_NBR_2
|
|
||||||
tcp_mss: 1500
|
|
||||||
|
|
||||||
- neighbor: 203.0.113.10
|
- name: Configure BGP neighbors with operation replace
|
||||||
remote_as: 64511
|
iosxr_bgp: &nbr_rplc
|
||||||
description: EBGP_NBR_1
|
operation: replace
|
||||||
register: result
|
config:
|
||||||
|
bgp_as: 64496
|
||||||
|
neighbors:
|
||||||
|
- neighbor: 192.0.2.15
|
||||||
|
remote_as: 64496
|
||||||
|
description: IBGP_NBR_2
|
||||||
|
tcp_mss: 1500
|
||||||
|
|
||||||
- assert:
|
- neighbor: 203.0.113.10
|
||||||
that:
|
remote_as: 64511
|
||||||
- 'result.changed == true'
|
description: EBGP_NBR_1
|
||||||
- "'neighbor 203.0.113.10' in result.commands"
|
register: result
|
||||||
- "'remote-as 64511' in result.commands"
|
|
||||||
- "'description EBGP_NBR_1' in result.commands"
|
|
||||||
- "'no neighbor 192.0.2.10' in result.commands"
|
|
||||||
|
|
||||||
- name: Configure BGP neighbors with operation replace (idempotent)
|
- assert:
|
||||||
iosxr_bgp: *nbr_rplc
|
that:
|
||||||
register: result
|
- 'result.changed == true'
|
||||||
|
- "'neighbor 203.0.113.10' in result.commands"
|
||||||
|
- "'remote-as 64511' in result.commands"
|
||||||
|
- "'description EBGP_NBR_1' in result.commands"
|
||||||
|
- "'no neighbor 192.0.2.10' in result.commands"
|
||||||
|
|
||||||
- assert:
|
- name: Configure BGP neighbors with operation replace (idempotent)
|
||||||
that:
|
iosxr_bgp: *nbr_rplc
|
||||||
- 'result.changed == false'
|
register: result
|
||||||
|
|
||||||
- name: Configure networks under address family
|
- assert:
|
||||||
iosxr_bgp: &af_net
|
that:
|
||||||
operation: merge
|
- 'result.changed == false'
|
||||||
config:
|
|
||||||
bgp_as: 64496
|
|
||||||
address_family:
|
|
||||||
- afi: ipv4
|
|
||||||
networks:
|
|
||||||
- prefix: 198.51.100.48
|
|
||||||
masklen: 28
|
|
||||||
route_map: RMAP_1
|
|
||||||
|
|
||||||
- prefix: 192.0.2.64
|
- name: Configure networks under address family
|
||||||
masklen: 27
|
iosxr_bgp: &af_net
|
||||||
|
operation: merge
|
||||||
|
config:
|
||||||
|
bgp_as: 64496
|
||||||
|
address_family:
|
||||||
|
- afi: ipv4
|
||||||
|
networks:
|
||||||
|
- prefix: 198.51.100.48
|
||||||
|
masklen: 28
|
||||||
|
route_map: RMAP_1
|
||||||
|
|
||||||
- prefix: 203.0.113.160
|
- prefix: 192.0.2.64
|
||||||
masklen: 27
|
masklen: 27
|
||||||
|
|
||||||
- afi: ipv4
|
- prefix: 203.0.113.160
|
||||||
safi: multicast
|
masklen: 27
|
||||||
networks:
|
|
||||||
- prefix: 198.51.100.64
|
|
||||||
masklen: 28
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- afi: ipv4
|
||||||
that:
|
safi: multicast
|
||||||
- 'result.changed == true'
|
networks:
|
||||||
- "'router bgp 64496' in result.commands"
|
- prefix: 198.51.100.64
|
||||||
- "'address-family ipv4 unicast' in result.commands"
|
masklen: 28
|
||||||
- "'network 198.51.100.48/28 route-policy RMAP_1' in result.commands"
|
register: result
|
||||||
- "'network 192.0.2.64/27' in result.commands"
|
|
||||||
- "'network 203.0.113.160/27' in result.commands"
|
|
||||||
- "'address-family ipv4 multicast' in result.commands"
|
|
||||||
- "'network 198.51.100.64/28' in result.commands"
|
|
||||||
|
|
||||||
- name: Configure networks under address family (idempotent)
|
- assert:
|
||||||
iosxr_bgp: *af_net
|
that:
|
||||||
register: result
|
- 'result.changed == true'
|
||||||
|
- "'router bgp 64496' in result.commands"
|
||||||
|
- "'address-family ipv4 unicast' in result.commands"
|
||||||
|
- "'network 198.51.100.48/28 route-policy RMAP_1' in result.commands"
|
||||||
|
- "'network 192.0.2.64/27' in result.commands"
|
||||||
|
- "'network 203.0.113.160/27' in result.commands"
|
||||||
|
- "'address-family ipv4 multicast' in result.commands"
|
||||||
|
- "'network 198.51.100.64/28' in result.commands"
|
||||||
|
|
||||||
- assert:
|
- name: Configure networks under address family (idempotent)
|
||||||
that:
|
iosxr_bgp: *af_net
|
||||||
- 'result.changed == false'
|
register: result
|
||||||
|
|
||||||
- name: Configure networks under address family with operation replace
|
- assert:
|
||||||
iosxr_bgp: &af_net_rplc
|
that:
|
||||||
operation: replace
|
- 'result.changed == false'
|
||||||
config:
|
|
||||||
bgp_as: 64496
|
|
||||||
address_family:
|
|
||||||
- afi: ipv4
|
|
||||||
safi: unicast
|
|
||||||
networks:
|
|
||||||
- prefix: 198.51.100.80
|
|
||||||
masklen: 28
|
|
||||||
|
|
||||||
- prefix: 192.0.2.64
|
- name: Configure networks under address family with operation replace
|
||||||
masklen: 27
|
iosxr_bgp: &af_net_rplc
|
||||||
|
operation: replace
|
||||||
|
config:
|
||||||
|
bgp_as: 64496
|
||||||
|
address_family:
|
||||||
|
- afi: ipv4
|
||||||
|
safi: unicast
|
||||||
|
networks:
|
||||||
|
- prefix: 198.51.100.80
|
||||||
|
masklen: 28
|
||||||
|
|
||||||
- prefix: 203.0.113.192
|
- prefix: 192.0.2.64
|
||||||
masklen: 27
|
masklen: 27
|
||||||
|
|
||||||
- afi: ipv4
|
- prefix: 203.0.113.192
|
||||||
safi: multicast
|
masklen: 27
|
||||||
networks:
|
|
||||||
- prefix: 198.51.100.64
|
|
||||||
masklen: 28
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- afi: ipv4
|
||||||
that:
|
safi: multicast
|
||||||
- 'result.changed == true'
|
networks:
|
||||||
- '"router bgp 64496" in result.commands'
|
- prefix: 198.51.100.64
|
||||||
- '"address-family ipv4 unicast" in result.commands'
|
masklen: 28
|
||||||
- '"network 198.51.100.80/28" in result.commands'
|
register: result
|
||||||
- '"network 203.0.113.192/27" in result.commands'
|
|
||||||
- '"no network 198.51.100.48/28" in result.commands'
|
|
||||||
- '"no network 203.0.113.160/27" in result.commands'
|
|
||||||
|
|
||||||
- name: Configure networks under address family with operation replace (idempotent)
|
- assert:
|
||||||
iosxr_bgp: *af_net_rplc
|
that:
|
||||||
register: result
|
- 'result.changed == true'
|
||||||
|
- '"router bgp 64496" in result.commands'
|
||||||
|
- '"address-family ipv4 unicast" in result.commands'
|
||||||
|
- '"network 198.51.100.80/28" in result.commands'
|
||||||
|
- '"network 203.0.113.192/27" in result.commands'
|
||||||
|
- '"no network 198.51.100.48/28" in result.commands'
|
||||||
|
- '"no network 203.0.113.160/27" in result.commands'
|
||||||
|
|
||||||
- assert:
|
- name: Configure networks under address family with operation replace (idempotent)
|
||||||
that:
|
iosxr_bgp: *af_net_rplc
|
||||||
- 'result.changed == false'
|
register: result
|
||||||
|
|
||||||
- name: Override all the exisiting BGP config
|
- assert:
|
||||||
iosxr_bgp:
|
that:
|
||||||
operation: override
|
- 'result.changed == false'
|
||||||
config:
|
|
||||||
bgp_as: 64497
|
|
||||||
router_id: 192.0.2.10
|
|
||||||
log_neighbor_changes: True
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- assert:
|
- name: Override all the exisiting BGP config
|
||||||
that:
|
iosxr_bgp:
|
||||||
- 'result.changed == true'
|
operation: override
|
||||||
- "'router bgp 64497' in result.commands"
|
config:
|
||||||
- "'bgp router-id 192.0.2.10' in result.commands"
|
bgp_as: 64497
|
||||||
- "'bgp log neighbor changes detail' in result.commands"
|
router_id: 192.0.2.10
|
||||||
|
log_neighbor_changes: True
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: Teardown
|
- assert:
|
||||||
iosxr_bgp: &rm
|
that:
|
||||||
operation: delete
|
- 'result.changed == true'
|
||||||
register: result
|
- "'router bgp 64497' in result.commands"
|
||||||
|
- "'bgp router-id 192.0.2.10' in result.commands"
|
||||||
|
- "'bgp log neighbor changes detail' in result.commands"
|
||||||
|
|
||||||
- assert:
|
- name: Teardown
|
||||||
that:
|
iosxr_bgp: &rm
|
||||||
- 'result.changed == true'
|
operation: delete
|
||||||
- "'no router bgp 64497' in result.commands"
|
register: result
|
||||||
|
|
||||||
- name: Teardown again (idempotent)
|
- assert:
|
||||||
iosxr_bgp: *rm
|
that:
|
||||||
register: result
|
- 'result.changed == true'
|
||||||
|
- "'no router bgp 64497' in result.commands"
|
||||||
|
|
||||||
- assert:
|
- name: Teardown again (idempotent)
|
||||||
that:
|
iosxr_bgp: *rm
|
||||||
- 'result.changed == false'
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == false'
|
||||||
|
|
||||||
|
when: facts['ansible_facts']['ansible_net_version'].split('[')[0] == '6.1.3'
|
||||||
|
|
||||||
- debug: msg="END iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}"
|
- debug: msg="END iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue