cisco.iosxr.iosxr_bgp_templates module – Manages BGP templates resource module.

Note

This module is part of the cisco.iosxr collection (version 6.1.1).

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

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

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

New in cisco.iosxr 6.0.0

Synopsis

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

Parameters

Parameter

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

disable local-labeled-route

Choices:

  • false

  • true

set

boolean

set local-labeled-route

Choices:

  • false

  • true

permanent_network

boolean

Allow permanent networks for this neighbor

Choices:

  • false

  • true

afi

string

address family.

Choices:

  • "ipv4"

  • "ipv6"

aigp

dictionary

AIGP attribute

disable

boolean

Ignore AIGP attribute.

Choices:

  • false

  • true

send_cost_community_disable

boolean

send AIGP attribute.

Choices:

  • false

  • true

send_med

dictionary

send med options.

disable

boolean

disable Send AIGP value in MED.

Choices:

  • false

  • true

set

boolean

set Send AIGP value in MED.

Choices:

  • false

  • true

set

boolean

Set AIGP attribute.

Choices:

  • false

  • true

allowas_in

dictionary

Allow as-path with my AS present in it.

set

boolean

set allowas_in

Choices:

  • false

  • true

value

integer

Number of occurences of AS number 1-10.

as_override

dictionary

Override matching AS-number while sending update

inheritance_disable

boolean

Prevent as-override from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set as_override

Choices:

  • false

  • true

bestpath_origin_as_allow_invalid

boolean

Change default route selection criteria.Allow BGP origin-AS knobs.

Choices:

  • false

  • true

capability_orf_prefix

string

Advertise address prefix ORF capability to this neighbor.

Choices:

  • "both"

  • "send"

  • "none"

  • "receive"

default_originate

dictionary

Originate default route to this neighbor.

inheritance_disable

boolean

Prevent default-originate from being inherited from the parent.

Choices:

  • false

  • true

route_policy

string

Route policy to specify criteria to originate default

set

boolean

set default route.

Choices:

  • false

  • true

encapsulation_type_srv6

boolean

Specify encapsulation type

Choices:

  • false

  • true

long_lived_graceful_restart

dictionary

Enable long lived graceful restart support.

capable

boolean

Treat neighbor as LLGR capable.

Choices:

  • false

  • true

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

Discard extra paths when limit is exceeded.

Choices:

  • false

  • true

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

Only give warning message when limit is exceeded.

Choices:

  • false

  • true

multipath

boolean

Paths from this neighbor is eligible for multipath.

Choices:

  • false

  • true

next_hop_self

dictionary

Disable the next hop calculation for this neighbor.

inheritance_disable

boolean

Prevent next_hop_self from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set next hop self.

Choices:

  • false

  • true

next_hop_unchanged

dictionary

Disable the next hop calculation for this neighbor.

inheritance_disable

boolean

Prevent next_hop_unchanged from being inherited from the parent.

Choices:

  • false

  • true

multipath

boolean

Do not overwrite nexthop before advertising multipaths.

Choices:

  • false

  • true

set

boolean

set next hop unchanged.

Choices:

  • false

  • true

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

Disable RPKI origin-AS validation.

Choices:

  • false

  • true

remove_private_AS

dictionary

Remove private AS number from outbound updates.

entire_aspath

boolean

remove only if all ASes in the path are private.

Choices:

  • false

  • true

inbound

boolean

Remove private AS number from inbound updates.

Choices:

  • false

  • true

inheritance_disable

boolean

Prevent remove-private-AS from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set remove private As.

Choices:

  • false

  • true

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

Prevent route-reflector-client from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set route-reflector-client.

Choices:

  • false

  • true

safi

string

Address Family modifier

Choices:

  • "flowspec"

  • "mdt"

  • "multicast"

  • "mvpn"

  • "rt-filter"

  • "tunnel"

  • "unicast"

  • "labeled-unicast"

  • "sr-policy"

send_community_ebgp

dictionary

Send community attribute to this external neighbor.

inheritance_disable

boolean

Prevent send_community_ebgp from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set send_community_ebgp.

Choices:

  • false

  • true

send_community_gshut_ebgp

dictionary

Allow the g-shut community to be sent to this external neighbor.

inheritance_disable

boolean

Prevent send_community_gshut_ebgp from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set send_community_gshut_ebgp.

Choices:

  • false

  • true

send_extended_community_ebgp

dictionary

Send extended community attribute to this external neighbor.

inheritance_disable

boolean

Prevent send_extended_community_ebgp from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set send_extended_community_ebgp.

Choices:

  • false

  • true

send_multicast_attributes

dictionary

Send multicast attributes to this neighbor .

disable

boolean

Disable send multicast attributes.

Choices:

  • false

  • true

set

boolean

set send_multicast_attributes.

Choices:

  • false

  • true

signalling

dictionary

Signalling protocols to disable, BGP or LDP

bgp_disable

boolean

Select BGP to disable

Choices:

  • false

  • true

ldp_disable

boolean

Select LDP to disable

Choices:

  • false

  • true

soft_reconfiguration

dictionary

Per neighbor soft reconfiguration.

inbound

dictionary

inbound soft reconfiguration

always

boolean

Allow inbound soft reconfiguration for this neighbor. Always use soft reconfig, even if route refresh is supported.

Choices:

  • false

  • true

inheritance_disable

boolean

Prevent soft_reconfiguration from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set inbound

Choices:

  • false

  • true

update

dictionary

update

out_originator_loopcheck_disable

boolean

Disable originator loop check

Choices:

  • false

  • true

out_originator_loopcheck_set

boolean

Set originator loop check

Choices:

  • false

  • true

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

Prevent bfd settings from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

set fast-detect

Choices:

  • false

  • true

strict_mode

boolean

Hold down neighbor session until BFD session is up

Choices:

  • false

  • true

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

set receive capability

Choices:

  • false

  • true

set

boolean

set receive capability

Choices:

  • false

  • true

send

dictionary

Additional paths Send capability

disable

boolean

set send capability

Choices:

  • false

  • true

set

boolean

set send capability

Choices:

  • false

  • true

suppress

dictionary

Suppress advertising capability to the peer.

all

dictionary

all capability

inheritance_disable

boolean

Do not inherit this configuration from parent group.

Choices:

  • false

  • true

set

boolean

set all.

Choices:

  • false

  • true

four_byte_AS

dictionary

4-byte-as capability

set

boolean

set 4_byte_as.

Choices:

  • false

  • true

cluster_id

string

Cluster ID of this router acting as a route reflector.

description

string

Neighbor specific description.

dictionary

Propagate the DMZ link bandwidth.

boolean

Do not inherit this configuration from parent group.

Choices:

  • false

  • true

boolean

set dmz-link-bandwidth.

Choices:

  • false

  • true

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

Disable BGP MPLS forwarding.

Choices:

  • false

  • true

value

integer

maximum hop count.Example-<1-255>.

ebgp_recv_extcommunity_dmz

dictionary

Receive extcommunity dmz link bandwidth from ebgp neighbor.

inheritance_disable

boolean

Prevent ebgp-recv-community-dmz from being inherited from parent

Choices:

  • false

  • true

set

boolean

set ebgp-recv-community-dmz.

Choices:

  • false

  • true

ebgp_send_extcommunity_dmz

dictionary

Send extcommunity dmz link bandwidth from ebgp neighbor.

cumulatie

boolean

Send cumulative community dmz link bandwidth of all multipaths to ebgp neighbor.

Choices:

  • false

  • true

inheritance_disable

boolean

Prevent ebgp-send-community-dmz from being inherited from parent

Choices:

  • false

  • true

set

boolean

set ebgp-send-community-dmz.

Choices:

  • false

  • true

egress_engineering

dictionary

Enable egress peer engineering for this neighbor.

inheritance_disable

boolean

Prevent egress-engineering from being inherited from parent

Choices:

  • false

  • true

set

boolean

set egress-engineering.

Choices:

  • false

  • true

enforce_first_as

dictionary

Enforce the first AS for EBGP routes

disable

boolean

disable enforce 1st as

Choices:

  • false

  • true

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

Prevent activate from being inherited from the parent.

Choices:

  • false

  • true

set

boolean

activate.

Choices:

  • false

  • true

as_prepends

dictionary

Number of times to prepend the local AS number to the AS path of routes. Default=0

inheritance_disable

boolean

Prevent as prepends from being inherited from the parent.

Choices:

  • false

  • true

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

Prevent local preference from being inherited from the parent.

Choices:

  • false

  • true

value

integer

Range of values for Local Preference.Example-<0-4294967295> .

set

boolean

set graceful maintenance.

Choices:

  • false

  • true

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

Prevent ignore-connected-check from being inherited from the parent

Choices:

  • false

  • true

set

boolean

set ignore-connected-check.

Choices:

  • false

  • true

internal_vpn_client

boolean

Preserve iBGP CE neighbor path in ATTR_SET across VPN core.

Choices:

  • false

  • true

keychain

dictionary

Set keychain based authentication.

inheritance_disable

boolean

Prevent keychain from being inherited from parent.

Choices:

  • false

  • true

name

string

Name of the key chain - maximum 32 characters.

local

dictionary

Configure local parameter

address

dictionary

IPv4 address

inheritance_disable

boolean

Prevent local address from being inherited from parent.

Choices:

  • false

  • true

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

Prevent local AS from being inherited from parent.

Choices:

  • false

  • true

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

Dual-AS mode.

Choices:

  • false

  • true

set

boolean

Prepend only local AS to announcements to this neighbor.

Choices:

  • false

  • true

set

boolean

Do not prepend local AS to announcements from this neighbor.

Choices:

  • false

  • true

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

Disable inbound message logging.

Choices:

  • false

  • true

inheritance_disable

boolean

Prevents the msg log from being inherited from the parent.

Choices:

  • false

  • true

value

integer

Range for message log buffer size <1-100>.

out

dictionary

Outbound log messages

disable

boolean

Disable inbound message logging.

Choices:

  • false

  • true

inheritance_disable

boolean

Prevents the msg log from being inherited from the parent.

Choices:

  • false

  • true

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

Prevent password from being inherited from parent.

Choices:

  • false

  • true

peer_set

integer

Assign this neighbor to a peer-set used for egress peer engineering <1-255>.

precedence

string

Set precedence

Choices:

  • "critical"

  • "flash"

  • "flash-override"

  • "immediate"

  • "internet"

  • "network"

  • "priority"

  • "routine"

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

Establish BGP session using this TCP open mode.

Choices:

  • "active-only"

  • "both"

  • "passive-only"

shutdown

dictionary

Administratively shut down this neighbor.

inheritance_disable

boolean

Prevent shutdown from being inherited from parent

Choices:

  • false

  • true

set

boolean

shutdown.

Choices:

  • false

  • true

tcp

dictionary

TCP session configuration commands.

mss

dictionary

Maximum Segment Size.

inheritance_disable

boolean

Prevent mss from being inherited from parent

Choices:

  • false

  • true

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

Prevent ttl-security from being inherited from parent

Choices:

  • false

  • true

set

boolean

set ttl-security

Choices:

  • false

  • true

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

Disable update filtering syslog message.

Choices:

  • false

  • true

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

The state the configuration should be left in.

Choices:

  • "deleted"

  • "merged" ← (default)

  • "overridden"

  • "replaced"

  • "gathered"

  • "rendered"

  • "parsed"

Notes

Note

  • This module works with connection network_cli.

Examples

# 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

Return Values

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

Key

Description

after

dictionary

The resulting configuration after module execution.

Returned: when changed

Sample: "This output will always be in the same format as the module argspec.\n"

before

dictionary

The configuration prior to the module execution.

Returned: when state is merged, replaced, overridden, deleted or purged

Sample: "This output will always be in the same format as the module argspec.\n"

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: when state is merged, replaced, overridden, deleted or purged

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

gathered

list / elements=string

Facts about the network resource gathered from the remote device as structured data.

Returned: when state is gathered

Sample: ["This output will always be in the same format as the module argspec.\n"]

parsed

list / elements=string

The device native config provided in running_config option parsed into structured data as per module argspec.

Returned: when state is parsed

Sample: ["This output will always be in the same format as the module argspec.\n"]

rendered

list / elements=string

The provided configuration in the task rendered in device-native format (offline).

Returned: when state is rendered

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

Authors

  • Ashwini Mhatre (@amhatre)