dellemc.enterprise_sonic.sonic_vrrp module – Configure VRRP protocol settings on SONiC.

Note

This module is part of the dellemc.enterprise_sonic collection (version 2.5.1).

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_vrrp.

New in dellemc.enterprise_sonic 2.5.0

Synopsis

  • This module provides configuration management of VRRP protocol settings on devices running SONiC

  • Configure interface IP address before configuring VRRP

  • Configure interface VRF forwarding before configuring VRRP in a VRF

Parameters

Parameter

Comments

config

list / elements=dictionary

Specifies the VRRP related configuration.

group

list / elements=dictionary

Defining the VRRP/VRRP6 group

advertisement_interval

integer

Configure advertisement interval (1 to 254)

afi

string / required

VRRP configurations to be set for the interface mentioned in types(VRRP/VRRP6).

Choices:

  • "ipv4"

  • "ipv6"

preempt

boolean

Enable preempt

Choices:

  • false

  • true

priority

integer

Priority for MASTER election (1 to 254)

track_interface

list / elements=dictionary

Configure track interface for priority change.

interface and priority_increment are required together.

interface

string / required

Full name of the Layer 3 interface, i.e. Eth1/1.

priority_increment

integer

Weight for changing priority (1 to 254)

use_v2_checksum

boolean

Enable checksum compatibility with VRRPv2 (Not supported for IPv6).

Choices:

  • false

  • true

version

integer

Configure VRRP Version 2 or 3 (Not supported for IPv6).

Choices:

  • 2

  • 3

virtual_address

list / elements=dictionary

Configure virtual IP Address.

address

string

List of IP addresses to be set.

virtual_router_id

integer / required

VRRP ID (1 to 255)

name

string / required

Full name of the Layer 3 interface, i.e. Eth1/1.

state

string

Specifies the operation to be performed on the VRRP process configured on the device.

In case of merged, the input configuration will be merged with the existing VRRP configuration on the device.

In case of deleted, the existing VRRP configuration will be removed from the device.

In case of overridden, all existing VRRP configuration will be deleted and the specified input configuration will be installed.

In case of replaced, the existing VRRP configuration on the device will be replaced by the configuration in the playbook for each VRRP interface/group configured by the playbook.

Choices:

  • "merged" ← (default)

  • "deleted"

  • "replaced"

  • "overridden"

Examples

# Using deleted
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 1 address-family ipv4
# preempt
# vip 81.1.1.3
# vip 81.1.1.4
# !
# vrrp 10 address-family ipv6
# priority 10
# advertisement-interval 4
# vip 81::3
# vip 81::4
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
# !
# vrrp 5 address-family ipv4
# priority 20
# vip 61.1.1.3
# !
# vrrp 15 address-family ipv4
# priority 20
# preempt
# vip 61.1.1.4
#!
  - name: Delete VRRP and VRRP6 relay configurations
    sonic_vrrp:
      config:
        - name: 'Eth1/1'
          group:
            - virtual_router_id: 1
              afi: ipv4
              virtual_address:
                - address: 81.1.1.4
              preempt: true
            - virtual_router_id: 10
              afi: ipv6
              advertisement_interval: 4
              priority: 10
        - name: 'Eth1/3'
          group:
            - virtual_router_id: 5
              afi: ipv4
              virtual_address:
                - address: 61.1.1.3
              priority: 20
            - virtual_router_id: 15
              afi: ipv4
      state: deleted
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 1 address-family ipv4
# vip 81.1.1.3
# !
# vrrp 10 address-family ipv6
# vip 81::3
# vip 81::4
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
#!

# Using merged
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
#!
  - name: Add VRRP and VRRP6 configurations
    sonic_vrrp:
      config:
        - name: 'Eth1/1'
          group:
            - virtual_router_id: 1
              afi: ipv4
              virtual_address:
                - address: 81.1.1.3
                - address: 81.1.1.4
              preempt: true
            - virtual_router_id: 10
              afi: ipv6
              virtual_address:
                - address: 81::3
                - address: 81::4
              advertisement_interval: 4
              priority: 10
        - name: 'Eth1/3'
          group:
            - virtual_router_id: 5
              afi: ipv4
              virtual_address:
                - address: 61.1.1.3
              priority: 20
            - virtual_router_id: 15
              afi: ipv4
              virtual_address:
                - address: 61.1.1.4
              preempt: true
              priority: 20
      state: merged
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 1 address-family ipv4
# preempt
# vip 81.1.1.3
# vip 81.1.1.4
# !
# vrrp 10 address-family ipv6
# priority 10
# advertisement-interval 4
# vip 81::3
# vip 81::4
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
# !
# vrrp 5 address-family ipv4
# priority 20
# vip 61.1.1.3
# !
# vrrp 15 address-family ipv4
# priority 20
# preempt
# vip 61.1.1.4
#!

# Using replaced
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 1 address-family ipv4
# preempt
# vip 81.1.1.3
# vip 81.1.1.4
# !
# vrrp 10 address-family ipv6
# priority 10
# advertisement-interval 4
# vip 81::3
# vip 81::4
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
# !
# vrrp 5 address-family ipv4
# priority 20
# vip 61.1.1.3
# !
# vrrp 15 address-family ipv4
# priority 20
# preempt
# vip 61.1.1.4
#!
  - name: Replace VRRP and VRRP6 relay configurations
    sonic_vrrp:
      config:
        - name: 'Eth1/1'
          group:
            - virtual_router_id: 10
              afi: ipv6
              priority: 20
        - name: 'Eth1/3'
          group:
            - virtual_router_id: 5
              afi: ipv4
              virtual_address:
                - address: 61.1.1.5
              preempt: false
              track_interface:
                - interface: Eth1/1
                  priority_increment: 10
      state: replaced
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 1 address-family ipv4
# vip 81.1.1.3
# vip 81.1.1.4
# !
# vrrp 10 address-family ipv6
# priority 20
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
# !
# vrrp 5 address-family ipv4
# no preempt
# vip 61.1.1.5
# track-interface Eth1/1 weight 10
# !
# vrrp 15 address-family ipv4
# priority 20
# preempt
# vip 61.1.1.4
#!

# Using overridden
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 1 address-family ipv4
# preempt
# vip 81.1.1.3
# vip 81.1.1.4
# !
# vrrp 10 address-family ipv6
# priority 10
# advertisement-interval 4
# vip 81::3
# vip 81::4
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
# !
# vrrp 5 address-family ipv4
# priority 20
# vip 61.1.1.3
# !
# vrrp 15 address-family ipv4
# priority 20
# preempt
# vip 61.1.1.4
#!
  - name: Overwrite the VRRP and VRRP6 relay configurations
    sonic_vrrp:
      config:
        - name: 'Eth1/1'
          group:
            - virtual_router_id: 15
              afi: ipv4
              virtual_address:
                - address: 81.1.1.15
              preempt: false
        - name: 'Eth1/3'
          group:
            - virtual_router_id: 5
              afi: ipv4
            - virtual_router_id: 15
              afi: ipv4
              virtual_address:
                - address: 61.1.1.5
      state: overridden
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Eth1/1
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 81.1.1.1/24
# ipv6 address 81::1/24
# !
# vrrp 15 address-family ipv4
# no preempt
# vip 81.1.1.15
#!
#interface Eth1/3
# mtu 9100
# speed 400000
# fec RS
# no shutdown
# ip address 61.1.1.1/24
# !
# vrrp 5 address-family ipv4
# !
# vrrp 15 address-family ipv4
# vip 61.1.1.5
#!

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

after

list / elements=string

The resulting configuration model invocation.

Returned: when changed

Sample: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

after(generated)

list / elements=string

The generated configuration model invocation.

Returned: when check_mode

Sample: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

before

list / elements=string

The configuration prior to the model invocation.

Returned: always

Sample: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

commands

list / elements=string

The set of commands pushed to the remote device.

Returned: always

Sample: ["command 1", "command 2", "command 3"]

Authors

  • Santhosh Kumar T(@santhosh-kt)