dellemc.enterprise_sonic.sonic_vlans module – Manage VLAN and its parameters

Note

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

New in dellemc.enterprise_sonic 1.0.0

Synopsis

  • This module provides configuration management of VLANs parameters on devices running Enterprise SONiC Distribution by Dell Technologies.

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

config

list / elements=dictionary

A dictionary of VLAN options.

description

string

Description about the VLAN.

vlan_id

integer / required

ID of the VLAN

Range is 1 to 4094

state

string

The state that the configuration should be left in.

Choices:

  • "merged" ← (default)

  • "deleted"

Notes

Note

  • Tested against Enterprise SONiC Distribution by Dell Technologies.

  • Supports check_mode.

Examples

# Using merged

# Before state:
# -------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#30         Inactive
#
#sonic#
#


- name: Merges given VLAN attributes with the device configuration
  dellemc.enterprise_sonic.sonic_vlans:
    config:
      - vlan_id: 10
        description: "Internal"
    state: merged

# After state:
# ------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#30         Inactive
#
#sonic#
#
#sonic# show interface Vlan 10
#Description: Internal
#Vlan10 is up
#Mode of IPV4 address assignment: not-set
#Mode of IPV6 address assignment: not-set
#IP MTU 6000 bytes
#sonic#
#


# Using deleted

# Before state:
# -------------
#
#sonic# show interface Vlan 70
#Description: Internal
#Vlan70 is up
#Mode of IPV4 address assignment: not-set
#Mode of IPV6 address assignment: not-set
#IP MTU 6000 bytes

- name: Deletes attributes of the given VLANs
  dellemc.enterprise_sonic.sonic_vlans:
    config:
      - vlan_id: 70
        description: "Internal"
    state: deleted

# After state:
# ------------
#
#sonic# show interface Vlan 70
#Vlan70 is up
#Mode of IPV4 address assignment: not-set
#Mode of IPV6 address assignment: not-set
#IP MTU 6000 bytes

# Before state:
# -------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#20         Inactive
#
#sonic#

- name: Deletes attributes of the given VLANs
  dellemc.enterprise_sonic.sonic_vlans:
    config:
      - vlan_id: 20
    state: deleted

# After state:
# ------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#
#sonic#


# Using deleted

# Before state:
# -------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#10         Inactive
#20         Inactive
#30         Inactive
#
#sonic#

- name: Deletes all the VLANs on the switch
  dellemc.enterprise_sonic.sonic_vlans:
    config:
    state: deleted

# After state:
# ------------
#
#sonic# show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM        Status      Q Ports
#
#sonic#

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 is always in the same format of the parameters above.\n"]

before

list / elements=string

The configuration prior to the model invocation.

Returned: always

Sample: ["The configuration that is returned is always 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

  • Mohamed Javeed (@javeedf)