dellemc.enterprise_sonic.sonic_vlan_mapping 模块 – 在 SONiC 上配置 VLAN 映射。
注意
此模块是 dellemc.enterprise_sonic 集合 (版本 2.5.1) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install dellemc.enterprise_sonic
。
要在 playbook 中使用它,请指定: dellemc.enterprise_sonic.sonic_vlan_mapping
。
dellemc.enterprise_sonic 2.1.0 中的新增功能
概要
此模块提供对运行 SONiC 的设备上的 VLAN 映射的配置管理。
VLAN 映射仅在 TD3 和 TD4 设备上可用。
对于 TD4 设备,必须首先启用 VLAN 映射(可以在 config-switch-resource 中启用)。
参数
参数 |
注释 |
---|---|
指定与 VLAN 映射相关的配置。 |
|
定义单个 VLAN 映射。 |
|
指定它是 VLAN 堆叠还是转换(false 表示转换;true 表示堆叠)。 选项
|
|
配置内部客户 VLAN ID。 VLAN ID 范围是 1-4094。 仅适用于双标记转换。 |
|
设置 VLAN 映射的优先级。 优先级范围是 0-7。 |
|
配置服务提供商 VLAN ID。 VLAN ID 范围是 1-4094。 |
|
配置客户 VLAN ID。 如果模式是双标记转换,则此 VLAN ID 表示外部 VLAN ID。 如果模式设置为堆叠,则可以传递范围和/或多个列表条目。 单个 VLAN ID 或 (-) 分隔的 VLAN ID 范围。 |
|
接口的全名,例如 Ethernet8、PortChannel2、Eth1/2。 |
|
指定要在设备上配置的 VLAN 映射上执行的操作。 如果为 merged,则输入配置将与设备上现有的 VLAN 映射合并。 如果为 deleted,则将从设备中删除现有的 VLAN 映射配置。 如果为 overridden,则所有现有的 VLAN 映射都将被删除,并将添加指定的输入配置。 如果为 replaced,则设备上现有的 VLAN 映射将被每个 VLAN 映射的配置替换。 选项
|
示例
# Using deleted
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
# switchport vlan-mapping 392 inner 590 2755
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,404,406,408,410,412,420,422,430-432 dot1q-tunnel 2436 priority 3
# switchport vlan-mapping 300 dot1q-tunnel 2567 priority 3
#!
- name: Delete vlan mapping configurations
sonic_vlan_mapping:
config:
- name: Ethernet8
mapping:
- service_vlan: 2755
- name: Ethernet16
mapping:
- service_vlan: 2567
priority: 3
- service_vlan: 2436
vlan_ids:
- 404
- 401
- 412
- 430-431
priority: 3
state: deleted
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400,402,406,408,410,420,422,432 dot1q-tunnel 2436
# switchport vlan-mapping 300 dot1q-tunnel 2567
#!
# Using deleted
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
# switchport vlan-mapping 392 inner 590 2755
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,404,406,408,410,412,420,422,430-431 dot1q-tunnel 2436
# switchport vlan-mapping 300 dot1q-tunnel 2567 priority 3
#!
- name: Delete vlan mapping configurations
sonic_vlan_mapping:
config:
- name: Ethernet8
- name: Ethernet16
mapping:
- service_vlan: 2567
state: deleted
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdo#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,406,408,410,420,422,431 dot1q-tunnel 2436
#!
# Using merged
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
#!
#interface PortChannel 2
# switchport vlan-mapping 345 2999 priority 0
# switchport vlan-mapping 500,540 dot1q-tunnel 3000
# no shutdown
#!
- name: Add vlan mapping configurations
sonic_vlan_mapping:
config:
- name: Ethernet8
mapping:
- service_vlan: 2755
vlan_ids:
- 392
dot1q_tunnel: false
inner_vlan: 590
- name: Ethernet16
mapping:
- service_vlan: 2567
vlan_ids:
- 300
dot1q_tunnel: true
priority: 3
- service_vlan: 2436
vlan_ids:
- 400-402
- 404
- 406
- 408
- 410
- 412
- 420
- 422
- 430-431
dot1q_tunnel: true
- name: Portchannel 2
mapping:
- service_vlan: 2999
priority: 4
- service_vlan: 3000
vlan_ids:
- 506-512
- 561
priority: 5
state: merged
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
# switchport vlan-mapping 392 inner 590 2755
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,404,406,408,410,412,420,422,430-431 dot1q-tunnel 2436
# switchport vlan-mapping 300 dot1q-tunnel 2567 priority 3
#!
#interface PortChannel 2
# switchport vlan-mapping 345 2999 priority 4
# switchport vlan-mapping 500,506-512,540,561 dot1q-tunnel 3000 priority 5
# no shutdown
#!
# Using replaced
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
# switchport vlan-mapping 392 inner 590 2755
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,404,406,408,410,412,420,422,430-431 dot1q-tunnel 2436
# switchport vlan-mapping 300 dot1q-tunnel 2567 priority 3
#!
#interface PortChannel 2
# switchport vlan-mapping 345 2999 priority 0
# no shutdown
#!
- name: Replace vlan mapping configurations
sonic_vlan_mapping:
config:
- name: Ethernet8
mapping:
- service_vlan: 2755
vlan_ids:
- 390
dot1q_tunnel: false
inner_vlan: 593
- name: Ethernet16
mapping:
- service_vlan: 2567
vlan_ids:
- 310
- 330-340
priority: 5
- name: Portchannel 2
mapping:
- service_vlan: 2999
vlan_ids:
- 345
dot1q_tunnel: true
priority: 1
state: replaced
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
# switchport vlan-mapping 390 inner 593 2755
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,404,406,408,410,412,420,422,430-431 dot1q-tunnel 2436
# switchport vlan-mapping 310,330-340 dot1q-tunnel 2567 priority 5
#!
#interface PortChannel 2
# switchport vlan-mapping 345 dot1q_tunnel 2999 priority 1
# no shutdown
#!
# Using overridden
#
# Before State:
# -------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 623 2411
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 400-402,404,406,408,410,412,420,422,430-431 dot1q-tunnel 2436
#!
- name: Override the vlan mapping configurations
sonic_vlan_mapping:
config:
- name: Ethernet8
mapping:
- service_vlan: 2755
vlan_ids:
- 392
dot1q_tunnel: false
inner_vlan: 590
- name: Ethernet16
mapping:
- service_vlan: 2567
vlan_ids:
- 300
dot1q_tunnel: true
priority: 3
- name: Portchannel 2
mapping:
- service_vlan: 2999
vlan_ids:
- 345
priority: 0
state: overridden
# After State:
# ------------
#
#sonic# show running-configuration interface
#!
#interface Ethernet8
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 392 inner 590 2755
#!
#interface Ethernet16
# mtu 9100
# speed 400000
# fec RS
# unreliable-los auto
# shutdown
# switchport vlan-mapping 300 dot1q-tunnel 2567 priority 3
#!
#interface PortChannel 2
# switchport vlan-mapping 345 2999 priority 0
# no shutdown
#!
返回值
常见的返回值在 此处 有记录,以下是此模块独有的字段
键 |
描述 |
---|---|
模块调用后的结果配置。 返回:发生更改时 示例: |
|
模块调用之前的配置。 返回:始终返回 示例: |
|
推送到远程设备的命令集。 返回:始终返回 示例: |