cisco / cisco.nxos / 7.0.0 / module / nxos_bgp_address_family BGP Address Family resource module. | "added in version" 2.0.0 of cisco.nxos" Authors: Nilashish Chakraborty (@NilashishC)cisco.nxos.nxos_bgp_address_family (7.0.0) — module
Install with ansible-galaxy collection install cisco.nxos:==7.0.0
collections: - name: cisco.nxos version: 7.0.0
This module manages BGP Address Family configuration on devices running Cisco NX-OS.
# Using merged # Before state: # ------------- # Nexus9000v# show running-config | section "^router bgp" # Nexus9000v# - name: Merge the provided configuration with the existing running configuration cisco.nxos.nxos_bgp_address_family: config: as_number: 65536 address_family: - afi: ipv4 safi: multicast networks: - prefix: 192.0.2.32/27 - prefix: 192.0.2.64/27 route_map: rmap1 nexthop: route_map: rmap2 trigger_delay: critical_delay: 120 non_critical_delay: 180 - afi: ipv4 safi: unicast vrf: site-1 default_information: originate: true aggregate_address: - prefix: 203.0.113.0/24 as_set: true summary_only: true - afi: ipv6 safi: multicast vrf: site-1 redistribute: - protocol: ospfv3 id: 100 route_map: rmap-ospf-1 - protocol: eigrp id: 101 route_map: rmap-eigrp-1
# Task output: # ------------ # before: {} # # commands: # - router bgp 65536 # - address-family ipv4 multicast # - nexthop route-map rmap2 # - nexthop trigger-delay critical 120 non-critical 180 # - network 192.0.2.32/27 # - network 192.0.2.64/27 route-map rmap1 # - vrf site-1 # - address-family ipv4 unicast # - default-information originate # - aggregate-address 203.0.113.0/24 as-set summary-only # - address-family ipv6 multicast # - redistribute ospfv3 100 route-map rmap-ospf-1 # - redistribute eigrp 101 route-map rmap-eigrp-1 # # after: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.32/27 # - prefix: 192.0.2.64/27 # route_map: rmap1 # nexthop: # route_map: rmap2 # trigger_delay: # critical_delay: 120 # non_critical_delay: 180 # - afi: ipv4 # safi: unicast # vrf: site-1 # default_information: # originate: true # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # - afi: ipv6 # safi: multicast # vrf: site-1 # redistribute: # - id: "100" # protocol: ospfv3 # route_map: rmap-ospf-1 # - id: "101" # protocol: eigrp # route_map: rmap-eigrp-1 # After state: # ------------ # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.32/27 # network 192.0.2.64/27 route-map rmap1 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 # # Using replaced # Before state: # ------------- # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.32/27 # network 192.0.2.64/27 route-map rmap1 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 - name: Replace configuration of specified AFs cisco.nxos.nxos_bgp_address_family: config: as_number: 65536 address_family: - afi: ipv4 safi: multicast networks: - prefix: 192.0.2.64/27 route_map: rmap1 nexthop: route_map: rmap2 trigger_delay: critical_delay: 120 non_critical_delay: 180 aggregate_address: - prefix: 203.0.113.0/24 as_set: true summary_only: true - afi: ipv4 safi: unicast vrf: site-1 state: replaced
# Task output: # ------------ # before: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.32/27 # - prefix: 192.0.2.64/27 # route_map: rmap1 # nexthop: # route_map: rmap2 # trigger_delay: # critical_delay: 120 # non_critical_delay: 180 # - afi: ipv4 # safi: unicast # vrf: site-1 # default_information: # originate: true # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # - afi: ipv6 # safi: multicast # vrf: site-1 # redistribute: # - id: "100" # protocol: ospfv3 # route_map: rmap-ospf-1 # - id: "101" # protocol: eigrp # route_map: rmap-eigrp-1 # # commands: # - router bgp 65536 # - address-family ipv4 multicast # - no network 192.0.2.32/27 # - aggregate-address 203.0.113.0/24 as-set summary-only # - vrf site-1 # - address-family ipv4 unicast # - no default-information originate # - no aggregate-address 203.0.113.0/24 as-set summary-only # # after: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.64/27 # route_map: rmap1 # nexthop: # route_map: rmap2 # trigger_delay: # critical_delay: 120 # non_critical_delay: 180 # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # # - afi: ipv4 # safi: unicast # vrf: site-1 # # - afi: ipv6 # safi: multicast # vrf: site-1 # redistribute: # - protocol: ospfv3 # id: "100" # route_map: rmap-ospf-1 # - protocol: eigrp # id: "101" # route_map: rmap-eigrp-1 # After state: # ------------ # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.64/27 route-map rmap1 # aggregate-address 203.0.113.0/24 as-set summary-only # vrf site-1 # address-family ipv4 unicast # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 # Using overridden # Before state: # ------------- # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.32/27 # network 192.0.2.64/27 route-map rmap1 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 - name: Override all BGP AF configuration with provided configuration cisco.nxos.nxos_bgp_address_family: &overridden config: as_number: 65536 address_family: - afi: ipv4 safi: multicast networks: - prefix: 192.0.2.64/27 route_map: rmap1 aggregate_address: - prefix: 203.0.113.0/24 as_set: true summary_only: true - afi: ipv4 safi: unicast vrf: site-1 state: overridden
# Task output: # ------------ # before: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.32/27 # - prefix: 192.0.2.64/27 # route_map: rmap1 # nexthop: # route_map: rmap2 # trigger_delay: # critical_delay: 120 # non_critical_delay: 180 # - afi: ipv4 # safi: unicast # vrf: site-1 # default_information: # originate: true # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # - afi: ipv6 # safi: multicast # vrf: site-1 # redistribute: # - id: "100" # protocol: ospfv3 # route_map: rmap-ospf-1 # - id: "101" # protocol: eigrp # route_map: rmap-eigrp-1 # # commands: # - router bgp 65536 # - vrf site-1 # - no address-family ipv6 multicast # - exit # - address-family ipv4 multicast # - no nexthop route-map rmap2 # - no nexthop trigger-delay critical 120 non-critical 180 # - aggregate-address 203.0.113.0/24 as-set summary-only # - no network 192.0.2.32/27 # - vrf site-1 # - address-family ipv4 unicast # - no default-information originate # - no aggregate-address 203.0.113.0/24 as-set summary-only # # after: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.64/27 # route_map: rmap1 # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # - afi: ipv4 # safi: unicast # vrf: site-1 # # After state: # ------------ # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # network 192.0.2.64/27 route-map rmap1 # aggregate-address 203.0.113.0/24 as-set summary-only # vrf site-1 # address-family ipv4 unicast # # Using deleted to remove specified AFs # Before state: # ------------- # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.32/27 # network 192.0.2.64/27 route-map rmap1 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 - name: Delete specified BGP AFs cisco.nxos.nxos_bgp_address_family: config: as_number: 65536 address_family: - afi: ipv4 safi: multicast - vrf: site-1 afi: ipv6 safi: multicast state: deleted
# Task output: # ------------ # before: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.32/27 # - prefix: 192.0.2.64/27 # route_map: rmap1 # nexthop: # route_map: rmap2 # trigger_delay: # critical_delay: 120 # non_critical_delay: 180 # - afi: ipv4 # safi: unicast # vrf: site-1 # default_information: # originate: true # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # - afi: ipv6 # safi: multicast # vrf: site-1 # redistribute: # - id: "100" # protocol: ospfv3 # route_map: rmap-ospf-1 # - id: "101" # protocol: eigrp # route_map: rmap-eigrp-1 # # commands: # - router bgp 65563 # - no address-family ipv4 multicast # - vrf site-1 # - no address-family ipv6 multicast # # after: # as_number: "65536" # address_family: # - afi: ipv4 # safi: unicast # vrf: site-1 # default_information: # originate: true # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # After state: # ------------ # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # Using deleted to remove all BGP AFs # Before state: # ------------- # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.32/27 # network 192.0.2.64/27 route-map rmap1 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 - name: Delete all BGP AFs cisco.nxos.nxos_bgp_address_family: state: deleted
# Task output: # ------------ # before: # as_number: "65536" # address_family: # - afi: ipv4 # safi: multicast # networks: # - prefix: 192.0.2.32/27 # - prefix: 192.0.2.64/27 # route_map: rmap1 # nexthop: # route_map: rmap2 # trigger_delay: # critical_delay: 120 # non_critical_delay: 180 # - afi: ipv4 # safi: unicast # vrf: site-1 # default_information: # originate: true # aggregate_address: # - prefix: 203.0.113.0/24 # as_set: true # summary_only: true # - afi: ipv6 # safi: multicast # vrf: site-1 # redistribute: # - id: "100" # protocol: ospfv3 # route_map: rmap-ospf-1 # - id: "101" # protocol: eigrp # route_map: rmap-eigrp-1 # # commands: # - router bgp 65563 # - no address-family ipv4 multicast # - vrf site-1 # - no address-family ipv4 unicast # - no address-family ipv6 multicast # # after: # as_number: "65536" # After state: # ------------ # Nexus9000v# show running-config | section "^router bgp" # router bgp 65536 # Nexus9000v# # Using rendered - name: Render platform specific configuration lines with state rendered (without connecting to the device) cisco.nxos.nxos_bgp_address_family: config: as_number: 65536 address_family: - afi: ipv4 safi: multicast networks: - prefix: 192.0.2.32/27 - prefix: 192.0.2.64/27 route_map: rmap1 nexthop: route_map: rmap2 trigger_delay: critical_delay: 120 non_critical_delay: 180 - afi: ipv4 safi: unicast vrf: site-1 default_information: originate: true aggregate_address: - prefix: 203.0.113.0/24 as_set: true summary_only: true - afi: ipv6 safi: multicast vrf: site-1 redistribute: - protocol: ospfv3 id: 100 route_map: rmap-ospf-1 - protocol: eigrp id: 101 route_map: rmap-eigrp-1 state: rendered
# Task Output: # ------------ # rendered: # - router bgp 65536 # - address-family ipv4 multicast # - nexthop route-map rmap2 # - nexthop trigger-delay critical 120 non-critical 180 # - network 192.0.2.32/27 # - network 192.0.2.64/27 route-map rmap1 # - vrf site-1 # - address-family ipv4 unicast # - default-information originate # - aggregate-address 203.0.113.0/24 as-set summary-only # - address-family ipv6 multicast # - redistribute ospfv3 100 route-map rmap-ospf-1 # - redistribute eigrp 101 route-map rmap-eigrp-1 # Using parsed # parsed.cfg # ------------ # router bgp 65536 # address-family ipv4 multicast # nexthop route-map rmap2 # nexthop trigger-delay critical 120 non-critical 180 # network 192.0.2.32/27 # network 192.0.2.64/27 route-map rmap1 # vrf site-1 # address-family ipv4 unicast # default-information originate # aggregate-address 203.0.113.0/24 as-set summary-only # address-family ipv6 multicast # redistribute ospfv3 100 route-map rmap-ospf-1 # redistribute eigrp 101 route-map rmap-eigrp-1 - name: Parse externally provided BGP AF config cisco.nxos.nxos_bgp_address_family: running_config: "{{ lookup('file', 'parsed.cfg') }}" state: parsed
state: choices: - merged - replaced - overridden - deleted - parsed - gathered - rendered default: merged description: - The state the configuration should be left in. - State I(deleted) only removes BGP attributes that this modules manages and does not negate the BGP process completely. - Refer to examples for more details. type: str config: description: A list of BGP process configuration. suboptions: address_family: description: Address Family related configurations. elements: dict suboptions: additional_paths: description: Additional paths configuration. suboptions: install_backup: description: Install backup path. type: bool receive: description: Additional paths Receive capability. type: bool selection: description: Additional paths selection suboptions: route_map: description: Route-map for additional paths selection type: str type: dict send: description: Additional paths Send capability type: bool type: dict advertise_l2vpn_evpn: description: Enable advertising EVPN routes. type: bool advertise_pip: description: Advertise physical ip for type-5 route. type: bool advertise_system_mac: description: Advertise extra EVPN RT-2 with system MAC. type: bool afi: choices: - ipv4 - ipv6 - link-state - vpnv4 - vpnv6 - l2vpn description: Address Family indicator. required: true type: str aggregate_address: description: Configure BGP aggregate prefixes elements: dict suboptions: advertise_map: description: Select attribute information from specific routes. type: str as_set: description: Generate AS-SET information. type: bool attribute_map: description: Set attribute information of aggregate. type: str prefix: description: Aggregate prefix. type: str summary_only: description: Do not advertise more specifics. type: bool suppress_map: description: Conditionally filter more specific routes. type: str type: list allow_vni_in_ethertag: description: Allow VNI in Ethernet Tag field in EVPN route. type: bool client_to_client: description: Configure client-to-client route reflection. suboptions: no_reflection: description: Reflection of routes permitted. type: bool type: dict dampen_igp_metric: description: Dampen IGP metric-related changes. type: int dampening: description: Configure route flap dampening. suboptions: decay_half_life: description: Decay half life. type: int max_suppress_time: description: Maximum suppress time for stable route. type: int route_map: description: Apply route-map to specify dampening criteria. type: str set: description: Set route flap dampening. type: bool start_reuse_route: description: Value to start reusing a route. type: int start_suppress_route: description: Value to start suppressing a route. type: int type: dict default_information: description: Control distribution of default information. suboptions: originate: description: Distribute a default route. type: bool type: dict default_metric: description: Set metric of redistributed routes. type: int distance: description: Configure administrative distance. suboptions: ebgp_routes: description: Distance for EBGP routes. type: int ibgp_routes: description: Distance for IBGP routes. type: int local_routes: description: Distance for local routes. type: int type: dict export_gateway_ip: description: Export Gateway IP to Type-5 EVPN routes for VRF type: bool inject_map: description: Routemap which specifies prefixes to inject. elements: dict suboptions: copy_attributes: description: Copy attributes from aggregate. type: bool exist_map: description: Routemap which specifies exist condition. type: str route_map: description: Route-map name. type: str type: list maximum_paths: description: Forward packets over multipath paths. suboptions: eibgp: description: Configure multipath for both EBGP and IBGP paths. suboptions: parallel_paths: description: Number of parallel paths. type: int type: dict ibgp: description: Configure multipath for IBGP paths. suboptions: parallel_paths: description: Number of parallel paths. type: int type: dict local: description: Configure multipath for local paths. suboptions: parallel_paths: description: Number of parallel paths. type: int type: dict mixed: description: Configure multipath for local and remote paths. suboptions: parallel_paths: description: Number of parallel paths. type: int type: dict parallel_paths: description: Number of parallel paths. type: int type: dict networks: description: Configure an IP prefix to advertise. elements: dict suboptions: prefix: description: IP prefix in CIDR format. type: str route_map: description: Route-map name. type: str type: list nexthop: description: Nexthop tracking. suboptions: route_map: description: Route-map name. type: str trigger_delay: description: Set the delay to trigger nexthop tracking. suboptions: critical_delay: description: - Nexthop changes affecting reachability. - Delay value (miliseconds). type: int non_critical_delay: description: - Other nexthop changes. - Delay value (miliseconds). type: int type: dict type: dict redistribute: description: Configure redistribution. elements: dict suboptions: id: description: - The identifier for the protocol specified. type: str protocol: choices: - am - direct - eigrp - isis - lisp - ospf - ospfv3 - rip - static - hmm description: - The name of the protocol. required: true type: str route_map: description: - The route map policy to constrain redistribution. required: true type: str type: list retain: description: Retain the routes based on Target VPN Extended Communities. suboptions: route_target: description: Specify Target VPN Extended Communities suboptions: retain_all: description: All the routes regardless of Target-VPN community type: bool route_map: description: Apply route-map to filter routes. type: str type: dict type: dict safi: choices: - unicast - multicast - mvpn - evpn description: Sub Address Family indicator. type: str suppress_inactive: description: Advertise only active routes to peers. type: bool table_map: description: - Policy for filtering/modifying OSPF routes before sending them to RIB. suboptions: filter: description: - Block the OSPF routes from being sent to RIB. type: bool name: description: - The Route Map name. required: true type: str type: dict timers: description: Configure bgp related timers. suboptions: bestpath_defer: description: Configure bestpath defer timer value for batch prefix processing. suboptions: defer_time: description: Bestpath defer time (mseconds). type: int maximum_defer_time: description: Maximum bestpath defer time (mseconds). type: int type: dict type: dict vrf: description: Virtual Router Context. type: str wait_igp_convergence: description: Delay initial bestpath until redistributed IGPs have converged. type: bool type: list as_number: description: Autonomous System Number of the router. type: str type: dict running_config: description: - This option is used only with state I(parsed). - The value of this option should be the output received from the NX-OS device by executing the command B(show running-config | section '^router 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. type: str
after: description: The resulting configuration after module execution. returned: when changed sample: 'This output will always be in the same format as the module argspec. ' type: dict before: description: The configuration prior to the module execution. returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) sample: 'This output will always be in the same format as the module argspec. ' type: dict commands: description: The set of commands pushed to the remote device. returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) sample: - router bgp 65536 - address-family ipv4 multicast - nexthop route-map rmap2 type: list gathered: description: Facts about the network resource gathered from the remote device as structured data. returned: when I(state) is C(gathered) sample: 'This output will always be in the same format as the module argspec. ' type: dict parsed: description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. returned: when I(state) is C(parsed) sample: 'This output will always be in the same format as the module argspec. ' type: dict rendered: description: The provided configuration in the task rendered in device-native format (offline). returned: when I(state) is C(rendered) sample: - router bgp 65536 - address-family ipv4 multicast - nexthop route-map rmap2 type: list