cisco.nxos.nxos_bgp_templates module – BGP Templates resource module.
Note
This module is part of the cisco.nxos collection (version 9.2.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.nxos
.
To use it in a playbook, specify: cisco.nxos.nxos_bgp_templates
.
New in cisco.nxos 4.2.0
Synopsis
This module manages BGP templates on devices running Cisco NX-OS.
Parameters
Parameter |
Comments |
---|---|
A list of BGP templates. |
|
Autonomous System Number of the router. |
|
Configure BGP peer templates. |
|
Configure an address-family for peer. |
|
Specify route-map for conditional advertisement. |
|
Condition route-map to advertise only when prefix in condition exists. |
|
Condition route-map to advertise only when prefix in condition does not exist. |
|
Route-map name. |
|
Minimum interval between sending BGP routing updates. |
|
Address Family indicator. Choices:
|
|
Accept as-path with my AS present in it. |
|
Number of occurrences of AS number, default is 3. |
|
Activate allowas-in property. Choices:
|
|
Override matching AS-number while sending update. Choices:
|
|
Advertise capability to the peer. |
|
Additional paths capability. |
|
Additional paths Receive capability. Choices:
|
|
Additional paths Send capability. Choices:
|
|
Originate a default toward this peer. |
|
Route-map to specify criteria for originating default. |
|
Set default-originate attribute. Choices:
|
|
Disable checking of peer AS-number while advertising. Choices:
|
|
Name of filter-list. |
|
Apply policy to incoming routes. |
|
Apply policy to outgoing routes. |
|
Inherit a peer-policy template. |
|
Peer-policy template to inherit. |
|
Maximum number of prefixes from this neighbor. |
|
Threshold percentage at which to generate a warning. |
|
Maximum prefix limit. |
|
Restart bgp connection after limit is exceeded. |
|
Only give a warning message when limit is exceeded. Choices:
|
|
Set our address as nexthop (non-reflected). |
|
Set our address as nexthop for all routes. Choices:
|
|
Set next-hop-self attribute. Choices:
|
|
Compute a third-party nexthop if possible. Choices:
|
|
Apply prefix-list. |
|
Apply policy to incoming routes. |
|
Apply policy to outgoing routes. |
|
Apply route-map to neighbor. |
|
Name of policy to apply to incoming routes. |
|
Name of policy to apply to outgoing routes. |
|
Configure a neighbor as Route reflector client. Choices:
|
|
Sub Address Family indicator. Choices:
|
|
Send Community attribute to this neighbor. Choices:
|
|
Soft reconfiguration. |
|
Always perform inbound soft reconfiguration. Choices:
|
|
Set soft-reconfiguration inbound attribute. Choices:
|
|
Specify Site-of-origin extcommunity. |
|
Advertise only active routes to peer. Choices:
|
|
Route-map to selectively unsuppress suppressed routes. |
|
Set default weight for routes from this neighbor. |
|
Bidirectional Fast Detection for the neighbor. |
|
Multihop session. |
|
Configure BFD session interval parameters. |
|
Minimum RX interval. |
|
Detect Multiplier. |
|
TX interval in milliseconds. |
|
Set BFD multihop. Choices:
|
|
Set BFD for this neighbor. Choices:
|
|
Single-hop session. Choices:
|
|
Specify server ID for activating BMP monitoring for the peer. |
|
Capability. |
|
Suppress 4-byte AS Capability. Choices:
|
|
Neighbor specific descripion. |
|
Disable check for directly connected peer. Choices:
|
|
Don’t negotiate capability with this neighbor. Choices:
|
|
Set dscp value for tcp transport. |
|
Dynamic Capability Choices:
|
|
Specify multihop TTL for remote peer. |
|
Graceful-shutdown for this neighbor. |
|
Send graceful-shutdown community. |
|
Apply route-map to modify attributes for outbound. |
|
Set activate. Choices:
|
|
Inherit a template. |
|
Peer-session template to inherit. |
|
Specify the local-as number for the eBGP neighbor. |
|
Log message for neighbor up/down event. |
|
Disable logging of neighbor up/down event. Choices:
|
|
Set log-neighbor-changes. Choices:
|
|
Behaviour in low memory situations. |
|
Do not shutdown this peer when under memory pressure. Choices:
|
|
Name of the BGP peer template. |
|
Configure a password for neighbor. |
|
0 specifies an UNENCRYPTED neighbor password. 3 specifies an 3DES ENCRYPTED neighbor password will follow. 7 specifies a Cisco type 7 ENCRYPTED neighbor password will follow. |
|
Authentication password. |
|
BGP path attribute optional filtering. |
|
Action. Choices:
|
|
Path attribute range. |
|
Path attribute range end value. |
|
Path attribute range start value. |
|
Path attribute type |
|
Specify Autonomous System Number of the neighbor. |
|
Remove private AS number from outbound updates. |
|
All. Choices:
|
|
Replace. Choices:
|
|
Remove private AS. Choices:
|
|
Administratively shutdown this neighbor. Choices:
|
|
Configure keepalive and hold timers. |
|
Holdtime (seconds). |
|
Keepalive interval (seconds). |
|
BGP transport connection. |
|
Specify type of connection. |
|
Allow passive connection setup only. Choices:
|
|
Enable TTL Security Mechanism. |
|
Specify hop count for remote peer. |
|
Specify source of BGP session and updates. |
|
This option is used only with state parsed. The value of this option should be the output received from the NX-OS device by executing the command show running-config bgp | section ‘template’. The state parsed reads the configuration from |
|
The state the configuration should be left in. Refer to examples for more details. Choices:
|
Notes
Note
Tested against NX-OS 9.3.6.
Unsupported for Cisco MDS
This module works with connection
network_cli
andhttpapi
.
Examples
# Using merged
# Before state:
# --------------
#
# nxos9k# show running-config | section "^router bgp"
# nxos9k#
- name: Merge the provided configuration with the existing running configuration
cisco.nxos.nxos_bgp_templates:
config:
as_number: 65536
neighbor:
- name: neighbor_tmplt_1
address_family:
- afi: ipv4
safi: unicast
advertise_map:
route_map: rmap1
non_exist_map: nemap1
advertisement_interval: 60
disable_peer_as_check: true
bmp_activate_server: 2
capability:
suppress_4_byte_as: true
description: Test_BGP_PEER_TEMPLATE_1
local_as: 65536
remote_as: 65001
- name: neighbor_tmplt_2
description: Test_BGP_PEER_TEMPLATE_2
address_family:
- afi: ipv4
safi: multicast
advertise_map:
route_map: rmap1
exist_map: emap1
as_override: true
filter_list:
inbound: flist1
outbound: flist2
inherit:
peer_session: psession1
timers:
holdtime: 100
keepalive: 45
# Task Output:
# ------------
# before: {}
#
# commands:
# - router bgp 65536
# - template peer neighbor_tmplt_1
# - bmp-activate-server 2
# - capability suppress 4-byte-as
# - description Test_BGP_PEER_TEMPLATE_1
# - local-as 65536
# - remote-as 65001
# - address-family ipv4 unicast
# - advertise-map rmap1 non-exist-map nemap1
# - advertisement-interval 60
# - disable-peer-as-check
# - template peer neighbor_tmplt_2
# - description Test_BGP_PEER_TEMPLATE_2
# - inherit peer-session psession1
# - timers 45 100
# - address-family ipv4 multicast
# - advertise-map rmap1 exist-map emap1
# - as-override
# - filter-list flist1 in
# - filter-list flist2 out
#
# after:
# as_number: "65536"
# neighbor:
# - name: neighbor_tmplt_1
# address_family:
# - afi: ipv4
# safi: unicast
# advertise_map:
# non_exist_map: nemap1
# route_map: rmap1
# advertisement_interval: 60
# disable_peer_as_check: true
# bmp_activate_server: 2
# capability:
# suppress_4_byte_as: true
# description: Test_BGP_PEER_TEMPLATE_1
# local_as: "65536"
# remote_as: "65001"
#
# - name: neighbor_tmplt_2
# description: Test_BGP_PEER_TEMPLATE_2
# address_family:
# - afi: ipv4
# safi: multicast
# advertise_map:
# exist_map: emap1
# route_map: rmap1
# as_override: true
# filter_list:
# inbound: flist1
# outbound: flist2
# inherit:
# peer_session: psession1
# timers:
# holdtime: 100
# keepalive: 45
# After state:
# --------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
# template peer neighbor_tmplt_1
# capability suppress 4-byte-as
# bmp-activate-server 2
# description Test_BGP_PEER_TEMPLATE_1
# local-as 65536
# remote-as 65001
# address-family ipv4 unicast
# advertise-map rmap1 non-exist-map nemap1
# advertisement-interval 60
# disable-peer-as-check
# template peer neighbor_tmplt_2
# description Test_BGP_PEER_TEMPLATE_2
# inherit peer-session psession1
# timers 45 100
# address-family ipv4 multicast
# advertise-map rmap1 exist-map emap1
# as-override
# filter-list flist1 in
# filter-list flist2 out
# Using replaced
# Before state:
# -------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
# template peer neighbor_tmplt_1
# capability suppress 4-byte-as
# description Test_BGP_PEER_TEMPLATE_1
# bmp-activate-server 2
# local-as 65536
# remote-as 65001
# address-family ipv4 unicast
# advertise-map rmap1 non-exist-map nemap1
# advertisement-interval 60
# disable-peer-as-check
# template peer neighbor_tmplt_2
# description Test_BGP_PEER_TEMPLATE_2
# inherit peer-session psession1
# timers 45 100
# address-family ipv4 multicast
# advertise-map rmap1 exist-map emap1
# as-override
# filter-list flist1 in
# filter-list flist2 out
- name: Replace BGP templates configuration with provided configuration
cisco.nxos.nxos_bgp_templates:
config:
as_number: 65536
neighbor:
- name: neighbor_tmplt_1
address_family:
- afi: ipv4
safi: unicast
advertise_map:
route_map: rmap1
non_exist_map: nemap1
advertisement_interval: 60
disable_peer_as_check: true
inherit:
peer_session: psession1
description: Test_BGP_PEER_TEMPLATE_1
local_as: 65537
state: replaced
# Task output:
# ------------
#
# before:
# as_number: "65536"
# neighbor:
# - name: neighbor_tmplt_1
# address_family:
# - afi: ipv4
# safi: unicast
# advertise_map:
# non_exist_map: nemap1
# route_map: rmap1
# advertisement_interval: 60
# disable_peer_as_check: true
# bmp_activate_server: 2
# capability:
# suppress_4_byte_as: true
# description: Test_BGP_PEER_TEMPLATE_1
# local_as: "65536"
# remote_as: "65001"
#
# - name: neighbor_tmplt_2
# description: Test_BGP_PEER_TEMPLATE_2
# address_family:
# - afi: ipv4
# safi: multicast
# advertise_map:
# exist_map: emap1
# route_map: rmap1
# as_override: true
# filter_list:
# inbound: flist1
# outbound: flist2
# inherit:
# peer_session: psession1
# timers:
# holdtime: 100
# keepalive: 45
#
# commands:
# - router bgp 65536
# - template peer neighbor_tmplt_1
# - no bmp-activate-server 2
# - no capability suppress 4-byte-as
# - inherit peer-session psession1
# - local-as 65537
# - no remote-as 65001
#
# after:
# as_number: "65536"
# neighbor:
# - name: neighbor_tmplt_1
# address_family:
# - afi: ipv4
# safi: unicast
# advertise_map:
# non_exist_map: nemap1
# route_map: rmap1
# advertisement_interval: 60
# disable_peer_as_check: true
# description: Test_BGP_PEER_TEMPLATE_1
# inherit:
# peer_session: psession1
# local_as: "65537"
#
# - name: neighbor_tmplt_2
# description: Test_BGP_PEER_TEMPLATE_2
# address_family:
# - afi: ipv4
# safi: multicast
# advertise_map:
# exist_map: emap1
# route_map: rmap1
# as_override: true
# filter_list:
# inbound: flist1
# outbound: flist2
# inherit:
# peer_session: psession1
# timers:
# holdtime: 100
# keepalive: 45
# After state:
# ------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
# template peer neighbor_tmplt_1
# inherit peer-session psession1
# description Test_BGP_PEER_TEMPLATE_1
# local-as 65537
# address-family ipv4 unicast
# advertise-map rmap1 non-exist-map nemap1
# advertisement-interval 60
# disable-peer-as-check
# template peer neighbor_tmplt_2
# description Test_BGP_PEER_TEMPLATE_2
# inherit peer-session psession1
# bmp-activate-server 2
# timers 45 100
# address-family ipv4 multicast
# advertise-map rmap1 exist-map emap1
# as-override
# filter-list flist1 in
# filter-list flist2 out
# Using overridden
#
# Before state:
# -------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
# template peer neighbor_tmplt_1
# capability suppress 4-byte-as
# description Test_BGP_PEER_TEMPLATE_1
# bmp-activate-server 2
# local-as 65536
# remote-as 65001
# address-family ipv4 unicast
# advertise-map rmap1 non-exist-map nemap1
# advertisement-interval 60
# disable-peer-as-check
# template peer neighbor_tmplt_2
# description Test_BGP_PEER_TEMPLATE_2
# inherit peer-session psession1
# timers 45 100
# address-family ipv4 multicast
# advertise-map rmap1 exist-map emap1
# as-override
# filter-list flist1 in
# filter-list flist2 out
- name: Override BGP templates configuration with provided configuration
cisco.nxos.nxos_bgp_templates:
config:
as_number: 65536
neighbor:
- name: neighbor_tmplt_1
address_family:
- afi: ipv4
safi: unicast
advertise_map:
route_map: rmap1
non_exist_map: nemap1
advertisement_interval: 60
disable_peer_as_check: true
inherit:
peer_session: psession1
description: Test_BGP_PEER_TEMPLATE_1
local_as: 65537
state: overridden
# Task output:
# ------------
#
# before:
# as_number: "65536"
# neighbor:
# - name: neighbor_tmplt_1
# address_family:
# - afi: ipv4
# safi: unicast
# advertise_map:
# non_exist_map: nemap1
# route_map: rmap1
# advertisement_interval: 60
# disable_peer_as_check: true
# bmp_activate_server: 2
# capability:
# suppress_4_byte_as: true
# description: Test_BGP_PEER_TEMPLATE_1
# local_as: "65536"
# remote_as: "65001"
#
# - name: neighbor_tmplt_2
# description: Test_BGP_PEER_TEMPLATE_2
# address_family:
# - afi: ipv4
# safi: multicast
# advertise_map:
# exist_map: emap1
# route_map: rmap1
# as_override: true
# filter_list:
# inbound: flist1
# outbound: flist2
# inherit:
# peer_session: psession1
# timers:
# holdtime: 100
# keepalive: 45
#
# commands:
# - router bgp 65536
# - template peer neighbor_tmplt_1
# - no bmp-activate-server 2
# - no capability suppress 4-byte-as
# - inherit peer-session psession1
# - local-as 65537
# - no remote-as 65001
# - no template peer neighbor_tmplt_2
#
# after:
# as_number: "65536"
# neighbor:
# - name: neighbor_tmplt_1
# address_family:
# - afi: ipv4
# safi: unicast
# advertise_map:
# non_exist_map: nemap1
# route_map: rmap1
# advertisement_interval: 60
# disable_peer_as_check: true
# description: Test_BGP_PEER_TEMPLATE_1
# inherit:
# peer_session: psession1
# local_as: "65537"
# After state:
# ------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
# template peer neighbor_tmplt_1
# inherit peer-session psession1
# description Test_BGP_PEER_TEMPLATE_1
# local-as 65537
# address-family ipv4 unicast
# advertise-map rmap1 non-exist-map nemap1
# advertisement-interval 60
# disable-peer-as-check
# Using deleted
# Before state:
# --------------
#
# nxos9k# show running-config | section "^router bgp"
# router bgp 65536
# template peer neighbor_tmplt_1
# capability suppress 4-byte-as
# description Test_BGP_PEER_TEMPLATE_1
# bmp-activate-server 2
# local-as 65536
# remote-as 65001
# address-family ipv4 unicast
# advertise-map rmap1 non-exist-map nemap1
# advertisement-interval 60
# disable-peer-as-check
# template peer neighbor_tmplt_2
# description Test_BGP_PEER_TEMPLATE_2
# inherit peer-session psession1
# timers 45 100
# address-family ipv4 multicast
# advertise-map rmap1 exist-map emap1
# as-override
# filter-list flist1 in
# filter-list flist2 out
- name: Delete BGP configs handled by this module
cisco.nxos.nxos_bgp_templates:
state: deleted
# Task output:
# ------------
#
# before:
# as_number: "65536"
# neighbor:
# - name: neighbor_tmplt_1
# address_family:
# - afi: ipv4
# safi: unicast
# advertise_map:
# non_exist_map: nemap1
# route_map: rmap1
# advertisement_interval: 60
# disable_peer_as_check: true
# bmp_activate_server: 2
# capability:
# suppress_4_byte_as: true
# description: Test_BGP_PEER_TEMPLATE_1
# local_as: "65536"
# remote_as: "65001"
#
# - name: neighbor_tmplt_2
# description: Test_BGP_PEER_TEMPLATE_2
# address_family:
# - afi: ipv4
# safi: multicast
# advertise_map:
# exist_map: emap1
# route_map: rmap1
# as_override: true
# filter_list:
# inbound: flist1
# outbound: flist2
# inherit:
# peer_session: psession1
# timers:
# holdtime: 100
# keepalive: 45
#
# commands:
# - router bgp 65536
# - no template peer neighbor_tmplt_1
# - no template peer neighbor_tmplt_2
#
# after: {}
# After state:
# -------------
# nxos9k# show running-config | section "^router bgp"
# nxos9k#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |