dellemc.enterprise_sonic.sonic_vlan_mapping module – Configure vlan mappings 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_vlan_mapping.
New in dellemc.enterprise_sonic 2.1.0
Synopsis
- This module provides configuration management for vlan mappings on devices running SONiC.
- Vlan mappings only available on TD3 and TD4 devices.
- For TD4 devices must enable vlan mapping first (can enable in config-switch-resource).
Parameters
Parameter | Comments |
|---|---|
config list / elements=dictionary | Specifies the vlan mapping related configurations. |
|
mapping list / elements=dictionary |
Define vlan mappings. dot1q_tunnel and vlan_translation are mutually exclusive. |
|
dot1q_tunnel dictionary |
Specify a vlan stacking. |
|
priority integer |
Set priority level of the vlan stacking. Priority range is 0-7. |
|
vlan_ids list / elements=string |
Configure customer VLAN IDs. It can pass ranges and/or multiple list entries. Individual VLAN ID or (-) separated range of VLAN IDs. |
|
service_vlan integer / required |
Configure service provider VLAN ID. VLAN ID range is 1-4094. |
|
vlan_translation dictionary added in dellemc.enterprise_sonic 3.0.0 |
Specify a vlan translation. |
|
match_double_tags list / elements=dictionary |
Configure double tagged vlan translation. |
|
inner_vlan integer / required |
Configure inner customer VLAN ID. VLAN ID range is 1-4094. Only available for double tagged translations. |
|
outer_vlan integer / required |
Configure outer customer VLAN ID. VLAN ID range is 1-4094. |
|
priority integer |
Set priority level of the vlan translation. Priority range is 0-7. |
|
match_single_tags list / elements=dictionary |
Configure single tagged vlan translation. |
|
outer_vlan integer / required |
Configure outer customer VLAN ID. VLAN ID range is 1-4094. |
|
priority integer |
Set priority level of the vlan translation. Priority range is 0-7. |
|
multi_tag boolean |
Indicate if there are multiple tags. Choices:
|
|
name string / required |
Full name of the interface, i.e. Ethernet8, PortChannel2, Eth1/2. |
state string | Specifies the operation to be performed on the vlan mappings configured on the device. In case of merged, the input configuration will be merged with the existing vlan mappings on the device. In case of deleted, the existing vlan mapping configuration will be removed from the device. In case of overridden, all existing vlan mappings will be deleted and the specified input configuration will be add. In case of replaced, the existing vlan mappings on the device will be replaced by the configuration for each vlan mapping. Choices:
|
Examples
# # Using "deleted" state # # Before state: # ------------- # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 360-366,392 2755 3 # # - name: Delete dot1q_tunnel configuration # sonic_vlan_mapping: # config: # - name: Ethernet4 # mapping: # - service_vlan: 2755 # dot1q_tunnel: # vlan_ids: # - 392 # - 360-362 # state: deleted # # After state: # ------------ # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 363-366 2755 3 # # Using "deleted" state # # Before state: # ------------- # # sonic# show interface vlan-mappings # Flags: M - Multi-tag # --------------------------------------------------------- # Name Outer Inner Mapped Vlan Priority Flags # --------------------------------------------------------- # Ethernet8 610 600 2567 - - # Ethernet8 611 601 2567 1 - # Ethernet8 612 602 2567 2 - # # - name: Delete vlan translation configuration # sonic_vlan_mapping: # config: # - name: Ethernet8 # mapping: # - service_vlan: 2567 # vlan_translation: # match_double_tags: # - inner_vlan: 602 # outer_vlan: 612 # priority: 2 # state: deleted # # After state: # ------------ # # sonic# show interface vlan-mappings # Flags: M - Multi-tag # --------------------------------------------------------- # Name Outer Inner Mapped Vlan Priority Flags # --------------------------------------------------------- # Ethernet8 610 600 2567 - - # Ethernet8 611 601 2567 1 - # # # Using "merged" state # # Before state: # ------------- # # sonic# show interface vlan-mappings dot1q-tunnel # # - name: Merge dot1q_tunnel configuration # sonic_vlan_mapping: # config: # - name: Ethernet4 # mapping: # - service_vlan: 2755 # dot1q_tunnel: # vlan_ids: # - 392 # - 360-366 # priority: 3 # state: merged # # After state: # ------------ # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 360-366,392 2755 3 # # Using "merged" state # # Before state: # ------------- # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 360-366,392 2755 3 # # - name: Merge vlan translation configuration # sonic_vlan_mapping: # config: # - name: Ethernet8 # mapping: # - service_vlan: 2567 # vlan_translation: # match_double_tags: # - inner_vlan: 600 # outer_vlan: 610 # - inner_vlan: 601 # outer_vlan: 611 # priority: 1 # - inner_vlan: 602 # outer_vlan: 612 # priority: 2 # state: merged # # After state: # ------------ # # sonic# show interface vlan-mappings # Flags: M - Multi-tag # --------------------------------------------------------- # Name Outer Inner Mapped Vlan Priority Flags # --------------------------------------------------------- # Ethernet8 610 600 2567 - - # Ethernet8 611 601 2567 1 - # Ethernet8 612 602 2567 2 - # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 360-366,392 2755 3 # # # Using "replaced" state # # Before state: # ------------- # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 360-366,392 2755 3 # # - name: Replace dot1q_tunnel configuration # sonic_vlan_mapping: # config: # - name: Ethernet4 # mapping: # - service_vlan: 2755 # dot1q_tunnel: # vlan_ids: # - 660-666 # priority: 6 # state: replaced # # After state: # ------------ # # sonic# show interface vlan-mappings dot1q-tunnel # -------------------------------------------------------------------- # Name Vlan dot1q-tunnel Vlan Priority # -------------------------------------------------------------------- # Ethernet4 660-666 2755 6 # # Using "overridden" state # # Before state: # ------------- # # sonic# show interface vlan-mappings # Flags: M - Multi-tag # --------------------------------------------------------- # Name Outer Inner Mapped Vlan Priority Flags # --------------------------------------------------------- # Ethernet8 610 600 2567 - - # Ethernet8 611 601 2567 1 - # Ethernet8 612 602 2567 2 - # # - name: Override vlan translation configuration # sonic_vlan_mapping: # config: # - name: Ethernet8 # mapping: # - service_vlan: 2567 # vlan_translation: # match_double_tags: # - inner_vlan: 701 # outer_vlan: 711 # priority: 5 # - inner_vlan: 702 # outer_vlan: 712 # priority: 6 # state: overridden # # After state: # ------------ # # sonic# show interface vlan-mappings # Flags: M - Multi-tag # --------------------------------------------------------- # Name Outer Inner Mapped Vlan Priority Flags # --------------------------------------------------------- # Ethernet8 711 701 2567 5 - # Ethernet8 712 702 2567 6 - #
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: |
before list / elements=string | The configuration prior to the module invocation. Returned: always Sample: |
commands list / elements=string | The set of commands pushed to the remote device. Returned: always Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/dellemc/enterprise_sonic/sonic_vlan_mapping_module.html