On this page
dellemc.enterprise_sonic.sonic_bgp_neighbors – Manage a BGP neighbor and its parameters
Note
This plugin is part of the dellemc.enterprise_sonic collection (version 1.1.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install dellemc.enterprise_sonic.
To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_bgp_neighbors.
New in version 1.0.0: of dellemc.enterprise_sonic
Synopsis
- This module provides configuration management of global BGP_NEIGHBORS parameters on devices running Enterprise SONiC.
 - bgp_as and vrf_name must be created on the device in advance.
 
Note
This module has a corresponding action plugin.
Parameters
| Parameter | Choices/Defaults | Comments | |||||
|---|---|---|---|---|---|---|---|
| config
        
        list / elements=dictionary
         | 
      
        
        Specifies the BGP neighbors related configuration.
         | 
     ||||||
| bgp_as
        
        string / required
         | 
      
        
        Specifies the BGP autonomous system (AS) number which is already configured on the device.
         | 
     ||||||
| neighbors
        
        list / elements=dictionary
         | 
      
        
        Specifies BGP neighbor-related configurations.
         | 
     ||||||
| advertisement_interval
        
        integer
         | 
      
        
        Specifies the minimum interval between sending BGP routing updates.
        
       
        The range is from 0 to 600.
         | 
     ||||||
| bfd
        
        boolean
         | 
      
       
  | 
      
        
        Enables or disables BFD.
         | 
     |||||
| capability
        
        dictionary
         | 
      
        
        Specifies capability attributes to this neighbor.
         | 
     ||||||
| dynamic
        
        boolean
         | 
      
       
  | 
      
        
        Enables or disables dynamic capability to this neighbor.
         | 
     |||||
| extended_nexthop
        
        boolean
         | 
      
       
  | 
      
        
        Enables or disables advertise extended next-hop capability to the peer.
         | 
     |||||
| neighbor
        
        string / required
         | 
      
        
        Neighbor router address.
         | 
     ||||||
| peer_group
        
        string
         | 
      
        
        The name of the peer group that the neighbor is a member of.
         | 
     ||||||
| remote_as
        
        dictionary
         | 
      
        
        Remote AS of the BGP neighbor to configure.
        
       
        peer_as and peer_type are mutually exclusive.
         | 
     ||||||
| peer_as
        
        integer
         | 
      
        
        Specifies remote AS number.
        
       
        The range is from 1 to 4294967295.
         | 
     ||||||
| peer_type
        
        string
         | 
      
       
  | 
      
        
        Specifies the type of BGP peer.
         | 
     |||||
| timers
        
        dictionary
         | 
      
        
        Specifies BGP neighbor timer-related configurations.
         | 
     ||||||
| holdtime
        
        integer
         | 
      
        
        Interval after not receiving a keepalive message that SONiC declares a peer dead, in seconds.
        
       
        The range is from 0 to 65535.
         | 
     ||||||
| keepalive
        
        integer
         | 
      
        
        Frequency with which the device sends keepalive messages to its peer, in seconds.
        
       
        The range is from 0 to 65535.
         | 
     ||||||
| peer_group
        
        list / elements=dictionary
         | 
      
        
        Specifies the list of peer groups.
         | 
     ||||||
| address_family
        
        dictionary
         | 
      
        
        Holds of list of address families associated to the peergroup.
         | 
     ||||||
| afis
        
        list / elements=dictionary
         | 
      
        
        List of address families with afi, safi, activate and allowas-in parameters.
        
       
        afi and safi are required together.
         | 
     ||||||
| activate
        
        boolean
         | 
      
       
  | 
      
        
        Enable or disable activate.
         | 
     |||||
| afi
        
        string
         | 
      
       
  | 
      
        
        Holds afi mode.
         | 
     |||||
| allowas_in
        
        dictionary
         | 
      
        
        Holds AS value.
        
       
        The origin and value are mutually exclusive.
         | 
     ||||||
| origin
        
        boolean
         | 
      
       
  | 
      
        
        Set AS as the origin.
         | 
     |||||
| value
        
        integer
         | 
      
        
        Holds AS number in the range 1-10.
         | 
     ||||||
| safi
        
        string
         | 
      
       
  | 
      
        
        Holds safi mode.
         | 
     |||||
| advertisement_interval
        
        integer
         | 
      
        
        Specifies the minimum interval between sending BGP routing updates.
        
       
        The range is from 0 to 600.
         | 
     ||||||
| bfd
        
        boolean
         | 
      
       
  | 
      
        
        Enables or disables BFD.
         | 
     |||||
| capability
        
        dictionary
         | 
      
        
        Specifies capability attributes to this peer group.
         | 
     ||||||
| dynamic
        
        boolean
         | 
      
       
  | 
      
        
        Enables or disables dynamic capability to this peer group.
         | 
     |||||
| extended_nexthop
        
        boolean
         | 
      
       
  | 
      
        
        Enables or disables advertise extended next-hop capability to the peer.
         | 
     |||||
| name
        
        string / required
         | 
      
        
        Name of the peer group.
         | 
     ||||||
| remote_as
        
        dictionary
         | 
      
        
        Remote AS of the BGP peer group to configure.
        
       
        peer_as and peer_type are mutually exclusive.
         | 
     ||||||
| peer_as
        
        integer
         | 
      
        
        Specifies remote AS number.
        
       
        The range is from 1 to 4294967295.
         | 
     ||||||
| peer_type
        
        string
         | 
      
       
  | 
      
        
        Specifies the type of BGP peer.
         | 
     |||||
| timers
        
        dictionary
         | 
      
        
        Specifies BGP peer group timer related configurations.
         | 
     ||||||
| holdtime
        
        integer
         | 
      
        
        Interval after not receiving a keepalive message that Enterprise SONiC declares a peer dead, in seconds.
        
       
        The range is from 0 to 65535.
         | 
     ||||||
| keepalive
        
        integer
         | 
      
        
        Frequency with which the device sends keepalive messages to its peer, in seconds.
        
       
        The range is from 0 to 65535.
         | 
     ||||||
| vrf_name
        
        string
         | 
      Default: 
        "default"
         | 
      
        
        Specifies the VRF name which is already configured on the device.
         | 
     |||||
| state
        
        string
         | 
      
       
  | 
      
        
        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.
         | 
     |||||
Notes
Note
- Tested against Enterprise SONiC Distribution by Dell Technologies.
 - Supports 
check_mode. 
Examples
# Using deleted
#
# Before state:
# -------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# neighbor interface Eth1/3
#!
#router bgp 11
# network import-check
# timers 60 180
# !
# neighbor 192.168.1.4
# !
# peer-group SP1
#  bfd
#  capability dynamic
# !
# peer-group SP2
# !
#
- name: Deletes all BGP neighbors
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
    state: deleted
#
# After state:
# -------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
#!
#router bgp 11
# network import-check
# timers 60 180
# !
#
# Using merged
#
# Before state:
# ------------
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
#!
#router bgp 11
# network import-check
# timers 60 180
# !
- name: "Adds sonic_bgp_neighbors"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       vrf_name: VrfReg1
       peer_group:
         - name: SPINE
           bfd: true
           capability:
             dynamic: true
             extended_nexthop: true
           remote_as:
             peer_as: 4
           address_family:
             afis:
               - afi: ipv4
                 safi: unicast
                 activate: true
                 allowas_in:
                   origin: true
               - afi: ipv6
                 safi: unicast
                 activate: true
                 allowas_in:
                   value: 5
       neighbors:
         - neighbor: Eth1/3
           remote_as:
             peer_as: 10
           peer_group: SPINE
           advertisement_interval: 15
           timers:
             keepalive: 30
             holdtime: 15
           bfd: true
           capability:
             dynamic: true
             extended_nexthop: true
         - neighbor: 192.168.1.4
    state: merged
#
# After state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  remote-as 4
#  bfd
#  capability dynamic
#  capability extended-nexthop
#  address-family ipv4 unicast
#   activate
#   allowas-in origin
#   send-community both
# !
#  address-family ipv6 unicast
#   activate
#   allowas-in 5
#   send-community both
# !
# neighbor interface Eth1/3
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 11
# network import-check
# timers 60 180
#
# Using deleted
#
# Before state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
# !
# neighbor interface Eth1/3
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
#!
#router bgp 11
# network import-check
# timers 60 18
# !
# peer-group SP
# !
# neighbor interface Eth1/3
#
- name: "Deletes sonic_bgp_neighbors and peer-groups specific to vrfname"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       vrf_name: VrfReg1
    state: deleted
# After state:
# ------------
#!
#router bgp 11 vrf VrfCheck2
# network import-check
# timers 60 180
#!
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
#router bgp 11
# network import-check
# timers 60 18
# !
# peer-group SP
# !
# neighbor interface Eth1/3
#
# Using deleted
#
# Before state:
# -------------
#
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
#  bfd
#  remote-as 4
# !
# neighbor interface Eth1/3
#  peer-group SPINE
#  remote-as 10
#  timers 15 30
#  advertisement-interval 15
#  bfd
#  capability extended-nexthop
#  capability dynamic
# !
# neighbor 192.168.1.4
# !
- name: "Deletes specific sonic_bgp_neighbors"
  dellemc.enterprise_sonic.sonic_bgp_neighbors:
    config:
     - bgp_as: 51
       vrf_name: VrfReg1
       peer_group:
         - name: SPINE
           bfd: true
           remote_as:
             peer_as: 4
       neighbors:
         - neighbor: Eth1/3
           remote_as:
             peer_as: 10
           peer_group: SPINE
           advertisement_interval: 15
           timers:
             keepalive: 30
             holdtime: 15
           bfd: true
           capability:
             dynamic: true
             extended_nexthop: true
         - neighbor: 192.168.1.4
    state: deleted
#
# After state:
# -------------
#
#router bgp 51 vrf VrfReg1
# network import-check
# timers 60 180
# !
# peer-group SPINE
# !
# neighbor interface Eth1/3
# !
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| after
        
        list / elements=string
         | 
      when changed | 
        
        The resulting configuration model invocation.
         Sample:
        
       
        The configuration returned is always in the same format of the parameters above.
         | 
     
| before
        
        list / elements=string
         | 
      always | 
        
        The configuration prior to the model invocation.
         Sample:
        
       
        The configuration returned is always in the same format of the parameters above.
         | 
     
| commands
        
        list / elements=string
         | 
      always | 
        
        The set of commands pushed to the remote device.
         Sample:
        
       
        ['command 1', 'command 2', 'command 3']
         | 
     
Authors
- Abirami N (@abirami-n)
 
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/latest/collections/dellemc/enterprise_sonic/sonic_bgp_neighbors_module.html