dellemc.enterprise_sonic.sonic_lldp_interfaces module – Manage Inteface LLDP configurations 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_lldp_interfaces.

New in dellemc.enterprise_sonic 2.1.0

Synopsis

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

  • It is intended for use in conjunction with global LLDP.

Parameters

Parameter

Comments

config

list / elements=dictionary

The set of link layer discovery protocol interface attribute configurations

enable

boolean

This argument is a boolean value to enable or disable LLDP.

This command is supported only on physical interfaces and not on logical interfaces.

Choices:

  • false

  • true

med_tlv_select

dictionary

This command can be used to select whether to advertise the LLDP-MED TLVs or not. By default the LLDP-MED TLVs are advertised.

This command is supported only on physical interfaces and not on logical interfaces.

network_policy

boolean

This command can be used to select whether to advertise network-policy LLDP-MED TLVs or not. By default network-policy LLDP-MED TLVs are advertised.

Choices:

  • false

  • true

power_management

boolean

This command can be used to select whether to advertise power-management LLDP-MED TLVs or not. By default power-management LLDP-MED TLVs are advertised.

Choices:

  • false

  • true

mode

string

By default both transmit and receive of LLDP frames is enabled.

This command can be used to configure either in receive only or transmit only mode.

This command is supported on physical and logical interfaces.

Choices:

  • "receive"

  • "transmit"

name

string / required

Interface name in which LLDP needs to be configured on.

tlv_select

dictionary

This command can be used to select whether to advertise the LLDP 802.3at or bt power management TLVs or not. By default this TLV is advertised.

This command is supported only on physical interfaces and not on logical interfaces.

power_management

boolean

This command can be used to select whether to advertise power-management LLDP TLVs or not. By default power-management LLDP TLVs are advertised.

Choices:

  • false

  • true

tlv_set

dictionary

This command can be used to configure an IPv4 or IPv6 management address that will be used to advertise by LLDP on an interface

This command is supported only on physical interfaces and not on logical interfaces.

ipv4_management_address

string

To configure IPv4 management address for LLDP in A.B.C.D format

ipv6_management_address

string

To configure IPv6 management address for LLDP in A:B::C:D format

state

string

The state specifies the type of configuration update to be performed on the device.

If the state is “merged”, merge specified attributes with existing configured attributes.

For “deleted”, delete the specified attributes from existing configuration.

For “replaced”, replaces lldp interface configuration of the specified interfaces with provided configuration.

For “overridden”, overrides all on-device lldp interface configurations with the provided configuration.

Choices:

  • "merged" ← (default)

  • "deleted"

  • "replaced"

  • "overridden"

Examples

# Using deleted
#
# Before State:
# -------------
# sonic# show running-configuration interface Ethernet 1
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  lldp tlv-set management-address ipv4 10.1.1.2
# sonic#

  - name: Delete LLDP interface configurations
    dellemc.enterprise_sonic.sonic_lldp_interfaces:
      config:
        - name: Ethernet1
          mode: transmit
          tlv_set:
            ipv4_management_address: 10.1.1.2
      state: deleted

# After State:
# ------------
# sonic# show running-configuration interface Ethernet 1
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# sonic#


# Using deleted
#
# Before State:
# -------------
# sonic# show running-configuration interface
# !
# interface Ethernet0
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# !
# sonic#

  - name: Delete default LLDP Interface configurations
    dellemc.enterprise_sonic.sonic_lldp_interfaces:
      config:
        - name: Ethernet1
          tlv_select:
            power-management: true
          med_tlv_select:
            network_policy: true
      state: deleted

# After State:
# ------------
# sonic# show running-configuration interface
# !
# interface Ethernet0
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  no lldp med-tlv-select network-policy
#  no lldp tlv-select power-management
# sonic#


# Using deleted
#
# Before State:
# -------------
# sonic# show running-configuration interface
# !
# interface Ethernet0
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp receive
#  lldp tlv-set management-address ipv4 20.1.1.1
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  lldp tlv-set management-address ipv4 21.1.1.1
# !
# sonic#

  - name: Delete default LLDP Interface configurations
    dellemc.enterprise_sonic.sonic_lldp_interfaces:
      config:
        - name: Ethernet1
      state: deleted

# After State:
# ------------
# sonic# show running-configuration interface
# !
# interface Ethernet0
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp receive
#  lldp tlv-set management-address ipv4 20.1.1.1
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# sonic#


# Using Merged
#
# Before State:
# -------------
# sonic# show running-configuration interface
# !
# interface Ethernet0
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  no lldp enable
# !
# sonic#

  - name: Modify LLDP Interface configurations
    dellemc.enterprise_sonic.sonic_lldp_interfaces:
      config:
        - name: Ethernet1
          enable: true
          mode: transmit
          med_tlv_select:
            power_management: true
          tlv_set:
            ipv4_management_address: 10.1.1.2
      state: merged

# After State:
# ------------
# sonic# show running-configuration interface
# !
# interface Ethernet0
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  lldp tlv-set management-address ipv4 10.1.1.2
# sonic#

# Using replaced
#
# Before State:
# -------------
#
# sonic# show running-configuration interface
# !
# interface Eth1/5
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  lldp tlv-set management-address ipv6 10::1
#  no lldp med-tlv-select network-policy
#  no lldp med-tlv-select power-management
#
# !
# interface Eth1/6
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  no lldp med-tlv-select power-management
#  no lldp tlv-select power-management

  - name: Replace LLDP interface configurations
    dellemc.enterprise_sonic.sonic_lldp_interfaces:
      config:
        - name: Eth1/5
          mode: receive
          tlv_set:
            ipv6_management_address: '30::1'
          med_tlv_select:
            network_policy: False
      state: replaced

# After State:
# ------------
#
# sonic# show running-configuration interface
# !
# interface Eth1/5
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  lldp receive
#  lldp tlv-set management-address ipv6 30::1
#  no lldp med-tlv-select network-policy
# !
# interface Eth1/6
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  no lldp med-tlv-select power-management
#  no lldp tlv-select power-management

# Using overridden
#
# Before State:
# -------------
#
# sonic# show running-configuration interface
# interface Eth1/5
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  lldp tlv-set management-address ipv6 30::2
# !
# interface Eth1/6
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  lldp tlv-set management-address ipv4 40.1.1.1

  - name: Override LLDP interface configurations
    dellemc.enterprise_sonic.sonic_lldp_interfaces:
      config:
        - name: Eth1/5
          mode: receive
          tlv_set:
            ipv4_management_address: '10.1.1.2'
      state: overridden

# After State:
# ------------
#
# sonic# show running-configuration interface
# !
# interface Eth1/5
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown
#  lldp receive
#  lldp tlv-set management-address ipv4 10.1.1.2
# !
# interface Eth1/6
#  mtu 9100
#  speed 10000
#  unreliable-los auto
#  no shutdown

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 module invocation.

Returned: when changed

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

before

list / elements=string

The configuration prior to the module invocation.

Returned: always

Sample: ["The configuration returned will always be in the same format as 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

  • Divya Balasubramanian(@divya-balasubramania)