1#!/usr/local/bin/python3.8 2# 3# This file is part of Ansible 4# 5# Ansible is free software: you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation, either version 3 of the License, or 8# (at your option) any later version. 9# 10# Ansible is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with Ansible. If not, see <http://www.gnu.org/licenses/>. 17# 18""" 19The module file for ios_bgp_global 20""" 21from __future__ import absolute_import, division, print_function 22 23__metaclass__ = type 24DOCUMENTATION = """ 25module: ios_bgp_global 26short_description: Global BGP resource module 27description: This module configures and manages the attributes of global bgp on Cisco IOS. 28version_added: 1.3.0 29author: Sumit Jaiswal (@justjais) 30notes: 31- Tested against Cisco IOSv Version 15.2 on VIRL 32options: 33 config: 34 description: A list of configurations for global bgp. 35 type: dict 36 suboptions: 37 as_number: 38 description: Autonomous system number. 39 type: str 40 required: true 41 aggregate_address: 42 description: Configure BGP aggregate entries 43 type: dict 44 suboptions: 45 address: 46 description: Aggregate address 47 type: str 48 netmask: 49 description: Aggregate mask 50 type: str 51 advertise_map: 52 description: Set condition to advertise attribute 53 type: str 54 as_confed_set: 55 description: Generate AS confed set path information 56 type: bool 57 as_set: 58 description: Generate AS set path information 59 type: bool 60 attribute_map: 61 description: Set attributes of aggregate 62 type: str 63 summary_only: 64 description: Filter more specific routes from updates 65 type: bool 66 suppress_map: 67 description: Conditionally filter more specific routes from updates 68 type: str 69 auto_summary: 70 description: Enable automatic network number summarization 71 type: bool 72 bgp: 73 description: Enable address family and enter its config mode 74 type: dict 75 suboptions: 76 additional_paths: 77 description: Additional paths in the BGP table 78 type: dict 79 suboptions: 80 install: 81 description: Additional paths to install into RIB 82 type: bool 83 receive: 84 description: Receive additional paths from neighbors 85 type: bool 86 select: 87 description: Selection criteria to pick the paths 88 type: dict 89 suboptions: 90 all: 91 description: Select all available paths 92 type: bool 93 best: 94 description: Select best N paths (2-3). 95 type: int 96 best_external: 97 description: Select best-external path 98 type: bool 99 group_best: 100 description: Select group-best path 101 type: bool 102 send: 103 description: Send additional paths to neighbors 104 type: bool 105 advertise_best_external: 106 description: Advertise best external path to internal peers 107 type: bool 108 aggregate_timer: 109 description: 110 - Configure Aggregation Timer 111 - Please refer vendor documentation for valid values 112 type: int 113 always_compare_med: 114 description: Allow comparing MED from different neighbors 115 type: bool 116 asnotation: 117 description: 118 - Change the default asplain notation 119 - asdot notation 120 type: bool 121 bestpath: 122 description: Change the default bestpath selection 123 type: list 124 elements: dict 125 suboptions: 126 aigp: 127 description: 128 - if both paths doesn't have aigp ignore on bestpath comparision 129 - ignore 130 type: bool 131 compare_routerid: 132 description: Compare router-id for identical EBGP paths 133 type: bool 134 cost_community: 135 description: cost community 136 type: bool 137 igp_metric: 138 description: 139 - igp metric 140 - Ignore igp metric in bestpath selection 141 type: bool 142 med: 143 description: MED attribute 144 type: dict 145 suboptions: 146 confed: 147 description: Compare MED among confederation paths 148 type: bool 149 missing_as_worst: 150 description: Treat missing MED as the least preferred one 151 type: bool 152 client_to_client: 153 description: Configure client to client route reflection 154 type: dict 155 suboptions: 156 set: 157 description: set reflection of routes allowed 158 type: bool 159 all: 160 description: inter-cluster and intra-cluster (default) 161 type: bool 162 intra_cluster: 163 description: 164 - intra cluster reflection 165 - intra-cluster reflection for cluster-id 166 type: str 167 cluster_id: 168 description: 169 - Configure Route-Reflector Cluster-id (peers may reset) 170 - A.B.C.D/Please refer vendor documentation for valid Route-Reflector Cluster-id 171 type: bool 172 confederation: 173 description: AS confederation parameters 174 type: dict 175 suboptions: 176 identifier: 177 description: 178 - Set routing domain confederation AS 179 - AS number 180 type: str 181 peers: 182 description: 183 - Peer ASs in BGP confederation 184 - AS number 185 type: str 186 consistency_checker: 187 description: Consistency-checker 188 type: dict 189 suboptions: 190 auto_repair: 191 description: Auto-Repair 192 type: dict 193 suboptions: 194 set: 195 description: Enable Auto-Repair 196 type: bool 197 interval: 198 description: 199 - Set the bgp consistency checker 200 - Please refer vendor documentation for valid values 201 type: int 202 error_message: 203 description: Log Error-Msg 204 type: dict 205 suboptions: 206 set: 207 description: Enable Error-Msg 208 type: bool 209 interval: 210 description: 211 - Set the bgp consistency checker 212 - Please refer vendor documentation for valid values 213 type: int 214 dampening: 215 description: Enable route-flap dampening 216 type: dict 217 suboptions: 218 penalty_half_time: 219 description: 220 - Half-life time for the penalty 221 - Please refer vendor documentation for valid values 222 type: int 223 reuse_route_val: 224 description: 225 - Value to start reusing a route 226 - Please refer vendor documentation for valid values 227 type: int 228 suppress_route_val: 229 description: 230 - Value to start suppressing a route 231 - Please refer vendor documentation for valid values 232 type: int 233 max_suppress: 234 description: 235 - Maximum duration to suppress a stable route 236 - Please refer vendor documentation for valid values 237 type: int 238 route_map: 239 description: Route-map to specify criteria for dampening 240 type: str 241 deterministic_med: 242 description: Pick the best-MED path among paths advertised from the neighboring AS 243 type: bool 244 dmzlink_bw: 245 description: Use DMZ Link Bandwidth as weight for BGP multipaths 246 type: bool 247 enforce_first_as: 248 description: Enforce the first AS for EBGP routes(default) 249 type: bool 250 enhanced_error: 251 description: Enabled BGP Enhanced error handling 252 type: bool 253 fast_external_fallover: 254 description: Immediately reset session if a link to a directly connected external peer goes down 255 type: bool 256 graceful_restart: 257 description: Graceful restart capability parameters 258 type: dict 259 suboptions: 260 set: 261 description: Set Graceful-Restart 262 type: bool 263 extended: 264 description: Enable Graceful-Restart Extension 265 type: bool 266 restart_time: 267 description: 268 - Set the max time needed to restart and come back up 269 - Please refer vendor documentation for valid values 270 type: int 271 stalepath_time: 272 description: 273 - Set the max time to hold onto restarting peer's stale paths 274 - Please refer vendor documentation for valid values 275 type: int 276 graceful_shutdown: 277 description: Graceful shutdown capability parameters 278 type: dict 279 suboptions: 280 neighbors: 281 description: Gracefully shut down all neigbors 282 type: dict 283 suboptions: 284 time: 285 description: 286 - time in seconds 287 - Please refer vendor documentation for valid values 288 type: int 289 activate: 290 description: Activate graceful shutdown of all neigbors 291 type: bool 292 vrfs: 293 description: Gracefully shut down all vrf neigbors 294 type: dict 295 suboptions: 296 time: 297 description: 298 - time in seconds 299 - Please refer vendor documentation for valid values 300 type: int 301 activate: 302 description: Activate graceful shutdown of all neigbors 303 type: bool 304 community: 305 description: 306 - Set Community for Gshut routes 307 - community number/community number in aa:nn format 308 type: str 309 local_preference: 310 description: 311 - Set Local Preference for Gshut routes 312 - Please refer vendor documentation for valid values 313 type: int 314 inject_map: 315 description: Routemap which specifies prefixes to inject 316 type: dict 317 suboptions: 318 name: 319 description: route-map name 320 type: str 321 exist_map_name: 322 description: route-map name 323 type: str 324 copy_attributes: 325 description: Copy attributes from aggregate 326 type: bool 327 listen: 328 description: Neighbor subnet range listener 329 type: dict 330 suboptions: 331 limit: 332 description: 333 - Set the max limit for the dynamic subnet range neighbors 334 - Please refer vendor documentation for valid values 335 type: int 336 range: 337 description: Subnet network range 338 type: dict 339 suboptions: 340 ipv4_with_subnet: 341 description: IPv4 subnet range(A.B.C.D/nn) 342 type: str 343 ipv6_with_subnet: 344 description: IPv6 subnet range(X:X:X:X::X/<0-128>) 345 type: str 346 peer_group: 347 description: Member of the peer-group 348 type: str 349 log_neighbor_changes: 350 description: Log neighbor up/down and reset reason 351 type: bool 352 maxas_limit: 353 description: 354 - Allow AS-PATH attribute from any neighbor imposing a limit on number of ASes 355 - Please refer vendor documentation for valid values 356 type: int 357 maxcommunity_limit: 358 description: 359 - Allow COMMUNITY attribute from any neighbor imposing a limit on number of communities 360 - Please refer vendor documentation for valid values 361 type: int 362 maxextcommunity_limit: 363 description: 364 - Allow EXTENDED COMMUNITY attribute from any neighbor imposing a limit on number of extended communities 365 - Please refer vendor documentation for valid values 366 type: int 367 nexthop: 368 description: Nexthop tracking commands 369 type: dict 370 suboptions: 371 route_map: 372 description: Route map for valid nexthops 373 type: str 374 trigger: 375 description: nexthop trackings 376 type: dict 377 suboptions: 378 delay: 379 description: 380 - Set the delay to tigger nexthop tracking 381 - Please refer vendor documentation for valid values 382 type: int 383 enable: 384 description: Enable nexthop tracking 385 type: bool 386 nopeerup_delay: 387 description: Set how long BGP will wait for the first peer to come up before beginning the update delay or 388 graceful restart timers (in seconds) 389 type: list 390 elements: dict 391 suboptions: 392 cold_boot: 393 description: 394 - How long to wait for the first peer to come up upon a cold boot 395 - Please refer vendor documentation for valid values 396 type: int 397 nsf_switchover: 398 description: 399 - How long to wait for the first peer, post NSF switchover 400 - Please refer vendor documentation for valid values 401 type: int 402 post_boot: 403 description: 404 - How long to wait for the first peer to come up once the system is already 405 booted and all peers go down 406 - Please refer vendor documentation for valid values 407 type: int 408 user_initiated: 409 description: 410 - How long to wait for the first peer, post a manual clear of BGP peers by the admin user 411 - Please refer vendor documentation for valid values 412 type: int 413 recursion: 414 description: 415 - recursion rule for the nexthops 416 - recursion via host for the nexthops 417 type: bool 418 redistribute_internal: 419 description: Allow redistribution of iBGP into IGPs (dangerous) 420 type: bool 421 refresh: 422 description: refresh 423 type: dict 424 suboptions: 425 max_eor_time: 426 description: 427 - Configure refresh max-eor time 428 - Please refer vendor documentation for valid values 429 type: int 430 stalepath_time: 431 description: 432 - Configure refresh stale-path time 433 - Please refer vendor documentation for valid values 434 type: int 435 regexp: 436 description: 437 - Select regular expression engine 438 - Enable bounded-execution-time regular expression engine 439 type: bool 440 route_map: 441 description: 442 - route-map control commands 443 - Have route-map set commands take priority over BGP commands such as next-hop unchanged 444 type: bool 445 router_id: 446 description: Override configured router identifier (peers will reset) 447 type: dict 448 suboptions: 449 address: 450 description: Manually configured router identifier(A.B.C.D) 451 type: str 452 interface: 453 description: Use IPv4 address on interface 454 type: str 455 vrf: 456 description: 457 - vrf-specific router id configuration 458 - Automatically assign per-vrf bgp router id 459 type: bool 460 scan_time: 461 description: 462 - Configure background scanner interval 463 - Please refer vendor documentation for valid values 464 type: int 465 slow_peer: 466 description: Configure slow-peer 467 type: dict 468 suboptions: 469 detection: 470 description: Slow-peer detection 471 type: dict 472 suboptions: 473 set: 474 description: Slow-peer detection 475 type: bool 476 threshold: 477 description: 478 - Set the slow-peer detection threshold 479 - Please refer vendor documentation for valid values 480 type: int 481 split_update_group: 482 description: Configure slow-peer split-update-group 483 type: dict 484 suboptions: 485 dynamic: 486 description: Dynamically split the slow peer to slow-update group 487 type: bool 488 permanent: 489 description: Keep the slow-peer permanently in slow-update group 490 type: int 491 snmp: 492 description: 493 - BGP SNMP options 494 - BGP SNMP trap options 495 - Use cbgpPeer2Type as part of index for traps 496 type: bool 497 sso: 498 description: 499 - Stateful Switchover 500 - Enable SSO only for Route-Refresh capable peers 501 type: bool 502 soft_reconfig_backup: 503 description: Use soft-reconfiguration inbound only when route-refresh is not negotiated 504 type: bool 505 suppress_inactive: 506 description: Suppress routes that are not in the routing table 507 type: bool 508 transport: 509 description: 510 - Global enable/disable transport session parameters 511 - Transport path MTU discovery 512 type: bool 513 update_delay: 514 description: 515 - Set the max initial delay for sending update 516 - Please refer vendor documentation for valid values 517 type: int 518 update_group: 519 description: 520 - Manage peers in bgp update groups 521 - Split update groups based on Policy 522 - Keep peers with as-override in different update groups 523 type: bool 524 upgrade_cli: 525 description: Upgrade to hierarchical AFI mode 526 type: dict 527 suboptions: 528 set: 529 description: enable upgrade to hierarchical AFI mode 530 type: bool 531 af_mode: 532 description: Upgrade to AFI mode 533 type: bool 534 bmp: 535 description: BGP Monitoring Protocol) 536 type: dict 537 suboptions: 538 buffer_size: 539 description: 540 - BMP Buffer Size 541 - Please refer vendor documentation for valid values 542 type: int 543 initial_refresh: 544 description: Initial Refresh options 545 type: dict 546 suboptions: 547 delay: 548 description: Delay before Initial Refresh 549 type: int 550 skip: 551 description: skip all refreshes 552 type: bool 553 server: 554 description: 555 - Server Information 556 - Please refer vendor documentation for valid values 557 type: int 558 default_information: 559 description: 560 - Control distribution of default information 561 - Distribute a default route 562 type: bool 563 default_metric: 564 description: 565 - Set metric of redistributed routes 566 - Please refer vendor documentation for valid values 567 type: int 568 distance: 569 description: Define an administrative distance 570 type: dict 571 suboptions: 572 admin: 573 description: Administrative distance 574 type: dict 575 suboptions: 576 distance: 577 description: 578 - Administrative distance 579 - Please refer vendor documentation for valid values 580 type: int 581 address: 582 description: IP Source address (A.B.C.D) 583 type: str 584 wildcard_bit: 585 description: Wildcard bits (A.B.C.D) 586 type: str 587 acl: 588 description: 589 - IP Standard access list number 590 - IP Standard expanded access list number 591 - Standard access-list name 592 type: str 593 bgp: 594 description: BGP distance 595 type: dict 596 suboptions: 597 routes_external: 598 description: 599 - Distance for routes external to the AS 600 - Please refer vendor documentation for valid values 601 type: int 602 routes_internal: 603 description: 604 - Distance for routes internal to the AS 605 - Please refer vendor documentation for valid values 606 type: int 607 routes_local: 608 description: 609 - Distance for local routes 610 - Please refer vendor documentation for valid values 611 type: int 612 mbgp: 613 description: MBGP distance 614 type: dict 615 suboptions: 616 routes_external: 617 description: 618 - Distance for routes external to the AS 619 - Please refer vendor documentation for valid values 620 type: int 621 routes_internal: 622 description: 623 - Distance for routes internal to the AS 624 - Please refer vendor documentation for valid values 625 type: int 626 routes_local: 627 description: 628 - Distance for local routes 629 - Please refer vendor documentation for valid values 630 type: int 631 distribute_list: 632 description: Filter networks in routing updates 633 type: dict 634 suboptions: 635 acl: 636 description: IP access list number/name 637 type: str 638 in: 639 description: Filter incoming routing updates 640 type: bool 641 out: 642 description: Filter outgoing routing updates 643 type: bool 644 interface: 645 description: interface details 646 type: str 647 maximum_paths: 648 description: Forward packets over multiple paths 649 type: dict 650 suboptions: 651 paths: 652 description: Number of paths 653 type: int 654 eibgp: 655 description: Both eBGP and iBGP paths as multipath 656 type: int 657 ibgp: 658 description: iBGP-multipath 659 type: int 660 maximum_secondary_paths: 661 description: Maximum secondary paths 662 type: dict 663 suboptions: 664 paths: 665 description: Number of secondary paths 666 type: int 667 eibgp: 668 description: Both eBGP and iBGP paths as secondary multipath 669 type: int 670 ibgp: 671 description: iBGP-secondary-multipath 672 type: int 673 neighbor: 674 description: Specify a neighbor router 675 type: list 676 elements: dict 677 suboptions: 678 address: 679 description: Neighbor address (A.B.C.D) 680 type: str 681 tag: 682 description: Neighbor tag 683 type: str 684 ipv6_adddress: 685 description: Neighbor ipv6 address (X:X:X:X::X) 686 type: str 687 activate: 688 description: Enable the Address Family for this Neighbor 689 type: bool 690 additional_paths: 691 description: Negotiate additional paths capabilities with this neighbor 692 type: dict 693 suboptions: 694 disable: 695 description: Disable additional paths for this neighbor 696 type: bool 697 receive: 698 description: Receive additional paths from neighbors 699 type: bool 700 send: 701 description: Send additional paths to neighbors 702 type: bool 703 advertise: 704 description: Advertise to this neighbor 705 type: dict 706 suboptions: 707 additional_paths: 708 description: Advertise additional paths 709 type: dict 710 suboptions: 711 all: 712 description: Select all available paths 713 type: bool 714 best: 715 description: Select best N paths (2-3). 716 type: int 717 group_best: 718 description: Select group-best path 719 type: bool 720 best_external: 721 description: Advertise best-external (at RRs best-internal) path 722 type: bool 723 diverse_path: 724 description: Advertise additional paths 725 type: dict 726 suboptions: 727 backup: 728 description: Diverse path can be backup path 729 type: bool 730 mpath: 731 description: Diverse path can be multipath 732 type: bool 733 advertise_map: 734 description: specify route-map for conditional advertisement 735 type: dict 736 suboptions: 737 name: 738 description: advertise route-map name 739 type: str 740 exist_map: 741 description: 742 - advertise prefix only if prefix is in the condition exists 743 - condition route-map name 744 type: str 745 non_exist_map: 746 description: 747 - advertise prefix only if prefix in the condition does not exist 748 - condition route-map name 749 type: str 750 advertisement_interval: 751 description: Minimum interval between sending BGP routing updates 752 type: int 753 aigp: 754 description: AIGP on neighbor 755 type: dict 756 suboptions: 757 enable: 758 description: Enable AIGP 759 type: bool 760 send: 761 description: Cost community or MED carrying AIGP VALUE 762 type: dict 763 suboptions: 764 cost_community: 765 description: Cost extended community carrying AIGP Value 766 type: dict 767 suboptions: 768 id: 769 description: 770 - Community ID 771 - Please refer vendor documentation for valid values 772 type: int 773 poi: 774 description: Point of Insertion 775 type: dict 776 suboptions: 777 igp_cost: 778 description: Point of Insertion After IGP 779 type: bool 780 pre_bestpath: 781 description: Point of Insertion At Beginning 782 type: bool 783 transitive: 784 description: Cost community is Transitive 785 type: bool 786 med: 787 description: Med carrying AIGP Value 788 type: bool 789 allow_policy: 790 description: Enable the policy support for this IBGP Neighbor 791 type: bool 792 allowas_in: 793 description: Accept as-path with my AS present in it 794 type: int 795 as_override: 796 description: 797 - Override matching AS-number while sending update 798 - Maintain Split Horizon while sending update 799 type: bool 800 bmp_activate: 801 description: Activate the BMP monitoring for a BGP peer 802 type: dict 803 suboptions: 804 all: 805 description: Activate BMP monitoring for all servers 806 type: bool 807 server: 808 description: 809 - Activate BMP for server 810 - BMP Server Number 811 - Please refer vendor documentation for valid values 812 type: int 813 capability: 814 description: 815 - Advertise capability to the peer 816 - Advertise ORF capability to the peer 817 - Advertise prefixlist ORF capability to this neighbor 818 type: dict 819 suboptions: 820 both: 821 description: Capability to SEND and RECEIVE the ORF to/from this neighbor 822 type: bool 823 receive: 824 description: Capability to RECEIVE the ORF from this neighbor 825 type: bool 826 send: 827 description: Capability to SEND the ORF to this neighbor 828 type: bool 829 cluster_id: 830 description: 831 - Configure Route-Reflector Cluster-id (peers may reset) 832 - Route-Reflector Cluster-id as 32 bit quantity, or 833 Route-Reflector Cluster-id in IP address format (A.B.C.D) 834 type: str 835 default_originate: 836 description: Originate default route to this neighbor 837 type: dict 838 suboptions: 839 set: 840 description: Originate default route to this neighbor 841 type: bool 842 route_map: 843 description: Route-map to specify criteria to originate default 844 type: str 845 description: 846 description: Neighbor specific description 847 type: str 848 disable_connected_check: 849 description: one-hop away EBGP peer using loopback address 850 type: bool 851 distribute_list: 852 description: Filter updates to/from this neighbor 853 type: dict 854 suboptions: 855 acl: 856 description: IP access list number/name 857 type: str 858 in: 859 description: Filter incoming updates 860 type: bool 861 out: 862 description: Filter outgoing updates 863 type: bool 864 dmzlink_bw: 865 description: Propagate the DMZ link bandwidth 866 type: bool 867 ebgp_multihop: 868 description: Allow EBGP neighbors not on directly connected networks 869 type: dict 870 suboptions: 871 enable: 872 description: Allow EBGP neighbors not on directly connected networks 873 type: bool 874 hop_count: 875 description: 876 - Maximum hop count 877 - Please refer vendor documentation for valid values 878 type: int 879 fall_over: 880 description: Session fall on peer route lost 881 type: dict 882 suboptions: 883 bfd: 884 description: Use BFD to detect failure 885 type: dict 886 suboptions: 887 set: 888 description: set bfd 889 type: bool 890 multi_hop: 891 description: Force BFD multi-hop to detect failure 892 type: bool 893 single_hop: 894 description: Force BFD single-hop to detect failure 895 type: bool 896 route_map: 897 description: Route map for peer route 898 type: str 899 filter_list: 900 description: Establish BGP filters 901 type: dict 902 suboptions: 903 path_acl: 904 description: AS path access list 905 type: str 906 in: 907 description: Filter incoming updates 908 type: bool 909 out: 910 description: Filter outgoing updates 911 type: bool 912 ha_mode: 913 description: high availability mode 914 type: dict 915 suboptions: 916 set: 917 description: set ha-mode and graceful-restart for this peer 918 type: bool 919 disable: 920 description: disable graceful-restart 921 type: bool 922 inherit: 923 description: 924 - Inherit a template 925 - Inherit a peer-session template and Template name 926 type: str 927 local_as: 928 description: Specify a local-as number 929 type: dict 930 suboptions: 931 set: 932 description: set local-as number 933 type: bool 934 number: 935 description: 936 - AS number used as local AS 937 - Please refer vendor documentation for valid values 938 type: int 939 dual_as: 940 description: Accept either real AS or local AS from the ebgp peer 941 type: bool 942 no_prepend: 943 description: Do not prepend local-as to updates from ebgp peers 944 type: dict 945 suboptions: 946 set: 947 description: Set prepend 948 type: bool 949 replace_as: 950 description: Replace real AS with local AS in the EBGP updates 951 type: bool 952 log_neighbor_changes: 953 description: Log neighbor up/down and reset reason 954 type: dict 955 suboptions: 956 set: 957 description: set Log neighbor up/down and reset 958 type: bool 959 disable: 960 description: disable Log neighbor up/down and reset 961 type: bool 962 maximum_prefix: 963 description: Maximum number of prefixes accepted from this peer 964 type: dict 965 suboptions: 966 max_no: 967 description: maximum no. of prefix limit 968 type: int 969 threshold_val: 970 description: Threshold value (%) at which to generate a warning msg 971 type: int 972 restart: 973 description: Restart bgp connection after limit is exceeded 974 type: int 975 warning_only: 976 description: Only give warning message when limit is exceeded 977 type: bool 978 next_hop_self: 979 description: Disable the next hop calculation for this neighbor 980 type: dict 981 suboptions: 982 set: 983 description: Enable next-hop-self 984 type: bool 985 all: 986 description: Enable next-hop-self for both eBGP and iBGP received paths 987 type: bool 988 next_hop_unchanged: 989 description: 990 - Propagate next hop unchanged for iBGP paths to this neighbor 991 - Propagate next hop unchanged for all paths (iBGP and eBGP) to this neighbor 992 type: dict 993 suboptions: 994 set: 995 description: Enable next-hop-unchanged 996 type: bool 997 allpaths: 998 description: Propagate next hop unchanged for all paths (iBGP and eBGP) to this neighbor 999 type: bool 1000 password: 1001 description: Set a password 1002 type: str 1003 path_attribute: 1004 description: BGP optional attribute filtering 1005 type: dict 1006 suboptions: 1007 discard: 1008 description: Discard matching path-attribute for this neighbor 1009 type: dict 1010 suboptions: 1011 type: 1012 description: 1013 - path attribute type 1014 - Please refer vendor documentation for valid values 1015 type: int 1016 range: 1017 description: path attribute range 1018 type: dict 1019 suboptions: 1020 start: 1021 description: 1022 - path attribute range start value 1023 - Please refer vendor documentation for valid values 1024 type: int 1025 end: 1026 description: 1027 - path attribute range end value 1028 - Please refer vendor documentation for valid values 1029 type: int 1030 in: 1031 description: Perform inbound path-attribute filtering 1032 type: bool 1033 treat_as_withdraw: 1034 description: Treat-as-withdraw matching path-attribute for this neighbor 1035 type: dict 1036 suboptions: 1037 type: 1038 description: 1039 - path attribute type 1040 - Please refer vendor documentation for valid values 1041 type: int 1042 range: 1043 description: path attribute range 1044 type: dict 1045 suboptions: 1046 start: 1047 description: 1048 - path attribute range start value 1049 - Please refer vendor documentation for valid values 1050 type: int 1051 end: 1052 description: 1053 - path attribute range end value 1054 - Please refer vendor documentation for valid values 1055 type: int 1056 in: 1057 description: Perform inbound path-attribute filtering 1058 type: bool 1059 peer_group: 1060 description: Member of the peer-group 1061 type: str 1062 remote_as: 1063 description: 1064 - Specify a BGP neighbor 1065 - AS of remote neighbor 1066 type: int 1067 remove_private_as: 1068 description: Remove private AS number from outbound updates 1069 type: dict 1070 suboptions: 1071 set: 1072 description: Remove private AS number 1073 type: bool 1074 all: 1075 description: Remove all private AS numbers 1076 type: bool 1077 replace_as: 1078 description: Replace all private AS numbers with local AS 1079 type: bool 1080 route_map: 1081 description: Apply route map to neighbor 1082 type: dict 1083 suboptions: 1084 name: 1085 description: Replace all private AS numbers with local AS 1086 type: str 1087 in: 1088 description: Apply map to incoming routes 1089 type: bool 1090 out: 1091 description: Apply map to outbound routes 1092 type: bool 1093 route_reflector_client: 1094 description: Configure a neighbor as Route Reflector client 1095 type: bool 1096 route_server_client: 1097 description: Configure a neighbor as Route Server client 1098 type: dict 1099 suboptions: 1100 set: 1101 description: Set Route Server client 1102 type: bool 1103 context: 1104 description: 1105 - Specify Route Server context for neighbor 1106 - Route Server context name 1107 type: str 1108 send_community: 1109 description: Send Community attribute to this neighbor 1110 type: dict 1111 suboptions: 1112 set: 1113 description: Set send Community attribute to this neighbor 1114 type: bool 1115 both: 1116 description: Send Standard and Extended Community attributes 1117 type: bool 1118 extended: 1119 description: Send Extended Community attribute 1120 type: bool 1121 standard: 1122 description: Send Standard Community attribute 1123 type: bool 1124 send_label: 1125 description: Send NLRI + MPLS Label to this peer 1126 type: dict 1127 suboptions: 1128 set: 1129 description: Set send NLRI + MPLS Label to this peer 1130 type: bool 1131 explicit_null: 1132 description: Advertise Explicit Null label in place of Implicit Null 1133 type: bool 1134 shutdown: 1135 description: Administratively shut down this neighbor 1136 type: dict 1137 suboptions: 1138 set: 1139 description: shut down 1140 type: bool 1141 graceful: 1142 description: 1143 - Gracefully shut down this neighbor 1144 - time in seconds 1145 - Please refer vendor documentation for valid values 1146 type: int 1147 slow_peer: 1148 description: Configure slow-peer 1149 type: dict 1150 suboptions: 1151 detection: 1152 description: Configure slow-peer 1153 type: dict 1154 suboptions: 1155 enable: 1156 description: Enable slow-peer detection 1157 type: bool 1158 disable: 1159 description: Disable slow-peer detection 1160 type: bool 1161 threshold: 1162 description: Set the slow-peer detection threshold 1163 type: int 1164 split_update_group: 1165 description: Configure slow-peer split-update-group 1166 type: dict 1167 suboptions: 1168 dynamic: 1169 description: Dynamically split the slow peer to slow-update group 1170 type: dict 1171 suboptions: 1172 enable: 1173 description: Enable slow-peer detection 1174 type: bool 1175 disable: 1176 description: Disable slow-peer detection 1177 type: bool 1178 permanent: 1179 description: Keep the slow-peer permanently in slow-update group 1180 type: bool 1181 static: 1182 description: Static slow-peer 1183 type: bool 1184 soft_reconfiguration: 1185 description: 1186 - Per neighbor soft reconfiguration 1187 - Allow inbound soft reconfiguration for this neighbor 1188 type: bool 1189 timers: 1190 description: BGP per neighbor timers 1191 type: dict 1192 suboptions: 1193 interval: 1194 description: Keepalive interval 1195 type: int 1196 holdtime: 1197 description: Holdtime 1198 type: int 1199 min_holdtime: 1200 description: Minimum hold time from neighbor 1201 type: int 1202 translate_update: 1203 description: Translate Update to MBGP format 1204 type: dict 1205 suboptions: 1206 set: 1207 description: Set Translate Update 1208 type: bool 1209 nlri: 1210 description: Specify type of nlri to translate to 1211 type: dict 1212 suboptions: 1213 multicast: 1214 description: Translate Update to multicast nlri 1215 type: bool 1216 unicast: 1217 description: Process Update as unicast nlri 1218 type: bool 1219 transport: 1220 description: Transport options 1221 type: dict 1222 suboptions: 1223 connection_mode: 1224 description: Specify passive or active connection 1225 type: dict 1226 suboptions: 1227 active: 1228 description: Actively establish the TCP session 1229 type: bool 1230 passive: 1231 description: Passively establish the TCP session 1232 type: bool 1233 multi_session: 1234 description: Use Multi-session for transport 1235 type: bool 1236 path_mtu_discovery: 1237 description: Use transport path MTU discovery 1238 type: dict 1239 suboptions: 1240 set: 1241 description: Use path MTU discovery 1242 type: bool 1243 disable: 1244 description: disable 1245 type: bool 1246 ttl_security: 1247 description: 1248 - BGP ttl security check 1249 - maximum number of hops 1250 - Please refer vendor documentation for valid values 1251 type: int 1252 unsuppress_map: 1253 description: 1254 - Route-map to selectively unsuppress suppressed routes 1255 - Name of route map 1256 type: str 1257 version: 1258 description: 1259 - Set the BGP version to match a neighbor 1260 - Neighbor's BGP version 1261 - Please refer vendor documentation for valid values 1262 type: int 1263 weight: 1264 description: Set default weight for routes from this neighbor 1265 type: int 1266 redistribute: 1267 description: Redistribute information from another routing protocol 1268 type: list 1269 elements: dict 1270 suboptions: 1271 application: 1272 description: Application 1273 type: dict 1274 suboptions: 1275 name: 1276 description: Application name 1277 type: str 1278 metric: 1279 description: Metric for redistributed routes 1280 type: int 1281 route_map: 1282 description: Route map reference 1283 type: str 1284 bgp: 1285 description: Border Gateway Protocol (BGP) 1286 type: dict 1287 suboptions: 1288 as_number: 1289 description: Autonomous system number 1290 type: str 1291 metric: 1292 description: Metric for redistributed routes 1293 type: int 1294 route_map: 1295 description: Route map reference 1296 type: str 1297 connected: 1298 description: Connected 1299 type: dict 1300 suboptions: 1301 metric: 1302 description: Metric for redistributed routes 1303 type: int 1304 route_map: 1305 description: Route map reference 1306 type: str 1307 eigrp: 1308 description: Enhanced Interior Gateway Routing Protocol (EIGRP) 1309 type: dict 1310 suboptions: 1311 as_number: 1312 description: Autonomous system number 1313 type: str 1314 metric: 1315 description: Metric for redistributed routes 1316 type: int 1317 route_map: 1318 description: Route map reference 1319 type: str 1320 isis: 1321 description: ISO IS-IS 1322 type: dict 1323 suboptions: 1324 area_tag: 1325 description: ISO routing area tag 1326 type: str 1327 clns: 1328 description: Redistribution of OSI dynamic routes 1329 type: bool 1330 ip: 1331 description: Redistribution of IP dynamic routes 1332 type: bool 1333 metric: 1334 description: Metric for redistributed routes 1335 type: int 1336 route_map: 1337 description: Route map reference 1338 type: str 1339 iso_igrp: 1340 description: IGRP for OSI networks 1341 type: dict 1342 suboptions: 1343 area_tag: 1344 description: ISO routing area tag 1345 type: str 1346 route_map: 1347 description: Route map reference 1348 type: str 1349 lisp: 1350 description: Locator ID Separation Protocol (LISP) 1351 type: dict 1352 suboptions: 1353 metric: 1354 description: Metric for redistributed routes 1355 type: int 1356 route_map: 1357 description: Route map reference 1358 type: str 1359 mobile: 1360 description: Mobile routes 1361 type: dict 1362 suboptions: 1363 metric: 1364 description: Metric for redistributed routes 1365 type: int 1366 route_map: 1367 description: Route map reference 1368 type: str 1369 odr: 1370 description: On Demand stub Routes 1371 type: dict 1372 suboptions: 1373 metric: 1374 description: Metric for redistributed routes 1375 type: int 1376 route_map: 1377 description: Route map reference 1378 type: str 1379 ospf: 1380 description: Open Shortest Path First (OSPF) 1381 type: dict 1382 suboptions: 1383 process_id: 1384 description: Process ID 1385 type: int 1386 match: 1387 description: On Demand stub Routes 1388 type: dict 1389 suboptions: 1390 external: 1391 description: Redistribute OSPF external routes 1392 type: bool 1393 internal: 1394 description: Redistribute OSPF internal routes 1395 type: bool 1396 nssa_external: 1397 description: Redistribute OSPF NSSA external routes 1398 type: bool 1399 type_1: 1400 description: Redistribute NSSA external type 1 routes 1401 type: bool 1402 type_2: 1403 description: Redistribute NSSA external type 2 routes 1404 type: bool 1405 metric: 1406 description: Metric for redistributed routes 1407 type: int 1408 route_map: 1409 description: Route map reference 1410 type: str 1411 vrf: 1412 description: VPN Routing/Forwarding Instance 1413 type: str 1414 ospfv3: 1415 description: OSPFv3 1416 type: dict 1417 suboptions: 1418 process_id: 1419 description: Process ID 1420 type: int 1421 match: 1422 description: On Demand stub Routes 1423 type: dict 1424 suboptions: 1425 external: 1426 description: Redistribute OSPF external routes 1427 type: bool 1428 internal: 1429 description: Redistribute OSPF internal routes 1430 type: bool 1431 nssa_external: 1432 description: Redistribute OSPF NSSA external routes 1433 type: bool 1434 type_1: 1435 description: Redistribute NSSA external type 1 routes 1436 type: bool 1437 type_2: 1438 description: Redistribute NSSA external type 2 routes 1439 type: bool 1440 metric: 1441 description: Metric for redistributed routes 1442 type: int 1443 route_map: 1444 description: Route map reference 1445 type: str 1446 rip: 1447 description: Routing Information Protocol (RIP) 1448 type: dict 1449 suboptions: 1450 metric: 1451 description: Metric for redistributed routes 1452 type: int 1453 route_map: 1454 description: Route map reference 1455 type: str 1456 static: 1457 description: Static routes 1458 type: dict 1459 suboptions: 1460 clns: 1461 description: Redistribution of OSI static routes 1462 type: bool 1463 ip: 1464 description: Redistribution of IP static routes 1465 type: bool 1466 metric: 1467 description: Metric for redistributed routes 1468 type: int 1469 route_map: 1470 description: Route map reference 1471 type: str 1472 vrf: 1473 description: Specify a source VRF 1474 type: dict 1475 suboptions: 1476 name: 1477 description: Source VRF name 1478 type: str 1479 global: 1480 description: global VRF 1481 type: bool 1482 route_server_context: 1483 description: Enter route server context command mode 1484 type: dict 1485 suboptions: 1486 name: 1487 description: Name of route server context 1488 type: str 1489 address_family: 1490 description: Enter address family command mode 1491 type: dict 1492 suboptions: 1493 afi: 1494 description: Address family 1495 type: str 1496 choices: ['ipv4', 'ipv6'] 1497 modifier: 1498 description: Address Family modifier 1499 type: str 1500 choices: ['multicast', 'unicast'] 1501 import_map: 1502 description: 1503 - Import matching routes using a route map 1504 - Name of route map 1505 type: str 1506 description: 1507 description: Textual description of the router server context 1508 type: str 1509 scope: 1510 description: Enter scope command mode 1511 type: dict 1512 suboptions: 1513 global: 1514 description: Global scope 1515 type: bool 1516 vrf: 1517 description: 1518 - VRF scope 1519 - VPN Routing/Forwarding instance name 1520 type: str 1521 synchronization: 1522 description: Perform IGP synchronization 1523 type: bool 1524 table_map: 1525 description: Map external entry attributes into routing table 1526 type: dict 1527 suboptions: 1528 name: 1529 description: route-map name 1530 type: str 1531 filter: 1532 description: Selective route download 1533 type: bool 1534 template: 1535 description: Enter template command mode 1536 type: dict 1537 suboptions: 1538 peer_policy: 1539 description: Template configuration for policy parameters 1540 type: str 1541 peer_session: 1542 description: Template configuration for session parameters 1543 type: str 1544 timers: 1545 description: 1546 - Adjust routing timers 1547 - BGP timers 1548 type: dict 1549 suboptions: 1550 keepalive: 1551 description: Keepalive interval 1552 type: int 1553 holdtime: 1554 description: Holdtime 1555 type: int 1556 min_holdtime: 1557 description: Minimum hold time from neighbor 1558 type: int 1559 running_config: 1560 description: 1561 - This option is used only with state I(parsed). 1562 - The value of this option should be the output received from the IOS 1563 device by executing the command B(sh running-config | section ^router bgp). 1564 - The state I(parsed) reads the configuration from C(running_config) 1565 option and transforms it into Ansible structured data as per the 1566 resource module's argspec and the value is then returned in the 1567 I(parsed) key within the result. 1568 type: str 1569 state: 1570 choices: 1571 - merged 1572 - replaced 1573 - deleted 1574 - purged 1575 - gathered 1576 - rendered 1577 - parsed 1578 default: merged 1579 description: 1580 - The state the configuration should be left in 1581 - The states I(rendered), I(gathered) and I(parsed) does not perform any change 1582 on the device. 1583 - The state I(rendered) will transform the configuration in C(config) option to 1584 platform specific CLI commands which will be returned in the I(rendered) key 1585 within the result. For state I(rendered) active connection to remote host is 1586 not required. 1587 - The state I(gathered) will fetch the running configuration from device and transform 1588 it into structured data in the format as per the resource module argspec and 1589 the value is returned in the I(gathered) key within the result. 1590 - The state I(parsed) reads the configuration from C(running_config) option and 1591 transforms it into JSON format as per the resource module parameters and the 1592 value is returned in the I(parsed) key within the result. The value of C(running_config) 1593 option should be the same format as the output of command I(show running-config 1594 | include ip route|ipv6 route) executed on device. For state I(parsed) active 1595 connection to remote host is not required. 1596 type: str 1597""" 1598EXAMPLES = """ 1599# Using merged 1600 1601# Before state: 1602# ------------- 1603# 1604# vios#sh running-config | section ^router bgp 1605 1606- name: Merge provided configuration with device configuration 1607 cisco.ios.ios_bgp_global: 1608 config: 1609 as_number: 65000 1610 bgp: 1611 advertise_best_external: true 1612 bestpath: 1613 - compare_routerid: true 1614 nopeerup_delay: 1615 - post_boot: 10 1616 dampening: 1617 penalty_half_time: 1 1618 reuse_route_val: 1 1619 suppress_route_val: 1 1620 max_suppress: 1 1621 graceful_shutdown: 1622 neighbors: 1623 time: 50 1624 community: 100 1625 local_preference: 100 1626 neighbor: 1627 - address: 198.51.100.1 1628 description: merge neighbor 1629 remote_as: 100 1630 aigp: 1631 send: 1632 cost_community: 1633 id: 100 1634 poi: 1635 igp_cost: true 1636 transitive: true 1637 route_map: 1638 name: test-route 1639 out: true 1640 state: merged 1641 1642# Commands fired: 1643# --------------- 1644# 1645# "commands": [ 1646# "router bgp 65000", 1647# "bgp dampening 1 1 1 1", 1648# "bgp graceful-shutdown all neighbors 50 community 100 local-preference 100", 1649# "bgp advertise-best-external", 1650# "bgp nopeerup-delay post-boot 10", 1651# "bgp bestpath compare-routerid", 1652# "neighbor 198.51.100.1 remote-as 100", 1653# "neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive", 1654# "neighbor 198.51.100.1 description merge neighbor", 1655# "neighbor 198.51.100.1 route-map test-route out" 1656# ] 1657 1658# After state: 1659# ------------ 1660# 1661# vios#sh running-config | section ^router bgp 1662# router bgp 65000 1663# bgp nopeerup-delay post-boot 10 1664# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 1665# bgp bestpath compare-routerid 1666# bgp dampening 1 1 1 1 1667# bgp advertise-best-external 1668# neighbor 198.51.100.1 remote-as 100 1669# neighbor 198.51.100.1 description merge neighbor 1670# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 1671# neighbor 198.51.100.1 route-map test-route out 1672 1673 1674# Using replaced 1675 1676# Before state: 1677# ------------- 1678# 1679# vios#sh running-config | section ^router bgp 1680# router bgp 65000 1681# bgp nopeerup-delay post-boot 10 1682# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 1683# bgp bestpath compare-routerid 1684# bgp dampening 1 1 1 1 1685# bgp advertise-best-external 1686# neighbor 198.51.100.1 remote-as 100 1687# neighbor 198.51.100.1 description merge neighbor 1688# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 1689# neighbor 198.51.100.1 route-map test-route out 1690 1691 1692- name: Replaces device configuration of listed global BGP with provided configuration 1693 cisco.ios.ios_bgp_global: 1694 config: 1695 as_number: 65000 1696 bgp: 1697 advertise_best_external: true 1698 bestpath: 1699 - med: 1700 confed: true 1701 log_neighbor_changes: true 1702 nopeerup_delay: 1703 - post_boot: 10 1704 cold_boot: 20 1705 neighbor: 1706 - address: 192.0.2.1 1707 description: replace neighbor 1708 remote_as: 100 1709 slow_peer: 1710 detection: 1711 disable: true 1712 state: replaced 1713 1714# Commands fired: 1715# --------------- 1716# 1717# "commands": [ 1718# "router bgp 65000" 1719# "no bgp dampening 1 1 1 1" 1720# "no timers bgp 100 200 150" 1721# "no bgp bestpath compare-routerid" 1722# "bgp bestpath med confed" 1723# "bgp nopeerup-delay cold-boot 20" 1724# "no neighbor 198.51.100.1 remote-as 100" 1725# "neighbor 192.0.2.1 remote-as 100" 1726# "no bgp graceful-shutdown all neighbors 50 local-preference 100 community 100" 1727# "no neighbor 198.51.100.1 route-map test-route out" 1728# "no neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive" 1729# "no neighbor 198.51.100.1 description merge neighbor" 1730# "neighbor 192.0.2.1 slow-peer detection disable" 1731# "neighbor 192.0.2.1 description replace neighbor" 1732# ] 1733 1734 1735# After state: 1736# ------------- 1737# 1738# vios#sh running-config | section ^router bgp 1739# router bgp 65000 1740# bgp log-neighbor-changes 1741# bgp nopeerup-delay cold-boot 20 1742# bgp nopeerup-delay post-boot 10 1743# bgp bestpath med confed 1744# bgp advertise-best-external 1745# redistribute connected metric 10 1746# neighbor 192.0.2.1 remote-as 100 1747# neighbor 192.0.2.1 description replace neighbor 1748# neighbor 192.0.2.1 slow-peer detection disable 1749 1750# Using Deleted 1751 1752# Before state: 1753# ------------- 1754# 1755# vios#sh running-config | section ^router bgp 1756# router bgp 65000 1757# bgp nopeerup-delay post-boot 10 1758# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 1759# bgp bestpath compare-routerid 1760# bgp dampening 1 1 1 1 1761# bgp advertise-best-external 1762# neighbor 198.51.100.1 remote-as 100 1763# neighbor 198.51.100.1 description merge neighbor 1764# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 1765# neighbor 198.51.100.1 route-map test-route out 1766 1767- name: "Delete global BGP (Note: This won't delete the configured global BGP)" 1768 cisco.ios.ios_bgp_global: 1769 config: 1770 as_number: 65000 1771 state: deleted 1772 1773# Commands fired: 1774# --------------- 1775# "commands": [ 1776# "router bgp 65000", 1777# "no bgp dampening 1 1 1 1", 1778# "no bgp graceful-shutdown all neighbors 50 community 100 local-preference 100", 1779# "no bgp advertise-best-external", 1780# "no bgp bestpath compare-routerid", 1781# "no bgp nopeerup-delay post-boot 10", 1782# "no neighbor 198.51.100.1 remote-as 100", 1783# "no neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive", 1784# "no neighbor 198.51.100.1 description merge neighbor", 1785# "no neighbor 198.51.100.1 route-map test-route out" 1786# ] 1787 1788 1789# After state: 1790# ------------- 1791# 1792# vios#sh running-config | section ^router bgp 1793# router bgp 65000 1794 1795 1796# Using Deleted without any config passed 1797#"(NOTE: This will delete all of configured global BGP)" 1798 1799# Before state: 1800# ------------- 1801# 1802# vios#sh running-config | section ^router bgp 1803# router bgp 65000 1804# bgp nopeerup-delay post-boot 10 1805# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 1806# bgp bestpath compare-routerid 1807# bgp dampening 1 1 1 1 1808# bgp advertise-best-external 1809# neighbor 198.51.100.1 remote-as 100 1810# neighbor 198.51.100.1 description merge neighbor 1811# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 1812# neighbor 198.51.100.1 route-map test-route out 1813 1814 1815- name: "Delete global BGP without config" 1816 cisco.ios.ios_bgp_global: 1817 state: deleted 1818 1819# Commands fired: 1820# --------------- 1821# "commands": [ 1822# "router bgp 65000", 1823# "no bgp dampening 1 1 1 1", 1824# "no bgp graceful-shutdown all neighbors 50 community 100 local-preference 100", 1825# "no bgp advertise-best-external", 1826# "no bgp bestpath compare-routerid", 1827# "no bgp nopeerup-delay post-boot 10", 1828# "no neighbor 198.51.100.1 remote-as 100", 1829# "no neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive", 1830# "no neighbor 198.51.100.1 description merge neighbor", 1831# "no neighbor 198.51.100.1 route-map test-route out" 1832# ] 1833 1834 1835# After state: 1836# ------------- 1837# 1838# vios#sh running-config | section ^router bgp 1839# router bgp 65000 1840 1841# Using Purged 1842#"(NOTE: This WILL delete the configured global BGP)" 1843 1844# Before state: 1845# ------------- 1846# 1847# vios#sh running-config | section ^router bgp 1848# router bgp 65000 1849# bgp nopeerup-delay post-boot 10 1850# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 1851# bgp bestpath compare-routerid 1852# bgp dampening 1 1 1 1 1853# bgp advertise-best-external 1854# neighbor 198.51.100.1 remote-as 100 1855# neighbor 198.51.100.1 description merge neighbor 1856# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 1857# neighbor 198.51.100.1 route-map test-route out 1858 1859 1860- name: 'Delete the configured global BGP (Note: This WILL delete the the configured 1861 global BGP)' 1862 cisco.ios.ios_bgp_global: 1863 state: purged 1864 1865# Commands fired: 1866# --------------- 1867# "commands": [ 1868# "no router bgp 65000", 1869# ] 1870 1871# After state: 1872# ------------- 1873# 1874# vios#sh running-config | section ^router bgp 1875 1876# Using Gathered 1877 1878# Before state: 1879# ------------- 1880# 1881# vios#sh running-config | section ^router bgp 1882# router bgp 65000 1883# bgp nopeerup-delay post-boot 10 1884# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 1885# bgp bestpath compare-routerid 1886# bgp dampening 1 1 1 1 1887# bgp advertise-best-external 1888# neighbor 198.51.100.1 remote-as 100 1889# neighbor 198.51.100.1 description merge neighbor 1890# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 1891# neighbor 198.51.100.1 route-map test-route out 1892 1893 1894- name: Gather listed global BGP with provided configurations 1895 cisco.ios.ios_bgp_global: 1896 config: 1897 state: gathered 1898 1899# Module Execution Result: 1900# ------------------------ 1901# 1902# "gathered": { 1903# "as_number": "65000", 1904# "bgp": { 1905# "advertise_best_external": true, 1906# "bestpath": [ 1907# { 1908# "compare_routerid": true 1909# } 1910# ], 1911# "dampening": { 1912# "max_suppress": 1, 1913# "penalty_half_time": 1, 1914# "reuse_route_val": 1, 1915# "suppress_route_val": 1 1916# }, 1917# "graceful_shutdown": { 1918# "community": "100", 1919# "local_preference": 100, 1920# "neighbors": { 1921# "time": 50 1922# } 1923# }, 1924# "nopeerup_delay": [ 1925# { 1926# "post_boot": 10 1927# } 1928# ] 1929# }, 1930# "neighbor": [ 1931# { 1932# "address": "198.51.100.1", 1933# "aigp": { 1934# "send": { 1935# "cost_community": { 1936# "id": 100, 1937# "poi": { 1938# "igp_cost": true, 1939# "transitive": true 1940# } 1941# } 1942# } 1943# }, 1944# "description": "merge neighbor", 1945# "remote_as": 100, 1946# "route_map": { 1947# "name": "test-route", 1948# "out": true 1949# } 1950# } 1951# ] 1952# } 1953 1954# Using Rendered 1955 1956- name: Rendered the provided configuration with the existing running configuration 1957 cisco.ios.ios_bgp_global: 1958 config: 1959 as_number: 65000 1960 bgp: 1961 advertise_best_external: true 1962 bestpath: 1963 - compare_routerid: true 1964 nopeerup_delay: 1965 - post_boot: 10 1966 dampening: 1967 penalty_half_time: 1 1968 reuse_route_val: 1 1969 suppress_route_val: 1 1970 max_suppress: 1 1971 graceful_shutdown: 1972 neighbors: 1973 time: 50 1974 community: 100 1975 local_preference: 100 1976 neighbor: 1977 - address: 198.51.100.1 1978 description: merge neighbor 1979 remote_as: 100 1980 aigp: 1981 send: 1982 cost_community: 1983 id: 100 1984 poi: 1985 igp_cost: true 1986 transitive: true 1987 route_map: 1988 name: test-route 1989 out: true 1990 state: rendered 1991 1992# Module Execution Result: 1993# ------------------------ 1994# 1995# "rendered": [ 1996# "router bgp 65000", 1997# "bgp dampening 1 1 1 1", 1998# "bgp graceful-shutdown all neighbors 50 community 100 local-preference 100", 1999# "bgp advertise-best-external", 2000# "bgp nopeerup-delay post-boot 10", 2001# "bgp bestpath compare-routerid", 2002# "neighbor 198.51.100.1 remote-as 100", 2003# "neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive", 2004# "neighbor 198.51.100.1 description merge neighbor", 2005# "neighbor 198.51.100.1 route-map test-route out" 2006# ] 2007 2008# Using Parsed 2009 2010# File: parsed.cfg 2011# ---------------- 2012# 2013# router bgp 65000 2014# bgp nopeerup-delay post-boot 10 2015# bgp graceful-shutdown all neighbors 50 local-preference 100 community 100 2016# bgp bestpath compare-routerid 2017# bgp dampening 1 1 1 1 2018# bgp advertise-best-external 2019# neighbor 198.51.100.1 remote-as 100 2020# neighbor 198.51.100.1 description merge neighbor 2021# neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive 2022# neighbor 198.51.100.1 route-map test-route out 2023 2024- name: Parse the commands for provided configuration 2025 cisco.ios.ios_bgp_global: 2026 running_config: "{{ lookup('file', 'parsed.cfg') }}" 2027 state: parsed 2028 2029# Module Execution Result: 2030# ------------------------ 2031# 2032# "parsed": { 2033# "as_number": "65000", 2034# "bgp": { 2035# "advertise_best_external": true, 2036# "bestpath": [ 2037# { 2038# "compare_routerid": true 2039# } 2040# ], 2041# "dampening": { 2042# "max_suppress": 1, 2043# "penalty_half_time": 1, 2044# "reuse_route_val": 1, 2045# "suppress_route_val": 1 2046# }, 2047# "graceful_shutdown": { 2048# "community": "100", 2049# "local_preference": 100, 2050# "neighbors": { 2051# "time": 50 2052# } 2053# }, 2054# "nopeerup_delay": [ 2055# { 2056# "post_boot": 10 2057# } 2058# ] 2059# }, 2060# "neighbor": [ 2061# { 2062# "address": "198.51.100.1", 2063# "aigp": { 2064# "send": { 2065# "cost_community": { 2066# "id": 100, 2067# "poi": { 2068# "igp_cost": true, 2069# "transitive": true 2070# } 2071# } 2072# } 2073# }, 2074# "description": "merge neighbor", 2075# "remote_as": 100, 2076# "route_map": { 2077# "name": "test-route", 2078# "out": true 2079# } 2080# } 2081# ] 2082# } 2083 2084""" 2085 2086RETURN = """ 2087before: 2088 description: The configuration as structured data prior to module invocation. 2089 returned: always 2090 type: list 2091 sample: The configuration returned will always be in the same format of the parameters above. 2092after: 2093 description: The configuration as structured data after module completion. 2094 returned: when changed 2095 type: list 2096 sample: The configuration returned will always be in the same format of the parameters above. 2097commands: 2098 description: The set of commands pushed to the remote device 2099 returned: always 2100 type: list 2101 sample: ["router bgp 65000", "bgp nopeerup-delay post-boot 10", "bgp advertise-best-external"] 2102""" 2103 2104from ansible.module_utils.basic import AnsibleModule 2105from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.bgp_global.bgp_global import ( 2106 Bgp_globalArgs, 2107) 2108from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.bgp_global.bgp_global import ( 2109 Bgp_global, 2110) 2111 2112 2113def main(): 2114 """ 2115 Main entry point for module execution 2116 2117 :returns: the result form module invocation 2118 """ 2119 required_if = [ 2120 ("state", "merged", ("config",)), 2121 ("state", "replaced", ("config",)), 2122 ("state", "overridden", ("config",)), 2123 ("state", "rendered", ("config",)), 2124 ("state", "parsed", ("running_config",)), 2125 ] 2126 mutually_exclusive = [("config", "running_config")] 2127 module = AnsibleModule( 2128 argument_spec=Bgp_globalArgs.argument_spec, 2129 required_if=required_if, 2130 mutually_exclusive=mutually_exclusive, 2131 supports_check_mode=True, 2132 ) 2133 result = Bgp_global(module).execute_module() 2134 module.exit_json(**result) 2135 2136 2137if __name__ == "__main__": 2138 main() 2139