Skip to content

add code for interface DCBx #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions models/enterprise_sonic/dcbx/deleted_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Using Merged
#
# Before State:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
# no dcbx enable
# no dcbx tlv-select pfc
# no dcbx tlv-select ets-conf
# no dcbx tlv-select ets-reco


- name: Delete and set default DCBx Interface configurations
dellemc.enterprise_sonic.sonic_dcbx:
config:
interfaces:
- name: Ethernet0
enabled: False
pfc_tlv_enabled: False
ets_configuration_tlv_enabled: False
ets_recommendation_tlv_enabled: False
state: deleted

# After State:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
37 changes: 37 additions & 0 deletions models/enterprise_sonic/dcbx/deleted_example_02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Using Merged
#
# Before State:
# -------------
# sonic# show running-configuration interface Ethernet 24
# !
# interface Ethernet24
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
# no dcbx enable
# no dcbx tlv-select pfc
# no dcbx tlv-select ets-conf
# no dcbx tlv-select ets-reco


- name: Delete and set default DCBx Interface configurations
dellemc.enterprise_sonic.sonic_dcbx:
config:
interfaces:
- name: Ethernet0
pfc_tlv_enabled: False
state: deleted

# After State:
# ------------
# sonic# show running-configuration interface Etherneti 24
# !
# interface Ethernet24
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
# no dcbx enable
# no dcbx tlv-select ets-conf
# no dcbx tlv-select ets-reco
21 changes: 21 additions & 0 deletions models/enterprise_sonic/dcbx/deleted_example_03.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Using deleted
#
# Before State:
# -------------
#
# sonic# show running-configuration | grep dcbx
# !
# dcbx enable
# !

- name: Delete DCBX mode configuration
dellemc.enterprise_sonic.sonic_dcbx:
config:
global:
enable: true
state: deleted

# After State:
# ------------
# sonic# show running-configuration | grep dcbx
# sonic#
56 changes: 56 additions & 0 deletions models/enterprise_sonic/dcbx/merged_example_01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Using Merged
#
# Before State:
# -------------
# sonic# show running-configuration interface Ethernet9
# !
# interface Ethernet0
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown

- name: Modify DCBx Interface configurations
dellemc.enterprise_sonic.sonic_dcbx:
config:
-interfaces:
- name: Ethernet0
enabled: False
pfc_tlv_enabled: False
ets_configuration_tlv_enabled: False
ets_recommendation_tlv_enabled: False
state: merged

# After State:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
# no dcbx enable
# no dcbx tlv-select pfc
# no dcbx tlv-select ets-conf
# no dcbx tlv-select ets-reco

# Before State:
# -------------
#
# sonic# show running-configuration | grep dcbx
# sonic#

- name: Modify DCBX configurations
dellemc.enterprise_sonic.sonic_dcbx:
config:
global:
enable: true
state: merged

# After State:
# ------------
# sonic# show running-configuration | grep dcbx
# !
# dcbx enable
# !
37 changes: 37 additions & 0 deletions models/enterprise_sonic/dcbx/merged_example_02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Using Merged
#
# Before State:
# -------------
# sonic# show running-configuration interface Ethernet 0
# !
# interface Ethernet0
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
# no dcbx enable
# no dcbx tlv-select pfc
# no dcbx tlv-select ets-conf
# no dcbx tlv-select ets-reco


- name: Modify DCBx Interface configurations
dellemc.enterprise_sonic.sonic_dcbx:
config:
interfaces:
- name: Ethernet0
enabled: True
pfc_tlv_enabled: True
ets_configuration_tlv_enabled: True
ets_recommendation_tlv_enabled: True
state: deleted

# After State:
# ------------
# sonic# show running-configuration interface Ethernet0
# !
# interface Ethernet0
# mtu 9100
# speed 25000
# unreliable-los auto
# no shutdown
21 changes: 21 additions & 0 deletions models/enterprise_sonic/dcbx/merged_example_03.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Using Merged
#
# Before State:
# -------------
#
# sonic# show running-configuration | grep dcbx
# sonic#

- name: Modify DCBX configurations
dellemc.enterprise_sonic.sonic_dcbx:
config:
global:
enable: true
state: merged

# After State:
# ------------
# sonic# show running-configuration | grep dcbx
# !
# dcbx enable
# !
83 changes: 83 additions & 0 deletions models/enterprise_sonic/dcbx/sonic_dcbx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
GENERATOR_VERSION: '1.0'
ANSIBLE_METADATA: |
{
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community',
'license': 'Apache 2.0'
}
NETWORK_OS: sonic
RESOURCE: dcbx
COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved
DOCUMENTATION: |
module: sonic_dcbx
version_added: '2.1.0'
short_description: Manage DCBx configurations on SONiC
description:
- This module provides configuration management of DCBx parameters
in devices running SONiC.
author: '[email protected]'
options:
config:
description: The set of DCBx attribute configurations
type: dict
suboptions:
global:
description:
- Global DCBx configuration
type: dict
suboptions:
enable:
description:
- This argument is a boolean value to enable or disable DCBx.
type: bool
interfaces:
description:
- Interfaces DCBx configuration
type: list
elements: dict
suboptions:
name:
description:
- Interface name in which DCBx needs to be configured on.
type: str
required: true
enabled:
description:
- This argument is a boolean value to enable or disable DCBx.
By default interface level DCBx is enabled.
- This command is supported only on physical interfaces and not on logical interfaces.
type: bool
pfc_tlv_enabled:
description:
- This command can be used to select whether to advertise and receive PFC TLV.
By default PFC TLV is advertised and received.
type: bool
ets_configuration_tlv_enabled:
description:
- This command can be used to select whether to advertise and receive ETS configuration TLV.
By default ETS configuration TLV is advertised and received.
type: bool
ets_recommendation_tlv_enabled:
description:
- This command can be used to select whether to advertise and receive ETS recommendation TLV.
By default ETS recommendation TLV is advertised and received.
type: bool
state:
description:
- The state specifies the type of configuration update to be performed on the device.
- If the state is "merged", merge specified attributes with existing configured attributes.
- For "deleted", delete the specified attributes from existing configuration.
type: str
choices:
- merged
- deleted
default: merged
EXAMPLES:
- merged_example_01.txt
- merged_example_02.txt
- merged_example_03.txt
- deleted_example_01.txt
- deleted_example_02.txt
- deleted_example_03.txt