Resource module to configure BGP.
Version added: 2.0.0
- This module configures and manages the attributes of BGP global on Cisco IOS-XR platforms.
Note
- This module works with connection
network_cli
.
# Using merged
#
# Before state
# ------------
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:38:36.245 UTC
# % No such configuration item(s)
# RP/0/0/CPU0:10#
- name: Merge the following BGP global configuration
cisco.iosxr.iosxr_bgp_global:
config:
as_number: 65536
default_metric: 5
socket:
receive_buffer_size: 514
send_buffer_size: 4098
bgp:
confederation:
identifier: 4
bestpath:
med:
confed: true
cluster_id: 5
router_id: 192.0.2.10
neighbors:
- neighbor: 192.0.2.13
remote_as: 65538
bfd:
fast_detect:
strict_mode: true
multiplier: 6
minimum_interval: 20
vrfs:
- vrf: vrf1
default_metric: 5
#
# Task Output:
# ---------------
#
# before: {}
# commands:
# - router bgp 65536
# - bgp cluster-id 5
# - bgp router-id 192.0.2.10
# - bgp bestpath med confed
# - bgp confederation identifier 4
# - default-metric 5
# - socket receive-buffer-size 514
# - socket send-buffer-size 4098
# - neighbor 192.0.2.13
# - bfd fast-detect strict-mode
# - bfd minimum-interval 20
# - bfd multiplier 6
# - remote-as 65538
# - vrf vrf1
# - default-metric 5
#
# after:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 5
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.13
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
#
# After state
# -----------
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:44:32.480 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 5
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.13
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
# Using replaced
#
# Before state
# ------------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:44:32.480 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 5
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.13
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
- name: Replace the following configuration
cisco.iosxr.iosxr_bgp_global:
state: replaced
config:
as_number: 65536
default_metric: 4
socket:
receive_buffer_size: 514
send_buffer_size: 4098
bgp:
confederation:
identifier: 4
bestpath:
med:
confed: true
cluster_id: 5
router_id: 192.0.2.10
neighbors:
- neighbor: 192.0.2.14
remote_as: 65538
bfd:
fast_detect:
strict_mode: true
multiplier: 6
minimum_interval: 20
vrfs:
- vrf: vrf1
default_metric: 5
#
# Task Output:
# -------------
#
# before:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 5
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.13
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
#
# commands:
# - router bgp 65536
# - default-metric 4
# - neighbor 192.0.2.14
# - bfd fast-detect strict-mode
# - bfd minimum-interval 20
# - bfd multiplier 6
# - remote-as 65538
# - no neighbor 192.0.2.13
#
# after:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 4
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.14
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
#
# After state
# -----------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:54:11.161 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 4
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.14
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
# Using overridden
#
# Before state
# ------------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:44:32.480 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 5
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.13
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
- name: Override running config with provided configuration
cisco.iosxr.iosxr_bgp_global:
state: overridden
config:
as_number: 65536
default_metric: 4
socket:
receive_buffer_size: 514
send_buffer_size: 4098
bgp:
confederation:
identifier: 4
bestpath:
med:
confed: true
cluster_id: 5
router_id: 192.0.2.10
neighbors:
- neighbor: 192.0.2.14
remote_as: 65538
bfd:
fast_detect:
strict_mode: true
multiplier: 6
minimum_interval: 20
vrfs:
- vrf: vrf1
default_metric: 5
#
# Task Output:
# -------------
#
# before:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 5
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.13
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
#
# commands:
# - router bgp 65536
# - default-metric 4
# - neighbor 192.0.2.14
# - bfd fast-detect strict-mode
# - bfd minimum-interval 20
# - bfd multiplier 6
# - remote-as 65538
# - no neighbor 192.0.2.13
#
# after:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 4
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.14
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
# After state
# -----------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:54:11.161 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 4
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.14
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
# Using deleted
#
# Before state
# ------------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:54:11.161 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 4
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.14
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
#
- name: Delete BGP configurations handled by this module
cisco.iosxr.iosxr_bgp_global:
config:
as_number: 65536
state: deleted
#
# Task Output:
# -------------
#
# before:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 4
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.14
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
#
# commands:
# - router bgp 65536
# - no bgp cluster-id 5
# - no bgp router-id 192.0.2.10
# - no bgp bestpath med confed
# - no bgp confederation identifier 4
# - no default-metric 4
# - no socket receive-buffer-size 514
# - no socket send-buffer-size 4098
# - no neighbor 192.0.2.14
# - no vrf vrf1
#
# after:
# as_number: '65536'
#
# After state
# -----------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 10:01:08.232 UTC
# router bgp 65536
# !
#
# Using purged
#
# Before state
# ------------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:54:11.161 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 5
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.13
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
#
- name: Purge all BGP configurations from the device
cisco.iosxr.iosxr_bgp_global:
state: purged
#
# Task Output:
# -------------
#
# before:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 5
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.13
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
#
# commands:
# - no router bgp 65536
#
# after: {}
#
# After state
# -----------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:38:36.245 UTC
# % No such configuration item(s)
# RP/0/0/CPU0:10#
#
#
# Using Rendered
# -----------------
#
- name: >-
Render platform specific configuration lines (without connecting to the
device)
cisco.iosxr.iosxr_bgp_global:
state: rendered
config:
as_number: 1
default_metric: 4
vrfs:
- vrf: vrf3
bfd:
minimum_interval: 20
multiplier: 10
bgp:
fast_external_fallover:
disable: true
router_id: 1.2.3.4
auto_policy_soft_reset:
disable: true
timers:
keepalive_time: 20
holdtime: 30
- vrf: vrf2
bgp:
enforce_first_as:
disable: true
default_metric: 4
neighbors:
- neighbor: 1.1.1.3
remote_as: 2
graceful_maintenance:
set: true
activate:
inheritance_disable: true
local_preference:
value: 1
as_prepends:
value: 2
#
# Task output
# -----------------------
# rendered:
# - router bgp 1
# - default-metric 4
# - vrf vrf3
# - bfd multiplier 10
# - bfd minimum-interval 20
# - bgp auto-policy-soft-reset disable
# - bgp fast-external-fallover disable
# - bgp router-id 1.2.3.4
# - timers bgp 20 30
# - vrf vrf2
# - neighbor 1.1.1.3
# - remote-as 2
# - graceful-maintenance
# - graceful-maintenance activate inheritance-disable
# - graceful-maintenance local-preference 1
# - graceful-maintenance as-prepends 2
# - bgp enforce-first-as disable
# - default-metric 4
# Using parsed
#
# parsed.cfg
# ------------
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 4
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.11
# remote-as 65537
# cluster-id 3
# !
# neighbor 192.0.2.14
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# !
#
- name: Parse externally provided BGP config
cisco.iosxr.iosxr_bgp_global:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task output
# -----------------------
# parsed:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 4
# neighbors:
# - cluster_id: '3'
# neighbor_address: 192.0.2.11
# remote_as: 65537
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.14
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# Using gathered
#
# Before state
# ------------
#
# RP/0/0/CPU0:10#show running-config router bgp
# Thu Feb 4 09:38:36.245 UTC
# router bgp 65536
# bgp confederation identifier 4
# bgp router-id 192.0.2.10
# bgp cluster-id 5
# default-metric 5
# socket send-buffer-size 4098
# bgp bestpath med confed
# socket receive-buffer-size 514
# neighbor 192.0.2.13
# remote-as 65538
# bfd fast-detect strict-mode
# bfd multiplier 6
# bfd minimum-interval 20
# !
# vrf vrf1
# default-metric 5
# !
# !
- name: Gather bgp global facts
cisco.iosxr.iosxr_bgp_global:
state: gathered
# Task Output:
# ------------
#
# gathered:
# as_number: '65536'
# bgp:
# bestpath:
# med:
# confed: true
# cluster_id: '5'
# confederation:
# identifier: 4
# router_id: 192.0.2.10
# default_metric: 5
# neighbors:
# - bfd:
# fast_detect:
# strict_mode: true
# minimum_interval: 20
# multiplier: 6
# neighbor_address: 192.0.2.13
# remote_as: 65538
# socket:
# receive_buffer_size: 514
# send_buffer_size: 4098
# vrfs:
# - default_metric: 5
# vrf: vrf1
Common return values are documented here, the following are the fields unique to this module:
- Ashwini Mhatre (@amhatre)