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

network_policy

integer

added in dellemc.enterprise_sonic 3.1.0

Network policy number, range 1-128.

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.

boolean

added in dellemc.enterprise_sonic 3.1.0

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

Choices:

  • false

  • true

max_frame_size

boolean

added in dellemc.enterprise_sonic 3.1.0

This command can be used to select whether to advertise max-frame-size LLDP TLVs or not. By default max-frame-size LLDP TLVs are advertised.

Choices:

  • false

  • true

port_vlan_id

boolean

added in dellemc.enterprise_sonic 3.1.0

This command can be used to select whether to advertise port-vlan-id LLDP TLVs or not. By default port-vlan-id LLDP TLVs are advertised.

Choices:

  • false

  • true

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

vlan_name

boolean

added in dellemc.enterprise_sonic 3.1.0

This command can be used to select whether to advertise vlan-name LLDP TLVs or not. By default vlan-name 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

vlan_name_tlv

dictionary

added in dellemc.enterprise_sonic 3.1.0

This command can be used to configure the vlan list for the Vlan name TLV advertisement.

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

allowed_vlans

list / elements=dictionary

This command can be used to configure the vlan list for the Vlan name TLV advertisement.

Multiple Vlans or Vlan ranges can be configured.

Ranges are specified by a start and end Vlan value separated by hyphen.

Vlans configured should be in the range 1-4094.

vlan

string

Configures the specified VLAN or VLAN range.

max_tlv_count

integer

This command can be used to configure the maximum number of Vlan name TLVs that can be advertised on the interface.

Range is 1-128 and the default value is 10.

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"

Notes

Note

  • Tested against Enterprise SONiC Distribution by Dell Technologies.

  • Supports check_mode.

Examples

# Using "deleted" state
#
# Before state:
# -------------
# sonic# show running-configuration interface Ethernet 1
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  network-policy 1
#  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
        network_policy: 1
        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" state
#
# 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
          port_vlan_id: true
          vlan_name: true
          link_aggregation: true
          max_frame_size: 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
#  no lldp tlv-select port-vlan-id
#  no lldp tlv-select vlan-name
#  no lldp tlv-select link-aggregation
#  no lldp tlv-select max-frame-size
# sonic#


# Using "deleted" state
#
# 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
#  lldp vlan-name-tlv allowed Vlan 10,15-20
#  lldp vlan-name-tlv max-tlv-count 15
# !
# interface Ethernet1
#  mtu 9100
#  speed 25000
#  unreliable-los auto
#  no shutdown
#  lldp transmit
#  lldp tlv-set management-address ipv4 21.1.1.1
#  lldp vlan-name-tlv allowed Vlan 10,15-20
#  lldp vlan-name-tlv max-tlv-count 15
# !
# sonic#

- name: Delete default LLDP Interface configurations
  dellemc.enterprise_sonic.sonic_lldp_interfaces:
    config:
      - name: Ethernet0
        vlan_name_tlv:
          allowed_vlans:
            - vlan: 10
            - vlan: 15-20
          max_tlv_count: 15
      - 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" state
#
# 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
        network_policy: 2
        med_tlv_select:
          power_management: true
        tlv_set:
          ipv4_management_address: 10.1.1.2
        vlan_name_tlv:
          allowed_vlans:
            - vlan: 10
            - vlan: 15-20
          max_tlv_count: 15
    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
#  network-policy 2
#  lldp tlv-set management-address ipv4 10.1.1.2
#  lldp vlan-name-tlv allowed Vlan 10,15-20
#  lldp vlan-name-tlv max-tlv-count 15
# sonic#

# Using "replaced" state
#
# 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
#  lldp vlan-name-tlv allowed Vlan 10,15-20
#  lldp vlan-name-tlv max-tlv-count 15
#
# !
# 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
        vlan_name_tlv:
          allowed_vlans:
            - vlan: 20-30
          max_tlv_count: 20
    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
#  lldp vlan-name-tlv allowed Vlan 20-30
#  lldp vlan-name-tlv max-tlv-count 20
# !
# 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" state
#
# 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'
        vlan_name_tlv:
          allowed_vlans:
            - vlan: 10
            - vlan: 15-20
          max_tlv_count: 15
    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
#  lldp vlan-name-tlv allowed Vlan 10,15-20
#  lldp vlan-name-tlv max-tlv-count 15
# !
# 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"]

after(generated)

list / elements=string

The generated configuration from module 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 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)