cisco.iosxr.iosxr_bgp_neighbor_address_family – Manages BGP neighbor address family resource module.

Note

This plugin is part of the cisco.iosxr collection (version 2.5.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install cisco.iosxr.

To use it in a playbook, specify: cisco.iosxr.iosxr_bgp_neighbor_address_family.

New in version 2.0.0: of cisco.iosxr

Synopsis

  • This module configures and manages the attributes of BGP global on Cisco IOS-XR platforms.

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
config
dictionary
BGP neighbor address family configurations.
as_number
string
Autonomous system number.
neighbors
list / elements=dictionary
A list of BGP neighbor address family configurations.
address_family
list / elements=dictionary
Enable address family and enter its config mode
afi
string
    Choices:
  • ipv4
  • ipv6
address family.
aigp
dictionary
AIGP attribute
disable
boolean
    Choices:
  • no
  • yes
Ignore AIGP attribute.
send_cost_community_disable
boolean
    Choices:
  • no
  • yes
send AIGP attribute.
send_med
dictionary
send med options.
disable
boolean
    Choices:
  • no
  • yes
disable Send AIGP value in MED.
set
boolean
    Choices:
  • no
  • yes
set Send AIGP value in MED.
set
boolean
    Choices:
  • no
  • yes
Set AIGP attribute.
allowas_in
dictionary
Allow as-path with my AS present in it.
set
boolean
    Choices:
  • no
  • yes
set allowas_in
value
integer
Number of occurences of AS number 1-10.
as_override
dictionary
Override matching AS-number while sending update
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent as-override from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set as_override
bestpath_origin_as_allow_invalid
boolean
    Choices:
  • no
  • yes
Change default route selection criteria.Allow BGP origin-AS knobs.
capability_orf_prefix
string
    Choices:
  • both
  • send
  • none
  • receive
Advertise address prefix ORF capability to this neighbor.
default_originate
dictionary
Originate default route to this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent default-originate from being inherited from the parent.
route_policy
string
Route policy to specify criteria to originate default
set
boolean
    Choices:
  • no
  • yes
set default route.
long_lived_graceful_restart
dictionary
Enable long lived graceful restart support.
capable
boolean
    Choices:
  • no
  • yes
Treat neighbor as LLGR capable.
stale_time
dictionary
Maximum time to wait before purging long-lived stale routes.
accept
integer
max accept time
send
integer
max send time
maximum_prefix
dictionary
Maximum number of prefixes to accept from this peer.
discard_extra_paths
boolean
    Choices:
  • no
  • yes
Discard extra paths when limit is exceeded.
max_limit
integer
maximum no. of prefix limit.<1-4294967295.
restart
integer
Restart time interval.
threshold_value
integer
hreshold value (%) at which to generate a warning msg <1-100>.
warning_only
boolean
    Choices:
  • no
  • yes
Only give warning message when limit is exceeded.
multipath
boolean
    Choices:
  • no
  • yes
Paths from this neighbor is eligible for multipath.
next_hop_self
dictionary
Disable the next hop calculation for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent next_hop_self from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set next hop self.
next_hop_unchanged
dictionary
Disable the next hop calculation for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent next_hop_unchanged from being inherited from the parent.
multipath
boolean
    Choices:
  • no
  • yes
Do not overwrite nexthop before advertising multipaths.
set
boolean
    Choices:
  • no
  • yes
set next hop unchanged.
optimal_route_reflection_group_name
string
Configure optimal-route-reflection group.
orf_route_policy
string
Specify ORF and inbound filtering criteria.'
origin_as
dictionary
BGP origin-AS knobs.
validation
dictionary
BGP origin-AS validation knobs.
disable
boolean
    Choices:
  • no
  • yes
Disable RPKI origin-AS validation.
remove_private_AS
dictionary
Remove private AS number from outbound updates.
entire_aspath
boolean
    Choices:
  • no
  • yes
remove only if all ASes in the path are private.
inbound
boolean
    Choices:
  • no
  • yes
Remove private AS number from inbound updates.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent remove-private-AS from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set remove private As.
route_policy
dictionary
Apply route policy to neighbor.
inbound
string
Apply route policy to inbound routes.
outbound
string
Apply route policy to outbound routes.
route_reflector_client
dictionary
Configure a neighbor as Route Reflector client.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent route-reflector-client from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set route-reflector-client.
safi
string
    Choices:
  • flowspec
  • mdt
  • multicast
  • mvpn
  • rt-filter
  • tunnel
  • unicast
  • labeled-unicast
Address Family modifier
send_community_ebgp
dictionary
Send community attribute to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_community_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_community_ebgp.
send_community_gshut_ebgp
dictionary
Allow the g-shut community to be sent to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_community_gshut_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_community_gshut_ebgp.
send_extended_community_ebgp
dictionary
Send extended community attribute to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_extended_community_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_extended_community_ebgp.
send_multicast_attributes
dictionary
Send multicast attributes to this neighbor .
disable
boolean
    Choices:
  • no
  • yes
Disable send multicast attributes.
set
boolean
    Choices:
  • no
  • yes
set send_multicast_attributes.
soft_reconfiguration
dictionary
Per neighbor soft reconfiguration.
inbound
dictionary
inbound soft reconfiguration
always
boolean
    Choices:
  • no
  • yes
Allow inbound soft reconfiguration for this neighbor. Always use soft reconfig, even if route refresh is supported.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent soft_reconfiguration from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set inbound
validation
dictionary
Flowspec Validation for this neighbor.
disable
boolean
    Choices:
  • no
  • yes
disable validation.
redirect
boolean
    Choices:
  • no
  • yes
Flowspec Redirect nexthop Validation.
set
boolean
    Choices:
  • no
  • yes
set validation.
weight
integer
Set default weight for routes from this neighbor.
neighbor_address
string / required
Neighbor router address.
vrfs
list / elements=dictionary
Configure BGP neighbor afin a VRF.
neighbors
list / elements=dictionary
A list of BGP neighbor address family configurations.
address_family
list / elements=dictionary
Enable address family and enter its config mode
afi
string
    Choices:
  • ipv4
  • ipv6
address family.
aigp
dictionary
AIGP attribute
disable
boolean
    Choices:
  • no
  • yes
Ignore AIGP attribute.
send_cost_community_disable
boolean
    Choices:
  • no
  • yes
send AIGP attribute.
send_med
dictionary
send med options.
disable
boolean
    Choices:
  • no
  • yes
disable Send AIGP value in MED.
set
boolean
    Choices:
  • no
  • yes
set Send AIGP value in MED.
set
boolean
    Choices:
  • no
  • yes
Set AIGP attribute.
allowas_in
dictionary
Allow as-path with my AS present in it.
set
boolean
    Choices:
  • no
  • yes
set allowas_in
value
integer
Number of occurences of AS number 1-10.
as_overrride
dictionary
Override matching AS-number while sending update
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent as-override from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set as_override
capability_orf_prefix
string
    Choices:
  • both
  • send
  • none
  • receive
Advertise address prefix ORF capability to this neighbor.
default_originate
dictionary
Originate default route to this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent default-originate from being inherited from the parent.
route_policy
string
Route policy to specify criteria to originate default
set
boolean
    Choices:
  • no
  • yes
set default route.
long_lived_graceful_restart
dictionary
Enable long lived graceful restart support.
capable
boolean
    Choices:
  • no
  • yes
Treat neighbor as LLGR capable.
stale_time
dictionary
Maximum time to wait before purging long-lived stale routes.
accept
integer
max accept time
send
integer
max send time
maximum_prefix
dictionary
Maximum number of prefixes to accept from this peer.
discard_extra_paths
boolean
    Choices:
  • no
  • yes
Discard extra paths when limit is exceeded.
max_limit
integer
maximum no. of prefix limit.<1-4294967295.
restart
integer
Restart time interval.
threshold_value
integer
hreshold value (%) at which to generate a warning msg <1-100>.
warning_only
boolean
    Choices:
  • no
  • yes
Only give warning message when limit is exceeded.
multipath
boolean
    Choices:
  • no
  • yes
Paths from this neighbor is eligible for multipath.
next_hop_self
dictionary
Disable the next hop calculation for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent next_hop_self from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set next hop self.
next_hop_unchanged
dictionary
Disable the next hop calculation for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent next_hop_unchanged from being inherited from the parent.
multipath
boolean
    Choices:
  • no
  • yes
Do not overwrite nexthop before advertising multipaths.
set
boolean
    Choices:
  • no
  • yes
set next hop unchanged.
optimal_route_reflection_group_name
string
Configure optimal-route-reflection group.
orf_route_policy
string
Specify ORF and inbound filtering criteria.'
remove_private_AS
dictionary
Remove private AS number from outbound updates.
entire_aspath
boolean
    Choices:
  • no
  • yes
remove only if all ASes in the path are private.
inbound
boolean
    Choices:
  • no
  • yes
Remove private AS number from inbound updates.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent remove-private-AS from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set remove private As.
route_policy
dictionary
Apply route policy to neighbor.
inbound
string
Apply route policy to inbound routes.
outbound
string
Apply route policy to outbound routes.
route_reflector_client
dictionary
Configure a neighbor as Route Reflector client.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent route-reflector-client from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set route-reflector-client.
safi
string
    Choices:
  • flowspec
  • multicast
  • mvpn
  • unicast
  • labeled-unicast
Address Family modifier
send_community_ebgp
dictionary
Send community attribute to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_community_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_community_ebgp.
send_community_gshut_ebgp
dictionary
Allow the g-shut community to be sent to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_community_gshut_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_community_gshut_ebgp.
send_extended_community_ebgp
dictionary
Send extended community attribute to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_extended_community_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_extended_community_ebgp.
site_of_origin
string
Site-of-Origin extended community associated with the neighbor.
soft_reconfiguration
dictionary
Per neighbor soft reconfiguration.
inbound
dictionary
inbound soft reconfiguration
always
boolean
    Choices:
  • no
  • yes
Allow inbound soft reconfiguration for this neighbor. Always use soft reconfig, even if route refresh is supported.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent soft_reconfiguration from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set inbound
validation
dictionary
Flowspec Validation for this neighbor.
disable
boolean
    Choices:
  • no
  • yes
disable validation.
redirect
boolean
    Choices:
  • no
  • yes
Flowspec Redirect nexthop Validation.
set
boolean
    Choices:
  • no
  • yes
set validation.
weight
integer
Set default weight for routes from this neighbor.
neighbor_address
string / required
Neighbor router address.
vrf
string
VRF name.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the Iosxr device by executing the command show running-config router bgp.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
state
string
    Choices:
  • deleted
  • merged
  • overridden
  • replaced
  • gathered
  • rendered
  • parsed
The state the configuration should be left in.

Notes

Note

  • This module works with connection network_cli.

Examples

# 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
#

Authors

  • Ashwini Mhatre (@amhatre)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/cisco/iosxr/iosxr_bgp_neighbor_address_family_module.html