dellemc.enterprise_sonic.sonic_port_group 模块 – 管理 SONiC 上的端口组配置。

注意

此模块是 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_port_group

dellemc.enterprise_sonic 2.1.0 中的新功能

概要

  • 此模块为运行 SONiC 的设备提供端口组的配置管理。

参数

参数

注释

config

列表 / 元素=字典

端口组配置的列表。

id

字符串 / 必需

端口组的索引。

speed

字符串

端口组的速度。

这会为端口组的所有成员端口配置速度。

支持的速度取决于交换机的类型。

选项

  • "SPEED_10MB"

  • "SPEED_100MB"

  • "SPEED_1GB"

  • "SPEED_2500MB"

  • "SPEED_5GB"

  • "SPEED_10GB"

  • "SPEED_20GB"

  • "SPEED_25GB"

  • "SPEED_40GB"

  • "SPEED_50GB"

  • "SPEED_100GB"

  • "SPEED_400GB"

state

字符串

模块完成后配置的状态。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

注释

注意

  • 支持 check_mode

示例

#
# Using deleted
#
# Before state:
# -------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           10G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
- name: Configure port group speed
  sonic_port_group:
    config:
      - id: 1
      - id: 10
    state: deleted
#
#
# After state:
# ------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
# Using deleted
#
# Before state:
# -------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           10G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
- name: Configure port group speed
  sonic_port_group:
    config:
      - id:
    state: deleted
#
#
# After state:
# ------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           25G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
# Using merged
#
# Before state:
# -------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           25G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
- name: Configure port group speed
  sonic_port_group:
    config:
      - id: 1
        speed: SPEED_10GB
      - id: 9
        speed: SPEED_10GB
    state: merged
#
#
# After state:
# ------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           10G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
# Using replaced
#
# Before state:
# -------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           10G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           25G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
- name: Replace port group speed
  sonic_port_group:
    config:
      - id: 1
        speed: SPEED_10GB
      - id: 9
        speed: SPEED_10GB
    state: replaced
#
# After state:
# ------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           10G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           10G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#
# Using overridden
#
# Before state:
# -------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           25G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           10G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           10G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           10G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           10G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           10G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           10G
#
- name: Override port group speed
  sonic_port_group:
    config:
      - id: 1
        speed: SPEED_10GB
      - id: 9
        speed: SPEED_10GB
    state: overridden
#
# After state:
# ------------
#
#sonic# show port-group
#-------------------------------------------------------------------------------------
#Port-group  Interface range            Valid speeds      Default Speed Current Speed
#-------------------------------------------------------------------------------------
#1           Ethernet0 - Ethernet3      10G, 25G          25G           10G
#2           Ethernet4 - Ethernet7      10G, 25G          25G           25G
#3           Ethernet8 - Ethernet11     10G, 25G          25G           25G
#4           Ethernet12 - Ethernet15    10G, 25G          25G           25G
#5           Ethernet16 - Ethernet19    10G, 25G          25G           25G
#6           Ethernet20 - Ethernet23    10G, 25G          25G           25G
#7           Ethernet24 - Ethernet27    10G, 25G          25G           25G
#8           Ethernet28 - Ethernet31    10G, 25G          25G           25G
#9           Ethernet32 - Ethernet35    10G, 25G          25G           10G
#10          Ethernet36 - Ethernet39    10G, 25G          25G           25G
#

返回值

常见的返回值记录在此处,以下是此模块独有的字段

描述

after

列表 / 元素=字符串

生成的配置模块调用。

返回: 当更改时

示例: ["返回的配置将始终与上述参数的格式相同。\n"]

after(生成)

列表 / 元素=字符串

生成的配置模块调用。

返回:check_mode

示例: ["返回的配置将始终与上述参数的格式相同。\n"]

before

列表 / 元素=字符串

模块调用之前的配置。

返回: 始终

示例: ["返回的配置将始终与上述参数的格式相同。\n"]

commands

列表 / 元素=字符串

推送到远程设备的命令集。

返回: 始终

示例: ["命令 1", "命令 2", "命令 3"]

作者

    1. Zhang (@mingjunzhang2019)