cisco.nxos.nxos_bgp_address_family – BGP Address Family resource module.

Note

This plugin is part of the cisco.nxos collection (version 2.5.1).

To install it use: ansible-galaxy collection install cisco.nxos.

To use it in a playbook, specify: cisco.nxos.nxos_bgp_address_family.

New in version 2.0.0: of cisco.nxos

Synopsis

  • This module manages BGP Address Family configuration on devices running Cisco NX-OS.

Note

This module has a corresponding action plugin.

Parameters

Parameter Choices/Defaults Comments
config
dictionary
A list of BGP process configuration.
address_family
list / elements=dictionary
Address Family related configurations.
additional_paths
dictionary
Additional paths configuration.
install_backup
boolean
    Choices:
  • no
  • yes
Install backup path.
receive
boolean
    Choices:
  • no
  • yes
Additional paths Receive capability.
selection
dictionary
Additional paths selection
route_map
string
Route-map for additional paths selection
send
boolean
    Choices:
  • no
  • yes
Additional paths Send capability
advertise_l2vpn_evpn
boolean
    Choices:
  • no
  • yes
Enable advertising EVPN routes.
advertise_pip
boolean
    Choices:
  • no
  • yes
Advertise physical ip for type-5 route.
advertise_system_mac
boolean
    Choices:
  • no
  • yes
Advertise extra EVPN RT-2 with system MAC.
afi
string / required
    Choices:
  • ipv4
  • ipv6
  • link-state
  • vpnv4
  • vpnv6
  • l2vpn
Address Family indicator.
aggregate_address
list / elements=dictionary
Configure BGP aggregate prefixes
advertise_map
string
Select attribute information from specific routes.
as_set
boolean
    Choices:
  • no
  • yes
Generate AS-SET information.
attribute_map
string
Set attribute information of aggregate.
prefix
string
Aggregate prefix.
summary_only
boolean
    Choices:
  • no
  • yes
Do not advertise more specifics.
suppress_map
string
Conditionally filter more specific routes.
allow_vni_in_ethertag
boolean
    Choices:
  • no
  • yes
Allow VNI in Ethernet Tag field in EVPN route.
client_to_client
dictionary
Configure client-to-client route reflection.
no_reflection
boolean
    Choices:
  • no
  • yes
Reflection of routes permitted.
dampen_igp_metric
integer
Dampen IGP metric-related changes.
dampening
dictionary
Configure route flap dampening.
decay_half_life
integer
Decay half life.
max_suppress_time
integer
Maximum suppress time for stable route.
route_map
string
Apply route-map to specify dampening criteria.
set
boolean
    Choices:
  • no
  • yes
Set route flap dampening.
start_reuse_route
integer
Value to start reusing a route.
start_suppress_route
integer
Value to start suppressing a route.
default_information
dictionary
Control distribution of default information.
originate
boolean
    Choices:
  • no
  • yes
Distribute a default route.
default_metric
integer
Set metric of redistributed routes.
distance
dictionary
Configure administrative distance.
ebgp_routes
integer
Distance for EBGP routes.
ibgp_routes
integer
Distance for IBGP routes.
local_routes
integer
Distance for local routes.
export_gateway_ip
boolean
    Choices:
  • no
  • yes
Export Gateway IP to Type-5 EVPN routes for VRF
inject_map
list / elements=dictionary
Routemap which specifies prefixes to inject.
copy_attributes
boolean
    Choices:
  • no
  • yes
Copy attributes from aggregate.
exist_map
string
Routemap which specifies exist condition.
route_map
string
Route-map name.
maximum_paths
dictionary
Forward packets over multipath paths.
eibgp
dictionary
Configure multipath for both EBGP and IBGP paths.
parallel_paths
integer
Number of parallel paths.
ibgp
dictionary
Configure multipath for IBGP paths.
parallel_paths
integer
Number of parallel paths.
local
dictionary
Configure multipath for local paths.
parallel_paths
integer
Number of parallel paths.
mixed
dictionary
Configure multipath for local and remote paths.
parallel_paths
integer
Number of parallel paths.
parallel_paths
integer
Number of parallel paths.
networks
list / elements=dictionary
Configure an IP prefix to advertise.
prefix
string
IP prefix in CIDR format.
route_map
string
Route-map name.
nexthop
dictionary
Nexthop tracking.
route_map
string
Route-map name.
trigger_delay
dictionary
Set the delay to trigger nexthop tracking.
critical_delay
integer
Nexthop changes affecting reachability.
Delay value (miliseconds).
non_critical_delay
integer
Other nexthop changes.
Delay value (miliseconds).
redistribute
list / elements=dictionary
Configure redistribution.
id
string
The identifier for the protocol specified.
protocol
string / required
    Choices:
  • am
  • direct
  • eigrp
  • isis
  • lisp
  • ospf
  • ospfv3
  • rip
  • static
The name of the protocol.
route_map
string / required
The route map policy to constrain redistribution.
retain
dictionary
Retain the routes based on Target VPN Extended Communities.
route_target
dictionary
Specify Target VPN Extended Communities
retain_all
boolean
    Choices:
  • no
  • yes
All the routes regardless of Target-VPN community
route_map
string
Apply route-map to filter routes.
safi
string
    Choices:
  • unicast
  • multicast
  • mvpn
  • evpn
Sub Address Family indicator.
suppress_inactive
boolean
    Choices:
  • no
  • yes
Advertise only active routes to peers.
table_map
dictionary
Policy for filtering/modifying OSPF routes before sending them to RIB.
filter
boolean
    Choices:
  • no
  • yes
Block the OSPF routes from being sent to RIB.
name
string / required
The Route Map name.
timers
dictionary
Configure bgp related timers.
bestpath_defer
dictionary
Configure bestpath defer timer value for batch prefix processing.
defer_time
integer
Bestpath defer time (mseconds).
maximum_defer_time
integer
Maximum bestpath defer time (mseconds).
vrf
string
Virtual Router Context.
wait_igp_convergence
boolean
    Choices:
  • no
  • yes
Delay initial bestpath until redistributed IGPs have converged.
as_number
string
Autonomous System Number of the router.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the NX-OS device by executing the command show running-config | section '^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:
  • merged ←
  • replaced
  • overridden
  • deleted
  • parsed
  • gathered
  • rendered
The state the configuration should be left in.
State deleted only removes BGP attributes that this modules manages and does not negate the BGP process completely.
Refer to examples for more details.

Notes

Note

  • Tested against NX-OS 9.3.6.

  • Unsupported for Cisco MDS

  • For managing BGP neighbor address family configurations please use the cisco.nxos.nxos_bgp_neighbor_address_family module.

  • This module works with connection network_cli and httpapi.

Examples

# Using merged

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# Nexus9000v#

- name: Merge the provided configuration with the existing running configuration
  cisco.nxos.nxos_bgp_address_family:
    config:
      as_number: 65536
      address_family:
        - afi: ipv4
          safi: multicast
          networks:
            - prefix: 192.0.2.32/27
            - prefix: 192.0.2.64/27
              route_map: rmap1
          nexthop:
            route_map: rmap2
            trigger_delay:
              critical_delay: 120
              non_critical_delay: 180
        - afi: ipv4
          safi: unicast
          vrf: site-1
          default_information:
            originate: True
          aggregate_address:
            - prefix: 203.0.113.0/24
              as_set: True
              summary_only: True
        - afi: ipv6
          safi: multicast
          vrf: site-1
          redistribute:
            - protocol: ospfv3
              id: 100
              route_map: rmap-ospf-1
            - protocol: eigrp
              id: 101
              route_map: rmap-eigrp-1

# Task output
# -------------
#  before: {}
#
#  commands:
#  - router bgp 65536
#  - address-family ipv4 multicast
#  - nexthop route-map rmap2
#  - nexthop trigger-delay critical 120 non-critical 180
#  - network 192.0.2.32/27
#  - network 192.0.2.64/27 route-map rmap1
#  - vrf site-1
#  - address-family ipv4 unicast
#  - default-information originate
#  - aggregate-address 203.0.113.0/24 as-set summary-only
#  - address-family ipv6 multicast
#  - redistribute ospfv3 100 route-map rmap-ospf-1
#  - redistribute eigrp 101 route-map rmap-eigrp-1
#
#  after:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.32/27
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - id: "100"
#            protocol: ospfv3
#            route_map: rmap-ospf-1
#          - id: "101"
#            protocol: eigrp
#            route_map: rmap-eigrp-1

# After state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.32/27
#     network 192.0.2.64/27 route-map rmap1
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#       aggregate-address 203.0.113.0/24 as-set summary-only
#     address-family ipv6 multicast
#       redistribute ospfv3 100 route-map rmap-ospf-1
#       redistribute eigrp 101 route-map rmap-eigrp-1
#

# Using replaced

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.32/27
#     network 192.0.2.64/27 route-map rmap1
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#       aggregate-address 203.0.113.0/24 as-set summary-only
#     address-family ipv6 multicast
#       redistribute ospfv3 100 route-map rmap-ospf-1
#       redistribute eigrp 101 route-map rmap-eigrp-1

- name: Replace configuration of specified AFs
  cisco.nxos.nxos_bgp_address_family:
    config:
      as_number: 65536
      address_family:
        - afi: ipv4
          safi: multicast
          networks:
            - prefix: 192.0.2.64/27
              route_map: rmap1
          nexthop:
            route_map: rmap2
            trigger_delay:
              critical_delay: 120
              non_critical_delay: 180
          aggregate_address:
            - prefix: 203.0.113.0/24
              as_set: True
              summary_only: True
        - afi: ipv4
          safi: unicast
          vrf: site-1
    state: replaced

# Task output
# -------------
#  before:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.32/27
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - id: "100"
#            protocol: ospfv3
#            route_map: rmap-ospf-1
#          - id: "101"
#            protocol: eigrp
#            route_map: rmap-eigrp-1
#
#  commands:
#  - router bgp 65536
#  - address-family ipv4 multicast
#  - no network 192.0.2.32/27
#  - aggregate-address 203.0.113.0/24 as-set summary-only
#  - vrf site-1
#  - address-family ipv4 unicast
#  - no default-information originate
#  - no aggregate-address 203.0.113.0/24 as-set summary-only
#
#  after:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - protocol: ospfv3
#            id: "100"
#            route_map: rmap-ospf-1
#          - protocol: eigrp
#            id: "101"
#            route_map: rmap-eigrp-1

# After state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.64/27 route-map rmap1
#     aggregate-address 203.0.113.0/24 as-set summary-only
#   vrf site-1
#     address-family ipv4 unicast
#     address-family ipv6 multicast
#       redistribute ospfv3 100 route-map rmap-ospf-1
#       redistribute eigrp 101 route-map rmap-eigrp-1

# Using overridden

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.32/27
#     network 192.0.2.64/27 route-map rmap1
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#       aggregate-address 203.0.113.0/24 as-set summary-only
#     address-family ipv6 multicast
#       redistribute ospfv3 100 route-map rmap-ospf-1
#       redistribute eigrp 101 route-map rmap-eigrp-1

- name: Override all BGP AF configuration with provided configuration
  cisco.nxos.nxos_bgp_address_family: &overridden
    config:
      as_number: 65536
      address_family:
        - afi: ipv4
          safi: multicast
          networks:
            - prefix: 192.0.2.64/27
              route_map: rmap1
          aggregate_address:
            - prefix: 203.0.113.0/24
              as_set: True
              summary_only: True
        - afi: ipv4
          safi: unicast
          vrf: site-1
    state: overridden

# Task output
# -------------
#  before:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.32/27
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - id: "100"
#            protocol: ospfv3
#            route_map: rmap-ospf-1
#          - id: "101"
#            protocol: eigrp
#            route_map: rmap-eigrp-1
#
#  commands:
#  - router bgp 65536
#  - vrf site-1
#  - no address-family ipv6 multicast
#  - exit
#  - address-family ipv4 multicast
#  - no nexthop route-map rmap2
#  - no nexthop trigger-delay critical 120 non-critical 180
#  - aggregate-address 203.0.113.0/24 as-set summary-only
#  - no network 192.0.2.32/27
#  - vrf site-1
#  - address-family ipv4 unicast
#  - no default-information originate
#  - no aggregate-address 203.0.113.0/24 as-set summary-only
#
#  after:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1

#
# After state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     network 192.0.2.64/27 route-map rmap1
#     aggregate-address 203.0.113.0/24 as-set summary-only
#   vrf site-1
#     address-family ipv4 unicast
#

# Using deleted to remove specified AFs

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.32/27
#     network 192.0.2.64/27 route-map rmap1
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#       aggregate-address 203.0.113.0/24 as-set summary-only
#     address-family ipv6 multicast
#       redistribute ospfv3 100 route-map rmap-ospf-1
#       redistribute eigrp 101 route-map rmap-eigrp-1

- name: Delete specified BGP AFs
  cisco.nxos.nxos_bgp_address_family:
    config:
      as_number: 65536
      address_family:
        - afi: ipv4
          safi: multicast
        - vrf: site-1
          afi: ipv6
          safi: multicast
    state: deleted

# Task output
# -------------
#  before:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.32/27
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - id: "100"
#            protocol: ospfv3
#            route_map: rmap-ospf-1
#          - id: "101"
#            protocol: eigrp
#            route_map: rmap-eigrp-1
#
#  commands:
#  - router bgp 65563
#  - no address-family ipv4 multicast
#  - vrf site-1
#  - no address-family ipv6 multicast
#
#  after:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True

# After state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#       aggregate-address 203.0.113.0/24 as-set summary-only

# Using deleted to remove all BGP AFs

# Before state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.32/27
#     network 192.0.2.64/27 route-map rmap1
#   vrf site-1
#     address-family ipv4 unicast
#       default-information originate
#       aggregate-address 203.0.113.0/24 as-set summary-only
#     address-family ipv6 multicast
#       redistribute ospfv3 100 route-map rmap-ospf-1
#       redistribute eigrp 101 route-map rmap-eigrp-1

- name: Delete all BGP AFs
  cisco.nxos.nxos_bgp_address_family:
    state: deleted

# Task output
# -------------
#  before:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.32/27
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - id: "100"
#            protocol: ospfv3
#            route_map: rmap-ospf-1
#          - id: "101"
#            protocol: eigrp
#            route_map: rmap-eigrp-1
#
#  commands:
#  - router bgp 65563
#  - no address-family ipv4 multicast
#  - vrf site-1
#  - no address-family ipv4 unicast
#  - no address-family ipv6 multicast
#
#  after:
#    as_number: "65536"

# After state:
# -------------
# Nexus9000v# show running-config | section "^router bgp"
# router bgp 65536
# Nexus9000v#

# Using rendered

- name: Render platform specific configuration lines with state rendered (without connecting to the device)
  cisco.nxos.nxos_bgp_address_family:
    config:
      as_number: 65536
      address_family:
        - afi: ipv4
          safi: multicast
          networks:
            - prefix: 192.0.2.32/27
            - prefix: 192.0.2.64/27
              route_map: rmap1
          nexthop:
            route_map: rmap2
            trigger_delay:
              critical_delay: 120
              non_critical_delay: 180
        - afi: ipv4
          safi: unicast
          vrf: site-1
          default_information:
            originate: True
          aggregate_address:
            - prefix: 203.0.113.0/24
              as_set: True
              summary_only: True
        - afi: ipv6
          safi: multicast
          vrf: site-1
          redistribute:
            - protocol: ospfv3
              id: 100
              route_map: rmap-ospf-1
            - protocol: eigrp
              id: 101
              route_map: rmap-eigrp-1
    state: rendered

# Task Output (redacted)
# -----------------------
# rendered:
# - router bgp 65536
# - address-family ipv4 multicast
# - nexthop route-map rmap2
# - nexthop trigger-delay critical 120 non-critical 180
# - network 192.0.2.32/27
# - network 192.0.2.64/27 route-map rmap1
# - vrf site-1
# - address-family ipv4 unicast
# - default-information originate
# - aggregate-address 203.0.113.0/24 as-set summary-only
# - address-family ipv6 multicast
# - redistribute ospfv3 100 route-map rmap-ospf-1
# - redistribute eigrp 101 route-map rmap-eigrp-1

# Using parsed

# parsed.cfg
# ------------
# router bgp 65536
#   address-family ipv4 multicast
#     nexthop route-map rmap2
#     nexthop trigger-delay critical 120 non-critical 180
#     network 192.0.2.32/27
#    network 192.0.2.64/27 route-map rmap1
#  vrf site-1
#    address-family ipv4 unicast
#      default-information originate
#      aggregate-address 203.0.113.0/24 as-set summary-only
#    address-family ipv6 multicast
#      redistribute ospfv3 100 route-map rmap-ospf-1
#      redistribute eigrp 101 route-map rmap-eigrp-1

- name: Parse externally provided BGP AF config
  cisco.nxos.nxos_bgp_address_family:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task output (redacted)
# -----------------------
#  parsed:
#    as_number: "65536"
#    address_family:
#      - afi: ipv4
#        safi: multicast
#        networks:
#          - prefix: 192.0.2.32/27
#          - prefix: 192.0.2.64/27
#            route_map: rmap1
#        nexthop:
#          route_map: rmap2
#          trigger_delay:
#            critical_delay: 120
#            non_critical_delay: 180
#      - afi: ipv4
#        safi: unicast
#        vrf: site-1
#        default_information:
#          originate: True
#        aggregate_address:
#          - prefix: 203.0.113.0/24
#            as_set: True
#            summary_only: True
#      - afi: ipv6
#        safi: multicast
#        vrf: site-1
#        redistribute:
#          - id: "100"
#            protocol: ospfv3
#            route_map: rmap-ospf-1
#          - id: "101"
#            protocol: eigrp
#            route_map: rmap-eigrp-1

Authors

  • Nilashish Chakraborty (@NilashishC)