Skip to content

Latest commit

 

History

History
5587 lines (5456 loc) · 229 KB

cisco.iosxr.iosxr_bgp_templates_module.rst

File metadata and controls

5587 lines (5456 loc) · 229 KB

cisco.iosxr.iosxr_bgp_templates

Manages BGP templates resource module.

Version added: 6.0.0

  • This module configures and manages the attributes of BGP templates on Cisco IOS-XR platforms.
Parameter Choices/Defaults Comments
config
dictionary
BGP template configurations.
as_number
string
Autonomous system number.
neighbor
list / elements=dictionary
A list of BGP neighbor group configurations.
address_family
list / elements=dictionary
Enable address family and enter its config mode
advertise
dictionary
Per neighbor advertisement options
local_labeled_route
dictionary
Advertisement of routes with local-label
disable
boolean
    Choices:
  • no
  • yes
disable local-labeled-route
set
boolean
    Choices:
  • no
  • yes
set local-labeled-route
permanent_network
boolean
    Choices:
  • no
  • yes
Allow permanent networks for this neighbor
afi
string
    Choices:
  • ipv4
  • ipv6
  • vpnv4
  • vpnv6
  • link-state
  • l2vpn
address family.
aigp
dictionary
AIGP attribute
disable
boolean
    Choices:
  • no
  • yes
Ignore AIGP attribute.
send_cost_community_disable
boolean
    Choices:
  • no
  • yes
send AIGP attribute.
send_med
dictionary
send med options.
disable
boolean
    Choices:
  • no
  • yes
disable Send AIGP value in MED.
set
boolean
    Choices:
  • no
  • yes
set Send AIGP value in MED.
set
boolean
    Choices:
  • no
  • yes
Set AIGP attribute.
allowas_in
dictionary
Allow as-path with my AS present in it.
set
boolean
    Choices:
  • no
  • yes
set allowas_in
value
integer
Number of occurences of AS number 1-10.
as_override
dictionary
Override matching AS-number while sending update
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent as-override from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set as_override
bestpath_origin_as_allow_invalid
boolean
    Choices:
  • no
  • yes
Change default route selection criteria.Allow BGP origin-AS knobs.
capability_orf_prefix
string
    Choices:
  • both
  • send
  • none
  • receive
Advertise address prefix ORF capability to this neighbor.
default_originate
dictionary
Originate default route to this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent default-originate from being inherited from the parent.
route_policy
string
Route policy to specify criteria to originate default
set
boolean
    Choices:
  • no
  • yes
set default route.
encapsulation_type_srv6
boolean
    Choices:
  • no
  • yes
Specify encapsulation type
long_lived_graceful_restart
dictionary
Enable long lived graceful restart support.
capable
boolean
    Choices:
  • no
  • yes
Treat neighbor as LLGR capable.
stale_time
dictionary
Maximum time to wait before purging long-lived stale routes.
accept
integer
max accept time
send
integer
max send time
maximum_prefix
dictionary
Maximum number of prefixes to accept from this peer.
discard_extra_paths
boolean
    Choices:
  • no
  • yes
Discard extra paths when limit is exceeded.
max_limit
integer
maximum no. of prefix limit.<1-4294967295.
restart
integer
Restart time interval.
threshold_value
integer
hreshold value (%) at which to generate a warning msg <1-100>.
warning_only
boolean
    Choices:
  • no
  • yes
Only give warning message when limit is exceeded.
multipath
boolean
    Choices:
  • no
  • yes
Paths from this neighbor is eligible for multipath.
next_hop_self
dictionary
Disable the next hop calculation for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent next_hop_self from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set next hop self.
next_hop_unchanged
dictionary
Disable the next hop calculation for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent next_hop_unchanged from being inherited from the parent.
multipath
boolean
    Choices:
  • no
  • yes
Do not overwrite nexthop before advertising multipaths.
set
boolean
    Choices:
  • no
  • yes
set next hop unchanged.
optimal_route_reflection_group_name
string
Configure optimal-route-reflection group.
orf_route_policy
string
Specify ORF and inbound filtering criteria.'
origin_as
dictionary
BGP origin-AS knobs.
validation
dictionary
BGP origin-AS validation knobs.
disable
boolean
    Choices:
  • no
  • yes
Disable RPKI origin-AS validation.
remove_private_AS
dictionary
Remove private AS number from outbound updates.
entire_aspath
boolean
    Choices:
  • no
  • yes
remove only if all ASes in the path are private.
inbound
boolean
    Choices:
  • no
  • yes
Remove private AS number from inbound updates.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent remove-private-AS from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set remove private As.
route_policy
dictionary
Apply route policy to neighbor.
inbound
string
Apply route policy to inbound routes.
outbound
string
Apply route policy to outbound routes.
route_reflector_client
dictionary
Configure a neighbor as Route Reflector client.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent route-reflector-client from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set route-reflector-client.
safi
string
    Choices:
  • flowspec
  • mdt
  • multicast
  • mvpn
  • rt-filter
  • tunnel
  • unicast
  • labeled-unicast
  • sr-policy
  • link-state
  • evpn
  • mspw
  • vpls-vpws
Address Family modifier
send_community_ebgp
dictionary
Send community attribute to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_community_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_community_ebgp.
send_community_gshut_ebgp
dictionary
Allow the g-shut community to be sent to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_community_gshut_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_community_gshut_ebgp.
send_extended_community_ebgp
dictionary
Send extended community attribute to this external neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent send_extended_community_ebgp from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set send_extended_community_ebgp.
send_multicast_attributes
dictionary
Send multicast attributes to this neighbor .
disable
boolean
    Choices:
  • no
  • yes
Disable send multicast attributes.
set
boolean
    Choices:
  • no
  • yes
set send_multicast_attributes.
signalling
dictionary
Signalling protocols to disable, BGP or LDP
bgp_disable
boolean
    Choices:
  • no
  • yes
Select BGP to disable
ldp_disable
boolean
    Choices:
  • no
  • yes
Select LDP to disable
soft_reconfiguration
dictionary
Per neighbor soft reconfiguration.
inbound
dictionary
inbound soft reconfiguration
always
boolean
    Choices:
  • no
  • yes
Allow inbound soft reconfiguration for this neighbor. Always use soft reconfig, even if route refresh is supported.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent soft_reconfiguration from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set inbound
update
dictionary
update
out_originator_loopcheck_disable
boolean
    Choices:
  • no
  • yes
Disable originator loop check
out_originator_loopcheck_set
boolean
    Choices:
  • no
  • yes
Set originator loop check
use
string
Inherit configuration for this address-family from an af-group.
weight
integer
Set default weight for routes from this neighbor.
advertisement_interval
integer
Minimum interval between sending BGP routing updates.Example-<0-600>.
bfd
dictionary
Configure BFD parameters.
fast_detect
dictionary
Enable Fast detection
disable
boolean
    Choices:
  • no
  • yes
Prevent bfd settings from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
set fast-detect
strict_mode
boolean
    Choices:
  • no
  • yes
Hold down neighbor session until BFD session is up
minimum_interval
integer
Specifies the BFD session's minimum-interval value for the neighbor.
multiplier
integer
Specifies the BFD session's multiplier value for the neighbor.
bmp_activate
dictionary
Enable BMP logging for this neighbor.
server
integer
Enable BMP connection to particular server.Example-<1-8>.
capability
dictionary
Advertise capability to the peer.
additional_paths
dictionary
BGP additional-paths commands.
receive
dictionary
Additional paths receive capability
disable
boolean
    Choices:
  • no
  • yes
set receive capability
set
boolean
    Choices:
  • no
  • yes
set receive capability
send
dictionary
Additional paths Send capability
disable
boolean
    Choices:
  • no
  • yes
set send capability
set
boolean
    Choices:
  • no
  • yes
set send capability
suppress
dictionary
Suppress advertising capability to the peer.
all
dictionary
all capability
inheritance_disable
boolean
    Choices:
  • no
  • yes
Do not inherit this configuration from parent group.
set
boolean
    Choices:
  • no
  • yes
set all.
four_byte_AS
dictionary
4-byte-as capability
set
boolean
    Choices:
  • no
  • yes
set 4_byte_as.
cluster_id
string
Cluster ID of this router acting as a route reflector.
description
string
Neighbor specific description.
dmz_link_bandwidth
dictionary
Propagate the DMZ link bandwidth.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Do not inherit this configuration from parent group.
set
boolean
    Choices:
  • no
  • yes
set dmz-link-bandwidth.
dscp
string
Set IP DSCP (DiffServ CodePoint).Please refer vendor document for valid entries.
ebgp_multihop
dictionary
Allow EBGP neighbors not on directly connected networks.
mpls
boolean
    Choices:
  • no
  • yes
Disable BGP MPLS forwarding.
value
integer
maximum hop count.Example-<1-255>.
ebgp_recv_extcommunity_dmz
dictionary
Receive extcommunity dmz link bandwidth from ebgp neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent ebgp-recv-community-dmz from being inherited from parent
set
boolean
    Choices:
  • no
  • yes
set ebgp-recv-community-dmz.
ebgp_send_extcommunity_dmz
dictionary
Send extcommunity dmz link bandwidth from ebgp neighbor.
cumulatie
boolean
    Choices:
  • no
  • yes
Send cumulative community dmz link bandwidth of all multipaths to ebgp neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent ebgp-send-community-dmz from being inherited from parent
set
boolean
    Choices:
  • no
  • yes
set ebgp-send-community-dmz.
egress_engineering
dictionary
Enable egress peer engineering for this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent egress-engineering from being inherited from parent
set
boolean
    Choices:
  • no
  • yes
set egress-engineering.
enforce_first_as
dictionary
Enforce the first AS for EBGP routes
disable
boolean
    Choices:
  • no
  • yes
disable enforce 1st as
graceful_maintenance
dictionary
Attributes for Graceful Maintenance. This will cause neighbors to de-prefer routes from this router and choose alternates. This allows the router to be brought in or out of service gracefully.
activate
dictionary
Routes will be announced with the graceful maintenance attributes while activated either here or under router bgp configuration.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent activate from being inherited from the parent.
set
boolean
    Choices:
  • no
  • yes
activate.
as_prepends
dictionary
Number of times to prepend the local AS number to the AS path of routes. Default=0
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent as prepends from being inherited from the parent.
value
integer
Range of values for as prepends.Example-<0-6> .
local_preference
dictionary
local preference with which to advertise routes to ibgp neigbors. Default=No Touch
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent local preference from being inherited from the parent.
value
integer
Range of values for Local Preference.Example-<0-4294967295> .
set
boolean
    Choices:
  • no
  • yes
set graceful maintenance.
graceful_restart
dictionary
Enable graceful restart support for this neighbor.
restart_time
integer
Restart time advertised to neighbors in seconds <1-4095>.
stalepath_time
integer
Maximum time to wait for restart of GR capable peers in seconds <1-4095>.
idle_watch_time
integer
Maximum time to wait for deletion of IDLE state dynamic peer.
ignore_connected_check
dictionary
Bypass the directly connected nexthop check for single-hop eBGP peering
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent ignore-connected-check from being inherited from the parent
set
boolean
    Choices:
  • no
  • yes
set ignore-connected-check.
internal_vpn_client
boolean
    Choices:
  • no
  • yes
Preserve iBGP CE neighbor path in ATTR_SET across VPN core.
keychain
dictionary
Set keychain based authentication.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent keychain from being inherited from parent.
name
string
Name of the key chain - maximum 32 characters.
local
dictionary
Configure local parameter
address
dictionary
IPv4 address
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent local address from being inherited from parent.
ipv4_address
string
IPv4 address <A.B.C.D>.
local_address_subnet
string
Local address subnet of routing updates
local_as
dictionary
Specify local AS number.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent local AS from being inherited from parent.
no_prepend
dictionary
Do not prepend local AS to announcements from this neighbor.
replace_as
dictionary
Prepend only local AS to announcements to this neighbor.
dual_as
boolean
    Choices:
  • no
  • yes
Dual-AS mode.
set
boolean
    Choices:
  • no
  • yes
Prepend only local AS to announcements to this neighbor.
set
boolean
    Choices:
  • no
  • yes
Do not prepend local AS to announcements from this neighbor.
value
integer
2 byte, 4 byte As number
log
dictionary
Logging update messages per neighbor.
log_message
dictionary
Logging update/notification messages per neighbor.
in
dictionary
Inbound log messages
disable
boolean
    Choices:
  • no
  • yes
Disable inbound message logging.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevents the msg log from being inherited from the parent.
value
integer
Range for message log buffer size <1-100>.
out
dictionary
Outbound log messages
disable
boolean
    Choices:
  • no
  • yes
Disable inbound message logging.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevents the msg log from being inherited from the parent.
value
integer
Range for message log buffer size <1-100>.
maximum_peers
integer
Maximum dynamic neighbors <1-4095>.
name
string
Name of neighbor group.
password
dictionary
Set a password.
encrypted
string
Specifies an ENCRYPTED password will follow.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent password from being inherited from parent.
peer_set
integer
Assign this neighbor to a peer-set used for egress peer engineering <1-255>.
precedence
string
    Choices:
  • critical
  • flash
  • flash-override
  • immediate
  • internet
  • network
  • priority
  • routine
Set precedence
receive_buffer_size
integer
Set socket and BGP receive buffer size.Example <512-131072>.
remote_as
integer
Neighbor Autonomous System.
remote_as_list
string
Remote as-list configuration
send_buffer_size
integer
Set socket and BGP send buffer size.Example <4096-131072>.
session_open_mode
string
    Choices:
  • active-only
  • both
  • passive-only
Establish BGP session using this TCP open mode.
shutdown
dictionary
Administratively shut down this neighbor.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent shutdown from being inherited from parent
set
boolean
    Choices:
  • no
  • yes
shutdown.
tcp
dictionary
TCP session configuration commands.
mss
dictionary
Maximum Segment Size.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent mss from being inherited from parent
value
integer
TCP initial maximum segment size.
timers
dictionary
BGP per neighbor timers.
holdtime
integer
hold time <3-65535> or 0 Disable hold time.
keepalive_time
integer
keepalive interval <0-65535>.
min_holdtime
integer
Minimum acceptable holdtime from neighbor <3-65535>.
ttl_security
dictionary
Enable EBGP TTL security.
inheritance_disable
boolean
    Choices:
  • no
  • yes
Prevent ttl-security from being inherited from parent
set
boolean
    Choices:
  • no
  • yes
set ttl-security
update
dictionary
BGP Update configuration.
in
dictionary
Inbound update message handling.
filtering
dictionary
Inbound update message filtering
attribute_filter
dictionary
Attribute-filter configuration.
group
string
Name of group.
logging
dictionary
Update filtering syslog message.
disable
boolean
    Choices:
  • no
  • yes
Disable update filtering syslog message.
update_message
dictionary
Filtered update messages.
buffers
integer
Number of buffers to store filtered update messages.
update_source
string
Source of routing updates.Refer vendor document for valid values.
use
dictionary
Use a neighbor-group and session-group template.
neighbor_group
string
Inherit configuration from a neighbor-group.
session_group
string
Inherit address-family independent config from a session-group
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.

Note

  • This module works with connection network_cli.
# Using merged
# Before state:
# -------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:00:12.668 UTC
# % No such configuration item(s)
#
# RP/0/RP0/CPU0:10#

- name: Merge the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - address_family:
            - advertise:
                local_labeled_route:
                  set: true
              afi: ipv4
              safi: unicast
          advertisement_interval: 10
          bfd:
            fast_detect:
              strict_mode: true
          internal_vpn_client: true
          name: neighbor-group1
          precedence: critical
        - cluster_id: '1'
          description: neighbor-group2
          dmz_link_bandwidth:
            set: true
          ebgp_multihop:
            value: 255
          egress_engineering:
            set: true
          graceful_maintenance:
            as_prepends:
              value: 0
            set: true
          ignore_connected_check:
            set: true
          internal_vpn_client: true
          local:
            address:
              inheritance_disable: true
          local_as:
            value: 6
          name: neighbor-group2
          precedence: flash
          receive_buffer_size: 512
          send_buffer_size: 4096
          session_open_mode: both
          tcp:
            mss:
              inheritance_disable: true
          ttl_security:
            set: true
          update_source: Loopback919
    state: merged

# Task Output
# -----------
# before: {}
# commands:
# - router bgp 65536
# - neighbor-group neighbor-group1
# - advertisement-interval 10
# - bfd fast-detect strict-mode
# - internal-vpn-client
# - precedence critical
# - address-family ipv4 unicast
# - advertise local-labeled-route
# - neighbor-group neighbor-group2
# - dmz-link-bandwidth
# - description neighbor-group2
# - cluster-id 1
# - ebgp-multihop 255
# - egress-engineering
# - internal-vpn-client
# - ignore-connected-check
# - local-as 6
# - local address inheritance-disable
# - precedence flash
# - receive-buffer-size 512
# - send-buffer-size 4096
# - session-open-mode both
# - tcp mss inheritance-disable
# - update-source Loopback919
# - ttl-security
# - graceful-maintenance
# - graceful-maintenance as-prepends 0
# after:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 10
#       bfd:
#         fast_detect:
#           strict_mode: true
#       internal_vpn_client: true
#       name: neighbor-group1
#       precedence: critical
#     - cluster_id: '1'
#       description: neighbor-group2
#       dmz_link_bandwidth:
#         set: true
#       ebgp_multihop:
#         value: 255
#       egress_engineering:
#         set: true
#       graceful_maintenance:
#         as_prepends:
#           value: 0
#         set: true
#       ignore_connected_check:
#         set: true
#       internal_vpn_client: true
#       local:
#         address:
#           inheritance_disable: true
#       local_as:
#         value: 6
#       name: neighbor-group2
#       precedence: flash
#       receive_buffer_size: 512
#       send_buffer_size: 4096
#       session_open_mode: both
#       tcp:
#         mss:
#           inheritance_disable: true
#       ttl_security:
#         set: true
#       update_source: Loopback919

# After state:
# ------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:14:33.116 UTC
# router bgp 65536
#  neighbor-group neighbor-group1
#   bfd fast-detect strict-mode
#   precedence critical
#   advertisement-interval 10
#   internal-vpn-client
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 255
#   egress-engineering
#   precedence flash
#   graceful-maintenance
#    as-prepends 0
#   !
#   tcp mss inheritance-disable
#   local-as 6
#   cluster-id 1
#   dmz-link-bandwidth
#   description neighbor-group2
#   ttl-security
#   local address inheritance-disable
#   update-source Loopback919
#   ignore-connected-check
#   session-open-mode both
#   send-buffer-size 4096
#   receive-buffer-size 512
#   internal-vpn-client
#  !
# !


# Using replaced
# Before state:
# ------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:14:33.116 UTC
# router bgp 65536
#  neighbor-group neighbor-group1
#   bfd fast-detect strict-mode
#   precedence critical
#   advertisement-interval 10
#   internal-vpn-client
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 255
#   egress-engineering
#   precedence flash
#   graceful-maintenance
#    as-prepends 0
#   !
#   tcp mss inheritance-disable
#   local-as 6
#   cluster-id 1
#   dmz-link-bandwidth
#   description neighbor-group2
#   ttl-security
#   local address inheritance-disable
#   update-source Loopback919
#   ignore-connected-check
#   session-open-mode both
#   send-buffer-size 4096
#   receive-buffer-size 512
#   internal-vpn-client
#  !
# !

- name: Replaced given bgp_templates configuration
  cisco.iosxr.iosxr_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - address_family:
            - advertise:
                local_labeled_route:
                  set: true
              afi: ipv4
              safi: unicast
          advertisement_interval: 12
          name: neighbor-group1
          precedence: flash
        - cluster_id: '2'
          description: replace neighbor-group2
          ebgp_multihop:
            value: 254
          graceful_maintenance:
            as_prepends:
              value: 2
            set: true
          update_source: Loopback917
          name: neighbor-group2
    state: replaced

# Task Output
# -----------
# before:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 10
#       bfd:
#         fast_detect:
#           strict_mode: true
#       internal_vpn_client: true
#       name: neighbor-group1
#       precedence: critical
#     - cluster_id: '1'
#       description: neighbor-group2
#       dmz_link_bandwidth:
#         set: true
#       ebgp_multihop:
#         value: 255
#       egress_engineering:
#         set: true
#       graceful_maintenance:
#         as_prepends:
#           value: 0
#         set: true
#       ignore_connected_check:
#         set: true
#       internal_vpn_client: true
#       local:
#         address:
#           inheritance_disable: true
#       local_as:
#         value: 6
#       name: neighbor-group2
#       precedence: flash
#       receive_buffer_size: 512
#       send_buffer_size: 4096
#       session_open_mode: both
#       tcp:
#         mss:
#           inheritance_disable: true
#       ttl_security:
#         set: true
#       update_source: Loopback919
# commands:
# - router bgp 65536
# - neighbor-group neighbor-group1
# - no bfd fast-detect strict-mode
# - no internal-vpn-client
# - advertisement-interval 12
# - precedence flash
# - neighbor-group neighbor-group2
# - no dmz-link-bandwidth
# - no egress-engineering
# - no internal-vpn-client
# - no ignore-connected-check
# - no local-as 6
# - no local address inheritance-disable
# - no precedence flash
# - no receive-buffer-size 512
# - no send-buffer-size 4096
# - no session-open-mode both
# - no tcp mss inheritance-disable
# - no ttl-security
# - description replace neighbor-group2
# - cluster-id 2
# - ebgp-multihop 254
# - update-source Loopback917
# - graceful-maintenance as-prepends 2
# after:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 12
#       name: neighbor-group1
#       precedence: flash
#     - cluster_id: '2'
#       description: replace neighbor-group2
#       ebgp_multihop:
#         value: 254
#       graceful_maintenance:
#         as_prepends:
#           value: 2
#         set: true
#       name: neighbor-group2
#       update_source: Loopback917

# After state:
# ------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:23:34.104 UTC
# router bgp 65536
#  neighbor-group neighbor-group1
#   precedence flash
#   advertisement-interval 12
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 254
#   graceful-maintenance
#    as-prepends 2
#   !
#   cluster-id 2
#   description replace neighbor-group2
#   update-source Loopback917
#  !
# !


# Using deleted
# Before state:
# -------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:23:34.104 UTC
# router bgp 65536
#  neighbor-group neighbor-group1
#   precedence flash
#   advertisement-interval 12
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 254
#   graceful-maintenance
#    as-prepends 2
#   !
#   cluster-id 2
#   description replace neighbor-group2
#   update-source Loopback917
#  !
# !

- name: Delete given bgp_nbr_address_family configuration
  cisco.iosxr.iosxr_bgp_templates: &deleted
    config:
    state: deleted

# Task Output
# -----------
# before:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 12
#       name: neighbor-group1
#       precedence: flash
#     - cluster_id: '2'
#       description: replace neighbor-group2
#       ebgp_multihop:
#         value: 254
#       graceful_maintenance:
#         as_prepends:
#           value: 2
#         set: true
#       name: neighbor-group2
#       update_source: Loopback917
# commands:
# - router bgp 65536
# - no neighbor-group neighbor-group1
# - no neighbor-group neighbor-group2
# after: {}

# After state:
# -------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:00:12.668 UTC
# % No such configuration item(s)
#
# RP/0/RP0/CPU0:10#

# Using gathered
# Before state:
# -------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:30:38.785 UTC
# router bgp 65536
#  neighbor-group neighbor-group1
#   bfd fast-detect strict-mode
#   precedence critical
#   advertisement-interval 10
#   internal-vpn-client
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 255
#   egress-engineering
#   precedence flash
#   graceful-maintenance
#    as-prepends 0
#   !
#   tcp mss inheritance-disable
#   local-as 6
#   cluster-id 1
#   dmz-link-bandwidth
#   description neighbor-group2
#   ttl-security
#   local address inheritance-disable
#   update-source Loopback919
#   ignore-connected-check
#   session-open-mode both
#   send-buffer-size 4096
#   receive-buffer-size 512
#   internal-vpn-client
#  !
# !

- name: Gather given bgp_templates configuration
  cisco.iosxr.iosxr_bgp_templates: &id001
    config:
    state: gathered

# Task output
# -----------
# gathered:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 10
#       bfd:
#         fast_detect:
#           strict_mode: true
#       internal_vpn_client: true
#       name: neighbor-group1
#       precedence: critical
#     - cluster_id: '1'
#       description: neighbor-group2
#       dmz_link_bandwidth:
#         set: true
#       ebgp_multihop:
#         value: 255
#       egress_engineering:
#         set: true
#       graceful_maintenance:
#         as_prepends:
#           value: 0
#         set: true
#       ignore_connected_check:
#         set: true
#       internal_vpn_client: true
#       local:
#         address:
#           inheritance_disable: true
#       local_as:
#         value: 6
#       name: neighbor-group2
#       precedence: flash
#       receive_buffer_size: 512
#       send_buffer_size: 4096
#       session_open_mode: both
#       tcp:
#         mss:
#           inheritance_disable: true
#       ttl_security:
#         set: true
#       update_source: Loopback919


# Using overridden

# Before state:
# -------------
# RP/0/RP0/CPU0:10#show running-config router bgp
# Thu Mar 23 10:30:38.785 UTC
# router bgp 65536
#  neighbor-group neighbor-group1
#   bfd fast-detect strict-mode
#   precedence critical
#   advertisement-interval 10
#   internal-vpn-client
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 255
#   egress-engineering
#   precedence flash
#   graceful-maintenance
#    as-prepends 0
#   !
#   tcp mss inheritance-disable
#   local-as 6
#   cluster-id 1
#   dmz-link-bandwidth
#   description neighbor-group2
#   ttl-security
#   local address inheritance-disable
#   update-source Loopback919
#   ignore-connected-check
#   session-open-mode both
#   send-buffer-size 4096
#   receive-buffer-size 512
#   internal-vpn-client
#  !
# !
- name: override given bgp_templates configuration
  cisco.iosxr.iosxr_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - address_family:
            - advertise:
                local_labeled_route:
                  disable: true
              afi: ipv4
              safi: unicast
          advertisement_interval: 12
          bfd:
            fast_detect:
              strict_mode: true
          name: neighbor-group1
          precedence: flash
    state: overridden

# Task Output
# -----------
# before:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 10
#       bfd:
#         fast_detect:
#           strict_mode: true
#       internal_vpn_client: true
#       name: neighbor-group1
#       precedence: critical
#     - cluster_id: '1'
#       description: neighbor-group2
#       dmz_link_bandwidth:
#         set: true
#       ebgp_multihop:
#         value: 255
#       egress_engineering:
#         set: true
#       graceful_maintenance:
#         as_prepends:
#           value: 0
#         set: true
#       ignore_connected_check:
#         set: true
#       internal_vpn_client: true
#       local:
#         address:
#           inheritance_disable: true
#       local_as:
#         value: 6
#       name: neighbor-group2
#       precedence: flash
#       receive_buffer_size: 512
#       send_buffer_size: 4096
#       session_open_mode: both
#       tcp:
#         mss:
#           inheritance_disable: true
#       ttl_security:
#         set: true
#       update_source: Loopback919
# commands:
# - router bgp 65536
# - no neighbor-group neighbor-group2
# - neighbor-group neighbor-group1
# - no internal-vpn-client
# - advertisement-interval 12
# - precedence flash
# - address-family ipv4 unicast
# - no advertise local-labeled-route
# - advertise local-labeled-route disable
# after:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               disable: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 12
#       bfd:
#         fast_detect:
#           strict_mode: true
#       name: neighbor-group1
#       precedence: flash


# Using rendered
- name: >-
    Render platform specific configuration lines with state rendered (without
    connecting to the device)
  cisco.iosxr.iosxr_bgp_templates:
    config:
      as_number: 65536
      neighbor:
        - address_family:
            - advertise:
                local_labeled_route:
                  set: true
              afi: ipv4
              safi: unicast
          advertisement_interval: 10
          bfd:
            fast_detect:
              strict_mode: true
          internal_vpn_client: true
          name: neighbor-group1
          precedence: critical
        - cluster_id: '1'
          description: neighbor-group2
          dmz_link_bandwidth:
            set: true
          ebgp_multihop:
            value: 255
          egress_engineering:
            set: true
          graceful_maintenance:
            as_prepends:
              value: 0
            set: true
          ignore_connected_check:
            set: true
          internal_vpn_client: true
          local:
            address:
              inheritance_disable: true
          local_as:
            value: 6
          name: neighbor-group2
          precedence: flash
          receive_buffer_size: 512
          send_buffer_size: 4096
          session_open_mode: both
          tcp:
            mss:
              inheritance_disable: true
          ttl_security:
            set: true
          update_source: Loopback919
    state: rendered

# Task Output
# -----------
# rendered:
# - router bgp 65536
# - neighbor-group neighbor-group1
# - advertisement-interval 10
# - bfd fast-detect strict-mode
# - internal-vpn-client
# - precedence critical
# - address-family ipv4 unicast
# - advertise local-labeled-route
# - neighbor-group neighbor-group2
# - dmz-link-bandwidth
# - description neighbor-group2
# - cluster-id 1
# - ebgp-multihop 255
# - egress-engineering
# - internal-vpn-client
# - ignore-connected-check
# - local-as 6
# - local address inheritance-disable
# - precedence flash
# - receive-buffer-size 512
# - send-buffer-size 4096
# - session-open-mode both
# - tcp mss inheritance-disable
# - update-source Loopback919
# - ttl-security
# - graceful-maintenance
# - graceful-maintenance as-prepends 0


# Using parsed
- name: Parse externally provided BGP configuration
  register: result
  cisco.iosxr.iosxr_bgp_templates:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# content of pared.cfg
# router bgp 65536
#  neighbor-group neighbor-group1
#   bfd fast-detect strict-mode
#   precedence critical
#   advertisement-interval 10
#   internal-vpn-client
#   address-family ipv4 unicast
#    advertise local-labeled-route
#   !
#  !
#  neighbor-group neighbor-group2
#   ebgp-multihop 255
#   egress-engineering
#   precedence flash
#   graceful-maintenance
#    as-prepends 0
#   !
#   tcp mss inheritance-disable
#   local-as 6
#   cluster-id 1
#   dmz-link-bandwidth
#   description neighbor-group2
#   ttl-security
#   local address inheritance-disable
#   update-source Loopback919
#   idle-watch-time 30
#   ignore-connected-check
#   session-open-mode both
#   send-buffer-size 4096
#   receive-buffer-size 512
#   internal-vpn-client
#  !
# !
# Task output
# -----------
# parsed:
#   as_number: '65536'
#   neighbor:
#     - address_family:
#         - advertise:
#             local_labeled_route:
#               set: true
#           afi: ipv4
#           safi: unicast
#       advertisement_interval: 10
#       bfd:
#         fast_detect:
#           strict_mode: true
#       internal_vpn_client: true
#       name: neighbor-group1
#       precedence: critical
#     - cluster_id: '1'
#       description: neighbor-group2
#       dmz_link_bandwidth:
#         set: true
#       ebgp_multihop:
#         value: 255
#       egress_engineering:
#         set: true
#       graceful_maintenance:
#         as_prepends:
#           value: 0
#         set: true
#       ignore_connected_check:
#         set: true
#       internal_vpn_client: true
#       local:
#         address:
#           inheritance_disable: true
#       local_as:
#         value: 6
#       name: neighbor-group2
#       precedence: flash
#       receive_buffer_size: 512
#       send_buffer_size: 4096
#       session_open_mode: both
#       tcp:
#         mss:
#           inheritance_disable: true
#       ttl_security:
#         set: true
#       update_source: Loopback919

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
when state is merged, replaced, overridden, deleted or purged
The set of commands pushed to the remote device.

Sample:
['router bgp 65536', 'neighbor-group neighbor-group1', 'advertisement-interval 10', 'bfd fast-detect strict-mode', 'internal-vpn-client']
gathered
list
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
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
when state is rendered
The provided configuration in the task rendered in device-native format (offline).

Sample:
['router bgp 65536', 'neighbor-group neighbor-group1', 'advertisement-interval 10', 'bfd fast-detect strict-mode', 'internal-vpn-client']


Authors

  • Ashwini Mhatre (@amhatre)