Skip to content

eos_bgp_global

Collection Note

This module is part of the arista.eos collection. To install the collection, use:

ansible-galaxy collection install arista.eos
Added in version 1.4.0.

Synopsis

  • This module configures and manages the attributes of BGP global on Arista EOS platforms.

Parameters

Parameter Defaults / Choices Comments
config
dict
A list of configurations for BGP global.
config.access_group ip/ipv6 access list configuration.
config.aggregate_address Configure aggregate address.
config.as_number Autonomous system number.
config.bgp_params BGP parameters.
config.default_metric Default metric.
config.distance Define an administrative distance.
config.graceful_restart Enable graceful restart mode.
config.graceful_restart_helper Enable graceful restart helper mode.
config.maximum_paths Maximum number of equal cost paths.
config.monitoring BGP monitoring protocol configuration.
config.neighbor Configure routing for a network.
config.network Configure routing for a network.
config.redistribute Redistribute routes in to BGP.
config.route_target Route target.
config.router_id Router id.
config.shutdown When true, shut down BGP.
config.timers Timers.
config.ucmp Configure unequal cost multipathing.
config.update Configure BGP update generation.
config.vlan Configure MAC VRF BGP for single VLAN support.
config.vlan_aware_bundle Configure MAC VRF BGP for multiple VLAN support.
config.vrfs Configure BGP in a VRF.
running_config
str
This option is used only with state I(parsed).
The value of this option should be the output received from the EOS device by executing the command B(show running-config | section bgp).
The state I(parsed) reads the configuration from C(running_config) option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the I(parsed) key within the result.
state
str
Default: merged
Choices: deleted, merged, overridden, purged, replaced, gathered, rendered, parsed
The state the configuration should be left in.
State I(purged) removes all the BGP configurations from the target device. Use caution with this state.('no router bgp ')
State I(deleted) only removes BGP attributes that this modules manages and does not negate the BGP process completely. Thereby, preserving address-family related configurations under BGP context.
Running states I(deleted) and I(replaced) will result in an error if there are address-family configuration lines present under vrf context that is is to be removed. Please use the M(arista.eos.eos_bgp_address_family) module for prior cleanup.
Refer to examples for more details.

Notes

Note

  • Tested against Arista EOS 4.24.6F
  • This module works with connection C(network_cli). See the L(EOS Platform Options,eos_platform_options).

Examples

# Using Merged

# Before state:
# -------------
# veos(config)#show running-config | section bgp
# veos(config)#

- name: Merge provided configuration with device configuration
  arista.eos.eos_bgp_global:
    config:
      as_number: "100"
      bgp_params:
        host_routes: true
        convergence:
          slow_peer: true
          time: 6
        additional_paths: "send"
        log_neighbor_changes: true
      maximum_paths:
        max_equal_cost_paths: 55
      aggregate_address:
        - address: "1.2.1.0/24"
          as_set: true
          match_map: "match01"
        - address: "5.2.1.0/24"
          attribute_map: "attrmatch01"
          advertise_only: true
      redistribute:
        - protocol: "static"
          route_map: "map_static"
        - protocol: "attached-host"
      distance:
        internal: 50
      neighbor:
        - peer: "10.1.3.2"
          allowas_in:
            set: true
          default_originate:
            always: true
          dont_capability_negotiate: true
          export_localpref: 4000
          maximum_received_routes:
            count: 500
            warning_limit:
              limit_percent: 5
          next_hop_unchanged: true
          prefix_list:
            name: "prefix01"
            direction: "out"
        - neighbor_address: "peer1"
          fall_over: true
          link_bandwidth:
            update_delay: 5
          monitoring: true
          send_community:
            community_attribute: "extended"
            sub_attribute: "link-bandwidth"
            link_bandwidth_attribute: "aggregate"
            speed: "600"
      vlan: 5
    state: merged

# Task output:
# ------------
# before: {}
#
# commands:
# - router bgp 100
#   - neighbor 10.1.3.2 allowas-in
#   - neighbor 10.1.3.2 default-originate always
#   - neighbor 10.1.3.2 dont-capability-negotiate
#   - neighbor 10.1.3.2 export-localpref 4000
#   - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#   - neighbor 10.1.3.2 next-hop-unchanged
#   - neighbor 10.1.3.2 prefix-list prefix01 out
#   - neighbor peer1 fall-over bfd
#   - neighbor peer1 link-bandwidth update-delay 5
#   - neighbor peer1 monitoring
#   - neighbor peer1 send-community extended link-bandwidth aggregate 600
#   - redistribute static route-map map_static
#   - redistribute attached-host
#   - aggregate-address 1.2.1.0/24 as-set match-map match01
#   - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#   - bgp host-routes fib direct-install
#   - bgp convergence slow-peer time 6
#   - bgp additional-paths send any
#   - bgp log-neighbor-changes
#   - maximum-paths 55
#   - distance bgp 50
#   - vlan 5
#
# after:
#     aggregate_address:
#     - address: 1.2.1.0/24
#       as_set: true
#       match_map: match01
#     - address: 5.2.1.0/24
#       advertise_only: true
#       attribute_map: attrmatch01
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     distance:
#       external: 50
#       internal: 50
#       local: 50
#     maximum_paths:
#       max_equal_cost_paths: 55
#     neighbor:
#     - fall_over: true
#       link_bandwidth:
#         set: true
#         update_delay: 5
#       maximum_received_routes:
#         count: 12000
#       monitoring: true
#       neighbor_address: peer1
#       peer_group: peer1
#       send_community:
#         community_attribute: extended
#         link_bandwidth_attribute: aggregate
#         speed: '600'
#         sub_attribute: link-bandwidth
#     - allowas_in:
#         count: 3
#       default_originate:
#         always: true
#       dont_capability_negotiate: true
#       export_localpref: 4000
#       maximum_received_routes:
#         count: 500
#         warning_limit:
#           limit_percent: 5
#       neighbor_address: 10.1.3.2
#       next_hop_unchanged: true
#     redistribute:
#     - protocol: static
#       route_map: map_static
#     - protocol: attached-host
#     vlan: 5

# After state:
# ------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    distance bgp 50 50 50
#    maximum-paths 55
#    bgp additional-paths send any
#    neighbor peer1 peer group
#    neighbor peer1 link-bandwidth update-delay 5
#    neighbor peer1 fall-over bfd
#    neighbor peer1 monitoring
#    neighbor peer1 send-community extended link-bandwidth aggregate 600
#    neighbor peer1 maximum-routes 12000
#    neighbor 10.1.3.2 export-localpref 4000
#    neighbor 10.1.3.2 next-hop-unchanged
#    neighbor 10.1.3.2 dont-capability-negotiate
#    neighbor 10.1.3.2 allowas-in 3
#    neighbor 10.1.3.2 default-originate always
#    neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#    aggregate-address 1.2.1.0/24 as-set match-map match01
#    aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#    redistribute static route-map map_static
#    redistribute attached-host
#    !
#    vlan 5
#    !
#    address-family ipv4
#       neighbor 10.1.3.2 prefix-list prefix01 out

# Using replaced:

# Before state:
# -------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    distance bgp 50 50 50
#    maximum-paths 55
#    bgp additional-paths send any
#    neighbor peer1 peer group
#    neighbor peer1 link-bandwidth update-delay 5
#    neighbor peer1 fall-over bfd
#    neighbor peer1 monitoring
#    neighbor peer1 send-community extended link-bandwidth aggregate 600
#    neighbor peer1 maximum-routes 12000
#    neighbor 10.1.3.2 export-localpref 4000
#    neighbor 10.1.3.2 next-hop-unchanged
#    neighbor 10.1.3.2 dont-capability-negotiate
#    neighbor 10.1.3.2 allowas-in 3
#    neighbor 10.1.3.2 default-originate always
#    neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#    aggregate-address 1.2.1.0/24 as-set match-map match01
#    aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#    redistribute static route-map map_static
#    redistribute attached-host
#    !
#    vlan 5
#    !
#    address-family ipv4
#       neighbor 10.1.3.2 prefix-list prefix01 out
#    !
#    vrf vrf01
#       route-target import 54:11
#       neighbor 12.1.3.2 dont-capability-negotiate
#       neighbor 12.1.3.2 allowas-in 3
#       neighbor 12.1.3.2 default-originate always
#       neighbor 12.1.3.2 maximum-routes 12000

- name: replace provided configuration with device configuration
  arista.eos.eos_bgp_global:
    config:
      as_number: "100"
      bgp_params:
        host_routes: true
        convergence:
          slow_peer: true
          time: 6
        additional_paths: "send"
        log_neighbor_changes: true
      vrfs:
        - vrf: "vrf01"
          maximum_paths:
            max_equal_cost_paths: 55
          aggregate_address:
            - address: "1.2.1.0/24"
              as_set: true
              match_map: "match01"
            - address: "5.2.1.0/24"
              attribute_map: "attrmatch01"
              advertise_only: true
          redistribute:
            - protocol: "static"
              route_map: "map_static"
            - protocol: "attached-host"
          distance:
            internal: 50
          neighbor:
            - neighbor_address: "10.1.3.2"
              allowas_in:
                set: true
              default_originate:
                always: true
              dont_capability_negotiate: true
              export_localpref: 4000
              maximum_received_routes:
                count: 500
                warning_limit:
                  limit_percent: 5
              next_hop_unchanged: true
              prefix_list:
                name: "prefix01"
                direction: "out"
            - neighbor_address: "peer1"
              fall_over: true
              link_bandwidth:
                update_delay: 5
              monitoring: true
              send_community:
                community_attribute: "extended"
                sub_attribute: "link-bandwidth"
                link_bandwidth_attribute: "aggregate"
                speed: "600"
    state: replaced

# Task output:
# ------------

# before:
#     aggregate_address:
#     - address: 1.2.1.0/24
#       as_set: true
#       match_map: match01
#     - address: 5.2.1.0/24
#       advertise_only: true
#       attribute_map: attrmatch01
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     distance:
#       external: 50
#       internal: 50
#       local: 50
#     maximum_paths:
#       max_equal_cost_paths: 55
#     neighbor:
#     - fall_over: true
#       link_bandwidth:
#         set: true
#         update_delay: 5
#       maximum_received_routes:
#         count: 12000
#       monitoring: true
#       neighbor_address: peer1
#       peer_group: peer1
#       send_community:
#         community_attribute: extended
#         link_bandwidth_attribute: aggregate
#         speed: '600'
#         sub_attribute: link-bandwidth
#     - allowas_in:
#         count: 3
#       default_originate:
#         always: true
#       dont_capability_negotiate: true
#       export_localpref: 4000
#       maximum_received_routes:
#         count: 500
#         warning_limit:
#           limit_percent: 5
#       neighbor_address: 10.1.3.2
#       next_hop_unchanged: true
#     redistribute:
#     - protocol: static
#       route_map: map_static
#     - protocol: attached-host
#     vlan: 5
#     vrfs:
#     - neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         maximum_received_routes:
#           count: 12000
#         neighbor_address: 12.1.3.2
#       route_target:
#         action: import
#         target: '54:11'
#       vrf: vrf01
#
# commands:
# - router bgp 100
# - vrf vrf01
# - no route-target import 54:11
# - neighbor 10.1.3.2 allowas-in
# - neighbor 10.1.3.2 default-originate always
# - neighbor 10.1.3.2 dont-capability-negotiate
# - neighbor 10.1.3.2 export-localpref 4000
# - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
# - neighbor 10.1.3.2 next-hop-unchanged
# - neighbor 10.1.3.2 prefix-list prefix01 out
# - neighbor peer1 fall-over bfd
# - neighbor peer1 link-bandwidth update-delay 5
# - neighbor peer1 monitoring
# - neighbor peer1 send-community extended link-bandwidth aggregate 600
# - no neighbor 12.1.3.2
# - redistribute static route-map map_static
# - redistribute attached-host
# - aggregate-address 1.2.1.0/24 as-set match-map match01
# - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
# - maximum-paths 55
# - distance bgp 50
# - exit
# - no neighbor peer1 peer group
# - no neighbor peer1 link-bandwidth update-delay 5
# - no neighbor peer1 fall-over bfd
# - no neighbor peer1 monitoring
# - no neighbor peer1 send-community extended link-bandwidth aggregate 600
# - no neighbor peer1 maximum-routes 12000
# - no neighbor 10.1.3.2
# - no redistribute static route-map map_static
# - no redistribute attached-host
# - no aggregate-address 1.2.1.0/24 as-set match-map match01
# - no aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
# - bgp host-routes fib direct-install
# - bgp log-neighbor-changes
# - no distance bgp 50 50 50
# - no maximum-paths 55
# - no vlan 5
#
# after:
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     vrfs:
#     - aggregate_address:
#       - address: 1.2.1.0/24
#         as_set: true
#         match_map: match01
#       - address: 5.2.1.0/24
#         advertise_only: true
#         attribute_map: attrmatch01
#       distance:
#         external: 50
#         internal: 50
#         local: 50
#       maximum_paths:
#         max_equal_cost_paths: 55
#       neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         export_localpref: 4000
#         maximum_received_routes:
#           count: 500
#           warning_limit:
#             limit_percent: 5
#         neighbor_address: 10.1.3.2
#         next_hop_unchanged: true
#       redistribute:
#       - protocol: static
#         route_map: map_static
#       - protocol: attached-host
#       vrf: vrf01
#
# After state:
# ------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    bgp additional-paths send any
#    !
#    vrf vrf01
#       distance bgp 50 50 50
#       maximum-paths 55
#       neighbor 10.1.3.2 export-localpref 4000
#       neighbor 10.1.3.2 next-hop-unchanged
#       neighbor 10.1.3.2 dont-capability-negotiate
#       neighbor 10.1.3.2 allowas-in 3
#       neighbor 10.1.3.2 default-originate always
#       neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#       aggregate-address 1.2.1.0/24 as-set match-map match01
#       aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#       redistribute static route-map map_static
#       redistribute attached-host
#       !
#       address-family ipv4
#          neighbor 10.1.3.2 prefix-list prefix01 out

# Using overridden:
# (Note: Overridden and replaced operations are identitical)

# Before state:
# -------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    distance bgp 50 50 50
#    maximum-paths 55
#    bgp additional-paths send any
#    neighbor peer1 peer group
#    neighbor peer1 link-bandwidth update-delay 5
#    neighbor peer1 fall-over bfd
#    neighbor peer1 monitoring
#    neighbor peer1 send-community extended link-bandwidth aggregate 600
#    neighbor peer1 maximum-routes 12000
#    neighbor 10.1.3.2 export-localpref 4000
#    neighbor 10.1.3.2 next-hop-unchanged
#    neighbor 10.1.3.2 dont-capability-negotiate
#    neighbor 10.1.3.2 allowas-in 3
#    neighbor 10.1.3.2 default-originate always
#    neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#    aggregate-address 1.2.1.0/24 as-set match-map match01
#    aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#    redistribute static route-map map_static
#    redistribute attached-host
#    !
#    vlan 5
#    !
#    address-family ipv4
#       neighbor 10.1.3.2 prefix-list prefix01 out
#    !
#    vrf vrf01
#       route-target import 54:11
#       neighbor 12.1.3.2 dont-capability-negotiate
#       neighbor 12.1.3.2 allowas-in 3
#       neighbor 12.1.3.2 default-originate always
#       neighbor 12.1.3.2 maximum-routes 12000

- name: override running configuration with configuration
  arista.eos.eos_bgp_global:
    config:
      as_number: "100"
      bgp_params:
        host_routes: true
        convergence:
          slow_peer: true
          time: 6
        additional_paths: "send"
        log_neighbor_changes: true
      vrfs:
        - vrf: "vrf01"
          maximum_paths:
            max_equal_cost_paths: 55
          aggregate_address:
            - address: "1.2.1.0/24"
              as_set: true
              match_map: "match01"
            - address: "5.2.1.0/24"
              attribute_map: "attrmatch01"
              advertise_only: true
          redistribute:
            - protocol: "static"
              route_map: "map_static"
            - protocol: "attached-host"
          distance:
            internal: 50
          neighbor:
            - neighbor_address: "10.1.3.2"
              allowas_in:
                set: true
              default_originate:
                always: true
              dont_capability_negotiate: true
              export_localpref: 4000
              maximum_received_routes:
                count: 500
                warning_limit:
                  limit_percent: 5
              next_hop_unchanged: true
              prefix_list:
                name: "prefix01"
                direction: "out"
            - neighbor_address: "peer1"
              fall_over: true
              link_bandwidth:
                update_delay: 5
              monitoring: true
              send_community:
                community_attribute: "extended"
                sub_attribute: "link-bandwidth"
                link_bandwidth_attribute: "aggregate"
                speed: "600"
    state: overridden

# Task output:
# ------------
# before:
#     aggregate_address:
#     - address: 1.2.1.0/24
#       as_set: true
#       match_map: match01
#     - address: 5.2.1.0/24
#       advertise_only: true
#       attribute_map: attrmatch01
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     distance:
#       external: 50
#       internal: 50
#       local: 50
#     maximum_paths:
#       max_equal_cost_paths: 55
#     neighbor:
#     - fall_over: true
#       link_bandwidth:
#         set: true
#         update_delay: 5
#       maximum_received_routes:
#         count: 12000
#       monitoring: true
#       neighbor_address: peer1
#       peer_group: peer1
#       send_community:
#         community_attribute: extended
#         link_bandwidth_attribute: aggregate
#         speed: '600'
#         sub_attribute: link-bandwidth
#     - allowas_in:
#         count: 3
#       default_originate:
#         always: true
#       dont_capability_negotiate: true
#       export_localpref: 4000
#       maximum_received_routes:
#         count: 500
#         warning_limit:
#           limit_percent: 5
#       neighbor_address: 10.1.3.2
#       next_hop_unchanged: true
#     redistribute:
#     - protocol: static
#       route_map: map_static
#     - protocol: attached-host
#     vlan: 5
#     vrfs:
#     - neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         maximum_received_routes:
#           count: 12000
#         neighbor_address: 12.1.3.2
#       route_target:
#         action: import
#         target: '54:11'
#       vrf: vrf01
#
# commands:
# - router bgp 100
# - vrf vrf01
# - no route-target import 54:11
# - neighbor 10.1.3.2 allowas-in
# - neighbor 10.1.3.2 default-originate always
# - neighbor 10.1.3.2 dont-capability-negotiate
# - neighbor 10.1.3.2 export-localpref 4000
# - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
# - neighbor 10.1.3.2 next-hop-unchanged
# - neighbor 10.1.3.2 prefix-list prefix01 out
# - neighbor peer1 fall-over bfd
# - neighbor peer1 link-bandwidth update-delay 5
# - neighbor peer1 monitoring
# - neighbor peer1 send-community extended link-bandwidth aggregate 600
# - no neighbor 12.1.3.2
# - redistribute static route-map map_static
# - redistribute attached-host
# - aggregate-address 1.2.1.0/24 as-set match-map match01
# - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
# - maximum-paths 55
# - distance bgp 50
# - exit
# - no neighbor peer1 peer group
# - no neighbor peer1 link-bandwidth update-delay 5
# - no neighbor peer1 fall-over bfd
# - no neighbor peer1 monitoring
# - no neighbor peer1 send-community extended link-bandwidth aggregate 600
# - no neighbor peer1 maximum-routes 12000
# - no neighbor 10.1.3.2
# - no redistribute static route-map map_static
# - no redistribute attached-host
# - no aggregate-address 1.2.1.0/24 as-set match-map match01
# - no aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
# - bgp host-routes fib direct-install
# - bgp log-neighbor-changes
# - no distance bgp 50 50 50
# - no maximum-paths 55
# - no vlan 5
#
# after:
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     vrfs:
#     - aggregate_address:
#       - address: 1.2.1.0/24
#         as_set: true
#         match_map: match01
#       - address: 5.2.1.0/24
#         advertise_only: true
#         attribute_map: attrmatch01
#       distance:
#         external: 50
#         internal: 50
#         local: 50
#       maximum_paths:
#         max_equal_cost_paths: 55
#       neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         export_localpref: 4000
#         maximum_received_routes:
#           count: 500
#           warning_limit:
#             limit_percent: 5
#         neighbor_address: 10.1.3.2
#         next_hop_unchanged: true
#       redistribute:
#       - protocol: static
#         route_map: map_static
#       - protocol: attached-host
#       vrf: vrf01
#
# After state:
# ------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    bgp additional-paths send any
#    !
#    vrf vrf01
#       distance bgp 50 50 50
#       maximum-paths 55
#       neighbor 10.1.3.2 export-localpref 4000
#       neighbor 10.1.3.2 next-hop-unchanged
#       neighbor 10.1.3.2 dont-capability-negotiate
#       neighbor 10.1.3.2 allowas-in 3
#       neighbor 10.1.3.2 default-originate always
#       neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#       aggregate-address 1.2.1.0/24 as-set match-map match01
#       aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#       redistribute static route-map map_static
#       redistribute attached-host
#       !
#       address-family ipv4
#          neighbor 10.1.3.2 prefix-list prefix01 out

# Using deleted:

# Before state:
# -------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    bgp additional-paths send any
#    !
#    vrf vrf01
#       distance bgp 50 50 50
#       maximum-paths 55
#       neighbor 10.1.3.2 export-localpref 4000
#       neighbor 10.1.3.2 next-hop-unchanged
#       neighbor 10.1.3.2 dont-capability-negotiate
#       neighbor 10.1.3.2 allowas-in 3
#       neighbor 10.1.3.2 default-originate always
#       neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#       aggregate-address 1.2.1.0/24 as-set match-map match01
#       aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#       redistribute static route-map map_static
#       redistribute attached-host
#       !

- name: Delete configuration
  arista.eos.eos_bgp_global:
    config:
      as_number: "100"
    state: deleted

# Task output:
# ------------
# before:
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     vrfs:
#     - aggregate_address:
#       - address: 1.2.1.0/24
#         as_set: true
#         match_map: match01
#       - address: 5.2.1.0/24
#         advertise_only: true
#         attribute_map: attrmatch01
#       distance:
#         external: 50
#         internal: 50
#         local: 50
#       maximum_paths:
#         max_equal_cost_paths: 55
#       neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         export_localpref: 4000
#         maximum_received_routes:
#           count: 500
#           warning_limit:
#             limit_percent: 5
#         neighbor_address: 10.1.3.2
#         next_hop_unchanged: true
#       redistribute:
#       - protocol: static
#         route_map: map_static
#       - protocol: attached-host
#       vrf: vrf01
#
# commands:
# - router bgp 100
# - no vrf vrf01
# - no bgp convergence slow-peer time 6
# - no bgp additional-paths send any
#
# after:
#  as_number: '100'

#
# After state:
# ------------
# veos(config)#show running-config | section bgp
# router bgp 100

# Using purged:

# Before state:
# -------------
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    distance bgp 50 50 50
#    maximum-paths 55
#    bgp additional-paths send any
#    neighbor peer1 peer group
#    neighbor peer1 link-bandwidth update-delay 5
#    neighbor peer1 fall-over bfd
#    neighbor peer1 monitoring
#    neighbor peer1 send-community extended link-bandwidth aggregate 600
#    neighbor peer1 maximum-routes 12000
#    neighbor 10.1.3.2 export-localpref 4000
#    neighbor 10.1.3.2 next-hop-unchanged
#    neighbor 10.1.3.2 dont-capability-negotiate
#    neighbor 10.1.3.2 allowas-in 3
#    neighbor 10.1.3.2 default-originate always
#    neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#    aggregate-address 1.2.1.0/24 as-set match-map match01
#    aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#    redistribute static route-map map_static
#    redistribute attached-host
#    !
#    vlan 5
#    !
#    address-family ipv4
#       neighbor 10.1.3.2 prefix-list prefix01 out
#    !
#    vrf vrf01
#       route-target import 54:11
#       neighbor 12.1.3.2 dont-capability-negotiate
#       neighbor 12.1.3.2 allowas-in 3
#       neighbor 12.1.3.2 default-originate always
#       neighbor 12.1.3.2 maximum-routes 12000

- name: Purge configuration
  arista.eos.eos_bgp_global:
    config:
      as_number: "100"
    state: purged


# Task output:
# ------------
# before:
#     aggregate_address:
#     - address: 1.2.1.0/24
#       as_set: true
#       match_map: match01
#     - address: 5.2.1.0/24
#       advertise_only: true
#       attribute_map: attrmatch01
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     distance:
#       external: 50
#       internal: 50
#       local: 50
#     maximum_paths:
#       max_equal_cost_paths: 55
#     neighbor:
#     - fall_over: true
#       link_bandwidth:
#         set: true
#         update_delay: 5
#       maximum_received_routes:
#         count: 12000
#       monitoring: true
#       neighbor_address: peer1
#       peer_group: peer1
#       send_community:
#         community_attribute: extended
#         link_bandwidth_attribute: aggregate
#         speed: '600'
#         sub_attribute: link-bandwidth
#     - allowas_in:
#         count: 3
#       default_originate:
#         always: true
#       dont_capability_negotiate: true
#       export_localpref: 4000
#       maximum_received_routes:
#         count: 500
#         warning_limit:
#           limit_percent: 5
#       neighbor_address: 10.1.3.2
#       next_hop_unchanged: true
#     redistribute:
#     - protocol: static
#       route_map: map_static
#     - protocol: attached-host
#     vlan: 5
#     vrfs:
#     - neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         maximum_received_routes:
#           count: 12000
#         neighbor_address: 12.1.3.2
#       route_target:
#         action: import
#         target: '54:11'
#       vrf: vrf01
#     "changed": true,
#
# commands:
# - no router bgp 100
#
# after: {}

# After state:
# ------------
# veos(config)#show running-config | section bgp
# veos(config)#

# Using rendered

- name: Render command lines for provided configuration
  arista.eos.eos_bgp_global:
    config:
      as_number: "100"
      bgp_params:
        host_routes: true
        convergence:
          slow_peer: true
          time: 6
        additional_paths: "send"
        log_neighbor_changes: true
      maximum_paths:
        max_equal_cost_paths: 55
      aggregate_address:
        - address: "1.2.1.0/24"
          as_set: true
          match_map: "match01"
        - address: "5.2.1.0/24"
          attribute_map: "attrmatch01"
          advertise_only: true
      redistribute:
        - protocol: "static"
          route_map: "map_static"
        - protocol: "attached-host"
      distance:
        internal: 50
      neighbor:
        - peer: "10.1.3.2"
          allowas_in:
            set: true
          default_originate:
            always: true
          dont_capability_negotiate: true
          export_localpref: 4000
          maximum_received_routes:
            count: 500
            warning_limit:
              limit_percent: 5
          next_hop_unchanged: true
          prefix_list:
            name: "prefix01"
            direction: "out"
        - neighbor_address: "peer1"
          fall_over: true
          link_bandwidth:
            update_delay: 5
          monitoring: true
          send_community:
            community_attribute: "extended"
            sub_attribute: "link-bandwidth"
            link_bandwidth_attribute: "aggregate"
            speed: "600"
      vlan: 5
    state: rendered

# Task output:
# ------------
# rendered:
#   - router bgp 100
#   - neighbor 10.1.3.2 allowas-in
#   - neighbor 10.1.3.2 default-originate always
#   - neighbor 10.1.3.2 dont-capability-negotiate
#   - neighbor 10.1.3.2 export-localpref 4000
#   - neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#   - neighbor 10.1.3.2 next-hop-unchanged
#   - neighbor 10.1.3.2 prefix-list prefix01 out
#   - neighbor peer1 fall-over bfd
#   - neighbor peer1 link-bandwidth update-delay 5
#   - neighbor peer1 monitoring
#   - neighbor peer1 send-community extended link-bandwidth aggregate 600
#   - redistribute static route-map map_static
#   - redistribute attached-host
#   - aggregate-address 1.2.1.0/24 as-set match-map match01
#   - aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#   - bgp host-routes fib direct-install
#   - bgp convergence slow-peer time 6
#   - bgp additional-paths send any
#   - bgp log-neighbor-changes
#   - maximum-paths 55
#   - distance bgp 50
#   - vlan 5


# Using parsed

# parsed.cfg
# ----------
# router bgp 100
#    bgp convergence slow-peer time 6
#    distance bgp 50 50 50
#    maximum-paths 55
#    bgp additional-paths send any
#    neighbor peer1 peer group
#    neighbor peer1 link-bandwidth update-delay 5
#    neighbor peer1 fall-over bfd
#    neighbor peer1 monitoring
#    neighbor peer1 send-community extended link-bandwidth aggregate 600
#    neighbor peer1 maximum-routes 12000
#    neighbor 10.1.3.2 export-localpref 4000
#    neighbor 10.1.3.2 next-hop-unchanged
#    neighbor 10.1.3.2 dont-capability-negotiate
#    neighbor 10.1.3.2 allowas-in 3
#    neighbor 10.1.3.2 default-originate always
#    neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#    aggregate-address 1.2.1.0/24 as-set match-map match01
#    aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#    redistribute static route-map map_static
#    redistribute attached-host
#    !
#    vlan 5
#    !
#    address-family ipv4
#       neighbor 10.1.3.2 prefix-list prefix01 out
#    !
#    vrf vrf01
#       route-target import 54:11
#       neighbor 12.1.3.2 dont-capability-negotiate
#       neighbor 12.1.3.2 allowas-in 3
#       neighbor 12.1.3.2 default-originate always
#       neighbor 12.1.3.2 maximum-routes 12000

- name: Parse externally provided BGP config
  arista.eos.eos_bgp_global:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Task output:
# ------------

# parsed:
#     aggregate_address:
#     - address: 1.2.1.0/24
#       as_set: true
#       match_map: match01
#     - address: 5.2.1.0/24
#       advertise_only: true
#       attribute_map: attrmatch01
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     distance:
#       external: 50
#       internal: 50
#       local: 50
#     maximum_paths:
#       max_equal_cost_paths: 55
#     neighbor:
#     - fall_over: true
#       link_bandwidth:
#         set: true
#         update_delay: 5
#       maximum_received_routes:
#         count: 12000
#       monitoring: true
#       neighbor_address: peer1
#       peer_group: peer1
#       send_community:
#         community_attribute: extended
#         link_bandwidth_attribute: aggregate
#         speed: '600'
#         sub_attribute: link-bandwidth
#     - allowas_in:
#         count: 3
#       default_originate:
#         always: true
#       dont_capability_negotiate: true
#       export_localpref: 4000
#       maximum_received_routes:
#         count: 500
#         warning_limit:
#           limit_percent: 5
#       neighbor_address: 10.1.3.2
#       next_hop_unchanged: true
#     redistribute:
#     - protocol: static
#       route_map: map_static
#     - protocol: attached-host
#     vlan: 5
#     vrfs:
#     - neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         maximum_received_routes:
#           count: 12000
#         neighbor_address: 12.1.3.2
#       route_target:
#         action: import
#         target: '54:11'
#       vrf: vrf01

# Using gathered

# existing config
# veos(config)#show running-config | section bgp
# router bgp 100
#    bgp convergence slow-peer time 6
#    distance bgp 50 50 50
#    maximum-paths 55
#    bgp additional-paths send any
#    neighbor peer1 peer group
#    neighbor peer1 link-bandwidth update-delay 5
#    neighbor peer1 fall-over bfd
#    neighbor peer1 monitoring
#    neighbor peer1 send-community extended link-bandwidth aggregate 600
#    neighbor peer1 maximum-routes 12000
#    neighbor 10.1.3.2 export-localpref 4000
#    neighbor 10.1.3.2 next-hop-unchanged
#    neighbor 10.1.3.2 dont-capability-negotiate
#    neighbor 10.1.3.2 allowas-in 3
#    neighbor 10.1.3.2 default-originate always
#    neighbor 10.1.3.2 maximum-routes 500 warning-limit 5 percent
#    aggregate-address 1.2.1.0/24 as-set match-map match01
#    aggregate-address 5.2.1.0/24 attribute-map attrmatch01 advertise-only
#    redistribute static route-map map_static
#    redistribute attached-host
#    !
#    vlan 5
#    !
#    address-family ipv4
#       neighbor 10.1.3.2 prefix-list prefix01 out
#    !
#    vrf vrf01
#       route-target import 54:11
#       neighbor 12.1.3.2 dont-capability-negotiate
#       neighbor 12.1.3.2 allowas-in 3
#       neighbor 12.1.3.2 default-originate always
#       neighbor 12.1.3.2 maximum-routes 12000

- name: Gather BGP facts using gathered
  arista.eos.eos_bgp_global:
    state: gathered

# Task output:
# ------------
# gathered:
#     aggregate_address:
#     - address: 1.2.1.0/24
#       as_set: true
#       match_map: match01
#     - address: 5.2.1.0/24
#       advertise_only: true
#       attribute_map: attrmatch01
#     as_number: '100'
#     bgp_params:
#       additional_paths: send
#       convergence:
#         slow_peer: true
#         time: 6
#     distance:
#       external: 50
#       internal: 50
#       local: 50
#     maximum_paths:
#       max_equal_cost_paths: 55
#     neighbor:
#     - fall_over: true
#       link_bandwidth:
#         set: true
#         update_delay: 5
#       maximum_received_routes:
#         count: 12000
#       monitoring: true
#       neighbor_address: peer1
#       peer_group: peer1
#       send_community:
#         community_attribute: extended
#         link_bandwidth_attribute: aggregate
#         speed: '600'
#         sub_attribute: link-bandwidth
#     - allowas_in:
#         count: 3
#       default_originate:
#         always: true
#       dont_capability_negotiate: true
#       export_localpref: 4000
#       maximum_received_routes:
#         count: 500
#         warning_limit:
#           limit_percent: 5
#       neighbor_address: 10.1.3.2
#       next_hop_unchanged: true
#     redistribute:
#     - protocol: static
#       route_map: map_static
#     - protocol: attached-host
#     vlan: 5
#     vrfs:
#     - neighbor:
#       - allowas_in:
#           count: 3
#         default_originate:
#           always: true
#         dont_capability_negotiate: true
#         maximum_received_routes:
#           count: 12000
#         neighbor_address: 12.1.3.2
#       route_target:
#         action: import
#         target: '54:11'
#       vrf: vrf01

Return Values

Key Data Type Description Returned
after dict The resulting configuration model invocation. when changed
before dict The configuration prior to the model invocation. always
commands list The set of commands pushed to the remote device. always
gathered dict Facts about the network resource gathered from the remote device as structured data. when I(state) is C(gathered)
parsed dict The device native config provided in I(running_config) option parsed into structured data as per module argspec. when I(state) is C(parsed)
rendered list The provided configuration in the task rendered in device-native format (offline). when I(state) is C(rendered)

Authors

  • Gomathi Selvi Srinivasan (@gomathiselvis)