W3cubDocs

/Ansible

cisco.iosxr.iosxr_bgp_address_family – Manages BGP 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_address_family.

New in version 2.0.0: of cisco.iosxr

Synopsis

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

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
config
dictionary
A list of configurations for BGP address family.
address_family
list / elements=dictionary
Enable address family and enter its config mode
additional_paths
string
    Choices:
  • send
  • receive
BGP additional-paths commands
advertise_best_external
boolean
    Choices:
  • no
  • yes
Advertise best-external path.
afi
string
    Choices:
  • ipv4
  • ipv6
  • l2vpn
  • link-state
  • vpnv4
  • vpnv6
address family.
aggregate_address
list / elements=dictionary
Configure BGP aggregate entries.
as_confed_set
boolean
    Choices:
  • no
  • yes
Generate AS confed set path information.
as_set
boolean
    Choices:
  • no
  • yes
Generate AS set path information.
route_policy
string
Policy to condition advertisement, suppression, and attributes.
summary_only
boolean
    Choices:
  • no
  • yes
Filter more specific routes from updates.
value
string
IPv4 Aggregate address and mask or masklength.
allocate_label
dictionary
Allocate labels.
all
boolean
    Choices:
  • no
  • yes
Allocate labels for all prefixes.
route_policy
string
Use a route policy to select prefixes for label allocation.
allow_vpn_default_originate
boolean
    Choices:
  • no
  • yes
Allow sending default originate route to VPN neighbor.
as_path_loopcheck_out_disable
boolean
    Choices:
  • no
  • yes
Configure AS Path loop checking for outbound updates.
bgp
dictionary
BGP Commands.
attribute_download
boolean
    Choices:
  • no
  • yes
Configure attribute download for this address-family.
bestpath
dictionary
Change default route selection criteria.
origin_as
dictionary
BGP origin-AS knobs.
allow
dictionary
BGP origin-AS knobs.
invalid
boolean
    Choices:
  • no
  • yes
BGP bestpath selection will allow 'invalid' origin-AS
use
dictionary
BGP origin-AS knobs.
validity
boolean
    Choices:
  • no
  • yes
BGP bestpath selection will use origin-AS validity
client_to_client
dictionary
Configure client to client route reflection.
reflection
dictionary
disable client to client reflection of cluster id.
cluster_id_disable
dictionary
ID of Cluster for which reflection is to be disabled.
cluster_id
string
ID of Cluster for which reflection is to be disabled.
disable
boolean
    Choices:
  • no
  • yes
disable cluster id.
disable
boolean
    Choices:
  • no
  • yes
disable reflection.
dampening
dictionary
Enable route-flap dampening
route_policy
string
Route policy to specify criteria for dampening.
set
boolean
    Choices:
  • no
  • yes
Enable dampening.
value
integer
Half-life time for the penalty
import_delay
dictionary
Specify delay for batching import processing.
delay_ms_parts
integer
milliseconds part <0-999>.
delay_second_parts
integer
Delay, seconds part <0-10>.
label_delay
dictionary
Specify delay for batching label processing
delay_ms_parts
integer
milliseconds part <0-999>.
delay_second_parts
integer
Delay, seconds part <0-10>.
origin_as
dictionary
BGP origin-AS knobs.
validation
dictionary
BGP origin-AS validation knobs.
disable
boolean
    Choices:
  • no
  • yes
Disable RPKI origin-AS validation.
signal
dictionary
Signal origin-AS validity towards peers.
ibgp
boolean
    Choices:
  • no
  • yes
Signal origin-AS validity towards iBGP peers
scan_time
integer
Configure background scanner interval for this address-family Example- <5-3600>.
default_martian_check_disable
boolean
    Choices:
  • no
  • yes
Martian check default
distance
dictionary
Define an administrative distance.
local_routes
integer
Distance for local routes <1-255>.
routes_external_to_as
integer
Distance for routes external to the AS <1-255>.
routes_internal_to_as
integer
Distance for routes internal to the AS <1-255>.
dynamic_med
integer
Dynamic MED Interval.
global_table_multicast
boolean
    Choices:
  • no
  • yes
Enable global table multicast.
inter_as_install
boolean
    Choices:
  • no
  • yes
Install remote mvpn routes in default vrf.This is applicable for mvpn afi.
label_mode
dictionary
label configuration.
per_ce
boolean
    Choices:
  • no
  • yes
Set per CE label mode
per_prefix
boolean
    Choices:
  • no
  • yes
Set per perfix label mode.
per_vrf
boolean
    Choices:
  • no
  • yes
Set per VRF label mode.
route_policy
string
Use a route policy to select prefixes for label allocation mode.
maximum_paths
dictionary
Forward packets over multiple paths.
ebgp
dictionary
ebgp-multipath.
max_path_value
integer
<2-64> Number of paths (limit includes backup path).
order_igp_metric
boolean
    Choices:
  • no
  • yes
Order candidate multipaths for selection as per configured number(cisco-support).
selective_order_igp_metric
boolean
    Choices:
  • no
  • yes
Allow multipaths only from marked neighbors
eibgp
dictionary
eiBGP-multipath.
max_path_value
integer
<2-64> Number of paths (limit includes backup path).
order_igp_metric
boolean
    Choices:
  • no
  • yes
Order candidate multipaths for selection as per configured number(cisco-support).
selective_order_igp_metric
boolean
    Choices:
  • no
  • yes
Allow multipaths only from marked neighbors
ibgp
dictionary
iBGP-multipath.
max_path_value
integer
<2-64> Number of paths (limit includes backup path).
order_igp_metric
boolean
    Choices:
  • no
  • yes
Order candidate multipaths for selection as per configured number(cisco-support).
selective_order_igp_metric
boolean
    Choices:
  • no
  • yes
Allow multipaths only from marked neighbors
unequal_cost
dictionary
Allow multipaths to have different BGP nexthop IGP metrics.
order_igp_metric
boolean
    Choices:
  • no
  • yes
Order candidate multipaths for selection as per configured number(cisco-support).
selective_order_igp_metric
boolean
    Choices:
  • no
  • yes
Allow multipaths only from marked neighbors
set
boolean
    Choices:
  • no
  • yes
set unequal_cost.
mvpn_single_forwarder_selection_all
boolean
    Choices:
  • no
  • yes
Enable single forwarder selection for all
mvpn_single_forwarder_selection_highest_ip_address
boolean
    Choices:
  • no
  • yes
Enable single forwarder selection for PE with highest ip address.
networks
list / elements=dictionary
Specify a network to announce via BGP.
backdoor_route_policy
string
Specify a BGP backdoor route.
network
string
Specify a network to announce via BGP.
route_policy
string
Route-policy to modify the attributes.
nexthop
dictionary
Nexthop
resolution_prefix_length_minimum
integer
    Choices:
  • 0
  • 32
Set minimum prefix-length for nexthop resolution.
route_policy
string
Policy to filter out nexthop notification.
trigger_delay_critical
integer
For critical notification
trigger_delay_non_critical
integer
For non critical notification.
optimal_route_reflection
dictionary
Configure optimal-route-reflection group.
group_name
string
ORR group name - maximum 32 characters.
primary_address
string
IPv4 primary address.
secondary_address
string
IPv4 secondary address
permanent_network_route_policy
string
Name of the policy.
redistribute
list / elements=dictionary
Redistribute information from another routing protocol.
external
boolean
    Choices:
  • no
  • yes
Redistribute EIGRP external routes.applicable for eigrp.
external_ospf
integer
    Choices:
  • 1
  • 2
Redistribute OSPF external routes.applicable for ospf.
id
string
Identifier for the routing protocol for configuring redistribute information. Example-application name, eigrp/is-is instance name, ospf tag
Valid for protocols 'ospf', 'eigrp', 'isis' and 'application'.
internal
boolean
    Choices:
  • no
  • yes
Redistribute EIGRP internal routes.applicable for eigrp.
level
string
    Choices:
  • 1
  • 2
  • 1-inter-area
Redistribute routes from the specified ISIS levels.
Redistribute ISIS level 1 routes
Redistribute ISIS level 1 inter-area routes
Redistribute ISIS level 2 ISIS routes
metric
integer
Specifies the metric for redistributed routes.
nssa_external
boolean
    Choices:
  • no
  • yes
Redistribute OSPF NSSA external routes.applicable for ospf.
protocol
string / required
    Choices:
  • ospf
  • application
  • eigrp
  • isis
  • static
  • connected
  • lisp
  • mobile
  • rip
  • subscriber
Specifies the protocol for configuring redistribute information.
route_policy
string
Specifies the route policy reference.
retain_local_label
integer
Label retention time in minutes <3-60>.
route_target_download
boolean
    Choices:
  • no
  • yes
Route target RIB installation.
safi
string
    Choices:
  • flowspec
  • mdt
  • multicast
  • mvpn
  • rt-filter
  • tunnel
  • unicast
  • evpn
  • mspw
  • vpls-vpws
  • link-state
Address Family modifier
segmented_multicast
boolean
    Choices:
  • no
  • yes
Enable segmented multicast.This is applicable for mvpn afi.
table_policy
string
Configure policy for installation of routes to RIB.
update
dictionary
BGP Update generation configuration.
limit
dictionary
Update limit.
address_family
integer
Update limit for sub-groups.
sub_group
dictionary
Update limit for address-family.
ebgp
integer
Update limit for eBGP sub-groups<1-512.
ibgp
integer
Update limit for iBGP sub-groups<1-512.
wait_install
boolean
    Choices:
  • no
  • yes
Wait for route install.
vrf
string
VRF name.
vrf_all_conf
dictionary
configuration is for all vrfs and its applicable for afi vpn6 and modifier unicast.
label_mode
dictionary
Label-related configuration.
per_ce
boolean
    Choices:
  • no
  • yes
Set per CE label mode
per_vrf
boolean
    Choices:
  • no
  • yes
Set per VRF label mode.
route_policy
string
Use a route policy to select prefixes for label allocation mode.
source_rt_import_policy
boolean
    Choices:
  • no
  • yes
Source import route-targets from import-policy.
table_policy
string
Configure policy for installation of routes to RIB.
weight
dictionary
Define or modify weight.
reset_on_import
boolean
    Choices:
  • no
  • yes
set reset_on_import.
reset_on_import_disable
boolean
    Choices:
  • no
  • yes
disable reset_on_import.
as_number
string
Autonomous system number.
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 vpnv4 unicast
#  vrf vrf1
#   rd auto
- name: Merge the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_address_family:
    state: merged
    config:
      as_number: "65536"
      address_family:
        - afi: "ipv4"
          safi: "unicast"
          vrf: vrf1
          dynamic_med: 9
          redistribute:
            - protocol: connected
              metric: 10
        - afi: "ipv4"
          safi: "unicast"
          dynamic_med: 10
          redistribute:
            - protocol: application
              id: test1
              metric: 10
          bgp:
            scan_time: 20
            attribute_download: true
          advertise_best_external: true
          allocate_label:
            all: true
# Task output
# -------------
# commands:
# - router bgp 65536
# - address-family ipv4 unicast
# - advertise best-external
# - allocate-label all
# - bgp attribute-download
# - bgp scan-time 20
# - dynamic-med interval 10
# - redistribute application test1 metric 10
# - vrf vrf1
# - address-family ipv4 unicast
# - dynamic-med interval 9
# - redistribute connected metric 10
#
#
# after:
#   as_number: "65536"
#   address_family:
#     - afi: "ipv4"
#       safi: "unicast"
#       vrf: vrf1
#       dynamic_med: 9
#       redistribute:
#         - protocol: connected
#           metric: 10
#     - afi: "ipv4"
#       safi: "unicast"
#       dynamic_med: 10
#       redistribute:
#         - protocol: application
#           id: "test1"
#           metric: 10
#       bgp:
#         scan_time: 20
#         attribute_download: true
#       advertise_best_external: true
#       allocate_label:
#         all: true
#
# 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
#    advertise best-external
#    allocate-label all
#    bgp attribute-download
#    bgp scan-time 20
#  address-family vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 9
#     redistribute connected metric 10
#
# 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
#    advertise best-external
#    allocate-label all
#    bgp attribute-download
#    bgp scan-time 20
#  address-family vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 9
#     redistribute connected metric 10
#
#
- name: Replace the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_address_family:
    state: replaced
    config:
      as_number: "65536"
      address_family:
        - afi: "ipv4"
          safi: "unicast"
          vrf: vrf1
          dynamic_med: 10
# Task output
# -------------
# commands:
# - router bgp 65536
# - vrf vrf1
# - address-family ipv4 unicast
# - dynamic-med interval 10
# - no redistribute connected metric 10
#
# after:
#   as_number: "65536"
#   address_family:
#     - afi: "ipv4"
#       safi: "unicast"
#       vrf: vrf1
#       dynamic_med: 10
#     - afi: "ipv4"
#       safi: "unicast"
#       dynamic_med: 10
#       redistribute:
#         - protocol: application
#           id: "test1"
#           metric: 10
#       bgp:
#         scan_time: 20
#         attribute_download: true
#       advertise_best_external: true
#       allocate_label:
#         all: true
# 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
#    advertise best-external
#    allocate-label all
#    bgp attribute-download
#    bgp scan-time 20
#  address-family vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 10
#
#
# 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
#    advertise best-external
#    allocate-label all
#    bgp attribute-download
#    bgp scan-time 20
#  address-family vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 9
#     redistribute connected metric 10
#
#
- name: Override the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_address_family:
    state: overridden
    config:
      as_number: "65536"
      address_family:
        - afi: "ipv4"
          safi: "unicast"
          vrf: vrf1
          dynamic_med: 10

# Task output
# -------------
# commands:
# - router bgp 65536
# - no address-family ipv4 unicast
# - vrf vrf1
# - address-family ipv4 unicast
# - dynamic-med interval 10
# - no redistribute connected metric 10
#
#
# after:
#   as_number: "65536"
#   address_family:
#     - afi: "ipv4"
#       safi: "unicast"
#       vrf: vrf1
#       dynamic_med: 10
#
# 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 vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 10
#
#
# Using deleted
# 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
#    advertise best-external
#    allocate-label all
#    bgp attribute-download
#    bgp scan-time 20
#  address-family vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 9
#     redistribute connected metric 10
#
#
- name: Delete the provided configuration
  cisco.iosxr.iosxr_bgp_address_family:
    state: deleted
    config:

# Task output
# -------------
# commands:
# - router bgp 65536
# - no address-family ipv4 unicast
# - vrf vrf1
# - no address-family ipv4 unicast
#
#
# after:
#   as_number: "65536"
#
#
# 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 vpnv4 unicast
#  vrf vrf1
#   rd auto
#
# Using rendered
# -------------
#
- name: rendered state example
  cisco.iosxr.iosxr_bgp_address_family:
    state: rendered
    config:
      as_number: "65536"
      address_family:
        - afi: "ipv4"
          safi: "unicast"
          vrf: vrf1
          dynamic_med: 9
          redistribute:
            - protocol: connected
              metric: 10
        - afi: "ipv4"
          safi: "unicast"
          dynamic_med: 10
          redistribute:
            - protocol: application
              id: test1
              metric: 10
          bgp:
            scan_time: 20
            attribute_download: true
          advertise_best_external: true
          allocate_label:
            all: true
# Task output
# -------------
# commands:
# - router bgp 65536
# - address-family ipv4 unicast
# - advertise best-external
# - allocate-label all
# - bgp attribute-download
# - bgp scan-time 20
# - dynamic-med interval 10
# - redistribute application test1 metric 10
# - vrf vrf1
# - address-family ipv4 unicast
# - dynamic-med interval 9
# - redistribute connected metric 10
#
# Using gathered
# -------------
- name: Merge the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_address_family:
    state: gathered
    config:
      as_number: "65536"
      address_family:
        - afi: "ipv4"
          safi: "unicast"
          vrf: vrf1
          dynamic_med: 9
          redistribute:
            - protocol: connected
              metric: 10
        - afi: "ipv4"
          safi: "unicast"
          dynamic_med: 10
          redistribute:
            - protocol: application
              id: test1
              metric: 10
          bgp:
            scan_time: 20
            attribute_download: true
          advertise_best_external: true
          allocate_label:
            all: true
# gathered:
#   as_number: "65536"
#   address_family:
#     - afi: "ipv4"
#       safi: "unicast"
#       vrf: vrf1
#       dynamic_med: 9
#       redistribute:
#         - protocol: connected
#           metric: 10
#     - afi: "ipv4"
#       safi: "unicast"
#       dynamic_med: 10
#       redistribute:
#         - protocol: application
#           id: "test1"
#           metric: 10
#       bgp:
#         scan_time: 20
#         attribute_download: true
#       advertise_best_external: true
#       allocate_label:
#         all: true
#
# Using parsed
#
#parsed.cfg
#------------
# router bgp 65536
#  bgp router-id 192.0.1.1
#  address-family ipv4 unicast
#    advertise best-external
#    allocate-label all
#    bgp attribute-download
#    bgp scan-time 20
#  address-family vpnv4 unicast
#  vrf vrf1
#   rd auto
#   address-family ipv4 unicast
#     dynamic-med interval 9
#     redistribute connected metric 10
#
- name: Parse externally provided BGP neighbor AF config
  cisco.iosxr.iosxr_bgp_address_family:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task output (redacted)
# -----------------------
# parsed:
#   as_number: "65536"
#   address_family:
#     - afi: "ipv4"
#       safi: "unicast"
#       vrf: vrf1
#       dynamic_med: 9
#       redistribute:
#         - protocol: connected
#           metric: 10
#     - afi: "ipv4"
#       safi: "unicast"
#       dynamic_med: 10
#       redistribute:
#         - protocol: application
#           id: "test1"
#           metric: 10
#       bgp:
#         scan_time: 20
#         attribute_download: true
#       advertise_best_external: true
#       allocate_label:
#         all: true

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_address_family_module.html