| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
# Copyright 2023 Red Hat |
| 4 |
# GNU General Public License v3.0+ |
| 5 |
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
""" |
| 8 |
The module file for iosxr_bgp_templates |
| 9 |
""" |
| 10 |
|
| 11 |
from __future__ import absolute_import, division, print_function |
| 12 |
|
| 13 |
|
| 14 |
__metaclass__ = type |
| 15 |
|
| 16 |
DOCUMENTATION = """ |
| 17 |
module: iosxr_bgp_templates |
| 18 |
short_description: Manages BGP templates resource module. |
| 19 |
description: |
| 20 |
- This module configures and manages the attributes of BGP templates on Cisco IOS-XR platforms. |
| 21 |
version_added: 6.0.0 |
| 22 |
author: Ashwini Mhatre (@amhatre) |
| 23 |
notes: |
| 24 |
- This module works with connection C(network_cli). |
| 25 |
options: |
| 26 |
config: |
| 27 |
description: BGP template configurations. |
| 28 |
type: dict |
| 29 |
suboptions: |
| 30 |
as_number: |
| 31 |
description: Autonomous system number. |
| 32 |
type: str |
| 33 |
neighbor: |
| 34 |
description: A list of BGP neighbor group configurations. |
| 35 |
type: list |
| 36 |
elements: dict |
| 37 |
suboptions: |
| 38 |
name: |
| 39 |
description: Name of neighbor group. |
| 40 |
type: str |
| 41 |
address_family: |
| 42 |
description: Enable address family and enter its config mode |
| 43 |
type: list |
| 44 |
elements: dict |
| 45 |
suboptions: |
| 46 |
afi: |
| 47 |
description: address family. |
| 48 |
type: str |
| 49 |
choices: [ 'ipv4', 'ipv6', 'vpnv4', 'vpnv6', 'link-state', 'l2vpn'] |
| 50 |
safi: |
| 51 |
description: Address Family modifier |
| 52 |
type: str |
| 53 |
choices: [ 'flowspec', 'mdt', 'multicast', 'mvpn', 'rt-filter', 'tunnel', |
| 54 |
'unicast', 'labeled-unicast' , 'sr-policy', 'link-state', 'evpn', 'mspw', 'vpls-vpws'] |
| 55 |
signalling: |
| 56 |
type: dict |
| 57 |
description: Signalling protocols to disable, BGP or LDP |
| 58 |
suboptions: |
| 59 |
bgp_disable: |
| 60 |
type: bool |
| 61 |
description: Select BGP to disable |
| 62 |
ldp_disable: |
| 63 |
type: bool |
| 64 |
description: Select LDP to disable |
| 65 |
advertise: |
| 66 |
type: dict |
| 67 |
description: Per neighbor advertisement options |
| 68 |
suboptions: |
| 69 |
local_labeled_route: |
| 70 |
type: dict |
| 71 |
description: Advertisement of routes with local-label |
| 72 |
suboptions: |
| 73 |
set: |
| 74 |
type: bool |
| 75 |
description: set local-labeled-route |
| 76 |
disable: |
| 77 |
type: bool |
| 78 |
description: disable local-labeled-route |
| 79 |
permanent_network: |
| 80 |
type: bool |
| 81 |
description: Allow permanent networks for this neighbor |
| 82 |
aigp: |
| 83 |
description: AIGP attribute |
| 84 |
type: dict |
| 85 |
suboptions: |
| 86 |
disable: |
| 87 |
description: Ignore AIGP attribute. |
| 88 |
type: bool |
| 89 |
set: |
| 90 |
description: Set AIGP attribute. |
| 91 |
type: bool |
| 92 |
send_cost_community_disable: |
| 93 |
description: send AIGP attribute. |
| 94 |
type: bool |
| 95 |
send_med: |
| 96 |
description: send med options. |
| 97 |
type: dict |
| 98 |
suboptions: |
| 99 |
set: |
| 100 |
type: bool |
| 101 |
description: set Send AIGP value in MED. |
| 102 |
disable: |
| 103 |
description: disable Send AIGP value in MED. |
| 104 |
type: bool |
| 105 |
allowas_in: |
| 106 |
type: dict |
| 107 |
description: Allow as-path with my AS present in it. |
| 108 |
suboptions: |
| 109 |
value: |
| 110 |
type: int |
| 111 |
description: Number of occurences of AS number 1-10. |
| 112 |
set: |
| 113 |
type: bool |
| 114 |
description: set allowas_in |
| 115 |
as_override: |
| 116 |
type: dict |
| 117 |
description: Override matching AS-number while sending update |
| 118 |
suboptions: |
| 119 |
set: |
| 120 |
type: bool |
| 121 |
description: set as_override |
| 122 |
inheritance_disable: |
| 123 |
type: bool |
| 124 |
description: Prevent as-override from being inherited from the parent. |
| 125 |
bestpath_origin_as_allow_invalid: |
| 126 |
type: bool |
| 127 |
description: Change default route selection criteria.Allow BGP origin-AS knobs. |
| 128 |
capability_orf_prefix: |
| 129 |
type: str |
| 130 |
description: Advertise address prefix ORF capability to this neighbor. |
| 131 |
choices: [ 'both', 'send', 'none', 'receive' ] |
| 132 |
default_originate: |
| 133 |
type: dict |
| 134 |
description: Originate default route to this neighbor. |
| 135 |
suboptions: |
| 136 |
set: |
| 137 |
type: bool |
| 138 |
description: set default route. |
| 139 |
route_policy: |
| 140 |
type: str |
| 141 |
description: Route policy to specify criteria to originate default |
| 142 |
inheritance_disable: |
| 143 |
type: bool |
| 144 |
description: Prevent default-originate from being inherited from the parent. |
| 145 |
encapsulation_type_srv6: |
| 146 |
type: bool |
| 147 |
description: Specify encapsulation type |
| 148 |
long_lived_graceful_restart: |
| 149 |
type: dict |
| 150 |
description: Enable long lived graceful restart support. |
| 151 |
suboptions: |
| 152 |
capable: |
| 153 |
type: bool |
| 154 |
description: Treat neighbor as LLGR capable. |
| 155 |
stale_time: |
| 156 |
type: dict |
| 157 |
description: Maximum time to wait before purging long-lived stale routes. |
| 158 |
suboptions: |
| 159 |
send: |
| 160 |
type: int |
| 161 |
description: max send time |
| 162 |
accept: |
| 163 |
type: int |
| 164 |
description: max accept time |
| 165 |
maximum_prefix: |
| 166 |
type: dict |
| 167 |
description: Maximum number of prefixes to accept from this peer. |
| 168 |
suboptions: |
| 169 |
max_limit: |
| 170 |
type: int |
| 171 |
description: maximum no. of prefix limit.<1-4294967295. |
| 172 |
threshold_value: |
| 173 |
type: int |
| 174 |
description: hreshold value (%) at which to generate a warning msg <1-100>. |
| 175 |
restart: |
| 176 |
type: int |
| 177 |
description: Restart time interval. |
| 178 |
warning_only: |
| 179 |
type: bool |
| 180 |
description: Only give warning message when limit is exceeded. |
| 181 |
discard_extra_paths: |
| 182 |
description: Discard extra paths when limit is exceeded. |
| 183 |
type: bool |
| 184 |
multipath: |
| 185 |
type: bool |
| 186 |
description: Paths from this neighbor is eligible for multipath. |
| 187 |
next_hop_self: |
| 188 |
type: dict |
| 189 |
description: Disable the next hop calculation for this neighbor. |
| 190 |
suboptions: |
| 191 |
set: |
| 192 |
type: bool |
| 193 |
description: set next hop self. |
| 194 |
inheritance_disable: |
| 195 |
type: bool |
| 196 |
description: Prevent next_hop_self from being inherited from the parent. |
| 197 |
next_hop_unchanged: |
| 198 |
type: dict |
| 199 |
description: Disable the next hop calculation for this neighbor. |
| 200 |
suboptions: |
| 201 |
set: |
| 202 |
type: bool |
| 203 |
description: set next hop unchanged. |
| 204 |
inheritance_disable: |
| 205 |
type: bool |
| 206 |
description: Prevent next_hop_unchanged from being inherited from the parent. |
| 207 |
multipath: |
| 208 |
type: bool |
| 209 |
description: Do not overwrite nexthop before advertising multipaths. |
| 210 |
optimal_route_reflection_group_name: |
| 211 |
type: str |
| 212 |
description: Configure optimal-route-reflection group. |
| 213 |
orf_route_policy: &orf_rp |
| 214 |
type: str |
| 215 |
description: Specify ORF and inbound filtering criteria.' |
| 216 |
origin_as: |
| 217 |
description: BGP origin-AS knobs. |
| 218 |
type: dict |
| 219 |
suboptions: |
| 220 |
validation: |
| 221 |
description: BGP origin-AS validation knobs. |
| 222 |
type: dict |
| 223 |
suboptions: |
| 224 |
disable: |
| 225 |
description: Disable RPKI origin-AS validation. |
| 226 |
type: bool |
| 227 |
remove_private_AS: |
| 228 |
type: dict |
| 229 |
description: Remove private AS number from outbound updates. |
| 230 |
suboptions: |
| 231 |
set: |
| 232 |
type: bool |
| 233 |
description: set remove private As. |
| 234 |
inbound: |
| 235 |
type: bool |
| 236 |
description: Remove private AS number from inbound updates. |
| 237 |
entire_aspath: |
| 238 |
type: bool |
| 239 |
description: remove only if all ASes in the path are private. |
| 240 |
inheritance_disable: |
| 241 |
type: bool |
| 242 |
description: Prevent remove-private-AS from being inherited from the parent. |
| 243 |
route_policy: |
| 244 |
type: dict |
| 245 |
description: Apply route policy to neighbor. |
| 246 |
suboptions: |
| 247 |
inbound: |
| 248 |
type: str |
| 249 |
description: Apply route policy to inbound routes. |
| 250 |
outbound: |
| 251 |
type: str |
| 252 |
description: Apply route policy to outbound routes. |
| 253 |
route_reflector_client: |
| 254 |
type: dict |
| 255 |
description: Configure a neighbor as Route Reflector client. |
| 256 |
suboptions: |
| 257 |
set: |
| 258 |
type: bool |
| 259 |
description: set route-reflector-client. |
| 260 |
inheritance_disable: |
| 261 |
type: bool |
| 262 |
description: Prevent route-reflector-client from being inherited from the parent. |
| 263 |
send_community_ebgp: |
| 264 |
description: Send community attribute to this external neighbor. |
| 265 |
type: dict |
| 266 |
suboptions: |
| 267 |
set: |
| 268 |
type: bool |
| 269 |
description: set send_community_ebgp. |
| 270 |
inheritance_disable: |
| 271 |
type: bool |
| 272 |
description: Prevent send_community_ebgp from being inherited from the parent. |
| 273 |
send_community_gshut_ebgp: |
| 274 |
description: Allow the g-shut community to be sent to this external neighbor. |
| 275 |
type: dict |
| 276 |
suboptions: |
| 277 |
set: |
| 278 |
type: bool |
| 279 |
description: set send_community_gshut_ebgp. |
| 280 |
inheritance_disable: |
| 281 |
type: bool |
| 282 |
description: Prevent send_community_gshut_ebgp from being inherited from the parent. |
| 283 |
send_extended_community_ebgp: |
| 284 |
description: Send extended community attribute to this external neighbor. |
| 285 |
type: dict |
| 286 |
suboptions: |
| 287 |
set: |
| 288 |
type: bool |
| 289 |
description: set send_extended_community_ebgp. |
| 290 |
inheritance_disable: |
| 291 |
type: bool |
| 292 |
description: Prevent send_extended_community_ebgp from being inherited from the parent. |
| 293 |
send_multicast_attributes: |
| 294 |
description: Send multicast attributes to this neighbor . |
| 295 |
type: dict |
| 296 |
suboptions: |
| 297 |
set: |
| 298 |
type: bool |
| 299 |
description: set send_multicast_attributes. |
| 300 |
disable: |
| 301 |
type: bool |
| 302 |
description: Disable send multicast attributes. |
| 303 |
soft_reconfiguration: &soft_reconfiguration |
| 304 |
description: Per neighbor soft reconfiguration. |
| 305 |
type: dict |
| 306 |
suboptions: |
| 307 |
inbound: |
| 308 |
type: dict |
| 309 |
description: inbound soft reconfiguration |
| 310 |
suboptions: |
| 311 |
set: |
| 312 |
type: bool |
| 313 |
description: set inbound |
| 314 |
always: |
| 315 |
type: bool |
| 316 |
description: Allow inbound soft reconfiguration for this neighbor. Always use soft reconfig, even if route refresh is supported. |
| 317 |
inheritance_disable: |
| 318 |
type: bool |
| 319 |
description: Prevent soft_reconfiguration from being inherited from the parent. |
| 320 |
weight: |
| 321 |
type: int |
| 322 |
description: Set default weight for routes from this neighbor. |
| 323 |
update: |
| 324 |
type: dict |
| 325 |
description: update |
| 326 |
suboptions: |
| 327 |
out_originator_loopcheck_disable: |
| 328 |
type: bool |
| 329 |
description: Disable originator loop check |
| 330 |
out_originator_loopcheck_set: |
| 331 |
type: bool |
| 332 |
description: Set originator loop check |
| 333 |
use: |
| 334 |
description: Inherit configuration for this address-family from an af-group. |
| 335 |
type: str |
| 336 |
advertisement_interval: |
| 337 |
description: Minimum interval between sending BGP routing updates.Example-<0-600>. |
| 338 |
type: int |
| 339 |
bfd: |
| 340 |
description: Configure BFD parameters. |
| 341 |
type: dict |
| 342 |
suboptions: |
| 343 |
fast_detect: |
| 344 |
description: Enable Fast detection |
| 345 |
type: dict |
| 346 |
suboptions: |
| 347 |
set: |
| 348 |
description: set fast-detect |
| 349 |
type: bool |
| 350 |
disable: |
| 351 |
description: Prevent bfd settings from being inherited from the parent. |
| 352 |
type: bool |
| 353 |
strict_mode: |
| 354 |
description: Hold down neighbor session until BFD session is up |
| 355 |
type: bool |
| 356 |
minimum_interval: |
| 357 |
description: Specifies the BFD session's minimum-interval value for the neighbor. |
| 358 |
type: int |
| 359 |
multiplier: |
| 360 |
description: Specifies the BFD session's multiplier value for the neighbor. |
| 361 |
type: int |
| 362 |
bmp_activate: |
| 363 |
description: Enable BMP logging for this neighbor. |
| 364 |
type: dict |
| 365 |
suboptions: |
| 366 |
server: |
| 367 |
description: Enable BMP connection to particular server.Example-<1-8>. |
| 368 |
type: int |
| 369 |
capability: |
| 370 |
description: Advertise capability to the peer. |
| 371 |
type: dict |
| 372 |
suboptions: |
| 373 |
additional_paths: |
| 374 |
description: BGP additional-paths commands. |
| 375 |
type: dict |
| 376 |
suboptions: |
| 377 |
send: |
| 378 |
type: dict |
| 379 |
description: Additional paths Send capability |
| 380 |
suboptions: |
| 381 |
set: |
| 382 |
type: bool |
| 383 |
description: set send capability |
| 384 |
disable: |
| 385 |
type: bool |
| 386 |
description: set send capability |
| 387 |
receive: |
| 388 |
type: dict |
| 389 |
description: Additional paths receive capability |
| 390 |
suboptions: |
| 391 |
set: |
| 392 |
type: bool |
| 393 |
description: set receive capability |
| 394 |
disable: |
| 395 |
type: bool |
| 396 |
description: set receive capability |
| 397 |
suppress: |
| 398 |
description: Suppress advertising capability to the peer. |
| 399 |
type: dict |
| 400 |
suboptions: |
| 401 |
four_byte_AS: |
| 402 |
description: 4-byte-as capability |
| 403 |
type: dict |
| 404 |
suboptions: |
| 405 |
set: |
| 406 |
description: set 4_byte_as. |
| 407 |
type: bool |
| 408 |
|
| 409 |
all: |
| 410 |
description: all capability |
| 411 |
type: dict |
| 412 |
suboptions: |
| 413 |
inheritance_disable: |
| 414 |
description: Do not inherit this configuration from parent group. |
| 415 |
type: bool |
| 416 |
set: |
| 417 |
description: set all. |
| 418 |
type: bool |
| 419 |
cluster_id: |
| 420 |
description: Cluster ID of this router acting as a route reflector. |
| 421 |
type: str |
| 422 |
description: |
| 423 |
description: Neighbor specific description. |
| 424 |
type: str |
| 425 |
dmz_link_bandwidth: |
| 426 |
description: Propagate the DMZ link bandwidth. |
| 427 |
type: dict |
| 428 |
suboptions: |
| 429 |
inheritance_disable: |
| 430 |
description: Do not inherit this configuration from parent group. |
| 431 |
type: bool |
| 432 |
set: |
| 433 |
description: set dmz-link-bandwidth. |
| 434 |
type: bool |
| 435 |
dscp: |
| 436 |
description: Set IP DSCP (DiffServ CodePoint).Please refer vendor document for valid entries. |
| 437 |
type: str |
| 438 |
ebgp_multihop: |
| 439 |
description: Allow EBGP neighbors not on directly connected networks. |
| 440 |
type: dict |
| 441 |
suboptions: |
| 442 |
value: |
| 443 |
description: maximum hop count.Example-<1-255>. |
| 444 |
type: int |
| 445 |
mpls: |
| 446 |
description: Disable BGP MPLS forwarding. |
| 447 |
type: bool |
| 448 |
ebgp_recv_extcommunity_dmz: |
| 449 |
description: Receive extcommunity dmz link bandwidth from ebgp neighbor. |
| 450 |
type: dict |
| 451 |
suboptions: |
| 452 |
inheritance_disable: |
| 453 |
description: Prevent ebgp-recv-community-dmz from being inherited from parent |
| 454 |
type: bool |
| 455 |
set: |
| 456 |
description: set ebgp-recv-community-dmz. |
| 457 |
type: bool |
| 458 |
ebgp_send_extcommunity_dmz: |
| 459 |
description: Send extcommunity dmz link bandwidth from ebgp neighbor. |
| 460 |
type: dict |
| 461 |
suboptions: |
| 462 |
inheritance_disable: |
| 463 |
description: Prevent ebgp-send-community-dmz from being inherited from parent |
| 464 |
type: bool |
| 465 |
cumulatie: |
| 466 |
description: Send cumulative community dmz link bandwidth of all multipaths to ebgp neighbor. |
| 467 |
type: bool |
| 468 |
set: |
| 469 |
description: set ebgp-send-community-dmz. |
| 470 |
type: bool |
| 471 |
egress_engineering: |
| 472 |
type: dict |
| 473 |
description: Enable egress peer engineering for this neighbor. |
| 474 |
suboptions: |
| 475 |
inheritance_disable: |
| 476 |
description: Prevent egress-engineering from being inherited from parent |
| 477 |
type: bool |
| 478 |
set: |
| 479 |
description: set egress-engineering. |
| 480 |
type: bool |
| 481 |
enforce_first_as: |
| 482 |
description: Enforce the first AS for EBGP routes |
| 483 |
type: dict |
| 484 |
suboptions: |
| 485 |
disable: |
| 486 |
description: disable enforce 1st as |
| 487 |
type: bool |
| 488 |
graceful_maintenance: |
| 489 |
description: |
| 490 |
Attributes for Graceful Maintenance. This will cause neighbors to de-prefer routes from this router and |
| 491 |
choose alternates. This allows the router to be brought in or out of service gracefully. |
| 492 |
type: dict |
| 493 |
suboptions: |
| 494 |
set: |
| 495 |
description: set graceful maintenance. |
| 496 |
type: bool |
| 497 |
activate: |
| 498 |
description: Routes will be announced with the graceful maintenance attributes while activated either here or under router |
| 499 |
bgp configuration. |
| 500 |
type: dict |
| 501 |
suboptions: |
| 502 |
inheritance_disable: |
| 503 |
description: Prevent activate from being inherited from the parent. |
| 504 |
type: bool |
| 505 |
set: |
| 506 |
description: activate. |
| 507 |
type: bool |
| 508 |
as_prepends: |
| 509 |
description: Number of times to prepend the local AS number to the |
| 510 |
AS path of routes. Default=0 |
| 511 |
type: dict |
| 512 |
suboptions: |
| 513 |
inheritance_disable: |
| 514 |
description: Prevent as prepends from being inherited from the parent. |
| 515 |
type: bool |
| 516 |
value: |
| 517 |
description: Range of values for as prepends.Example-<0-6> . |
| 518 |
type: int |
| 519 |
local_preference: |
| 520 |
description: local preference with which to advertise routes to ibgp neigbors. Default=No Touch |
| 521 |
type: dict |
| 522 |
suboptions: |
| 523 |
value: |
| 524 |
description: Range of values for Local Preference.Example-<0-4294967295> . |
| 525 |
type: int |
| 526 |
inheritance_disable: |
| 527 |
description: Prevent local preference from being inherited from the parent. |
| 528 |
type: bool |
| 529 |
graceful_restart: |
| 530 |
description: Enable graceful restart support for this neighbor. |
| 531 |
type: dict |
| 532 |
suboptions: |
| 533 |
restart_time: |
| 534 |
description: Restart time advertised to neighbors in seconds <1-4095>. |
| 535 |
type: int |
| 536 |
stalepath_time: |
| 537 |
description: Maximum time to wait for restart of GR capable peers in seconds <1-4095>. |
| 538 |
type: int |
| 539 |
ignore_connected_check: |
| 540 |
description: Bypass the directly connected nexthop check for single-hop eBGP peering |
| 541 |
type: dict |
| 542 |
suboptions: |
| 543 |
inheritance_disable: |
| 544 |
description: Prevent ignore-connected-check from being inherited from the parent |
| 545 |
type: bool |
| 546 |
set: |
| 547 |
description: set ignore-connected-check. |
| 548 |
type: bool |
| 549 |
idle_watch_time: |
| 550 |
type: int |
| 551 |
description: Maximum time to wait for deletion of IDLE state dynamic peer. |
| 552 |
internal_vpn_client: |
| 553 |
type: bool |
| 554 |
description: Preserve iBGP CE neighbor path in ATTR_SET across VPN core. |
| 555 |
keychain: |
| 556 |
description: Set keychain based authentication. |
| 557 |
type: dict |
| 558 |
suboptions: |
| 559 |
name: |
| 560 |
description: Name of the key chain - maximum 32 characters. |
| 561 |
type: str |
| 562 |
inheritance_disable: |
| 563 |
description: Prevent keychain from being inherited from parent. |
| 564 |
type: bool |
| 565 |
local: |
| 566 |
type: dict |
| 567 |
description: Configure local parameter |
| 568 |
suboptions: |
| 569 |
address: |
| 570 |
description: IPv4 address |
| 571 |
type: dict |
| 572 |
suboptions: |
| 573 |
ipv4_address: |
| 574 |
description: IPv4 address <A.B.C.D>. |
| 575 |
type: str |
| 576 |
inheritance_disable: |
| 577 |
description: Prevent local address from being inherited from parent. |
| 578 |
type: bool |
| 579 |
local_as: |
| 580 |
description: Specify local AS number. |
| 581 |
type: dict |
| 582 |
suboptions: |
| 583 |
value: |
| 584 |
description: 2 byte, 4 byte As number |
| 585 |
type: int |
| 586 |
no_prepend: |
| 587 |
description: Do not prepend local AS to announcements from this neighbor. |
| 588 |
type: dict |
| 589 |
suboptions: |
| 590 |
set: |
| 591 |
type: bool |
| 592 |
description: Do not prepend local AS to announcements from this neighbor. |
| 593 |
replace_as: |
| 594 |
type: dict |
| 595 |
description: Prepend only local AS to announcements to this neighbor. |
| 596 |
suboptions: |
| 597 |
set: |
| 598 |
type: bool |
| 599 |
description: Prepend only local AS to announcements to this neighbor. |
| 600 |
dual_as: |
| 601 |
type: bool |
| 602 |
description: Dual-AS mode. |
| 603 |
inheritance_disable: |
| 604 |
description: Prevent local AS from being inherited from parent. |
| 605 |
type: bool |
| 606 |
local_address_subnet: |
| 607 |
type: str |
| 608 |
description: Local address subnet of routing updates |
| 609 |
log: |
| 610 |
description: Logging update messages per neighbor. |
| 611 |
type: dict |
| 612 |
suboptions: |
| 613 |
log_message: |
| 614 |
description: Logging update/notification messages per neighbor. |
| 615 |
type: dict |
| 616 |
suboptions: |
| 617 |
in: |
| 618 |
description: Inbound log messages |
| 619 |
type: dict |
| 620 |
suboptions: |
| 621 |
value: |
| 622 |
description: Range for message log buffer size <1-100>. |
| 623 |
type: int |
| 624 |
disable: |
| 625 |
description: Disable inbound message logging. |
| 626 |
type: bool |
| 627 |
inheritance_disable: |
| 628 |
description: Prevents the msg log from being inherited from the parent. |
| 629 |
type: bool |
| 630 |
out: |
| 631 |
description: Outbound log messages |
| 632 |
type: dict |
| 633 |
suboptions: |
| 634 |
value: |
| 635 |
description: Range for message log buffer size <1-100>. |
| 636 |
type: int |
| 637 |
disable: |
| 638 |
description: Disable inbound message logging. |
| 639 |
type: bool |
| 640 |
inheritance_disable: |
| 641 |
description: Prevents the msg log from being inherited from the parent. |
| 642 |
type: bool |
| 643 |
maximum_peers: |
| 644 |
type: int |
| 645 |
description: Maximum dynamic neighbors <1-4095>. |
| 646 |
password: |
| 647 |
type: dict |
| 648 |
description: Set a password. |
| 649 |
suboptions: |
| 650 |
encrypted: |
| 651 |
type: str |
| 652 |
description: Specifies an ENCRYPTED password will follow. |
| 653 |
inheritance_disable: |
| 654 |
description: Prevent password from being inherited from parent. |
| 655 |
type: bool |
| 656 |
peer_set: |
| 657 |
type: int |
| 658 |
description: Assign this neighbor to a peer-set used for egress peer engineering <1-255>. |
| 659 |
precedence: |
| 660 |
type: str |
| 661 |
choices: ["critical", "flash", "flash-override", "immediate", "internet", "network", "priority","routine"] |
| 662 |
description: Set precedence |
| 663 |
receive_buffer_size: |
| 664 |
description: Set socket and BGP receive buffer size.Example <512-131072>. |
| 665 |
type: int |
| 666 |
remote_as: |
| 667 |
description: Neighbor Autonomous System. |
| 668 |
type: str |
| 669 |
remote_as_list: |
| 670 |
description: Remote as-list configuration |
| 671 |
type: str |
| 672 |
send_buffer_size: |
| 673 |
description: Set socket and BGP send buffer size.Example <4096-131072>. |
| 674 |
type: int |
| 675 |
session_open_mode: |
| 676 |
description: Establish BGP session using this TCP open mode. |
| 677 |
type: str |
| 678 |
choices: [ 'active-only', 'both', 'passive-only' ] |
| 679 |
shutdown: |
| 680 |
description: Administratively shut down this neighbor. |
| 681 |
type: dict |
| 682 |
suboptions: |
| 683 |
inheritance_disable: |
| 684 |
description: Prevent shutdown from being inherited from parent |
| 685 |
type: bool |
| 686 |
set: |
| 687 |
description: shutdown. |
| 688 |
type: bool |
| 689 |
tcp: |
| 690 |
description: TCP session configuration commands. |
| 691 |
type: dict |
| 692 |
suboptions: |
| 693 |
mss: |
| 694 |
description: Maximum Segment Size. |
| 695 |
type: dict |
| 696 |
suboptions: |
| 697 |
value: |
| 698 |
description: TCP initial maximum segment size. |
| 699 |
type: int |
| 700 |
inheritance_disable: |
| 701 |
description: Prevent mss from being inherited from parent |
| 702 |
type: bool |
| 703 |
timers: |
| 704 |
description: BGP per neighbor timers. |
| 705 |
type: dict |
| 706 |
suboptions: |
| 707 |
keepalive_time: |
| 708 |
description: keepalive interval <0-65535>. |
| 709 |
type: int |
| 710 |
holdtime: |
| 711 |
description: hold time <3-65535> or 0 Disable hold time. |
| 712 |
type: int |
| 713 |
min_holdtime: |
| 714 |
description: Minimum acceptable holdtime from neighbor <3-65535>. |
| 715 |
type: int |
| 716 |
ttl_security: |
| 717 |
description: Enable EBGP TTL security. |
| 718 |
type: dict |
| 719 |
suboptions: |
| 720 |
inheritance_disable: |
| 721 |
description: Prevent ttl-security from being inherited from parent |
| 722 |
type: bool |
| 723 |
set: |
| 724 |
description: set ttl-security |
| 725 |
type: bool |
| 726 |
update: |
| 727 |
description: BGP Update configuration. |
| 728 |
type: dict |
| 729 |
suboptions: |
| 730 |
in: |
| 731 |
description: Inbound update message handling. |
| 732 |
type: dict |
| 733 |
suboptions: |
| 734 |
filtering: |
| 735 |
description: Inbound update message filtering |
| 736 |
type: dict |
| 737 |
suboptions: |
| 738 |
attribute_filter: |
| 739 |
description: Attribute-filter configuration. |
| 740 |
type: dict |
| 741 |
suboptions: |
| 742 |
group: |
| 743 |
description: Name of group. |
| 744 |
type: str |
| 745 |
logging: |
| 746 |
description: Update filtering syslog message. |
| 747 |
type: dict |
| 748 |
suboptions: |
| 749 |
disable: |
| 750 |
description: Disable update filtering syslog message. |
| 751 |
type: bool |
| 752 |
update_message: |
| 753 |
description: Filtered update messages. |
| 754 |
type: dict |
| 755 |
suboptions: |
| 756 |
buffers: |
| 757 |
description: Number of buffers to store filtered update messages. |
| 758 |
type: int |
| 759 |
update_source: |
| 760 |
description: Source of routing updates.Refer vendor document for valid values. |
| 761 |
type: str |
| 762 |
use: |
| 763 |
description: Use a neighbor-group and session-group template. |
| 764 |
type: dict |
| 765 |
suboptions: |
| 766 |
neighbor_group: |
| 767 |
description: Inherit configuration from a neighbor-group. |
| 768 |
type: str |
| 769 |
session_group: |
| 770 |
description: Inherit address-family independent config from a session-group |
| 771 |
type: str |
| 772 |
running_config: |
| 773 |
description: |
| 774 |
- This option is used only with state I(parsed). |
| 775 |
- The value of this option should be the output received from the Iosxr device by |
| 776 |
executing the command B(show running-config router bgp). |
| 777 |
- The state I(parsed) reads the configuration from C(running_config) option and |
| 778 |
transforms it into Ansible structured data as per the resource module's argspec |
| 779 |
and the value is then returned in the I(parsed) key within the result. |
| 780 |
type: str |
| 781 |
state: |
| 782 |
description: |
| 783 |
- The state the configuration should be left in. |
| 784 |
type: str |
| 785 |
choices: [deleted, merged, overridden, replaced, gathered, rendered, parsed] |
| 786 |
default: merged |
| 787 |
""" |
| 788 |
|
| 789 |
EXAMPLES = """ |
| 790 |
# Using merged |
| 791 |
# Before state: |
| 792 |
# ------------- |
| 793 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 794 |
# Thu Mar 23 10:00:12.668 UTC |
| 795 |
# % No such configuration item(s) |
| 796 |
# |
| 797 |
# RP/0/RP0/CPU0:10# |
| 798 |
|
| 799 |
- name: Merge the provided configuration with the existing running configuration |
| 800 |
cisco.iosxr.iosxr_bgp_templates: |
| 801 |
config: |
| 802 |
as_number: 65536 |
| 803 |
neighbor: |
| 804 |
- address_family: |
| 805 |
- advertise: |
| 806 |
local_labeled_route: |
| 807 |
set: true |
| 808 |
afi: ipv4 |
| 809 |
safi: unicast |
| 810 |
advertisement_interval: 10 |
| 811 |
bfd: |
| 812 |
fast_detect: |
| 813 |
strict_mode: true |
| 814 |
internal_vpn_client: true |
| 815 |
name: neighbor-group1 |
| 816 |
precedence: critical |
| 817 |
- cluster_id: '1' |
| 818 |
description: neighbor-group2 |
| 819 |
dmz_link_bandwidth: |
| 820 |
set: true |
| 821 |
ebgp_multihop: |
| 822 |
value: 255 |
| 823 |
egress_engineering: |
| 824 |
set: true |
| 825 |
graceful_maintenance: |
| 826 |
as_prepends: |
| 827 |
value: 0 |
| 828 |
set: true |
| 829 |
ignore_connected_check: |
| 830 |
set: true |
| 831 |
internal_vpn_client: true |
| 832 |
local: |
| 833 |
address: |
| 834 |
inheritance_disable: true |
| 835 |
local_as: |
| 836 |
value: 6 |
| 837 |
name: neighbor-group2 |
| 838 |
precedence: flash |
| 839 |
receive_buffer_size: 512 |
| 840 |
send_buffer_size: 4096 |
| 841 |
session_open_mode: both |
| 842 |
tcp: |
| 843 |
mss: |
| 844 |
inheritance_disable: true |
| 845 |
ttl_security: |
| 846 |
set: true |
| 847 |
update_source: Loopback919 |
| 848 |
state: merged |
| 849 |
|
| 850 |
# Task Output |
| 851 |
# ----------- |
| 852 |
# before: {} |
| 853 |
# commands: |
| 854 |
# - router bgp 65536 |
| 855 |
# - neighbor-group neighbor-group1 |
| 856 |
# - advertisement-interval 10 |
| 857 |
# - bfd fast-detect strict-mode |
| 858 |
# - internal-vpn-client |
| 859 |
# - precedence critical |
| 860 |
# - address-family ipv4 unicast |
| 861 |
# - advertise local-labeled-route |
| 862 |
# - neighbor-group neighbor-group2 |
| 863 |
# - dmz-link-bandwidth |
| 864 |
# - description neighbor-group2 |
| 865 |
# - cluster-id 1 |
| 866 |
# - ebgp-multihop 255 |
| 867 |
# - egress-engineering |
| 868 |
# - internal-vpn-client |
| 869 |
# - ignore-connected-check |
| 870 |
# - local-as 6 |
| 871 |
# - local address inheritance-disable |
| 872 |
# - precedence flash |
| 873 |
# - receive-buffer-size 512 |
| 874 |
# - send-buffer-size 4096 |
| 875 |
# - session-open-mode both |
| 876 |
# - tcp mss inheritance-disable |
| 877 |
# - update-source Loopback919 |
| 878 |
# - ttl-security |
| 879 |
# - graceful-maintenance |
| 880 |
# - graceful-maintenance as-prepends 0 |
| 881 |
# after: |
| 882 |
# as_number: '65536' |
| 883 |
# neighbor: |
| 884 |
# - address_family: |
| 885 |
# - advertise: |
| 886 |
# local_labeled_route: |
| 887 |
# set: true |
| 888 |
# afi: ipv4 |
| 889 |
# safi: unicast |
| 890 |
# advertisement_interval: 10 |
| 891 |
# bfd: |
| 892 |
# fast_detect: |
| 893 |
# strict_mode: true |
| 894 |
# internal_vpn_client: true |
| 895 |
# name: neighbor-group1 |
| 896 |
# precedence: critical |
| 897 |
# - cluster_id: '1' |
| 898 |
# description: neighbor-group2 |
| 899 |
# dmz_link_bandwidth: |
| 900 |
# set: true |
| 901 |
# ebgp_multihop: |
| 902 |
# value: 255 |
| 903 |
# egress_engineering: |
| 904 |
# set: true |
| 905 |
# graceful_maintenance: |
| 906 |
# as_prepends: |
| 907 |
# value: 0 |
| 908 |
# set: true |
| 909 |
# ignore_connected_check: |
| 910 |
# set: true |
| 911 |
# internal_vpn_client: true |
| 912 |
# local: |
| 913 |
# address: |
| 914 |
# inheritance_disable: true |
| 915 |
# local_as: |
| 916 |
# value: 6 |
| 917 |
# name: neighbor-group2 |
| 918 |
# precedence: flash |
| 919 |
# receive_buffer_size: 512 |
| 920 |
# send_buffer_size: 4096 |
| 921 |
# session_open_mode: both |
| 922 |
# tcp: |
| 923 |
# mss: |
| 924 |
# inheritance_disable: true |
| 925 |
# ttl_security: |
| 926 |
# set: true |
| 927 |
# update_source: Loopback919 |
| 928 |
|
| 929 |
# After state: |
| 930 |
# ------------ |
| 931 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 932 |
# Thu Mar 23 10:14:33.116 UTC |
| 933 |
# router bgp 65536 |
| 934 |
# neighbor-group neighbor-group1 |
| 935 |
# bfd fast-detect strict-mode |
| 936 |
# precedence critical |
| 937 |
# advertisement-interval 10 |
| 938 |
# internal-vpn-client |
| 939 |
# address-family ipv4 unicast |
| 940 |
# advertise local-labeled-route |
| 941 |
# ! |
| 942 |
# ! |
| 943 |
# neighbor-group neighbor-group2 |
| 944 |
# ebgp-multihop 255 |
| 945 |
# egress-engineering |
| 946 |
# precedence flash |
| 947 |
# graceful-maintenance |
| 948 |
# as-prepends 0 |
| 949 |
# ! |
| 950 |
# tcp mss inheritance-disable |
| 951 |
# local-as 6 |
| 952 |
# cluster-id 1 |
| 953 |
# dmz-link-bandwidth |
| 954 |
# description neighbor-group2 |
| 955 |
# ttl-security |
| 956 |
# local address inheritance-disable |
| 957 |
# update-source Loopback919 |
| 958 |
# ignore-connected-check |
| 959 |
# session-open-mode both |
| 960 |
# send-buffer-size 4096 |
| 961 |
# receive-buffer-size 512 |
| 962 |
# internal-vpn-client |
| 963 |
# ! |
| 964 |
# ! |
| 965 |
|
| 966 |
|
| 967 |
# Using replaced |
| 968 |
# Before state: |
| 969 |
# ------------ |
| 970 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 971 |
# Thu Mar 23 10:14:33.116 UTC |
| 972 |
# router bgp 65536 |
| 973 |
# neighbor-group neighbor-group1 |
| 974 |
# bfd fast-detect strict-mode |
| 975 |
# precedence critical |
| 976 |
# advertisement-interval 10 |
| 977 |
# internal-vpn-client |
| 978 |
# address-family ipv4 unicast |
| 979 |
# advertise local-labeled-route |
| 980 |
# ! |
| 981 |
# ! |
| 982 |
# neighbor-group neighbor-group2 |
| 983 |
# ebgp-multihop 255 |
| 984 |
# egress-engineering |
| 985 |
# precedence flash |
| 986 |
# graceful-maintenance |
| 987 |
# as-prepends 0 |
| 988 |
# ! |
| 989 |
# tcp mss inheritance-disable |
| 990 |
# local-as 6 |
| 991 |
# cluster-id 1 |
| 992 |
# dmz-link-bandwidth |
| 993 |
# description neighbor-group2 |
| 994 |
# ttl-security |
| 995 |
# local address inheritance-disable |
| 996 |
# update-source Loopback919 |
| 997 |
# ignore-connected-check |
| 998 |
# session-open-mode both |
| 999 |
# send-buffer-size 4096 |
| 1000 |
# receive-buffer-size 512 |
| 1001 |
# internal-vpn-client |
| 1002 |
# ! |
| 1003 |
# ! |
| 1004 |
|
| 1005 |
- name: Replaced given bgp_templates configuration |
| 1006 |
cisco.iosxr.iosxr_bgp_templates: |
| 1007 |
config: |
| 1008 |
as_number: 65536 |
| 1009 |
neighbor: |
| 1010 |
- address_family: |
| 1011 |
- advertise: |
| 1012 |
local_labeled_route: |
| 1013 |
set: true |
| 1014 |
afi: ipv4 |
| 1015 |
safi: unicast |
| 1016 |
advertisement_interval: 12 |
| 1017 |
name: neighbor-group1 |
| 1018 |
precedence: flash |
| 1019 |
- cluster_id: '2' |
| 1020 |
description: replace neighbor-group2 |
| 1021 |
ebgp_multihop: |
| 1022 |
value: 254 |
| 1023 |
graceful_maintenance: |
| 1024 |
as_prepends: |
| 1025 |
value: 2 |
| 1026 |
set: true |
| 1027 |
update_source: Loopback917 |
| 1028 |
name: neighbor-group2 |
| 1029 |
state: replaced |
| 1030 |
|
| 1031 |
# Task Output |
| 1032 |
# ----------- |
| 1033 |
# before: |
| 1034 |
# as_number: '65536' |
| 1035 |
# neighbor: |
| 1036 |
# - address_family: |
| 1037 |
# - advertise: |
| 1038 |
# local_labeled_route: |
| 1039 |
# set: true |
| 1040 |
# afi: ipv4 |
| 1041 |
# safi: unicast |
| 1042 |
# advertisement_interval: 10 |
| 1043 |
# bfd: |
| 1044 |
# fast_detect: |
| 1045 |
# strict_mode: true |
| 1046 |
# internal_vpn_client: true |
| 1047 |
# name: neighbor-group1 |
| 1048 |
# precedence: critical |
| 1049 |
# - cluster_id: '1' |
| 1050 |
# description: neighbor-group2 |
| 1051 |
# dmz_link_bandwidth: |
| 1052 |
# set: true |
| 1053 |
# ebgp_multihop: |
| 1054 |
# value: 255 |
| 1055 |
# egress_engineering: |
| 1056 |
# set: true |
| 1057 |
# graceful_maintenance: |
| 1058 |
# as_prepends: |
| 1059 |
# value: 0 |
| 1060 |
# set: true |
| 1061 |
# ignore_connected_check: |
| 1062 |
# set: true |
| 1063 |
# internal_vpn_client: true |
| 1064 |
# local: |
| 1065 |
# address: |
| 1066 |
# inheritance_disable: true |
| 1067 |
# local_as: |
| 1068 |
# value: 6 |
| 1069 |
# name: neighbor-group2 |
| 1070 |
# precedence: flash |
| 1071 |
# receive_buffer_size: 512 |
| 1072 |
# send_buffer_size: 4096 |
| 1073 |
# session_open_mode: both |
| 1074 |
# tcp: |
| 1075 |
# mss: |
| 1076 |
# inheritance_disable: true |
| 1077 |
# ttl_security: |
| 1078 |
# set: true |
| 1079 |
# update_source: Loopback919 |
| 1080 |
# commands: |
| 1081 |
# - router bgp 65536 |
| 1082 |
# - neighbor-group neighbor-group1 |
| 1083 |
# - no bfd fast-detect strict-mode |
| 1084 |
# - no internal-vpn-client |
| 1085 |
# - advertisement-interval 12 |
| 1086 |
# - precedence flash |
| 1087 |
# - neighbor-group neighbor-group2 |
| 1088 |
# - no dmz-link-bandwidth |
| 1089 |
# - no egress-engineering |
| 1090 |
# - no internal-vpn-client |
| 1091 |
# - no ignore-connected-check |
| 1092 |
# - no local-as 6 |
| 1093 |
# - no local address inheritance-disable |
| 1094 |
# - no precedence flash |
| 1095 |
# - no receive-buffer-size 512 |
| 1096 |
# - no send-buffer-size 4096 |
| 1097 |
# - no session-open-mode both |
| 1098 |
# - no tcp mss inheritance-disable |
| 1099 |
# - no ttl-security |
| 1100 |
# - description replace neighbor-group2 |
| 1101 |
# - cluster-id 2 |
| 1102 |
# - ebgp-multihop 254 |
| 1103 |
# - update-source Loopback917 |
| 1104 |
# - graceful-maintenance as-prepends 2 |
| 1105 |
# after: |
| 1106 |
# as_number: '65536' |
| 1107 |
# neighbor: |
| 1108 |
# - address_family: |
| 1109 |
# - advertise: |
| 1110 |
# local_labeled_route: |
| 1111 |
# set: true |
| 1112 |
# afi: ipv4 |
| 1113 |
# safi: unicast |
| 1114 |
# advertisement_interval: 12 |
| 1115 |
# name: neighbor-group1 |
| 1116 |
# precedence: flash |
| 1117 |
# - cluster_id: '2' |
| 1118 |
# description: replace neighbor-group2 |
| 1119 |
# ebgp_multihop: |
| 1120 |
# value: 254 |
| 1121 |
# graceful_maintenance: |
| 1122 |
# as_prepends: |
| 1123 |
# value: 2 |
| 1124 |
# set: true |
| 1125 |
# name: neighbor-group2 |
| 1126 |
# update_source: Loopback917 |
| 1127 |
|
| 1128 |
# After state: |
| 1129 |
# ------------ |
| 1130 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 1131 |
# Thu Mar 23 10:23:34.104 UTC |
| 1132 |
# router bgp 65536 |
| 1133 |
# neighbor-group neighbor-group1 |
| 1134 |
# precedence flash |
| 1135 |
# advertisement-interval 12 |
| 1136 |
# address-family ipv4 unicast |
| 1137 |
# advertise local-labeled-route |
| 1138 |
# ! |
| 1139 |
# ! |
| 1140 |
# neighbor-group neighbor-group2 |
| 1141 |
# ebgp-multihop 254 |
| 1142 |
# graceful-maintenance |
| 1143 |
# as-prepends 2 |
| 1144 |
# ! |
| 1145 |
# cluster-id 2 |
| 1146 |
# description replace neighbor-group2 |
| 1147 |
# update-source Loopback917 |
| 1148 |
# ! |
| 1149 |
# ! |
| 1150 |
|
| 1151 |
|
| 1152 |
# Using deleted |
| 1153 |
# Before state: |
| 1154 |
# ------------- |
| 1155 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 1156 |
# Thu Mar 23 10:23:34.104 UTC |
| 1157 |
# router bgp 65536 |
| 1158 |
# neighbor-group neighbor-group1 |
| 1159 |
# precedence flash |
| 1160 |
# advertisement-interval 12 |
| 1161 |
# address-family ipv4 unicast |
| 1162 |
# advertise local-labeled-route |
| 1163 |
# ! |
| 1164 |
# ! |
| 1165 |
# neighbor-group neighbor-group2 |
| 1166 |
# ebgp-multihop 254 |
| 1167 |
# graceful-maintenance |
| 1168 |
# as-prepends 2 |
| 1169 |
# ! |
| 1170 |
# cluster-id 2 |
| 1171 |
# description replace neighbor-group2 |
| 1172 |
# update-source Loopback917 |
| 1173 |
# ! |
| 1174 |
# ! |
| 1175 |
|
| 1176 |
- name: Delete given bgp_nbr_address_family configuration |
| 1177 |
cisco.iosxr.iosxr_bgp_templates: &deleted |
| 1178 |
config: |
| 1179 |
state: deleted |
| 1180 |
|
| 1181 |
# Task Output |
| 1182 |
# ----------- |
| 1183 |
# before: |
| 1184 |
# as_number: '65536' |
| 1185 |
# neighbor: |
| 1186 |
# - address_family: |
| 1187 |
# - advertise: |
| 1188 |
# local_labeled_route: |
| 1189 |
# set: true |
| 1190 |
# afi: ipv4 |
| 1191 |
# safi: unicast |
| 1192 |
# advertisement_interval: 12 |
| 1193 |
# name: neighbor-group1 |
| 1194 |
# precedence: flash |
| 1195 |
# - cluster_id: '2' |
| 1196 |
# description: replace neighbor-group2 |
| 1197 |
# ebgp_multihop: |
| 1198 |
# value: 254 |
| 1199 |
# graceful_maintenance: |
| 1200 |
# as_prepends: |
| 1201 |
# value: 2 |
| 1202 |
# set: true |
| 1203 |
# name: neighbor-group2 |
| 1204 |
# update_source: Loopback917 |
| 1205 |
# commands: |
| 1206 |
# - router bgp 65536 |
| 1207 |
# - no neighbor-group neighbor-group1 |
| 1208 |
# - no neighbor-group neighbor-group2 |
| 1209 |
# after: {} |
| 1210 |
|
| 1211 |
# After state: |
| 1212 |
# ------------- |
| 1213 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 1214 |
# Thu Mar 23 10:00:12.668 UTC |
| 1215 |
# % No such configuration item(s) |
| 1216 |
# |
| 1217 |
# RP/0/RP0/CPU0:10# |
| 1218 |
|
| 1219 |
# Using gathered |
| 1220 |
# Before state: |
| 1221 |
# ------------- |
| 1222 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 1223 |
# Thu Mar 23 10:30:38.785 UTC |
| 1224 |
# router bgp 65536 |
| 1225 |
# neighbor-group neighbor-group1 |
| 1226 |
# bfd fast-detect strict-mode |
| 1227 |
# precedence critical |
| 1228 |
# advertisement-interval 10 |
| 1229 |
# internal-vpn-client |
| 1230 |
# address-family ipv4 unicast |
| 1231 |
# advertise local-labeled-route |
| 1232 |
# ! |
| 1233 |
# ! |
| 1234 |
# neighbor-group neighbor-group2 |
| 1235 |
# ebgp-multihop 255 |
| 1236 |
# egress-engineering |
| 1237 |
# precedence flash |
| 1238 |
# graceful-maintenance |
| 1239 |
# as-prepends 0 |
| 1240 |
# ! |
| 1241 |
# tcp mss inheritance-disable |
| 1242 |
# local-as 6 |
| 1243 |
# cluster-id 1 |
| 1244 |
# dmz-link-bandwidth |
| 1245 |
# description neighbor-group2 |
| 1246 |
# ttl-security |
| 1247 |
# local address inheritance-disable |
| 1248 |
# update-source Loopback919 |
| 1249 |
# ignore-connected-check |
| 1250 |
# session-open-mode both |
| 1251 |
# send-buffer-size 4096 |
| 1252 |
# receive-buffer-size 512 |
| 1253 |
# internal-vpn-client |
| 1254 |
# ! |
| 1255 |
# ! |
| 1256 |
|
| 1257 |
- name: Gather given bgp_templates configuration |
| 1258 |
cisco.iosxr.iosxr_bgp_templates: &id001 |
| 1259 |
config: |
| 1260 |
state: gathered |
| 1261 |
|
| 1262 |
# Task output |
| 1263 |
# ----------- |
| 1264 |
# gathered: |
| 1265 |
# as_number: '65536' |
| 1266 |
# neighbor: |
| 1267 |
# - address_family: |
| 1268 |
# - advertise: |
| 1269 |
# local_labeled_route: |
| 1270 |
# set: true |
| 1271 |
# afi: ipv4 |
| 1272 |
# safi: unicast |
| 1273 |
# advertisement_interval: 10 |
| 1274 |
# bfd: |
| 1275 |
# fast_detect: |
| 1276 |
# strict_mode: true |
| 1277 |
# internal_vpn_client: true |
| 1278 |
# name: neighbor-group1 |
| 1279 |
# precedence: critical |
| 1280 |
# - cluster_id: '1' |
| 1281 |
# description: neighbor-group2 |
| 1282 |
# dmz_link_bandwidth: |
| 1283 |
# set: true |
| 1284 |
# ebgp_multihop: |
| 1285 |
# value: 255 |
| 1286 |
# egress_engineering: |
| 1287 |
# set: true |
| 1288 |
# graceful_maintenance: |
| 1289 |
# as_prepends: |
| 1290 |
# value: 0 |
| 1291 |
# set: true |
| 1292 |
# ignore_connected_check: |
| 1293 |
# set: true |
| 1294 |
# internal_vpn_client: true |
| 1295 |
# local: |
| 1296 |
# address: |
| 1297 |
# inheritance_disable: true |
| 1298 |
# local_as: |
| 1299 |
# value: 6 |
| 1300 |
# name: neighbor-group2 |
| 1301 |
# precedence: flash |
| 1302 |
# receive_buffer_size: 512 |
| 1303 |
# send_buffer_size: 4096 |
| 1304 |
# session_open_mode: both |
| 1305 |
# tcp: |
| 1306 |
# mss: |
| 1307 |
# inheritance_disable: true |
| 1308 |
# ttl_security: |
| 1309 |
# set: true |
| 1310 |
# update_source: Loopback919 |
| 1311 |
|
| 1312 |
|
| 1313 |
# Using overridden |
| 1314 |
|
| 1315 |
# Before state: |
| 1316 |
# ------------- |
| 1317 |
# RP/0/RP0/CPU0:10#show running-config router bgp |
| 1318 |
# Thu Mar 23 10:30:38.785 UTC |
| 1319 |
# router bgp 65536 |
| 1320 |
# neighbor-group neighbor-group1 |
| 1321 |
# bfd fast-detect strict-mode |
| 1322 |
# precedence critical |
| 1323 |
# advertisement-interval 10 |
| 1324 |
# internal-vpn-client |
| 1325 |
# address-family ipv4 unicast |
| 1326 |
# advertise local-labeled-route |
| 1327 |
# ! |
| 1328 |
# ! |
| 1329 |
# neighbor-group neighbor-group2 |
| 1330 |
# ebgp-multihop 255 |
| 1331 |
# egress-engineering |
| 1332 |
# precedence flash |
| 1333 |
# graceful-maintenance |
| 1334 |
# as-prepends 0 |
| 1335 |
# ! |
| 1336 |
# tcp mss inheritance-disable |
| 1337 |
# local-as 6 |
| 1338 |
# cluster-id 1 |
| 1339 |
# dmz-link-bandwidth |
| 1340 |
# description neighbor-group2 |
| 1341 |
# ttl-security |
| 1342 |
# local address inheritance-disable |
| 1343 |
# update-source Loopback919 |
| 1344 |
# ignore-connected-check |
| 1345 |
# session-open-mode both |
| 1346 |
# send-buffer-size 4096 |
| 1347 |
# receive-buffer-size 512 |
| 1348 |
# internal-vpn-client |
| 1349 |
# ! |
| 1350 |
# ! |
| 1351 |
- name: override given bgp_templates configuration |
| 1352 |
cisco.iosxr.iosxr_bgp_templates: |
| 1353 |
config: |
| 1354 |
as_number: 65536 |
| 1355 |
neighbor: |
| 1356 |
- address_family: |
| 1357 |
- advertise: |
| 1358 |
local_labeled_route: |
| 1359 |
disable: true |
| 1360 |
afi: ipv4 |
| 1361 |
safi: unicast |
| 1362 |
advertisement_interval: 12 |
| 1363 |
bfd: |
| 1364 |
fast_detect: |
| 1365 |
strict_mode: true |
| 1366 |
name: neighbor-group1 |
| 1367 |
precedence: flash |
| 1368 |
state: overridden |
| 1369 |
|
| 1370 |
# Task Output |
| 1371 |
# ----------- |
| 1372 |
# before: |
| 1373 |
# as_number: '65536' |
| 1374 |
# neighbor: |
| 1375 |
# - address_family: |
| 1376 |
# - advertise: |
| 1377 |
# local_labeled_route: |
| 1378 |
# set: true |
| 1379 |
# afi: ipv4 |
| 1380 |
# safi: unicast |
| 1381 |
# advertisement_interval: 10 |
| 1382 |
# bfd: |
| 1383 |
# fast_detect: |
| 1384 |
# strict_mode: true |
| 1385 |
# internal_vpn_client: true |
| 1386 |
# name: neighbor-group1 |
| 1387 |
# precedence: critical |
| 1388 |
# - cluster_id: '1' |
| 1389 |
# description: neighbor-group2 |
| 1390 |
# dmz_link_bandwidth: |
| 1391 |
# set: true |
| 1392 |
# ebgp_multihop: |
| 1393 |
# value: 255 |
| 1394 |
# egress_engineering: |
| 1395 |
# set: true |
| 1396 |
# graceful_maintenance: |
| 1397 |
# as_prepends: |
| 1398 |
# value: 0 |
| 1399 |
# set: true |
| 1400 |
# ignore_connected_check: |
| 1401 |
# set: true |
| 1402 |
# internal_vpn_client: true |
| 1403 |
# local: |
| 1404 |
# address: |
| 1405 |
# inheritance_disable: true |
| 1406 |
# local_as: |
| 1407 |
# value: 6 |
| 1408 |
# name: neighbor-group2 |
| 1409 |
# precedence: flash |
| 1410 |
# receive_buffer_size: 512 |
| 1411 |
# send_buffer_size: 4096 |
| 1412 |
# session_open_mode: both |
| 1413 |
# tcp: |
| 1414 |
# mss: |
| 1415 |
# inheritance_disable: true |
| 1416 |
# ttl_security: |
| 1417 |
# set: true |
| 1418 |
# update_source: Loopback919 |
| 1419 |
# commands: |
| 1420 |
# - router bgp 65536 |
| 1421 |
# - no neighbor-group neighbor-group2 |
| 1422 |
# - neighbor-group neighbor-group1 |
| 1423 |
# - no internal-vpn-client |
| 1424 |
# - advertisement-interval 12 |
| 1425 |
# - precedence flash |
| 1426 |
# - address-family ipv4 unicast |
| 1427 |
# - no advertise local-labeled-route |
| 1428 |
# - advertise local-labeled-route disable |
| 1429 |
# after: |
| 1430 |
# as_number: '65536' |
| 1431 |
# neighbor: |
| 1432 |
# - address_family: |
| 1433 |
# - advertise: |
| 1434 |
# local_labeled_route: |
| 1435 |
# disable: true |
| 1436 |
# afi: ipv4 |
| 1437 |
# safi: unicast |
| 1438 |
# advertisement_interval: 12 |
| 1439 |
# bfd: |
| 1440 |
# fast_detect: |
| 1441 |
# strict_mode: true |
| 1442 |
# name: neighbor-group1 |
| 1443 |
# precedence: flash |
| 1444 |
|
| 1445 |
|
| 1446 |
# Using rendered |
| 1447 |
- name: >- |
| 1448 |
Render platform specific configuration lines with state rendered (without |
| 1449 |
connecting to the device) |
| 1450 |
cisco.iosxr.iosxr_bgp_templates: |
| 1451 |
config: |
| 1452 |
as_number: 65536 |
| 1453 |
neighbor: |
| 1454 |
- address_family: |
| 1455 |
- advertise: |
| 1456 |
local_labeled_route: |
| 1457 |
set: true |
| 1458 |
afi: ipv4 |
| 1459 |
safi: unicast |
| 1460 |
advertisement_interval: 10 |
| 1461 |
bfd: |
| 1462 |
fast_detect: |
| 1463 |
strict_mode: true |
| 1464 |
internal_vpn_client: true |
| 1465 |
name: neighbor-group1 |
| 1466 |
precedence: critical |
| 1467 |
- cluster_id: '1' |
| 1468 |
description: neighbor-group2 |
| 1469 |
dmz_link_bandwidth: |
| 1470 |
set: true |
| 1471 |
ebgp_multihop: |
| 1472 |
value: 255 |
| 1473 |
egress_engineering: |
| 1474 |
set: true |
| 1475 |
graceful_maintenance: |
| 1476 |
as_prepends: |
| 1477 |
value: 0 |
| 1478 |
set: true |
| 1479 |
ignore_connected_check: |
| 1480 |
set: true |
| 1481 |
internal_vpn_client: true |
| 1482 |
local: |
| 1483 |
address: |
| 1484 |
inheritance_disable: true |
| 1485 |
local_as: |
| 1486 |
value: 6 |
| 1487 |
name: neighbor-group2 |
| 1488 |
precedence: flash |
| 1489 |
receive_buffer_size: 512 |
| 1490 |
send_buffer_size: 4096 |
| 1491 |
session_open_mode: both |
| 1492 |
tcp: |
| 1493 |
mss: |
| 1494 |
inheritance_disable: true |
| 1495 |
ttl_security: |
| 1496 |
set: true |
| 1497 |
update_source: Loopback919 |
| 1498 |
state: rendered |
| 1499 |
|
| 1500 |
# Task Output |
| 1501 |
# ----------- |
| 1502 |
# rendered: |
| 1503 |
# - router bgp 65536 |
| 1504 |
# - neighbor-group neighbor-group1 |
| 1505 |
# - advertisement-interval 10 |
| 1506 |
# - bfd fast-detect strict-mode |
| 1507 |
# - internal-vpn-client |
| 1508 |
# - precedence critical |
| 1509 |
# - address-family ipv4 unicast |
| 1510 |
# - advertise local-labeled-route |
| 1511 |
# - neighbor-group neighbor-group2 |
| 1512 |
# - dmz-link-bandwidth |
| 1513 |
# - description neighbor-group2 |
| 1514 |
# - cluster-id 1 |
| 1515 |
# - ebgp-multihop 255 |
| 1516 |
# - egress-engineering |
| 1517 |
# - internal-vpn-client |
| 1518 |
# - ignore-connected-check |
| 1519 |
# - local-as 6 |
| 1520 |
# - local address inheritance-disable |
| 1521 |
# - precedence flash |
| 1522 |
# - receive-buffer-size 512 |
| 1523 |
# - send-buffer-size 4096 |
| 1524 |
# - session-open-mode both |
| 1525 |
# - tcp mss inheritance-disable |
| 1526 |
# - update-source Loopback919 |
| 1527 |
# - ttl-security |
| 1528 |
# - graceful-maintenance |
| 1529 |
# - graceful-maintenance as-prepends 0 |
| 1530 |
|
| 1531 |
|
| 1532 |
# Using parsed |
| 1533 |
- name: Parse externally provided BGP configuration |
| 1534 |
register: result |
| 1535 |
cisco.iosxr.iosxr_bgp_templates: |
| 1536 |
running_config: "{{ lookup('file', 'parsed.cfg') }}" |
| 1537 |
state: parsed |
| 1538 |
|
| 1539 |
# content of pared.cfg |
| 1540 |
# router bgp 65536 |
| 1541 |
# neighbor-group neighbor-group1 |
| 1542 |
# bfd fast-detect strict-mode |
| 1543 |
# precedence critical |
| 1544 |
# advertisement-interval 10 |
| 1545 |
# internal-vpn-client |
| 1546 |
# address-family ipv4 unicast |
| 1547 |
# advertise local-labeled-route |
| 1548 |
# ! |
| 1549 |
# ! |
| 1550 |
# neighbor-group neighbor-group2 |
| 1551 |
# ebgp-multihop 255 |
| 1552 |
# egress-engineering |
| 1553 |
# precedence flash |
| 1554 |
# graceful-maintenance |
| 1555 |
# as-prepends 0 |
| 1556 |
# ! |
| 1557 |
# tcp mss inheritance-disable |
| 1558 |
# local-as 6 |
| 1559 |
# cluster-id 1 |
| 1560 |
# dmz-link-bandwidth |
| 1561 |
# description neighbor-group2 |
| 1562 |
# ttl-security |
| 1563 |
# local address inheritance-disable |
| 1564 |
# update-source Loopback919 |
| 1565 |
# idle-watch-time 30 |
| 1566 |
# ignore-connected-check |
| 1567 |
# session-open-mode both |
| 1568 |
# send-buffer-size 4096 |
| 1569 |
# receive-buffer-size 512 |
| 1570 |
# internal-vpn-client |
| 1571 |
# ! |
| 1572 |
# ! |
| 1573 |
# Task output |
| 1574 |
# ----------- |
| 1575 |
# parsed: |
| 1576 |
# as_number: '65536' |
| 1577 |
# neighbor: |
| 1578 |
# - address_family: |
| 1579 |
# - advertise: |
| 1580 |
# local_labeled_route: |
| 1581 |
# set: true |
| 1582 |
# afi: ipv4 |
| 1583 |
# safi: unicast |
| 1584 |
# advertisement_interval: 10 |
| 1585 |
# bfd: |
| 1586 |
# fast_detect: |
| 1587 |
# strict_mode: true |
| 1588 |
# internal_vpn_client: true |
| 1589 |
# name: neighbor-group1 |
| 1590 |
# precedence: critical |
| 1591 |
# - cluster_id: '1' |
| 1592 |
# description: neighbor-group2 |
| 1593 |
# dmz_link_bandwidth: |
| 1594 |
# set: true |
| 1595 |
# ebgp_multihop: |
| 1596 |
# value: 255 |
| 1597 |
# egress_engineering: |
| 1598 |
# set: true |
| 1599 |
# graceful_maintenance: |
| 1600 |
# as_prepends: |
| 1601 |
# value: 0 |
| 1602 |
# set: true |
| 1603 |
# ignore_connected_check: |
| 1604 |
# set: true |
| 1605 |
# internal_vpn_client: true |
| 1606 |
# local: |
| 1607 |
# address: |
| 1608 |
# inheritance_disable: true |
| 1609 |
# local_as: |
| 1610 |
# value: 6 |
| 1611 |
# name: neighbor-group2 |
| 1612 |
# precedence: flash |
| 1613 |
# receive_buffer_size: 512 |
| 1614 |
# send_buffer_size: 4096 |
| 1615 |
# session_open_mode: both |
| 1616 |
# tcp: |
| 1617 |
# mss: |
| 1618 |
# inheritance_disable: true |
| 1619 |
# ttl_security: |
| 1620 |
# set: true |
| 1621 |
# update_source: Loopback919 |
| 1622 |
""" |
| 1623 |
|
| 1624 |
RETURN = """ |
| 1625 |
before: |
| 1626 |
description: The configuration prior to the module execution. |
| 1627 |
returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) |
| 1628 |
type: dict |
| 1629 |
sample: > |
| 1630 |
This output will always be in the same format as the |
| 1631 |
module argspec. |
| 1632 |
after: |
| 1633 |
description: The resulting configuration after module execution. |
| 1634 |
returned: when changed |
| 1635 |
type: dict |
| 1636 |
sample: > |
| 1637 |
This output will always be in the same format as the |
| 1638 |
module argspec. |
| 1639 |
commands: |
| 1640 |
description: The set of commands pushed to the remote device. |
| 1641 |
returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) |
| 1642 |
type: list |
| 1643 |
sample: |
| 1644 |
- router bgp 65536 |
| 1645 |
- neighbor-group neighbor-group1 |
| 1646 |
- advertisement-interval 10 |
| 1647 |
- bfd fast-detect strict-mode |
| 1648 |
- internal-vpn-client |
| 1649 |
rendered: |
| 1650 |
description: The provided configuration in the task rendered in device-native format (offline). |
| 1651 |
returned: when I(state) is C(rendered) |
| 1652 |
type: list |
| 1653 |
sample: |
| 1654 |
- router bgp 65536 |
| 1655 |
- neighbor-group neighbor-group1 |
| 1656 |
- advertisement-interval 10 |
| 1657 |
- bfd fast-detect strict-mode |
| 1658 |
- internal-vpn-client |
| 1659 |
gathered: |
| 1660 |
description: Facts about the network resource gathered from the remote device as structured data. |
| 1661 |
returned: when I(state) is C(gathered) |
| 1662 |
type: list |
| 1663 |
sample: > |
| 1664 |
This output will always be in the same format as the |
| 1665 |
module argspec. |
| 1666 |
parsed: |
| 1667 |
description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. |
| 1668 |
returned: when I(state) is C(parsed) |
| 1669 |
type: list |
| 1670 |
sample: > |
| 1671 |
This output will always be in the same format as the |
| 1672 |
module argspec. |
| 1673 |
""" |
| 1674 |
|
| 1675 |
from ansible.module_utils.basic import AnsibleModule |
| 1676 |
|
| 1677 |
from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.bgp_templates.bgp_templates import ( |
| 1678 |
Bgp_templatesArgs, |
| 1679 |
) |
| 1680 |
from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.bgp_templates.bgp_templates import ( |
| 1681 |
Bgp_templates, |
| 1682 |
) |
| 1683 |
|
| 1684 |
|
| 1685 |
def main(): |
| 1686 |
""" |
| 1687 |
Main entry point for module execution |
| 1688 |
|
| 1689 |
:returns: the result form module invocation |
| 1690 |
""" |
| 1691 |
module = AnsibleModule( |
| 1692 |
argument_spec=Bgp_templatesArgs.argument_spec, |
| 1693 |
mutually_exclusive=[["config", "running_config"]], |
| 1694 |
required_if=[ |
| 1695 |
["state", "merged", ["config"]], |
| 1696 |
["state", "replaced", ["config"]], |
| 1697 |
["state", "overridden", ["config"]], |
| 1698 |
["state", "rendered", ["config"]], |
| 1699 |
["state", "parsed", ["running_config"]], |
| 1700 |
], |
| 1701 |
supports_check_mode=True, |
| 1702 |
) |
| 1703 |
|
| 1704 |
result = Bgp_templates(module).execute_module() |
| 1705 |
module.exit_json(**result) |
| 1706 |
|
| 1707 |
|
| 1708 |
if __name__ == "__main__": |
| 1709 |
main() |