Resource module to configure BGP Neighbor Address family.
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:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.2.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# neighbor 192.0.2.3
# remote-as 65538
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
- name: Merge the provided configuration with the existing running configuration
cisco.iosxr.iosxr_bgp_neighbor_address_family:
state: merged
config:
as_number: 65536
neighbors:
- neighbor_address: 192.0.2.2
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
weight: 5
- neighbor_address: 192.0.2.3
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
weight: 4
vrfs:
- vrf: vrf1
neighbors:
- neighbor_address: 192.0.2.4
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
capability_orf_prefix: both
- vrf: vrf2
neighbors:
- neighbor_address: 192.0.2.5
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
capability_orf_prefix: both
# Task output
# -------------
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 5
# - neighbor 192.0.2.3
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 4
# - vrf vrf1
# - neighbor 192.0.2.4
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
# - vrf vrf2
# - neighbor 192.0.2.5
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
#
#
# after:
# as_number: 65536
# neighbors:
# - neighbor_address: 192.0.2.2
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 5
# - neighbor_address: 192.0.2.3
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 4
# vrfs:
# - vrf: vrf1
# neighbors:
# - neighbor_address: 192.0.2.4
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
# - vrf: vrf2
# neighbors:
# - neighbor_address: 192.0.2.5
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
#
#
# After state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# neighbor 1.1.1.2
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
#
#
# Using delete
# Before state:
# -------------
#
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# neighbor 192.0.2.3
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
- name: Delete the provided configuration
cisco.iosxr.iosxr_bgp_neighbor_address_family:
state: deleted
config:
as_number: 65536
neighbors:
- neighbor_address: 192.0.2.2
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
weight: 5
# Task output
# -------------
#
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - no address-family ipv4 unicast
#
#
# after:
# as_number: 65536
# neighbors:
# - neighbor_address: 192.0.2.3
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 4
# vrfs:
# - vrf: vrf1
# neighbors:
# - neighbor_address: 192.0.2.4
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
# - neighbor_address: 192.0.2.5
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
#
#
# Using Replaced
# Before state:
# -------------
#
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# neighbor 192.0.2.3
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
- name: Replace the provided configuration with the existing running configuration
cisco.iosxr.iosxr_bgp_neighbor_address_family:
state: replaced
config:
as_number: 65536
neighbors:
- neighbor_address: 192.0.2.2
address_family:
- afi: ipv4
safi: unicast
default_originate:
set: true
weight: 4
# Task output
# -------------
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - address-family ipv4 unicast
# - no multipath
# - weight 4
#
# after:
# as_number: 65536
# neighbors:
# - neighbor_address: 192.0.2.2
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 4
# - neighbor_address: 192.0.2.3
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 5
# vrfs:
# - vrf: vrf1
# neighbors:
# - neighbor_address: 192.0.2.4
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
# - neighbor_address: 192.0.2.5
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
#
# After state:
# -------------
# Nexus9000v# show running-config router bgp
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 4
# default-originate
# neighbor 192.0.2.3
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
#
#
# Using overridden
# Before state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# neighbor 192.0.2.3
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
- name: override the provided configuration
cisco.iosxr.iosxr_bgp_neighbor_address_family:
state: overridden
config:
as_number: 65536
neighbors:
- neighbor_address: 192.0.2.2
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
weight: 5
# Task output
# -------------
#
# commands:
# - router bgp 65536
# - neighbor 192.0.2.3
# - no address-family ipv4 unicast
# - vrf vrf1
# - neighbor 192.0.2.4
# - no address-family ipv4 unicast
# - vrf vrf1
# - neighbor 192.0.2.5
# - no address-family ipv4 unicast
#
#
#
# after:
# as_number: 65536
# neighbors:
# - neighbor_address: 192.0.2.2
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 5
#
# After state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
#
#
#
# Using rendered
# Before state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.2.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# neighbor 192.0.2.3
# remote-as 65538
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
- name: >-
Render platform specific configuration lines with state rendered (without
connecting to the device)
cisco.iosxr.iosxr_bgp_neighbor_address_family:
state: rendered
config:
as_number: 65536
neighbors:
- neighbor_address: 192.0.2.2
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
weight: 5
- neighbor_address: 192.0.2.3
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
weight: 4
vrfs:
- vrf: vrf1
neighbors:
- neighbor_address: 192.0.2.4
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
capability_orf_prefix: both
- vrf: vrf2
neighbors:
- neighbor_address: 192.0.2.5
address_family:
- afi: ipv4
safi: unicast
multipath: true
default_originate:
set: true
capability_orf_prefix: both
# Task output
# -------------
# commands:
# - router bgp 65536
# - neighbor 192.0.2.2
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 5
# - neighbor 192.0.2.3
# - address-family ipv4 unicast
# - default-originate
# - multipath
# - weight 4
# - vrf vrf1
# - neighbor 192.0.2.4
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
# - vrf vrf2
# - neighbor 192.0.2.5
# - address-family ipv4 unicast
# - capability orf prefix both
# - default-originate
# - multipath
#
# Using parsed
#
# parsed.cfg
# ------------
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# neighbor 1.1.1.2
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
- name: Parse externally provided BGP neighbor AF config
cisco.iosxr.iosxr_bgp_neighbor_address_family:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task output (redacted)
# -----------------------
# parsed:
# as_number: 65536
# neighbors:
# - neighbor_address: 192.0.2.2
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 5
# - neighbor_address: 192.0.2.3
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 4
# vrfs:
# - vrf: vrf1
# neighbors:
# - neighbor_address: 192.0.2.4
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
# - vrf: vrf2
# neighbors:
# - neighbor_address: 192.0.2.5
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
#
#
# Using Gathered
# -----------------
# Before state state:
# -------------
# RP/0/0/CPU0:iosxr-02#show running-config router bgp
# Sat Feb 20 03:49:43.618 UTC
# router bgp 65536
# bgp router-id 192.0.1.1
# address-family ipv4 unicast
# address-family vpnv4 unicast
# neighbor 192.0.2.2
# remote-as 65537
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# neighbor 1.1.1.2
# remote-as 65538
# address-family ipv4 unicast
# multipath
# weight 5
# default-originate
# vrf vrf1
# rd auto
# neighbor 192.0.2.4
# remote-as 65539
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
# vrf vrf2
# rd auto
# neighbor 192.0.2.5
# remote-as 65540
# address-family ipv4 unicast
# multipath
# capability orf prefix both
# default-originate
#
#
#
- name: Gathered the provided configuration with the existing running configuration
cisco.iosxr.iosxr_bgp_neighbor_address_family:
config:
state: gathered
# Task output
# -----------------------
# gathered:
# as_number: 65536
# neighbors:
# - neighbor_address: 192.0.2.2
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 5
# - neighbor_address: 192.0.2.3
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# weight: 4
# vrfs:
# - vrf: vrf1
# neighbors:
# - neighbor_address: 192.0.2.4
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
# - vrf: vrf2
# neighbors:
# - neighbor_address: 192.0.2.5
# address_family:
# - afi: "ipv4"
# safi: "unicast"
# multipath: true
# default_originate:
# set: true
# capability_orf_prefix: both
#
- Ashwini Mhatre (@amhatre)