Skip iosxr_bgp tests if device is not running XR 6.1.3 (#56123)

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
pull/56141/head
Nilashish Chakraborty 7 years ago committed by GitHub
parent 33d6f6f2dd
commit fef1a10efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 - name: Configure BGP with AS 64496 and a router-id
iosxr_bgp: &config
- assert: operation: merge
that: config:
- 'result.changed == true' bgp_as: 64496
- "'router bgp 64496' in result.commands" router_id: 192.0.2.2
- "'bgp router-id 192.0.2.2' in result.commands" 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"
- assert: - "'bgp router-id 192.0.2.2' in result.commands"
that:
- 'result.changed == false' - name: Configure BGP with AS 64496 and a router-id (idempotent)
iosxr_bgp: *config
- name: Configure BGP neighbors register: result
iosxr_bgp: &nbr
operation: merge - assert:
config: that:
bgp_as: 64496 - 'result.changed == false'
neighbors:
- neighbor: 192.0.2.10 - name: Configure BGP neighbors
remote_as: 64496 iosxr_bgp: &nbr
description: IBGP_NBR_1 operation: merge
advertisement_interval: 120 config:
timers: bgp_as: 64496
keepalive: 300 neighbors:
holdtime: 360 - neighbor: 192.0.2.10
remote_as: 64496
- neighbor: 192.0.2.15 description: IBGP_NBR_1
remote_as: 64496 advertisement_interval: 120
description: IBGP_NBR_2 timers:
tcp_mss: 1500 keepalive: 300
register: result 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" - assert:
- "'timers 300 360' in result.commands" that:
- "'advertisement-interval 120' in result.commands" - 'result.changed == true'
- "'neighbor 192.0.2.15' in result.commands" - "'router bgp 64496' in result.commands"
- "'remote-as 64496' in result.commands" - "'neighbor 192.0.2.10' in result.commands"
- "'description IBGP_NBR_2' in result.commands" - "'remote-as 64496' in result.commands"
- "'tcp mss 1500' in result.commands" - "'description IBGP_NBR_1' in result.commands"
- "'timers 300 360' in result.commands"
- name: Configure BGP neighbors (idempotent) - "'advertisement-interval 120' in result.commands"
iosxr_bgp: *nbr - "'neighbor 192.0.2.15' in result.commands"
register: result - "'remote-as 64496' in result.commands"
- "'description IBGP_NBR_2' in result.commands"
- assert: - "'tcp mss 1500' in result.commands"
that:
- 'result.changed == false' - name: Configure BGP neighbors (idempotent)
iosxr_bgp: *nbr
- name: Configure BGP neighbors with operation replace register: result
iosxr_bgp: &nbr_rplc
operation: replace - assert:
config: that:
bgp_as: 64496 - 'result.changed == false'
neighbors:
- neighbor: 192.0.2.15 - name: Configure BGP neighbors with operation replace
remote_as: 64496 iosxr_bgp: &nbr_rplc
description: IBGP_NBR_2 operation: replace
tcp_mss: 1500 config:
bgp_as: 64496
- neighbor: 203.0.113.10 neighbors:
remote_as: 64511 - neighbor: 192.0.2.15
description: EBGP_NBR_1 remote_as: 64496
register: result description: IBGP_NBR_2
tcp_mss: 1500
- assert:
that: - neighbor: 203.0.113.10
- 'result.changed == true' remote_as: 64511
- "'neighbor 203.0.113.10' in result.commands" description: EBGP_NBR_1
- "'remote-as 64511' in result.commands" register: result
- "'description EBGP_NBR_1' in result.commands"
- "'no neighbor 192.0.2.10' in result.commands" - assert:
that:
- name: Configure BGP neighbors with operation replace (idempotent) - 'result.changed == true'
iosxr_bgp: *nbr_rplc - "'neighbor 203.0.113.10' in result.commands"
register: result - "'remote-as 64511' in result.commands"
- "'description EBGP_NBR_1' in result.commands"
- assert: - "'no neighbor 192.0.2.10' in result.commands"
that:
- 'result.changed == false' - name: Configure BGP neighbors with operation replace (idempotent)
iosxr_bgp: *nbr_rplc
- name: Configure networks under address family register: result
iosxr_bgp: &af_net
operation: merge - assert:
config: that:
bgp_as: 64496 - 'result.changed == false'
address_family:
- afi: ipv4 - name: Configure networks under address family
networks: iosxr_bgp: &af_net
- prefix: 198.51.100.48 operation: merge
masklen: 28 config:
route_map: RMAP_1 bgp_as: 64496
address_family:
- prefix: 192.0.2.64 - afi: ipv4
masklen: 27 networks:
- prefix: 198.51.100.48
- prefix: 203.0.113.160 masklen: 28
masklen: 27 route_map: RMAP_1
- afi: ipv4 - prefix: 192.0.2.64
safi: multicast masklen: 27
networks:
- prefix: 198.51.100.64 - prefix: 203.0.113.160
masklen: 28 masklen: 27
register: result
- afi: ipv4
- assert: safi: multicast
that: networks:
- 'result.changed == true' - prefix: 198.51.100.64
- "'router bgp 64496' in result.commands" masklen: 28
- "'address-family ipv4 unicast' in result.commands" register: result
- "'network 198.51.100.48/28 route-policy RMAP_1' in result.commands"
- "'network 192.0.2.64/27' in result.commands" - assert:
- "'network 203.0.113.160/27' in result.commands" that:
- "'address-family ipv4 multicast' in result.commands" - 'result.changed == true'
- "'network 198.51.100.64/28' in result.commands" - "'router bgp 64496' in result.commands"
- "'address-family ipv4 unicast' in result.commands"
- name: Configure networks under address family (idempotent) - "'network 198.51.100.48/28 route-policy RMAP_1' in result.commands"
iosxr_bgp: *af_net - "'network 192.0.2.64/27' in result.commands"
register: result - "'network 203.0.113.160/27' in result.commands"
- "'address-family ipv4 multicast' in result.commands"
- assert: - "'network 198.51.100.64/28' in result.commands"
that:
- 'result.changed == false' - name: Configure networks under address family (idempotent)
iosxr_bgp: *af_net
- name: Configure networks under address family with operation replace register: result
iosxr_bgp: &af_net_rplc
operation: replace - assert:
config: that:
bgp_as: 64496 - 'result.changed == false'
address_family:
- afi: ipv4 - name: Configure networks under address family with operation replace
safi: unicast iosxr_bgp: &af_net_rplc
networks: operation: replace
- prefix: 198.51.100.80 config:
masklen: 28 bgp_as: 64496
address_family:
- prefix: 192.0.2.64 - afi: ipv4
masklen: 27 safi: unicast
networks:
- prefix: 203.0.113.192 - prefix: 198.51.100.80
masklen: 27 masklen: 28
- afi: ipv4 - prefix: 192.0.2.64
safi: multicast masklen: 27
networks:
- prefix: 198.51.100.64 - prefix: 203.0.113.192
masklen: 28 masklen: 27
register: result
- afi: ipv4
- assert: safi: multicast
that: networks:
- 'result.changed == true' - prefix: 198.51.100.64
- '"router bgp 64496" in result.commands' masklen: 28
- '"address-family ipv4 unicast" in result.commands' register: result
- '"network 198.51.100.80/28" in result.commands'
- '"network 203.0.113.192/27" in result.commands' - assert:
- '"no network 198.51.100.48/28" in result.commands' that:
- '"no network 203.0.113.160/27" in result.commands' - 'result.changed == true'
- '"router bgp 64496" in result.commands'
- name: Configure networks under address family with operation replace (idempotent) - '"address-family ipv4 unicast" in result.commands'
iosxr_bgp: *af_net_rplc - '"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'
- assert: - '"no network 203.0.113.160/27" in result.commands'
that:
- 'result.changed == false' - name: Configure networks under address family with operation replace (idempotent)
iosxr_bgp: *af_net_rplc
- name: Override all the exisiting BGP config register: result
iosxr_bgp:
operation: override - assert:
config: that:
bgp_as: 64497 - 'result.changed == false'
router_id: 192.0.2.10
log_neighbor_changes: True - name: Override all the exisiting BGP config
register: result iosxr_bgp:
operation: override
- assert: config:
that: bgp_as: 64497
- 'result.changed == true' router_id: 192.0.2.10
- "'router bgp 64497' in result.commands" log_neighbor_changes: True
- "'bgp router-id 192.0.2.10' in result.commands" register: result
- "'bgp log neighbor changes detail' in result.commands"
- assert:
- name: Teardown that:
iosxr_bgp: &rm - 'result.changed == true'
operation: delete - "'router bgp 64497' in result.commands"
register: result - "'bgp router-id 192.0.2.10' in result.commands"
- "'bgp log neighbor changes detail' in result.commands"
- assert:
that: - name: Teardown
- 'result.changed == true' iosxr_bgp: &rm
- "'no router bgp 64497' in result.commands" operation: delete
register: result
- name: Teardown again (idempotent)
iosxr_bgp: *rm - assert:
register: result that:
- 'result.changed == true'
- assert: - "'no router bgp 64497' in result.commands"
that:
- 'result.changed == false' - name: Teardown again (idempotent)
iosxr_bgp: *rm
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…
Cancel
Save