cisco.ios.ios_bgp_address_family – BGP Address family resource module

Note

This plugin is part of the cisco.ios 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.ios.

To use it in a playbook, specify: cisco.ios.ios_bgp_address_family.

New in version 1.2.0: of cisco.ios

Synopsis

  • This module configures and manages the attributes of bgp address family on Cisco IOS.

Parameters

Parameter Choices/Defaults Comments
config
dictionary
A list of configurations for bgp address family.
address_family
list / elements=dictionary
A list of configurations for bgp address family.
afi
string
    Choices:
  • ipv4
  • ipv6
  • l2vpn
  • nsap
  • rtfilter
  • vpnv4
  • vpnv6
Address Family
aggregate_address
list / elements=dictionary
Configure BGP aggregate entries
address
string
Aggregate address(A.B.C.D)
advertise_map
string
Set condition to advertise attribute
as_confed_set
boolean
    Choices:
  • no
  • yes
Generate AS confed set path information
as_set
boolean
    Choices:
  • no
  • yes
Generate AS set path information
attribute_map
string
Set attributes of aggregate
netmask
string
Aggregate mask(A.B.C.D)
summary_only
boolean
    Choices:
  • no
  • yes
Filter more specific routes from updates
suppress_map
string
Conditionally filter more specific routes from updates
auto_summary
boolean
    Choices:
  • no
  • yes
Enable automatic network number summarization
bgp
dictionary
Configure BGP aggregate entries
additional_paths
dictionary
Additional paths in the BGP table
receive
boolean
    Choices:
  • no
  • yes
Receive additional paths from neighbors
select
dictionary
Selection criteria to pick the paths
all
boolean
    Choices:
  • no
  • yes
Select all available paths
best
integer
Select best N paths (2-3).
group_best
boolean
    Choices:
  • no
  • yes
Select group-best path
send
boolean
    Choices:
  • no
  • yes
Send additional paths to neighbors
aggregate_timer
integer
Configure Aggregation Timer
Please refer vendor documentation for valid values
dampening
dictionary
Enable route-flap dampening
max_suppress
integer
Maximum duration to suppress a stable route
Please refer vendor documentation for valid values
penalty_half_time
integer
Half-life time for the penalty
Please refer vendor documentation for valid values
reuse_route_val
integer
Value to start reusing a route
Please refer vendor documentation for valid values
route_map
string
Route-map to specify criteria for dampening
suppress_route_val
integer
Value to start suppressing a route
Please refer vendor documentation for valid values
dmzlink_bw
boolean
    Choices:
  • no
  • yes
Use DMZ Link Bandwidth as weight for BGP multipaths
nexthop
dictionary
Nexthop tracking commands
route_map
string
Route map for valid nexthops
trigger
dictionary
Nexthop triggering
delay
integer
Set the delay to tigger nexthop tracking
Please refer vendor documentation for valid values
enable
boolean
    Choices:
  • no
  • yes
Enable nexthop tracking
redistribute_internal
boolean
    Choices:
  • no
  • yes
Allow redistribution of iBGP into IGPs (dangerous)
route_map
boolean
    Choices:
  • no
  • yes
route-map control commands
Have route-map set commands take priority over BGP commands such as next-hop unchanged
scan_time
integer
Configure background scanner interval
Please refer vendor documentation for valid values
slow_peer
list / elements=dictionary
Nexthop triggering
detection
dictionary
Slow-peer detection
enable
boolean
    Choices:
  • no
  • yes
Enable slow-peer detection
threshold
integer
Set the slow-peer detection threshold
Threshold value (seconds)
Please refer vendor documentation for valid values
split_update_group
dictionary
Configure slow-peer split-update-group
dynamic
boolean
    Choices:
  • no
  • yes
Dynamically split the slow peer to slow-update group
permanent
boolean
    Choices:
  • no
  • yes
Keep the slow-peer permanently in slow-update group
soft_reconfig_backup
boolean
    Choices:
  • no
  • yes
Use soft-reconfiguration inbound only when route-refresh is not negotiated
update_group
boolean
    Choices:
  • no
  • yes
Manage peers in bgp update groups
Split update groups based on Policy
Keep peers with as-override in different update groups
default
boolean
    Choices:
  • no
  • yes
Set a command to its defaults
default_information
boolean
    Choices:
  • no
  • yes
Distribution of default information
Distribute default route
default_metric
integer
Set metric of redistributed routes
distance
dictionary
Define an administrative distance
external
integer
Distance for routes external to the AS
internal
integer
Distance for routes internal to the AS
local
integer
Distance for local routes
neighbor
list / elements=dictionary
Specify a neighbor router
activate
boolean
    Choices:
  • no
  • yes
Enable the Address Family for this Neighbor
additional_paths
dictionary
Negotiate additional paths capabilities with this neighbor
disable
boolean
    Choices:
  • no
  • yes
Disable additional paths for this neighbor
receive
boolean
    Choices:
  • no
  • yes
Receive additional paths from neighbors
send
boolean
    Choices:
  • no
  • yes
Send additional paths to this neighbor
address
string
Neighbor address (A.B.C.D)
advertise
dictionary
Advertise to this neighbor
Advertise additional paths
all
boolean
    Choices:
  • no
  • yes
Select all available paths
best
integer
Select best N paths (2-3).
group_best
boolean
    Choices:
  • no
  • yes
Select group-best path
advertise_map
dictionary
specify route-map for conditional advertisement
exist_map
string
advertise prefix only if prefix is in the condition exists
condition route-map name
name
string
advertise route-map name
non_exist_map
string
advertise prefix only if prefix in the condition does not exist
condition route-map name
advertisement_interval
integer
Minimum interval between sending BGP routing updates
aigp
dictionary
Enable a AIGP on neighbor
enable
string
Enable a AIGP on neighbor
send
dictionary
Cost community or MED carrying AIGP VALUE
cost_community
dictionary
Cost extended community carrying AIGP Value
id
integer
Community ID
Please refer vendor documentation for valid values
poi
dictionary
Point of Insertion
igp_cost
boolean
    Choices:
  • no
  • yes
Point of Insertion After IGP
pre_bestpath
boolean
    Choices:
  • no
  • yes
Point of Insertion At Beginning
transitive
boolean
    Choices:
  • no
  • yes
Cost community is Transitive
med
boolean
    Choices:
  • no
  • yes
Med carrying AIGP Value
allow_policy
boolean
    Choices:
  • no
  • yes
Enable the policy support for this IBGP Neighbor
allowas_in
integer
Accept as-path with my AS present in it
Please refer vendor documentation for valid values
as_override
dictionary
Override matching AS-number while sending update
set
boolean
    Choices:
  • no
  • yes
Enable AS override
split_horizon
boolean
    Choices:
  • no
  • yes
Maintain Split Horizon while sending update
bmp_activate
dictionary
Activate the BMP monitoring for a BGP peer
all
boolean
    Choices:
  • no
  • yes
Activate BMP monitoring for all servers
server
integer
Activate BMP for server
BMP Server Number
Please refer vendor documentation for valid values
capability
dictionary
Advertise capability to the peer
Advertise ORF capability to the peer
Advertise prefixlist ORF capability to this neighbor
both
boolean
    Choices:
  • no
  • yes
Capability to SEND and RECEIVE the ORF to/from this neighbor
receive
boolean
    Choices:
  • no
  • yes
Capability to RECEIVE the ORF from this neighbor
send
boolean
    Choices:
  • no
  • yes
Capability to SEND the ORF to this neighbor
cluster_id
string
Configure Route-Reflector Cluster-id (peers may reset)
Route-Reflector Cluster-id as 32 bit quantity, or Route-Reflector Cluster-id in IP address format (A.B.C.D)
default_originate
dictionary
Originate default route to this neighbor
route_map
string
Route-map to specify criteria to originate default
set
boolean
    Choices:
  • no
  • yes
Set default route to this neighbor
description
string
Neighbor specific description
disable_connected_check
boolean
    Choices:
  • no
  • yes
one-hop away EBGP peer using loopback address
distribute_list
dictionary
Filter updates to/from this neighbor
acl
string
ACL id/name
in
boolean
    Choices:
  • no
  • yes
Filter incoming updates
out
boolean
    Choices:
  • no
  • yes
Filter outgoing updates
dmzlink_bw
boolean
    Choices:
  • no
  • yes
Propagate the DMZ link bandwidth
ebgp_multihop
dictionary
Allow EBGP neighbors not on directly connected networks
enable
boolean
    Choices:
  • no
  • yes
Allow EBGP neighbors not on directly connected networks
hop_count
integer
Maximum hop count
Please refer vendor documentation for valid values
fall_over
dictionary
Session fall on peer route lost
bfd
dictionary
Use BFD to detect failure
multi_hop
boolean
    Choices:
  • no
  • yes
Force BFD multi-hop to detect failure
set
boolean
    Choices:
  • no
  • yes
set bfd
single_hop
boolean
    Choices:
  • no
  • yes
Force BFD single-hop to detect failure
route_map
string
Route map for peer route
filter_list
dictionary
Establish BGP filters
as_path_acl
integer
AS path access list
Please refer vendor documentation for valid values
in
boolean
    Choices:
  • no
  • yes
Filter incoming updates
out
boolean
    Choices:
  • no
  • yes
Filter outgoing updates
ha_mode
dictionary
high availability mode
disable
boolean
    Choices:
  • no
  • yes
disable graceful-restart
set
boolean
    Choices:
  • no
  • yes
set ha-mode and graceful-restart for this peer
inherit
string
Inherit a template
Inherit a peer-policy template
internal_vpn_client
boolean
    Choices:
  • no
  • yes
Stack iBGP-CE Neighbor Path in ATTR_SET for vpn update
ipv6_adddress
string
Neighbor ipv6 address (X:X:X:X::X)
local_as
dictionary
Specify a local-as number
dual_as
boolean
    Choices:
  • no
  • yes
Accept either real AS or local AS from the ebgp peer
no_prepend
dictionary
Do not prepend local-as to updates from ebgp peers
replace_as
boolean
    Choices:
  • no
  • yes
Replace real AS with local AS in the EBGP updates
set
boolean
    Choices:
  • no
  • yes
Set prepend
number
integer
AS number used as local AS
Please refer vendor documentation for valid values
set
boolean
    Choices:
  • no
  • yes
set local-as number
log_neighbor_changes
dictionary
Log neighbor up/down and reset reason
disable
boolean
    Choices:
  • no
  • yes
disable Log neighbor up/down and reset
set
boolean
    Choices:
  • no
  • yes
set Log neighbor up/down and reset
maximum_prefix
dictionary
Establish BGP filters
number
integer
maximum no. of prefix limit
Please refer vendor documentation for valid values
restart
integer
Restart bgp connection after limit is exceeded
threshold_value
integer
Threshold value (%) at which to generate a warning msg
Please refer vendor documentation for valid values
warning_only
boolean
    Choices:
  • no
  • yes
Only give warning message when limit is exceeded
next_hop_self
boolean
    Choices:
  • no
  • yes
Disable the next hop calculation for this neighbor
This option is DEPRECATED and is replaced with nexthop_self which accepts dict as input this attribute will be removed after 2023-06-01.
next_hop_unchanged
boolean
    Choices:
  • no
  • yes
Propagate next hop unchanged for iBGP paths to this neighbor
nexthop_self
dictionary
Disable the next hop calculation for this neighbor
all
boolean
    Choices:
  • no
  • yes
Enable next-hop-self for both eBGP and iBGP received paths
set
boolean
    Choices:
  • no
  • yes
set the next hop self
password
string
Set a password
path_attribute
dictionary
BGP optional attribute filtering
discard
dictionary
Discard matching path-attribute for this neighbor
in
boolean
    Choices:
  • no
  • yes
Perform inbound path-attribute filtering
range
dictionary
path attribute range
end
integer
path attribute range end value
Please refer vendor documentation for valid values
start
integer
path attribute range start value
Please refer vendor documentation for valid values
type
integer
path attribute type
Please refer vendor documentation for valid values
treat_as_withdraw
dictionary
Treat-as-withdraw matching path-attribute for this neighbor
in
boolean
    Choices:
  • no
  • yes
Perform inbound path-attribute filtering
range
dictionary
path attribute range
end
integer
path attribute range end value
Please refer vendor documentation for valid values
start
integer
path attribute range start value
Please refer vendor documentation for valid values
type
integer
path attribute type
Please refer vendor documentation for valid values
peer_group
boolean
    Choices:
  • no
  • yes
Member of the peer-group
prefix_list
dictionary
Filter updates to/from this neighbor
This option is DEPRECATED and is replaced with prefix_lists which accepts list of dict as input
in
boolean
    Choices:
  • no
  • yes
Filter incoming updates
name
string
Name of a prefix list
out
boolean
    Choices:
  • no
  • yes
Filter outgoing updates
prefix_lists
list / elements=dictionary
Filter updates to/from this neighbor
in
boolean
    Choices:
  • no
  • yes
Filter incoming updates
name
string
Name of a prefix list
out
boolean
    Choices:
  • no
  • yes
Filter outgoing updates
remote_as
integer
Specify a BGP neighbor
AS of remote neighbor
remove_private_as
dictionary
Remove private AS number from outbound updates
all
boolean
    Choices:
  • no
  • yes
Remove all private AS numbers
replace_as
boolean
    Choices:
  • no
  • yes
Replace all private AS numbers with local AS
set
boolean
    Choices:
  • no
  • yes
Remove private AS number from outbound updates
route_map
dictionary
Apply route map to neighbor
This option is DEPRECATED and is replaced with route_maps which accepts list of dict as input
in
boolean
    Choices:
  • no
  • yes
Apply map to incoming routes
name
string
Name of route map
out
boolean
    Choices:
  • no
  • yes
Apply map to outbound routes
route_maps
list / elements=dictionary
Apply route map to neighbor
in
boolean
    Choices:
  • no
  • yes
Apply map to incoming routes
name
string
Name of route map
out
boolean
    Choices:
  • no
  • yes
Apply map to outbound routes
route_reflector_client
boolean
    Choices:
  • no
  • yes
Configure a neighbor as Route Reflector client
route_server_client
boolean
    Choices:
  • no
  • yes
Configure a neighbor as Route Server client
send_community
dictionary
Send Community attribute to this neighbor
both
boolean
    Choices:
  • no
  • yes
Send Standard and Extended Community attributes
extended
boolean
    Choices:
  • no
  • yes
Send Extended Community attribute
standard
boolean
    Choices:
  • no
  • yes
Send Standard Community attribute
shutdown
dictionary
Administratively shut down this neighbor
graceful
integer
Gracefully shut down this neighbor
time in seconds
Please refer vendor documentation for valid values
set
boolean
    Choices:
  • no
  • yes
shut down
slow_peer
list / elements=dictionary
Configure slow-peer
detection
dictionary
Configure slow-peer
disable
boolean
    Choices:
  • no
  • yes
Disable slow-peer detection
enable
boolean
    Choices:
  • no
  • yes
Enable slow-peer detection
threshold
integer
Set the slow-peer detection threshold
split_update_group
dictionary
Configure slow-peer
dynamic
dictionary
Configure slow-peer
disable
boolean
    Choices:
  • no
  • yes
Configure slow-peer
enable
boolean
    Choices:
  • no
  • yes
Configure slow-peer
permanent
boolean
    Choices:
  • no
  • yes
Configure slow-peer
static
boolean
    Choices:
  • no
  • yes
Configure slow-peer
soft_reconfiguration
boolean
    Choices:
  • no
  • yes
Per neighbor soft reconfiguration
Allow inbound soft reconfiguration for this neighbor
soo
string
Site-of-Origin extended community
tag
string
Neighbor tag
timers
dictionary
BGP per neighbor timers
holdtime
integer
Holdtime
interval
integer
Keepalive interval
min_holdtime
integer
Minimum hold time from neighbor
transport
dictionary
Transport options
connection_mode
dictionary
Specify passive or active connection
active
boolean
    Choices:
  • no
  • yes
Actively establish the TCP session
passive
boolean
    Choices:
  • no
  • yes
Passively establish the TCP session
multi_session
boolean
    Choices:
  • no
  • yes
Use Multi-session for transport
path_mtu_discovery
dictionary
Use transport path MTU discovery
disable
boolean
    Choices:
  • no
  • yes
disable
set
boolean
    Choices:
  • no
  • yes
Use path MTU discovery
ttl_security
integer
BGP ttl security check
maximum number of hops
Please refer vendor documentation for valid values
unsuppress_map
string
Route-map to selectively unsuppress suppressed routes
version
integer
Set the BGP version to match a neighbor
Neighbor's BGP version
Please refer vendor documentation for valid values
weight
integer
Set default weight for routes from this neighbor
network
list / elements=dictionary
Specify a network to announce via BGP
address
string
Network number (A.B.C.D)
backdoor
boolean
    Choices:
  • no
  • yes
Specify a BGP backdoor route
mask
string
Network mask (A.B.C.D)
route_map
string
Route-map to modify the attributes
redistribute
list / elements=dictionary
Redistribute information from another routing protocol
application
dictionary
Application
metric
integer
Metric for redistributed routes
name
string
Application name
route_map
string
Route map reference
bgp
dictionary
Border Gateway Protocol (BGP)
as_number
string
Autonomous system number
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
connected
dictionary
Connected
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
eigrp
dictionary
Enhanced Interior Gateway Routing Protocol (EIGRP)
as_number
string
Autonomous system number
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
isis
dictionary
ISO IS-IS
area_tag
string
ISO routing area tag
clns
boolean
    Choices:
  • no
  • yes
Redistribution of OSI dynamic routes
ip
boolean
    Choices:
  • no
  • yes
Redistribution of IP dynamic routes
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
iso_igrp
dictionary
IGRP for OSI networks
area_tag
string
ISO routing area tag
route_map
string
Route map reference
lisp
dictionary
Locator ID Separation Protocol (LISP)
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
mobile
dictionary
Mobile routes
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
odr
dictionary
On Demand stub Routes
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
ospf
dictionary
Open Shortest Path First (OSPF)
match
dictionary
On Demand stub Routes
external
boolean
    Choices:
  • no
  • yes
Redistribute OSPF external routes
internal
boolean
    Choices:
  • no
  • yes
Redistribute OSPF internal routes
nssa_external
boolean
    Choices:
  • no
  • yes
Redistribute OSPF NSSA external routes
type_1
boolean
    Choices:
  • no
  • yes
Redistribute NSSA external type 1 routes
type_2
boolean
    Choices:
  • no
  • yes
Redistribute NSSA external type 2 routes
metric
integer
Metric for redistributed routes
process_id
integer
Process ID
route_map
string
Route map reference
vrf
string
VPN Routing/Forwarding Instance
ospfv3
dictionary
OSPFv3
match
dictionary
On Demand stub Routes
external
boolean
    Choices:
  • no
  • yes
Redistribute OSPF external routes
internal
boolean
    Choices:
  • no
  • yes
Redistribute OSPF internal routes
nssa_external
boolean
    Choices:
  • no
  • yes
Redistribute OSPF NSSA external routes
type_1
boolean
    Choices:
  • no
  • yes
Redistribute NSSA external type 1 routes
type_2
boolean
    Choices:
  • no
  • yes
Redistribute NSSA external type 2 routes
metric
integer
Metric for redistributed routes
process_id
integer
Process ID
route_map
string
Route map reference
rip
dictionary
Routing Information Protocol (RIP)
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
static
dictionary
Static routes
clns
boolean
    Choices:
  • no
  • yes
Redistribution of OSI static routes
ip
boolean
    Choices:
  • no
  • yes
Redistribution of IP static routes
metric
integer
Metric for redistributed routes
route_map
string
Route map reference
vrf
dictionary
Specify a source VRF
global
boolean
    Choices:
  • no
  • yes
global VRF
name
string
Source VRF name
safi
string
    Choices:
  • flowspec
  • mdt
  • multicast
  • mvpn
  • evpn
  • unicast
Address Family modifier
snmp
dictionary
Modify snmp parameters
context
dictionary
Configure a SNMP context
Context Name
community
dictionary
Configure a SNMP v2c Community string and access privs
acl
string
Standard IP accesslist allowing access with this community string
Expanded IP accesslist allowing access with this community string
Access-list name
ipv6
string
Specify IPv6 Named Access-List
IPv6 Access-list name
ro
boolean
    Choices:
  • no
  • yes
Read-only access with this community string
rw
boolean
    Choices:
  • no
  • yes
Read-write access with this community string
snmp_community
string
SNMP community string
name
string
Context Name
user
dictionary
Configure a SNMP v3 user
access
dictionary
specify an access-list associated with this group
acl
string
SNMP community string
ipv6
string
Specify IPv6 Named Access-List
IPv6 Access-list name
auth
dictionary
authentication parameters for the user
md5
string
Use HMAC MD5 algorithm for authentication
authentication password for user
sha
string
Use HMAC SHA algorithm for authentication
authentication password for user
credential
boolean
    Choices:
  • no
  • yes
If the user password is already configured and saved
encrypted
boolean
    Choices:
  • no
  • yes
specifying passwords as MD5 or SHA digests
name
string
SNMP community string
priv
dictionary
encryption parameters for the user
des
string
Use 56 bit DES algorithm for encryption
table_map
dictionary
Map external entry attributes into routing table
filter
boolean
    Choices:
  • no
  • yes
Selective route download
name
string
route-map name
vrf
string
Specify parameters for a VPN Routing/Forwarding instance
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 IOS device by executing the command sh 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
  • gathered
  • rendered
  • parsed
The state the configuration should be left in
The states rendered, gathered and parsed does not perform any change on the device.
The state rendered will transform the configuration in config option to platform specific CLI commands which will be returned in the rendered key within the result. For state rendered active connection to remote host is not required.
The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result.
The state parsed reads the configuration from running_config option and transforms it into JSON format as per the resource module parameters and the value is returned in the parsed key within the result. The value of running_config option should be the same format as the output of command show running-config | include ip route|ipv6 route executed on device. For state parsed active connection to remote host is not required.

Notes

Note

  • Tested against Cisco IOSv Version 15.2 on VIRL

Examples

# Using merged

# Before state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20

- name: Merge provided configuration with device configuration
  cisco.ios.ios_bgp_address_family:
    config:
      as_number: 65000
      address_family:
        - afi: ipv4
          safi: multicast
          vrf: blue
          aggregate_address:
            - address: 192.0.2.1
              netmask: 255.255.255.255
              as_confed_set: true
          bgp:
            aggregate_timer: 10
            dampening:
              penalty_half_time: 1
              reuse_route_val: 1
              suppress_route_val: 1
              max_suppress: 1
            slow_peer:
              - detection:
                  threshold: 150
          neighbor:
            - address: 198.51.100.1
              aigp:
                send:
                  cost_community:
                    id: 100
                    poi:
                      igp_cost: true
                      transitive: true
              slow_peer:
                - detection:
                    threshold: 150
              remote_as: 10
              route_map:
                - name: test-route-out
                  out: true
                - name: test-route-in
                  in: true
              route_server_client: true
          network:
            - address: 198.51.110.10
              mask: 255.255.255.255
              backdoor: true
          snmp:
            context:
              name: snmp_con
              community:
                snmp_community: community
                ro: true
                acl: 10
        - afi: ipv4
          safi: mdt
          bgp:
            dmzlink_bw: true
            dampening:
              penalty_half_time: 1
              reuse_route_val: 10
              suppress_route_val: 100
              max_suppress: 5
            soft_reconfig_backup: true
        - afi: ipv4
          safi: multicast
          aggregate_address:
            - address: 192.0.3.1
              netmask: 255.255.255.255
              as_confed_set: true
          default_metric: 12
          distance:
            external: 10
            internal: 10
            local: 100
          network:
            - address: 198.51.111.11
              mask: 255.255.255.255
              route_map: test
          table_map:
            name: test_tableMap
            filter: true
    state: merged

# Commands fired:
# ---------------
# "commands": [
#     "router bgp 65000",
#     "address-family ipv4 multicast vrf blue",
#     "bgp aggregate-timer 10",
#     "bgp slow-peer detection threshold 150",
#     "bgp dampening 1 1 1 1",
#     "neighbor 198.51.100.1 remote-as 10",
#     "neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive",
#     "neighbor 198.51.100.1 route-map test-route out",
#     "neighbor 198.51.100.1 route-server-client",
#     "neighbor 198.51.100.1 slow-peer detection threshold 150",
#     "network 198.51.110.10 mask 255.255.255.255 backdoor",
#     "snmp context snnmp_con_1 community community ro 10",
#     "aggregate-address 192.0.2.1 255.255.255.255 as-confed-set",
#     "exit-address-family",
#     "address-family ipv4 mdt",
#     "bgp dmzlink-bw",
#     "bgp dampening 1 10 100 5",
#     "bgp soft-reconfig-backup",
#     "exit-address-family",
#     "address-family ipv4 multicast",
#     "network 1.1.1.1 mask 255.255.255.255 route-map test",
#     "aggregate-address 192.0.3.1 255.255.255.255 as-confed-set",
#     "default-metric 12",
#     "distance bgp 10 10 100",
#     "table-map test_tableMap filter"
#     "exit-address-family",
# ]

# After state:
# ------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   table-map test_tableMap filter
#   network 1.1.1.1 mask 255.255.255.255 route-map test
#   aggregate-address 192.0.3.1 255.255.255.255 as-confed-set
#   default-metric 12
#   distance bgp 10 10 100
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.100.1 remote-as 10
#   neighbor 198.51.100.1 activate
#   neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive
#   neighbor 198.51.100.1 route-server-client
#   neighbor 198.51.100.1 slow-peer detection threshold 150
#   neighbor 198.51.100.1 route-map test-route out
#  exit-address-family

# Using replaced

# Before state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   table-map test_tableMap filter
#   network 1.1.1.1 mask 255.255.255.255 route-map test
#   aggregate-address 192.0.3.1 255.255.255.255 as-confed-set
#   default-metric 12
#   distance bgp 10 10 100
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.100.1 remote-as 10
#   neighbor 198.51.100.1 activate
#   neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive
#   neighbor 198.51.100.1 route-server-client
#   neighbor 198.51.100.1 slow-peer detection threshold 150
#   neighbor 198.51.100.1 route-map test-route out
#  exit-address-family

- name: Replaces device configuration of listed AF BGP with provided configuration
  cisco.ios.ios_bgp_address_family:
    config:
      as_number: 65000
      address_family:
        - afi: ipv4
          safi: multicast
          vrf: blue
          aggregate_address:
            - address: 192.0.2.1
              netmask: 255.255.255.255
              as_confed_set: true
          bgp:
            aggregate_timer: 10
            dampening:
              penalty_half_time: 1
              reuse_route_val: 1
              suppress_route_val: 1
              max_suppress: 1
            slow_peer:
              - detection:
                  threshold: 150
          neighbor:
            - address: 198.51.110.1
              activate: true
              aigp:
                send:
                  cost_community:
                    id: 200
                    poi:
                      igp_cost: true
                      transitive: true
              slow_peer:
                - detection:
                    threshold: 150
              remote_as: 10
              route_maps:
                - name: test-replaced-route
                  out: true
              route_server_client: true
          network:
            - address: 198.51.110.10
              mask: 255.255.255.255
              backdoor: true
        - afi: ipv4
          safi: multicast
          bgp:
            aggregate_timer: 10
            dampening:
              penalty_half_time: 10
              reuse_route_val: 10
              suppress_route_val: 10
              max_suppress: 10
            slow_peer:
              - detection:
                  threshold: 200
          network:
            - address: 192.0.2.1
              mask: 255.255.255.255
              route_map: test
    state: replaced

# Commands fired:
# ---------------
# "commands": [
#         "router bgp 65000",
#         "address-family ipv4 multicast vrf blue",
#         "neighbor 198.51.110.1 remote-as 10",
#         "neighbor 198.51.110.1 activate",
#         "neighbor 198.51.110.1 aigp send cost-community 200 poi igp-cost transitive",
#         "neighbor 198.51.110.1 route-map test-replaced-route out",
#         "neighbor 198.51.110.1 route-server-client",
#         "neighbor 198.51.110.1 slow-peer detection threshold 150",
#         "no neighbor 198.51.100.1 remote-as 10",
#         "no neighbor 198.51.100.1 activate",
#         "no neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive",
#         "no neighbor 198.51.100.1 route-map test-route out",
#         "no neighbor 198.51.100.1 route-server-client",
#         "no neighbor 198.51.100.1 slow-peer detection threshold 150",
#         "exit-address-family",
#         "address-family ipv4 multicast",
#         "bgp aggregate-timer 10",
#         "bgp slow-peer detection threshold 200",
#         "bgp dampening 10 10 10 10",
#         "network 192.0.2.1 mask 255.255.255.255 route-map test",
#         "no network 1.1.1.1 mask 255.255.255.255 route-map test",
#         "no aggregate-address 192.0.3.1 255.255.255.255 as-confed-set",
#         "no default-metric 12",
#         "no distance bgp 10 10 100",
#         "no table-map test_tableMap filter"
#         "exit-address-family",
#     ]

# After state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 200
#   bgp dampening 10 10 10 10
#   network 192.0.2.1 mask 255.255.255.255 route-map test
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.110.1 remote-as 10
#   neighbor 198.51.110.1 activate
#   neighbor 198.51.110.1 aigp send cost-community 200 poi igp-cost transitive
#   neighbor 198.51.110.1 route-server-client
#   neighbor 198.51.110.1 slow-peer detection threshold 150
#   neighbor 198.51.110.1 route-map test-replaced-route out
#  exit-address-family

# Using overridden

# Before state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   table-map test_tableMap filter
#   network 1.1.1.1 mask 255.255.255.255 route-map test
#   aggregate-address 192.0.3.1 255.255.255.255 as-confed-set
#   default-metric 12
#   distance bgp 10 10 100
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.100.1 remote-as 10
#   neighbor 198.51.100.1 activate
#   neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive
#   neighbor 198.51.100.1 route-server-client
#   neighbor 198.51.100.1 slow-peer detection threshold 150
#   neighbor 198.51.100.1 route-map test-route out
#  exit-address-family

- name: Override device configuration of all AF BGP with provided configuration
  cisco.ios.ios_bgp_address_family:
    config:
      as_number: 65000
      address_family:
        - afi: ipv4
          safi: multicast
          vrf: blue
          aggregate_address:
            - address: 192.0.2.1
              netmask: 255.255.255.255
              as_confed_set: true
          bgp:
            aggregate_timer: 10
            dampening:
              penalty_half_time: 10
              reuse_route_val: 10
              suppress_route_val: 100
              max_suppress: 50
            slow_peer:
              - detection:
                  threshold: 150
          neighbor:
            - address: 198.51.110.1
              activate: true
              log_neighbor_changes:
                disable: true
              maximum_prefix:
                number: 1
                threshold_value: 10
                restart: 100
              slow_peer:
                - detection:
                    threshold: 150
              remote_as: 100
              route_maps:
                - name: test-override-route
                  out: true
              route_server_client: true
              version: 4
          network:
            - address: 198.51.110.10
              mask: 255.255.255.255
              backdoor: true
        - afi: ipv6
          safi: multicast
          default_information: true
          bgp:
            aggregate_timer: 10
            dampening:
              penalty_half_time: 10
              reuse_route_val: 10
              suppress_route_val: 10
              max_suppress: 10
            slow_peer:
              - detection:
                  threshold: 200
          network:
            - address: 2001:DB8:0:3::/64
              route_map: test_ipv6
    state: overridden

# Commands fired:
# ---------------
# "commands": [
#       "router bgp 65000",
#       "no address-family ipv4 multicast",
#       "no address-family ipv4 mdt",
#       "address-family ipv4 multicast vrf blue",
#       "bgp aggregate-timer 10",
#       "bgp slow-peer detection threshold 150",
#       "bgp dampening 10 10 100 50",
#       "neighbor 198.51.110.1 remote-as 100",
#       "neighbor 198.51.110.1 activate",
#       "neighbor 198.51.110.1 log-neighbor-changes disable",
#       "neighbor 198.51.110.1 maximum-prefix 1 10 restart 100",
#       "neighbor 198.51.110.1 route-map test-override-route out",
#       "neighbor 198.51.110.1 route-server-client",
#       "neighbor 198.51.110.1 version 4",
#       "neighbor 198.51.110.1 slow-peer detection threshold 150",
#       "network 198.51.110.10 mask 255.255.255.255 backdoor",
#       "aggregate-address 192.0.2.1 255.255.255.255 as-confed-set",
#       "exit-address-family",
#       "address-family ipv6 multicast",
#       "bgp aggregate-timer 10",
#       "bgp slow-peer detection threshold 200",
#       "bgp dampening 10 10 10 10",
#       "network 2001:DB8:0:3::/64 route-map test_ipv6"
#       "exit-address-family",
#   ]

# After state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  bgp nopeerup-delay post-boot 10
#  bgp bestpath med confed
#  snmp context snnmp_con_1 community community RO 10
#  neighbor 192.0.2.1 remote-as 100
#  neighbor 192.0.2.1 description replace neighbor
#  neighbor 198.51.100.1 remote-as 10
#  !
#  address-family ipv6 multicast
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 200
#   bgp dampening 10 10 10 10
#   network 2001:DB8:0:3::/64 route-map test_ipv6
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 10 10 100 50
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.110.1 remote-as 100
#   neighbor 198.51.110.1 log-neighbor-changes disable
#   neighbor 198.51.110.1 version 4
#   neighbor 198.51.110.1 activate
#   neighbor 198.51.110.1 route-server-client
#   neighbor 198.51.110.1 slow-peer detection threshold 150
#   neighbor 198.51.110.1 route-map test-override-route out
#   neighbor 198.51.110.1 maximum-prefix 1 10 restart 100
#  exit-address-family

# Using Deleted

# Before state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   table-map test_tableMap filter
#   network 1.1.1.1 mask 255.255.255.255 route-map test
#   aggregate-address 192.0.3.1 255.255.255.255 as-confed-set
#   default-metric 12
#   distance bgp 10 10 100
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.100.1 remote-as 10
#   neighbor 198.51.100.1 activate
#   neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive
#   neighbor 198.51.100.1 route-server-client
#   neighbor 198.51.100.1 slow-peer detection threshold 150
#   neighbor 198.51.100.1 route-map test-route out
#  exit-address-family

- name: "Delete AF BGP (Note: This won't delete the all configured AF BGP)"
  cisco.ios.ios_bgp_address_family:
    config:
      as_number: 65000
      address_family:
        - afi: ipv4
          safi: multicast
        - afi: ipv4
          safi: mdt
    state: deleted

# Commands fired:
# ---------------
# "commands": [
#       "router bgp 65000",
#       "no address-family ipv4 multicast",
#       "no address-family ipv4 mdt"
#   ]

# After state:
# -------------
#
# vios#sh running-config | section ^router bg
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.100.1 remote-as 10
#   neighbor 198.51.100.1 activate
#   neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive
#   neighbor 198.51.100.1 route-server-client
#   neighbor 198.51.100.1 slow-peer detection threshold 150
#   neighbor 198.51.100.1 route-map test-route out
#  exit-address-family

# Using Deleted without any config passed
#"(NOTE: This will delete all of configured AF BGP)"

# Before state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   table-map test_tableMap filter
#   network 1.1.1.1 mask 255.255.255.255 route-map test
#   aggregate-address 192.0.3.1 255.255.255.255 as-confed-set
#   default-metric 12
#   distance bgp 10 10 100
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !
#  address-family ipv4 multicast vrf blue
#   bgp aggregate-timer 10
#   bgp slow-peer detection threshold 150
#   bgp dampening 1 1 1 1
#   network 198.51.110.10 mask 255.255.255.255 backdoor
#   aggregate-address 192.0.2.1 255.255.255.255 as-confed-set
#   neighbor 198.51.100.1 remote-as 10
#   neighbor 198.51.100.1 activate
#   neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive
#   neighbor 198.51.100.1 route-server-client
#   neighbor 198.51.100.1 slow-peer detection threshold 150
#   neighbor 198.51.100.1 route-map test-route out
#  exit-address-family

- name: 'Delete ALL of configured AF BGP (Note: This WILL delete the all configured
    AF BGP)'
  cisco.ios.ios_bgp_address_family:
    state: deleted

# Commands fired:
# ---------------
# "commands": [
#       "router bgp 65000",
#       "no address-family ipv4 multicast vrf blue",
#       "no address-family ipv4 multicast",
#       "no address-family ipv4 mdt"
#   ]

# After state:
# -------------
#
# vios#sh running-config | section ^router bgp
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20

# Using Gathered
# Before state:
# -------------
#
# vios#sh running-config | section ^router bgp

- name: Gather listed AF BGP with provided configurations
  cisco.ios.ios_bgp_address_family:
    config:
    state: gathered

# Module Execution Result:
# ------------------------
#
# "gathered": {
#       "address_family": [
#           {
#               "afi": "ipv4",
#               "aggregate_address": [{
#                   "address": "192.0.2.1",
#                   "as_confed_set": true,
#                   "netmask": "255.255.255.255"
#               }],
#               "bgp": {
#                   "aggregate_timer": 10,
#                   "dampening": {
#                       "max_suppress": 1,
#                       "penalty_half_time": 1,
#                       "reuse_route_val": 1,
#                       "suppress_route_val": 1
#                   },
#                   "slow_peer": [
#                       {
#                           "detection": {
#                               "threshold": 150
#                           }
#                       }
#                   ]
#               },
#               "neighbor": [
#                   {
#                       "activate": true,
#                       "address": "198.51.100.1",
#                       "aigp": {
#                           "send": {
#                               "cost_community": {
#                                   "id": 100,
#                                   "poi": {
#                                       "igp_cost": true,
#                                       "transitive": true
#                                   }
#                               }
#                           }
#                       },
#                       "remote_as": 10,
#                       "route_maps": [{
#                           "name": "test-route",
#                           "out": true
#                       }],
#                       "route_server_client": true,
#                       "slow_peer": [
#                           {
#                               "detection": {
#                                   "threshold": 150
#                               }
#                           }
#                       ]
#                   }
#               ],
#               "network": [
#                   {
#                       "address": "198.51.110.10",
#                       "backdoor": true,
#                       "mask": "255.255.255.255"
#                   }
#               ],
#               "safi": "multicast",
#               "snmp": {
#                   "context": {
#                       "community": {
#                           "acl": "10",
#                           "ro": true,
#                           "snmp_community": "community"
#                       },
#                       "name": "snnmp_con_1"
#                   }
#               },
#               "vrf": "blue"
#           },
#           {
#               "afi": "ipv4",
#               "aggregate_address": [{
#                   "address": "192.0.3.1",
#                   "as_confed_set": true,
#                   "netmask": "255.255.255.255"
#               }],
#               "default_metric": 12,
#               "distance": {
#                   "external": 10,
#                   "internal": 10,
#                   "local": 100
#               },
#               "network": [
#                   {
#                       "address": "1.1.1.1",
#                       "mask": "255.255.255.255",
#                       "route_map": "test"
#                   }
#               ],
#               "safi": "multicast",
#               "table_map": {
#                   "filter": true,
#                   "name": "test_tableMap"
#               }
#           },
#           {
#               "afi": "ipv4",
#               "bgp": {
#                   "dampening": {
#                       "max_suppress": 5,
#                       "penalty_half_time": 1,
#                       "reuse_route_val": 10,
#                       "suppress_route_val": 100
#                   },
#                   "dmzlink_bw": true,
#                   "soft_reconfig_backup": true
#               },
#               "safi": "mdt"
#           }
#       ],
#       "as_number": "65000"
#   }

# Using Rendered

- name: Rendered the provided configuration with the existing running configuration
  cisco.ios.ios_bgp_address_family:
    config:
      as_number: 65000
      address_family:
        - afi: ipv4
          safi: multicast
          vrf: blue
          aggregate_address:
            - address: 192.0.2.1
              netmask: 255.255.255.255
              as_confed_set: true
          bgp:
            aggregate_timer: 10
            dampening:
              penalty_half_time: 1
              reuse_route_val: 1
              suppress_route_val: 1
              max_suppress: 1
            slow_peer:
              - detection:
                  threshold: 150
          neighbor:
            - address: 198.51.100.1
              aigp:
                send:
                  cost_community:
                    id: 100
                    poi:
                      igp_cost: true
                      transitive: true
              slow_peer:
                - detection:
                    threshold: 150
              remote_as: 10
              route_maps:
                - name: test-route
                  out: true
              route_server_client: true
          network:
            - address: 198.51.110.10
              mask: 255.255.255.255
              backdoor: true
          snmp:
            context:
              name: snmp_con
              community:
                snmp_community: community
                ro: true
                acl: 10
        - afi: ipv4
          safi: mdt
          bgp:
            dmzlink_bw: true
            dampening:
              penalty_half_time: 1
              reuse_route_val: 10
              suppress_route_val: 100
              max_suppress: 5
            soft_reconfig_backup: true
    state: rendered

# Module Execution Result:
# ------------------------
#
# "rendered": [
#     "router bgp 65000",
#     "address-family ipv4 multicast vrf blue",
#     "bgp aggregate-timer 10",
#     "bgp slow-peer detection threshold 150",
#     "bgp dampening 1 1 1 1",
#     "neighbor 198.51.100.1 remote-as 10",
#     "neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive",
#     "neighbor 198.51.100.1 route-map test-route out",
#     "neighbor 198.51.100.1 route-server-client",
#     "neighbor 198.51.100.1 slow-peer detection threshold 150",
#     "network 198.51.110.10 mask 255.255.255.255 backdoor",
#     "snmp context snnmp_con_1 community community ro 10",
#     "aggregate-address 192.0.2.1 255.255.255.255 as-confed-set",
#     "exit-address-family",
#     "address-family ipv4 mdt",
#     "bgp dmzlink-bw",
#     "bgp dampening 1 10 100 5",
#     "bgp soft-reconfig-backup"
#     "exit-address-family",
# ]

# Using Parsed

# File: parsed.cfg
# ----------------
# router bgp 65000
#  bgp log-neighbor-changes
#  bgp nopeerup-delay cold-boot 20
#  !
#  address-family ipv4 multicast
#   table-map test_tableMap filter
#   network 1.1.1.1 mask 255.255.255.255 route-map test
#   aggregate-address 192.0.3.1 255.255.255.255 as-confed-set
#   default-metric 12
#   distance bgp 10 10 100
#  exit-address-family
#  !
#  address-family ipv4 mdt
#   bgp dampening 1 10 100 5
#   bgp dmzlink-bw
#   bgp soft-reconfig-backup
#  exit-address-family
#  !

- name: Parse the commands for provided configuration
  cisco.ios.ios_bgp_address_family:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Module Execution Result:
# ------------------------
#
# "parsed": {
#       "address_family": [
#           {
#               "afi": "ipv4",
#               "aggregate_address": [{
#                   "address": "192.0.3.1",
#                   "as_confed_set": true,
#                   "netmask": "255.255.255.255"
#               }],
#               "default_metric": 12,
#               "distance": {
#                   "external": 10,
#                   "internal": 10,
#                   "local": 100
#               },
#               "network": [
#                   {
#                       "address": "1.1.1.1",
#                       "mask": "255.255.255.255",
#                       "route_map": "test"
#                   }
#               ],
#               "safi": "multicast",
#               "table_map": {
#                   "filter": true,
#                   "name": "test_tableMap"
#               }
#           },
#           {
#               "afi": "ipv4",
#               "bgp": {
#                   "dampening": {
#                       "max_suppress": 5,
#                       "penalty_half_time": 1,
#                       "reuse_route_val": 10,
#                       "suppress_route_val": 100
#                   },
#                   "dmzlink_bw": true,
#                   "soft_reconfig_backup": true
#               },
#               "safi": "mdt"
#           }
#       ],
#       "as_number": "65000"
#   }

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
after
dictionary
when changed
The resulting configuration after module execution.

Sample:
This output will always be in the same format as the module argspec.
before
dictionary
when state is merged, replaced, overridden, deleted or purged
The configuration prior to the module execution.

Sample:
This output will always be in the same format as the module argspec.
commands
list / elements=string
when state is merged, replaced, overridden, deleted or purged
The set of commands pushed to the remote device.

Sample:
['router bgp 65000', 'address-family ipv4 multicast', 'table-map test_tableMap filter', 'network 1.1.1.1 mask 255.255.255.255 route-map test', 'aggregate-address 192.0.3.1 255.255.255.255 as-confed-set']
gathered
list / elements=string
when state is gathered
Facts about the network resource gathered from the remote device as structured data.

Sample:
This output will always be in the same format as the module argspec.
parsed
list / elements=string
when state is parsed
The device native config provided in running_config option parsed into structured data as per module argspec.

Sample:
This output will always be in the same format as the module argspec.
rendered
list / elements=string
when state is rendered
The provided configuration in the task rendered in device-native format (offline).

Sample:
['router bgp 65000', 'address-family ipv4 multicast', 'table-map test_tableMap filter', 'network 1.1.1.1 mask 255.255.255.255 route-map test', 'aggregate-address 192.0.3.1 255.255.255.255 as-confed-set']


Authors

  • Sumit Jaiswal (@justjais)

© 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/ios/ios_bgp_address_family_module.html