dellemc.enterprise_sonic.sonic_br_l2pt module – Manage L2PT configurations on SONiC

Note

This module is part of the dellemc.enterprise_sonic collection (version 3.2.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_br_l2pt.

New in dellemc.enterprise_sonic 3.1.0

Synopsis

  • This module provides configuration management of L2PT parameters in devices running SONiC.

Parameters

Parameter

Comments

config

list / elements=dictionary

A list of L2PT configurations.

bridge_l2pt_params

list / elements=dictionary

VLAN ID list per supported Layer 2 protocol.

protocol

string / required

L2 protocol.

Choices:

  • "LLDP"

  • "LACP"

  • "STP"

  • "CDP"

vlan_ids

list / elements=string

List of VLAN IDs on which the L2 Protocol packets are to be tunneled.

Ranges can be specified in the list of VLAN IDs using the delimiter ‘-’.

name

string / required

Interface name for L2PT configuration.

state

string

The state of the configuration after module completion.

Choices:

  • "merged" ← (default)

  • "deleted"

  • "replaced"

  • "overridden"

Notes

Note

  • Tested against Enterprise SONiC Distribution by Dell Technologies.

  • Supports check_mode.

Examples

# Using "merged" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 10

- name: Modify interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LACP'
            vlan_ids:
              - 10-12
          - protocol: 'CDP'
            vlan_ids:
              - 20
              - 40-60
          - protocol: 'STP'
            vlan_ids:
              - 25-26
    state: merged

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel lldp Vlan 10
#  switchport l2proto-tunnel stp Vlan 25-26


# Using "merged" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel cdp Vlan 20, 40-50
#  switchport l2proto-tunnel lacp Vlan 10-11
#  switchport l2proto-tunnel lldp Vlan 10
#  switchport l2proto-tunnel stp Vlan 25-26

- name: Modify interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LLDP'
            vlan_ids:
              - 12
          - protocol: 'LACP'
            vlan_ids:
              - 12
          - protocol: 'CDP'
            vlan_ids:
              - 20
              - 45-60
          - protocol: 'STP'
            vlan_ids:
              - 20-21
    state: merged

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel lldp Vlan 10,12
#  switchport l2proto-tunnel stp Vlan 20-21,25-26


# Using "deleted" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26

- name: Delete interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LACP'
            vlan_ids:
              - 10-12
    state: deleted

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26


# Using "deleted" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 100
#  switchport l2proto-tunnel stp Vlan 100-150

- name: Delete all interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
    state: deleted

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown


# Using "deleted" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26

- name: Delete L2PT configurations for protocol
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LACP'
          - protocol: 'CDP'
            vlan_ids: []
    state: deleted

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel stp Vlan 25-26


# Using "deleted" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26

- name: Delete interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LACP'
            vlan_ids:
              - 11
          - protocol: 'CDP'
            vlan_ids:
              - 40-50
    state: deleted

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10,12
#  switchport l2proto-tunnel cdp Vlan 20,51-60
#  switchport l2proto-tunnel stp Vlan 25-26


# Using "deleted" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26

- name: Delete L2PT configurations for entire interface
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params: []
      - name: Ethernet8
    state: deleted

# After state:
# ------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown


# Using "replaced" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel stp Vlan 25-26
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 100
#  switchport l2proto-tunnel stp Vlan 100-150

- name: Replace interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LLDP'
            vlan_ids:
              - 10-12
          - protocol: 'LACP'
            vlan_ids:
              - 8
              - 12-14
          - protocol: 'CDP'
            vlan_ids:
              - 20-45
    state: replaced

# After state:
# ------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 10-12
#  switchport l2proto-tunnel lacp Vlan 8,12-14
#  switchport l2proto-tunnel cdp Vlan 20-45
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 100
#  switchport l2proto-tunnel stp Vlan 100-150


# Using "overridden" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 10
#  switchport l2proto-tunnel lacp Vlan 15-50
#  switchport l2proto-tunnel cdp 20
#  switchport l2proto-tunnel stp 25-26
# sonic# show running-configuration interface Ethernet 8
# !
# interface Ethernet8
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel lldp Vlan 100
#  switchport l2proto-tunnel stp Vlan 100-150

- name: Override interface L2PT configurations
  dellemc.enterprise_sonic.sonic_br_l2pt:
    config:
      - name: Ethernet0
        bridge_l2pt_params:
          - protocol: 'LACP'
            vlan_ids:
              - 10-12
          - protocol: 'CDP'
            vlan_ids:
              - 20
              - 40-60
          - protocol: 'STP'
            vlan_ids:
              - 25-26
    state: overridden

# After state:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
#  mtu 9100
#  speed 400000
#  fec RS
#  unreliable-los auto
#  no shutdown
#  switchport l2proto-tunnel cdp Vlan 20,40-60
#  switchport l2proto-tunnel lacp Vlan 10-12
#  switchport l2proto-tunnel stp Vlan 25-26

Return Values

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

Key

Description

after

list / elements=string

The configuration resulting from module invocation.

Returned: when changed

after(generated)

list / elements=string

The configuration that would result from non-check-mode module invocation.

Returned: when check_mode

before

list / elements=string

The configuration prior to the module invocation.

Returned: always

commands

list / elements=string

The set of commands pushed to the remote device. In check_mode the needed commands are displayed, but not pushed to the device.

Returned: always

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

Authors

  • Allen Ting (@allenkting)