dellemc.enterprise_sonic.sonic_l2_interfaces module – Configure interface-to-VLAN association that is based on access or trunk mode
Note
This module is part of the dellemc.enterprise_sonic collection (version 2.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_l2_interfaces
.
New in dellemc.enterprise_sonic 1.0.0
Synopsis
Manages Layer 2 interface attributes of Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
---|---|
A list of Layer 2 interface configurations. |
|
Configures access mode characteristics of the interface. |
|
Configures the specified VLAN in access mode. |
|
Full name of the interface, for example, ‘Eth1/26’. |
|
Configures trunking parameters on an interface. |
|
Specifies a list of allowed trunk mode VLANs and VLAN ranges for the interface. |
|
Configures the specified trunk mode VLAN or VLAN range. |
|
The state that the configuration should be left in. Choices:
|
Notes
Note
Tested against Enterprise SONiC Distribution by Dell Technologies.
Supports
check_mode
.
Examples
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/3
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
- name: Eth1/4
state: deleted
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive
#13 Inactive
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
#
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/3
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
state: deleted
#
# After state:
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive
#13 Inactive
#14 Inactive
#15 Inactive
#
#
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#11 Inactive T Ethernet12
#12 Inactive A Ethernet12
#13 Inactive T Ethernet12
#14 Inactive T Ethernet12
#15 Inactive T Ethernet12
#16 Inactive T Ethernet12
- name: Delete the access vlan and a range of trunk vlans for an interface
sonic_l2_interfaces:
config:
- name: Ethernet12
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13-16
state: deleted
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#11 Inactive T Ethernet12
#12 Inactive
#13 Inactive
#14 Inactive
#15 Inactive
#16 Inactive
#
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
- name: Configures an access vlan for an interface
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 10
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#12 Inactive
#13 Inactive
#14 Inactive
#15 Inactive
#16 Inactive
#18 Inactive
#
- name: Modify the access vlan, add a range of trunk vlans and a single trunk vlan for an interface
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13-16
- vlan: 18
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#12 Inactive A Eth1/3
#13 Inactive T Eth1/3
#14 Inactive T Eth1/3
#15 Inactive T Eth1/3
#16 Inactive T Eth1/3
#18 Inactive T Eth1/3
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13
- vlan: 14
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive A Eth1/3
# A Eth1/4
#13 Inactive T Eth1/3
# T Eth1/4
#14 Inactive A Eth1/3
# A Eth1/5
#15 Inactive T Eth1/5
#
#
# Using replaced
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Ethernet12
# A Ethernet13
#11 Inactive T Ethernet12
# T Ethernet13
- name: Replace access vlan and trunk vlans for specified interfaces
sonic_l2_interfaces:
config:
- name: Ethernet12
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13-14
- name: Ethernet14
access:
vlan: 10
trunk:
allowed_vlans:
- vlan: 11
- vlan: 13-14
state: replaced
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Ethernet13
# A Ethernet14
#11 Inactive T Ethernet13
# T Ethernet14
#12 Inactive A Ethernet12
#13 Inactive T Ethernet12
# T Ethernet14
#14 Inactive T Ethernet12
# T Ethernet14
#
#
# Using overridden
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Ethernet11
#11 Inactive T Ethernet11
#12 Inactive A Ethernet12
#13 Inactive T Ethernet12
- name: Override L2 interfaces configuration in device with provided configuration
sonic_l2_interfaces:
config:
- name: Ethernet13
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13-14
state: overridden
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#12 Inactive A Ethernet13
#13 Inactive T Ethernet13
#14 Inactive T Ethernet13
#
#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: |
|
The configuration prior to the model invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device. Returned: always Sample: |