Skip to content

Latest commit

 

History

History
2841 lines (2759 loc) · 115 KB

cisco.nxos.nxos_bgp_templates_module.rst

File metadata and controls

2841 lines (2759 loc) · 115 KB

cisco.nxos.nxos_bgp_templates

BGP Templates resource module.

Version added: 4.2.0

  • This module manages BGP templates on devices running Cisco NX-OS.
Parameter Choices/Defaults Comments
config
dictionary
A list of BGP templates.
as_number
string
Autonomous System Number of the router.
neighbor
list / elements=dictionary
Configure BGP peer templates.
address_family
list / elements=dictionary
Configure an address-family for peer.
advertise_map
dictionary
Specify route-map for conditional advertisement.
exist_map
string
Condition route-map to advertise only when prefix in condition exists.
non_exist_map
string
Condition route-map to advertise only when prefix in condition does not exist.
route_map
string / required
Route-map name.
advertisement_interval
integer
Minimum interval between sending BGP routing updates.
afi
string / required
    Choices:
  • ipv4
  • ipv6
  • link-state
  • l2vpn
Address Family indicator.
allowas_in
dictionary
Accept as-path with my AS present in it.
max_occurences
integer
Number of occurrences of AS number, default is 3.
set
boolean
    Choices:
  • no
  • yes
Activate allowas-in property.
as_override
boolean
    Choices:
  • no
  • yes
Override matching AS-number while sending update.
capability
dictionary
Advertise capability to the peer.
additional_paths
dictionary
Additional paths capability.
receive
string
    Choices:
  • enable
  • disable
Additional paths Receive capability.
send
string
    Choices:
  • enable
  • disable
Additional paths Send capability.
default_originate
dictionary
Originate a default toward this peer.
route_map
string
Route-map to specify criteria for originating default.
set
boolean
    Choices:
  • no
  • yes
Set default-originate attribute.
disable_peer_as_check
boolean
    Choices:
  • no
  • yes
Disable checking of peer AS-number while advertising.
filter_list
dictionary
Name of filter-list.
inbound
string
Apply policy to incoming routes.
outbound
string
Apply policy to outgoing routes.
inherit
dictionary
Inherit a peer-policy template.
peer_policy
string
Peer-policy template to inherit.
maximum_prefix
dictionary
Maximum number of prefixes from this neighbor.
generate_warning_threshold
integer
Threshold percentage at which to generate a warning.
max_prefix_limit
integer
Maximum prefix limit.
restart_interval
integer
Restart bgp connection after limit is exceeded.
warning_only
boolean
    Choices:
  • no
  • yes
Only give a warning message when limit is exceeded.
next_hop_self
dictionary
Set our address as nexthop (non-reflected).
all_routes
boolean
    Choices:
  • no
  • yes
Set our address as nexthop for all routes.
set
boolean
    Choices:
  • no
  • yes
Set next-hop-self attribute.
next_hop_third_party
boolean
    Choices:
  • no
  • yes
Compute a third-party nexthop if possible.
prefix_list
dictionary
Apply prefix-list.
inbound
string
Apply policy to incoming routes.
outbound
string
Apply policy to outgoing routes.
route_map
dictionary
Apply route-map to neighbor.
inbound
string
Name of policy to apply to incoming routes.
outbound
string
Name of policy to apply to outgoing routes.
route_reflector_client
boolean
    Choices:
  • no
  • yes
Configure a neighbor as Route reflector client.
safi
string
    Choices:
  • unicast
  • multicast
  • mvpn
  • evpn
Sub Address Family indicator.
send_community
string
    Choices:
  • standard
  • extended
  • both
Send Community attribute to this neighbor.
soft_reconfiguration_inbound
dictionary
Soft reconfiguration.
always
boolean
    Choices:
  • no
  • yes
Always perform inbound soft reconfiguration.
set
boolean
    Choices:
  • no
  • yes
Set soft-reconfiguration inbound attribute.
soo
string
Specify Site-of-origin extcommunity.
suppress_inactive
boolean
    Choices:
  • no
  • yes
Advertise only active routes to peer.
unsuppress_map
string
Route-map to selectively unsuppress suppressed routes.
weight
integer
Set default weight for routes from this neighbor.
bfd
dictionary
Bidirectional Fast Detection for the neighbor.
multihop
dictionary
Multihop session.
interval
dictionary
Configure BFD session interval parameters.
min_rx_interval
integer / required
Minimum RX interval.
multiplier
integer / required
Detect Multiplier.
tx_interval
integer / required
TX interval in milliseconds.
set
boolean
    Choices:
  • no
  • yes
Set BFD multihop.
set
boolean
    Choices:
  • no
  • yes
Set BFD for this neighbor.
singlehop
boolean
    Choices:
  • no
  • yes
Single-hop session.
bmp_activate_server
integer
Specify server ID for activating BMP monitoring for the peer.
capability
dictionary
Capability.
suppress_4_byte_as
boolean
    Choices:
  • no
  • yes
Suppress 4-byte AS Capability.
description
string
Neighbor specific descripion.
disable_connected_check
boolean
    Choices:
  • no
  • yes
Disable check for directly connected peer.
dont_capability_negotiate
boolean
    Choices:
  • no
  • yes
Don't negotiate capability with this neighbor.
dscp
string
Set dscp value for tcp transport.
dynamic_capability
boolean
    Choices:
  • no
  • yes
Dynamic Capability
ebgp_multihop
integer
Specify multihop TTL for remote peer.
graceful_shutdown
dictionary
Graceful-shutdown for this neighbor.
activate
dictionary
Send graceful-shutdown community.
route_map
string
Apply route-map to modify attributes for outbound.
set
boolean
    Choices:
  • no
  • yes
Set activate.
inherit
dictionary
Inherit a template.
peer_session
string
Peer-session template to inherit.
local_as
string
Specify the local-as number for the eBGP neighbor.
log_neighbor_changes
dictionary
Log message for neighbor up/down event.
disable
boolean
    Choices:
  • no
  • yes
Disable logging of neighbor up/down event.
set
boolean
    Choices:
  • no
  • yes
Set log-neighbor-changes.
low_memory
dictionary
Behaviour in low memory situations.
exempt
boolean
    Choices:
  • no
  • yes
Do not shutdown this peer when under memory pressure.
name
string
Name of the BGP peer template.
password
dictionary
Configure a password for neighbor.
encryption
integer
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.
key
string
Authentication password.
path_attribute
list / elements=dictionary
BGP path attribute optional filtering.
action
string
    Choices:
  • discard
  • treat-as-withdraw
Action.
range
dictionary
Path attribute range.
end
integer
Path attribute range end value.
start
integer
Path attribute range start value.
type
integer
Path attribute type
remote_as
string
Specify Autonomous System Number of the neighbor.
remove_private_as
dictionary
Remove private AS number from outbound updates.
all
boolean
    Choices:
  • no
  • yes
All.
replace_as
boolean
    Choices:
  • no
  • yes
Replace.
set
boolean
    Choices:
  • no
  • yes
Remove private AS.
shutdown
boolean
    Choices:
  • no
  • yes
Administratively shutdown this neighbor.
timers
dictionary
Configure keepalive and hold timers.
holdtime
integer
Holdtime (seconds).
keepalive
integer
Keepalive interval (seconds).
transport
dictionary
BGP transport connection.
connection_mode
dictionary
Specify type of connection.
passive
boolean
    Choices:
  • no
  • yes
Allow passive connection setup only.
ttl_security
dictionary
Enable TTL Security Mechanism.
hops
integer
Specify hop count for remote peer.
update_source
string
Specify source of BGP session and updates.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the NX-OS device by executing the command show running-config bgp | section 'template'.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
  • parsed
  • gathered
  • rendered
The state the configuration should be left in.
Refer to examples for more details.

Note

  • Tested against NX-OS 9.3.6.
  • Unsupported for Cisco MDS
  • This module works with connection network_cli and httpapi.
# 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#

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', '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']
gathered
dictionary
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
dictionary
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', 'template peer neighbor_tmplt_1', 'bmp-activate-server 2', 'no capability suppress 4-byte-as', 'no template peer neighbor_tmplt_2']


Authors

  • Nilashish Chakraborty (@NilashishC)