dellemc.enterprise_sonic.sonic_port_group module – Manages port group configuration on SONiC.

Note

This module is part of the dellemc.enterprise_sonic collection (version 2.5.1).

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_port_group.

New in dellemc.enterprise_sonic 2.1.0

Synopsis

  • This module provides configuration management of port group for devices running SONiC.

Parameters

Parameter

Comments

config

list / elements=dictionary

A list of port group configurations.

id

string / required

The index of the port group.

speed

string

Speed for the port group.

This configures the speed for all the memebr ports of the prot group.

Supported speeds are dependent on the type of switch.

Choices:

  • "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

string

The state of the configuration after module completion.

Choices:

  • "merged" ← (default)

  • "replaced"

  • "overridden"

  • "deleted"

Notes

Note

  • Supports check_mode.

Examples

#
# 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
#

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: ["The configuration returned will always be in the same format as the parameters above.\n"]

after(generated)

list / elements=string

The generated configuration module invocation.

Returned: when check_mode

Sample: ["The configuration returned will always be in the same format as the parameters above.\n"]

before

list / elements=string

The configuration prior to the module invocation.

Returned: always

Sample: ["The configuration returned will always be in the same format as 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

    1. Zhang (@mingjunzhang2019)