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:
Nilashish Chakraborty 2019-05-06 23:03:20 +05:30 committed by GitHub
parent 33d6f6f2dd
commit fef1a10efc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,18 @@
---
- debug: msg="START iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}"
- name: Clear existing BGP config
- name: Check IOS-XR version
iosxr_facts:
gather_subset: default
register: facts
- block:
- name: Clear existing BGP config
iosxr_bgp:
operation: delete
ignore_errors: yes
- name: Configure BGP with AS 64496 and a router-id
- name: Configure BGP with AS 64496 and a router-id
iosxr_bgp: &config
operation: merge
config:
@ -14,21 +20,21 @@
router_id: 192.0.2.2
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- "'router bgp 64496' in result.commands"
- "'bgp router-id 192.0.2.2' in result.commands"
- name: Configure BGP with AS 64496 and a router-id (idempotent)
- name: Configure BGP with AS 64496 and a router-id (idempotent)
iosxr_bgp: *config
register: result
- assert:
- assert:
that:
- 'result.changed == false'
- name: Configure BGP neighbors
- name: Configure BGP neighbors
iosxr_bgp: &nbr
operation: merge
config:
@ -48,7 +54,7 @@
tcp_mss: 1500
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- "'router bgp 64496' in result.commands"
@ -62,15 +68,15 @@
- "'description IBGP_NBR_2' in result.commands"
- "'tcp mss 1500' in result.commands"
- name: Configure BGP neighbors (idempotent)
- name: Configure BGP neighbors (idempotent)
iosxr_bgp: *nbr
register: result
- assert:
- assert:
that:
- 'result.changed == false'
- name: Configure BGP neighbors with operation replace
- name: Configure BGP neighbors with operation replace
iosxr_bgp: &nbr_rplc
operation: replace
config:
@ -86,7 +92,7 @@
description: EBGP_NBR_1
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- "'neighbor 203.0.113.10' in result.commands"
@ -94,15 +100,15 @@
- "'description EBGP_NBR_1' in result.commands"
- "'no neighbor 192.0.2.10' in result.commands"
- name: Configure BGP neighbors with operation replace (idempotent)
- name: Configure BGP neighbors with operation replace (idempotent)
iosxr_bgp: *nbr_rplc
register: result
- assert:
- assert:
that:
- 'result.changed == false'
- name: Configure networks under address family
- name: Configure networks under address family
iosxr_bgp: &af_net
operation: merge
config:
@ -127,7 +133,7 @@
masklen: 28
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- "'router bgp 64496' in result.commands"
@ -138,15 +144,15 @@
- "'address-family ipv4 multicast' in result.commands"
- "'network 198.51.100.64/28' in result.commands"
- name: Configure networks under address family (idempotent)
- name: Configure networks under address family (idempotent)
iosxr_bgp: *af_net
register: result
- assert:
- assert:
that:
- 'result.changed == false'
- name: Configure networks under address family with operation replace
- name: Configure networks under address family with operation replace
iosxr_bgp: &af_net_rplc
operation: replace
config:
@ -171,7 +177,7 @@
masklen: 28
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- '"router bgp 64496" in result.commands'
@ -181,15 +187,15 @@
- '"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)
- name: Configure networks under address family with operation replace (idempotent)
iosxr_bgp: *af_net_rplc
register: result
- assert:
- assert:
that:
- 'result.changed == false'
- name: Override all the exisiting BGP config
- name: Override all the exisiting BGP config
iosxr_bgp:
operation: override
config:
@ -198,29 +204,31 @@
log_neighbor_changes: True
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- "'router bgp 64497' in result.commands"
- "'bgp router-id 192.0.2.10' in result.commands"
- "'bgp log neighbor changes detail' in result.commands"
- name: Teardown
- name: Teardown
iosxr_bgp: &rm
operation: delete
register: result
- assert:
- assert:
that:
- 'result.changed == true'
- "'no router bgp 64497' in result.commands"
- name: Teardown again (idempotent)
- name: Teardown again (idempotent)
iosxr_bgp: *rm
register: result
- assert:
- 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 }}"