dellemc.enterprise_sonic.sonic_bgp_neighbors_af (2.4.0) — module

Manage the BGP neighbor address-family and its parameters

| "added in version" 1.0.0 of dellemc.enterprise_sonic"

Authors: Niraimadaiselvam M (@niraimadaiselvamm)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0


Add to requirements.yml

  collections:
    - name: dellemc.enterprise_sonic
      version: 2.4.0

Description

This module provides configuration management of BGP neighbors address-family parameters on devices running Enterprise SONiC.

bgp_as, vrf_name and neighbors need be created in advance on the device.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 4
# !
# neighbor interface Eth1/3
#  !
#  address-family ipv4 unicast
#   activate
#   allowas-in 4
#   route-map aa in
#   route-map aa out
#   route-reflector-client
#   route-server-client
#   send-community both
#!
#
- name: Deletes neighbors address-family with specific values
  dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
     config:
       - bgp_as: 4
         neighbors:
           - neighbor: Eth1/3
             address_family:
               - afi: ipv4
                 safi: unicast
                 allowas_in:
                   value: 4
                 route_map:
                   - name: aa
                     direction: in
                   - name: aa
                     direction: out
                 route_reflector_client: true
                 route_server_client: true
     state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#!
#router bgp 4
# !
# neighbor interface Eth1/3
#  !
#  address-family ipv4 unicast
#   send-community both
#!


# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 4
# !
# neighbor interface Eth1/3
#  !
#  address-family ipv4 unicast
#   activate
#   allowas-in 4
#   route-map aa in
#   route-map aa out
#   route-reflector-client
#   route-server-client
#   send-community both
#!
# neighbor interface Eth1/5
#  !
#  address-family ipv4 unicast
#   activate
#   allowas-in origin
#   send-community both
#!
#
- name: Deletes neighbors address-family with specific values
  dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
     config:
     state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#!
#router bgp 4
#!


# Using deleted
#
# Before state:
# -------------
#
#!
#router bgp 4
# !
# neighbor interface Eth1/3
#!
#
- name: Merges neighbors address-family with specific values
  dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
     config:
       - bgp_as: 4
         neighbors:
           - neighbor: Eth1/3
             address_family:
               - afi: ipv4
                 safi: unicast
                 allowas_in:
                   value: 4
                 route_map:
                   - name: aa
                     direction: in
                   - name: aa
                     direction: out
                 route_reflector_client: true
                 route_server_client: true
     state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#!
#router bgp 4
# !
# neighbor interface Eth1/3
#  !
#  address-family ipv4 unicast
#   activate
#   allowas-in 4
#   route-map aa in
#   route-map aa out
#   route-reflector-client
#   route-server-client
#   send-community both
#!


# Using merged
#
# Before state:
# -------------
#
# sonic# show running-configuration bgp neighbor vrf default 1.1.1.1
# (No bgp neighbor configuration present)
- name: "Configure BGP neighbor prefix-list attributes"
  dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
    config:
     - bgp_as: 51
       neighbors:
         - neighbor: 1.1.1.1
           address_family:
             - afi: ipv4
               safi: unicast
               ip_afi:
                 default_policy_name: rmap_reg1
                 send_default_route: true
               prefix_limit:
                 max_prefixes: 1
                 prevent_teardown: true
                 warning_threshold: 80
               prefix_list_in: p1
               prefix_list_out: p2
    state: merged
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# After state:
# ------------
#
# sonic# show running-configuration bgp neighbor vrf default 1.1.1.1
# !
# neighbor 1.1.1.1
#  !
#  address-family ipv4 unicast
#   default-originate route-map rmap_reg1
#   prefix-list p1 in
#   prefix-list p2 out
#   send-community both
#   maximum-prefix 1 80 warning-only


# Using deleted
#
# Before state:
# -------------
#
# sonic# show running-configuration bgp neighbor vrf default 1.1.1.1
# !
# neighbor 1.1.1.1
#  !
#  address-family ipv6 unicast
#   default-originate route-map rmap_reg2
#   prefix-list p1 in
#   prefix-list p2 out
#   send-community both
#   maximum-prefix 5 90 restart 2
- name: "Delete BGP neighbor prefix-list attributes"
  dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
    config:
     - bgp_as: 51
       neighbors:
         - neighbor: 1.1.1.1
           address_family:
             - afi: ipv6
               safi: unicast
               ip_afi:
                 default_policy_name: rmap_reg2
                 send_default_route: true
               prefix_limit:
                 max_prefixes: 5
                 warning_threshold: 90
                 restart-timer: 2
               prefix_list_in: p1
               prefix_list_out: p2
    state: deleted

Inputs

    
state:
    choices:
    - merged
    - deleted
    default: merged
    description:
    - Specifies the operation to be performed on the BGP process that is configured on
      the device.
    - In case of merged, the input configuration is merged with the existing BGP configuration
      on the device.
    - In case of deleted, the existing BGP configuration is removed from the device.
    type: str

config:
    description:
    - Specifies the BGP neighbors address-family related configuration.
    elements: dict
    suboptions:
      bgp_as:
        description:
        - Specifies the BGP autonomous system (AS) number which is already configured
          on the device.
        required: true
        type: str
      neighbors:
        description:
        - Specifies BGP neighbor related configurations in address-family configuration
          mode.
        elements: dict
        suboptions:
          address_family:
            description:
            - Specifies BGP address-family related configurations.
            - afi and safi are required together.
            elements: dict
            suboptions:
              activate:
                description:
                - Enables the address-family for this neighbor.
                type: bool
              afi:
                choices:
                - ipv4
                - ipv6
                - l2vpn
                description:
                - Type of address-family to configure.
                required: true
                type: str
              allowas_in:
                description:
                - Specifies the allowas in values.
                suboptions:
                  origin:
                    description:
                    - Specifies the origin value.
                    type: bool
                  value:
                    description:
                    - Specifies the value of the allowas in.
                    type: int
                type: dict
              ip_afi:
                description:
                - Common configuration attributes for IPv4 and IPv6 unicast address families.
                suboptions:
                  default_policy_name:
                    description:
                    - Specifies routing policy definition.
                    type: str
                  send_default_route:
                    default: false
                    description:
                    - Enable or disable sending of default-route to the neighbor.
                    type: bool
                type: dict
              prefix_limit:
                description:
                - Specifies prefix limit attributes for ipv4-unicast and ipv6-unicast.
                suboptions:
                  max_prefixes:
                    description:
                    - Maximum number of prefixes that will be accepted from the neighbor.
                    type: int
                  prevent_teardown:
                    default: false
                    description:
                    - Enable or disable teardown of BGP session when maximum prefix limit
                      is exceeded.
                    type: bool
                  restart_timer:
                    description:
                    - Time interval in seconds after which the BGP session is re-established
                      after being torn down.
                    type: int
                  warning_threshold:
                    description:
                    - Threshold on number of prefixes that can be received from a neighbor
                      before generation of warning messages.
                    - Expressed as a percentage of max-prefixes.
                    type: int
                type: dict
              prefix_list_in:
                description:
                - Inbound route filtering policy for a neighbor.
                type: str
              prefix_list_out:
                description:
                - Outbound route filtering policy for a neighbor.
                type: str
              route_map:
                description:
                - Specifies the route-map.
                elements: dict
                suboptions:
                  direction:
                    description:
                    - Specifies the direction of the route-map.
                    type: str
                  name:
                    description:
                    - Specifies the name of the route-map.
                    type: str
                type: list
              route_reflector_client:
                description:
                - Specifies a neighbor as a route-reflector client.
                type: bool
              route_server_client:
                description:
                - Specifies a neighbor as a route-server client.
                type: bool
              safi:
                choices:
                - unicast
                - evpn
                default: unicast
                description:
                - Specifies the type of cast for the address-family.
                type: str
            type: list
          neighbor:
            description:
            - Neighbor router address which is already configured on the device.
            required: true
            type: str
        type: list
      vrf_name:
        default: default
        description:
        - Specifies the VRF name which is already configured on the device.
        type: str
    type: list

Outputs

after:
  description: The resulting configuration model invocation.
  returned: when changed
  sample: 'The configuration returned is always in the same format of the parameters
    above.

    '
  type: list
before:
  description: The configuration prior to the model invocation.
  returned: always
  sample: 'The configuration returned is always in the same format of the parameters
    above.

    '
  type: list
commands:
  description: The set of commands pushed to the remote device.
  returned: always
  sample:
  - command 1
  - command 2
  - command 3
  type: list