From 53603dae9c2b6759e2f4e7f4d470550e20c3a18c Mon Sep 17 00:00:00 2001 From: Allen Ting Date: Tue, 11 Mar 2025 17:19:57 +0000 Subject: [PATCH 01/14] bridge l2pt model definition --- .../br_l2pt/deleted_example_01.txt | 38 ++++++++ .../br_l2pt/deleted_example_02.txt | 50 ++++++++++ .../br_l2pt/deleted_example_03.txt | 39 ++++++++ .../br_l2pt/deleted_example_04.txt | 42 +++++++++ .../br_l2pt/merged_example_01.txt | 45 +++++++++ .../br_l2pt/merged_example_02.txt | 51 +++++++++++ .../br_l2pt/overridden_example_01.txt | 57 ++++++++++++ .../br_l2pt/replaced_example_01.txt | 66 ++++++++++++++ .../br_l2pt/sonic_br_l2pt.yaml | 91 +++++++++++++++++++ 9 files changed, 479 insertions(+) create mode 100644 models/enterprise_sonic/br_l2pt/deleted_example_01.txt create mode 100644 models/enterprise_sonic/br_l2pt/deleted_example_02.txt create mode 100644 models/enterprise_sonic/br_l2pt/deleted_example_03.txt create mode 100644 models/enterprise_sonic/br_l2pt/deleted_example_04.txt create mode 100644 models/enterprise_sonic/br_l2pt/merged_example_01.txt create mode 100644 models/enterprise_sonic/br_l2pt/merged_example_02.txt create mode 100644 models/enterprise_sonic/br_l2pt/overridden_example_01.txt create mode 100644 models/enterprise_sonic/br_l2pt/replaced_example_01.txt create mode 100644 models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_01.txt b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt new file mode 100644 index 00000000..3a2e1b54 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt @@ -0,0 +1,38 @@ +# Using Deleted +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 + + - name: Delete interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LACP: + vlan_ids: + - 10-12 + state: deleted + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_02.txt b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt new file mode 100644 index 00000000..766e9cd8 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt @@ -0,0 +1,50 @@ +# Using Deleted +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 100 +# switchport l2proto-tunnel stp Vlan 100-150 + + + - name: Delete all interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + state: deleted + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt new file mode 100644 index 00000000..b4c428e6 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt @@ -0,0 +1,39 @@ +# Using Deleted +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 + + - name: Delete interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LACP: + vlan_ids: + - 10-12 + CDP + vlan_ids: + state: deleted + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_04.txt b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt new file mode 100644 index 00000000..2ba4677d --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt @@ -0,0 +1,42 @@ +# Using Deleted +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 + + - name: Delete interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LACP: + vlan_ids: + - 11 + CDP + vlan_ids: + - 40-50 + state: deleted + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10,12 +# switchport l2proto-tunnel cdp Vlan 20,51-60 +# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/merged_example_01.txt b/models/enterprise_sonic/br_l2pt/merged_example_01.txt new file mode 100644 index 00000000..84ea8820 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/merged_example_01.txt @@ -0,0 +1,45 @@ +# Using Merged +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 10 + + - name: Modify interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LACP: + vlan_ids: + - 10-12 + CDP: + vlan_ids: + - 20 + - 40-60 + STP: + vlan_ids: + - 25-26 + state: merged + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel lldp Vlan 10 +# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/merged_example_02.txt b/models/enterprise_sonic/br_l2pt/merged_example_02.txt new file mode 100644 index 00000000..c37924cf --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/merged_example_02.txt @@ -0,0 +1,51 @@ +# Using Merged +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel cdp Vlan 20, 40-50 +# switchport l2proto-tunnel lacp Vlan 10-11 +# switchport l2proto-tunnel lldp Vlan 10 +# switchport l2proto-tunnel stp Vlan 25-26 + + - name: Modify interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LLDP: + vlan_ids: + - 12 + LACP: + vlan_ids: + - 12 + CDP: + vlan_ids: + - 20 + - 45-60 + STP: + vlan_ids: + - 20-21 + state: merged + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel lldp Vlan 10,12 +# switchport l2proto-tunnel stp Vlan 20-21,25-26 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/overridden_example_01.txt b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt new file mode 100644 index 00000000..e1ab6eca --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt @@ -0,0 +1,57 @@ +# Using Overridden +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 10 +# switchport l2proto-tunnel lacp Vlan 15-50 +# switchport l2proto-tunnel cdp 20 +# switchport l2proto-tunnel stp 25-26 +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 100 +# switchport l2proto-tunnel stp Vlan 100-150 + + - name: Modify interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LACP: + vlan_ids: + - 10-12 + CDP: + vlan_ids: + - 20 + - 40-60 + STP: + vlan_ids: + - 25-26 + state: overridden + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/replaced_example_01.txt b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt new file mode 100644 index 00000000..5fe24e8c --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt @@ -0,0 +1,66 @@ +# Using Replaced +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 100 +# switchport l2proto-tunnel stp Vlan 100-150 + + - name: Replace interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + protocol: + LLDP: + vlan_ids: + - 10-12 + LACP: + vlan_ids: + - 8 + - 12-14 + CDP: + vlan_ids: + - 20-45 + state: replaced + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 10-12 +# switchport l2proto-tunnel lacp Vlan 8,12-14 +# switchport l2proto-tunnel cdp Vlan 20-45 +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lldp Vlan 100 +# switchport l2proto-tunnel stp Vlan 100-150 \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml new file mode 100644 index 00000000..abf3539c --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml @@ -0,0 +1,91 @@ +GENERATOR_VERSION: '1.0' +ANSIBLE_METADATA: | + { + 'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community', + 'license': 'Apache 2.0' + } +NETWORK_OS: sonic +RESOURCE: br_l2pt +COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved +DOCUMENTATION: | + module: sonic_br_l2pt + version_added: '2.1.0' + short_description: Manage L2PT configurations on SONiC + description: + - This module provides configuration management of L2PT parameters + in devices running SONiC. + author: 'allen.ting@dell.com' + options: + config: + description: A list of L2PT configurations. + type: list + elements: dict + suboptions: + name: + description: Interface name for L2PT configuration. + type: str + required: true + protocol: + description: + - This defines which protocol to be used for tunneling L2 Protocol packets. + type: dict + suboptions: + LLDP: + description: Configuration for the LLDP protocol + type: dict + suboptions: + vlan_ids: + description: + - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + type: list + elements: str + LACP: + description: Configuration for the LACP protocol + type: dict + suboptions: + vlan_ids: + description: + - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + type: list + elements: str + STP: + description: Configuration for the STP protocol + type: dict + suboptions: + vlan_ids: + description: + - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + type: list + elements: str + CDP: + description: Configuration for the CDP protocol + type: dict + suboptions: + vlan_ids: + description: + - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + type: list + elements: str + 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 + - replaced + - overridden + default: merged +EXAMPLES: + - merged_example_01.txt + - merged_example_02.txt + - deleted_example_01.txt + - deleted_example_02.txt + - deleted_example_03.txt + - deleted_example_04.txt + - replaced_example_01.txt + - overridden_example_01.txt \ No newline at end of file From b1650a4aede27cb89245fbf1d3dee711bce4c79e Mon Sep 17 00:00:00 2001 From: Allen Ting Date: Mon, 28 Apr 2025 21:27:28 +0000 Subject: [PATCH 02/14] add br l2pt model definition --- .../br_l2pt/deleted_example_01.txt | 4 +- .../br_l2pt/deleted_example_03.txt | 6 +- .../br_l2pt/deleted_example_04.txt | 6 +- .../br_l2pt/merged_example_01.txt | 8 +-- .../br_l2pt/merged_example_02.txt | 10 ++-- .../br_l2pt/overridden_example_01.txt | 10 ++-- .../br_l2pt/replaced_example_01.txt | 8 +-- .../br_l2pt/sonic_br_l2pt.yaml | 57 +++++-------------- 8 files changed, 41 insertions(+), 68 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_01.txt b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt index 3a2e1b54..1bfbff0f 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt @@ -18,8 +18,8 @@ dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LACP: + bridge_l2pt_params: + - protocol: 'LACP' vlan_ids: - 10-12 state: deleted diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt index b4c428e6..0b7dab47 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt @@ -18,11 +18,11 @@ dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LACP: + bridge_l2pt_params: + - protocol: 'LACP' vlan_ids: - 10-12 - CDP + - protocol: 'CDP' vlan_ids: state: deleted diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_04.txt b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt index 2ba4677d..dd2e9053 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_04.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt @@ -18,11 +18,11 @@ dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LACP: + bridge_l2pt_params: + - protocol: 'LACP' vlan_ids: - 11 - CDP + - protocol: 'CDP' vlan_ids: - 40-50 state: deleted diff --git a/models/enterprise_sonic/br_l2pt/merged_example_01.txt b/models/enterprise_sonic/br_l2pt/merged_example_01.txt index 84ea8820..b4d1b8d0 100644 --- a/models/enterprise_sonic/br_l2pt/merged_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/merged_example_01.txt @@ -16,15 +16,15 @@ dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LACP: + bridge_l2pt_params: + - protocol: 'LACP' vlan_ids: - 10-12 - CDP: + - protocol: 'CDP' vlan_ids: - 20 - 40-60 - STP: + - protocol: 'STP' vlan_ids: - 25-26 state: merged diff --git a/models/enterprise_sonic/br_l2pt/merged_example_02.txt b/models/enterprise_sonic/br_l2pt/merged_example_02.txt index c37924cf..ff2bb707 100644 --- a/models/enterprise_sonic/br_l2pt/merged_example_02.txt +++ b/models/enterprise_sonic/br_l2pt/merged_example_02.txt @@ -19,18 +19,18 @@ dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LLDP: + bridge_l2pt_params: + - protocol: 'LLDP' vlan_ids: - 12 - LACP: + - protocol: 'LACP' vlan_ids: - 12 - CDP: + - protocol: 'CDP' vlan_ids: - 20 - 45-60 - STP: + - protocol: 'STP' vlan_ids: - 20-21 state: merged diff --git a/models/enterprise_sonic/br_l2pt/overridden_example_01.txt b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt index e1ab6eca..1073621b 100644 --- a/models/enterprise_sonic/br_l2pt/overridden_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt @@ -25,19 +25,19 @@ # switchport l2proto-tunnel lldp Vlan 100 # switchport l2proto-tunnel stp Vlan 100-150 - - name: Modify interface L2PT configurations + - name: Override interface L2PT configurations dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LACP: + bridge_l2pt_params: + - protocol: 'LACP' vlan_ids: - 10-12 - CDP: + - protocol: 'CDP' vlan_ids: - 20 - 40-60 - STP: + - protocol: 'STP' vlan_ids: - 25-26 state: overridden diff --git a/models/enterprise_sonic/br_l2pt/replaced_example_01.txt b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt index 5fe24e8c..0fa71dce 100644 --- a/models/enterprise_sonic/br_l2pt/replaced_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt @@ -28,15 +28,15 @@ dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 - protocol: - LLDP: + bridge_l2pt_params: + - protocol: 'LLDP' vlan_ids: - 10-12 - LACP: + - protocol: 'LACP' vlan_ids: - 8 - 12-14 - CDP: + - protocol: 'CDP' vlan_ids: - 20-45 state: replaced diff --git a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml index abf3539c..da74b64a 100644 --- a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml +++ b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml @@ -8,10 +8,10 @@ ANSIBLE_METADATA: | } NETWORK_OS: sonic RESOURCE: br_l2pt -COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved +COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved. DOCUMENTATION: | module: sonic_br_l2pt - version_added: '2.1.0' + version_added: '3.1.0' short_description: Manage L2PT configurations on SONiC description: - This module provides configuration management of L2PT parameters @@ -27,47 +27,20 @@ DOCUMENTATION: | description: Interface name for L2PT configuration. type: str required: true - protocol: - description: - - This defines which protocol to be used for tunneling L2 Protocol packets. - type: dict + bridge_l2pt_params: + description: VLAN ID list per supported Layer 2 protocol. + type: list + elements: dict suboptions: - LLDP: - description: Configuration for the LLDP protocol - type: dict - suboptions: - vlan_ids: - description: - - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. - type: list - elements: str - LACP: - description: Configuration for the LACP protocol - type: dict - suboptions: - vlan_ids: - description: - - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. - type: list - elements: str - STP: - description: Configuration for the STP protocol - type: dict - suboptions: - vlan_ids: - description: - - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. - type: list - elements: str - CDP: - description: Configuration for the CDP protocol - type: dict - suboptions: - vlan_ids: - description: - - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. - type: list - elements: str + protocol: + description: L2 protocol. + type: str + required: true + choices: ['LLDP', 'LACP', 'STP', 'CDP'] + vlan_ids: + description: List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + type: list + elements: str state: description: - The state specifies the type of configuration update to be performed on the device. From b0fc51b8fd893f9cf21c6122f005d7cc4ce3424e Mon Sep 17 00:00:00 2001 From: Allen Ting Date: Mon, 28 Apr 2025 21:31:04 +0000 Subject: [PATCH 03/14] minor fixes/updates --- models/enterprise_sonic/br_l2pt/deleted_example_02.txt | 1 - models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_02.txt b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt index 766e9cd8..c04c45c0 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_02.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt @@ -24,7 +24,6 @@ # switchport l2proto-tunnel lldp Vlan 100 # switchport l2proto-tunnel stp Vlan 100-150 - - name: Delete all interface L2PT configurations dellemc.enterprise_sonic.sonic_br_l2pt: config: diff --git a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml index da74b64a..611a6085 100644 --- a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml +++ b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml @@ -15,8 +15,8 @@ DOCUMENTATION: | short_description: Manage L2PT configurations on SONiC description: - This module provides configuration management of L2PT parameters - in devices running SONiC. - author: 'allen.ting@dell.com' + on devices running SONiC. + author: Allen Ting (allen.ting@dell.com) options: config: description: A list of L2PT configurations. From 8dcc6ebda4c4488d89879ea56891e64fbcfc6f3d Mon Sep 17 00:00:00 2001 From: Allen Ting Date: Tue, 29 Apr 2025 22:29:15 +0000 Subject: [PATCH 04/14] update descriptions, remove metadata --- .../br_l2pt/sonic_br_l2pt.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml index 611a6085..5b174b59 100644 --- a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml +++ b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml @@ -1,17 +1,13 @@ GENERATOR_VERSION: '1.0' -ANSIBLE_METADATA: | - { - 'metadata_version': '1.1', - 'status': ['preview'], - 'supported_by': 'community', - 'license': 'Apache 2.0' - } NETWORK_OS: sonic RESOURCE: br_l2pt COPYRIGHT: Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved. DOCUMENTATION: | module: sonic_br_l2pt version_added: '3.1.0' + notes: + - Tested against Enterprise SONiC Distribution by Dell Technologies. + - Supports C(check_mode). short_description: Manage L2PT configurations on SONiC description: - This module provides configuration management of L2PT parameters @@ -38,14 +34,14 @@ DOCUMENTATION: | required: true choices: ['LLDP', 'LACP', 'STP', 'CDP'] vlan_ids: - description: List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + description: + - List of VLAN IDs on which the L2 Protocol packets are to be tunneled. + - Ranges can be specified in the list of VLAN IDs using the delimiter '-'. type: list elements: str 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. + - The state of the configuration after module completion. type: str choices: - merged From 2bcfc95e9290b8ea881b131a2f2fd51f97d61919 Mon Sep 17 00:00:00 2001 From: Allen Ting Date: Fri, 9 May 2025 16:38:54 +0000 Subject: [PATCH 05/14] updated examples with delete by name --- .../br_l2pt/deleted_example_03.txt | 6 +-- .../br_l2pt/deleted_example_05.txt | 53 +++++++++++++++++++ .../br_l2pt/sonic_br_l2pt.yaml | 1 + 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 models/enterprise_sonic/br_l2pt/deleted_example_05.txt diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt index 0b7dab47..2efce811 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt @@ -14,16 +14,14 @@ # switchport l2proto-tunnel cdp Vlan 20,40-60 # switchport l2proto-tunnel stp Vlan 25-26 - - name: Delete interface L2PT configurations + - name: Delete L2PT configurations for protocol dellemc.enterprise_sonic.sonic_br_l2pt: config: - name: Ethernet0 bridge_l2pt_params: - protocol: 'LACP' - vlan_ids: - - 10-12 - protocol: 'CDP' - vlan_ids: + vlan_ids: [] state: deleted # After State: diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_05.txt b/models/enterprise_sonic/br_l2pt/deleted_example_05.txt new file mode 100644 index 00000000..eca60ce4 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_05.txt @@ -0,0 +1,53 @@ +# Using Deleted +# +# Before State: +# ------------- +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# switchport l2proto-tunnel lacp Vlan 10-12 +# switchport l2proto-tunnel cdp Vlan 20,40-60 +# switchport l2proto-tunnel stp Vlan 25-26 + + - name: Delete L2PT configurations for entire interface + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + bridge_l2pt_params: [] + - name: Ethernet8 + state: deleted + +# After State: +# ------------ +# sonic# show running-configuration interface Ethernet 0 +# ! +# interface Ethernet0 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown +# sonic# show running-configuration interface Ethernet 8 +# ! +# interface Ethernet8 +# mtu 9100 +# speed 400000 +# fec RS +# unreliable-los auto +# no shutdown \ No newline at end of file diff --git a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml index 5b174b59..b5ceba41 100644 --- a/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml +++ b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml @@ -56,5 +56,6 @@ EXAMPLES: - deleted_example_02.txt - deleted_example_03.txt - deleted_example_04.txt + - deleted_example_05.txt - replaced_example_01.txt - overridden_example_01.txt \ No newline at end of file From def3b52b0a4039738991fa77e74b7ee6380f23a5 Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 12:58:47 -0500 Subject: [PATCH 06/14] Update deleted_example_01.txt --- models/enterprise_sonic/br_l2pt/deleted_example_01.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_01.txt b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt index 1bfbff0f..57fcd184 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt @@ -1,6 +1,6 @@ -# Using Deleted +# Using "deleted" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -24,7 +24,7 @@ - 10-12 state: deleted -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -35,4 +35,4 @@ # unreliable-los auto # no shutdown # switchport l2proto-tunnel cdp Vlan 20,40-60 -# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 25-26 From d7890a1e5d041cb158fd8d2c3ba3908b7755529b Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:00:23 -0500 Subject: [PATCH 07/14] Update deleted_example_02.txt --- models/enterprise_sonic/br_l2pt/deleted_example_02.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_02.txt b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt index c04c45c0..65042e27 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_02.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt @@ -1,6 +1,6 @@ -# Using Deleted +# Using "deleted" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -29,7 +29,7 @@ config: state: deleted -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -46,4 +46,4 @@ # speed 400000 # fec RS # unreliable-los auto -# no shutdown \ No newline at end of file +# no shutdown From 813b377df5f82a21127c35e0b639a50a5ca95811 Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:00:48 -0500 Subject: [PATCH 08/14] Update deleted_example_03.txt --- models/enterprise_sonic/br_l2pt/deleted_example_03.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt index 2efce811..4337662b 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_03.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt @@ -1,6 +1,6 @@ -# Using Deleted +# Using "deleted" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -24,7 +24,7 @@ vlan_ids: [] state: deleted -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -34,4 +34,4 @@ # fec RS # unreliable-los auto # no shutdown -# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 25-26 From 39c63da64c6c0aef66187289272ef446810e0ffb Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:01:14 -0500 Subject: [PATCH 09/14] Update deleted_example_04.txt --- models/enterprise_sonic/br_l2pt/deleted_example_04.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_04.txt b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt index dd2e9053..0399b2c3 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_04.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt @@ -1,6 +1,6 @@ -# Using Deleted +# Using "deleted" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -27,7 +27,7 @@ - 40-50 state: deleted -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -39,4 +39,4 @@ # no shutdown # switchport l2proto-tunnel lacp Vlan 10,12 # switchport l2proto-tunnel cdp Vlan 20,51-60 -# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 25-26 From 25d7d4606a34fa5ebb259a68bf53c8295093384f Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:01:40 -0500 Subject: [PATCH 10/14] Update deleted_example_05.txt --- models/enterprise_sonic/br_l2pt/deleted_example_05.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/deleted_example_05.txt b/models/enterprise_sonic/br_l2pt/deleted_example_05.txt index eca60ce4..5f0ae6c2 100644 --- a/models/enterprise_sonic/br_l2pt/deleted_example_05.txt +++ b/models/enterprise_sonic/br_l2pt/deleted_example_05.txt @@ -1,6 +1,6 @@ -# Using Deleted +# Using "deleted" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -33,7 +33,7 @@ - name: Ethernet8 state: deleted -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet 0 # ! @@ -50,4 +50,4 @@ # speed 400000 # fec RS # unreliable-los auto -# no shutdown \ No newline at end of file +# no shutdown From 17023bf503f0827ea9a38d8d172e76b25a839019 Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:02:02 -0500 Subject: [PATCH 11/14] Update merged_example_01.txt --- models/enterprise_sonic/br_l2pt/merged_example_01.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/merged_example_01.txt b/models/enterprise_sonic/br_l2pt/merged_example_01.txt index b4d1b8d0..3bfdeb9d 100644 --- a/models/enterprise_sonic/br_l2pt/merged_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/merged_example_01.txt @@ -1,6 +1,6 @@ -# Using Merged +# Using "merged" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -29,7 +29,7 @@ - 25-26 state: merged -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -42,4 +42,4 @@ # switchport l2proto-tunnel cdp Vlan 20,40-60 # switchport l2proto-tunnel lacp Vlan 10-12 # switchport l2proto-tunnel lldp Vlan 10 -# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 25-26 From daa4d0840ec5b5efac5560d86191624a44ac4962 Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:02:31 -0500 Subject: [PATCH 12/14] Update merged_example_02.txt --- models/enterprise_sonic/br_l2pt/merged_example_02.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/merged_example_02.txt b/models/enterprise_sonic/br_l2pt/merged_example_02.txt index ff2bb707..6a653eed 100644 --- a/models/enterprise_sonic/br_l2pt/merged_example_02.txt +++ b/models/enterprise_sonic/br_l2pt/merged_example_02.txt @@ -1,6 +1,6 @@ -# Using Merged +# Using "merged" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -35,7 +35,7 @@ - 20-21 state: merged -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -48,4 +48,4 @@ # switchport l2proto-tunnel cdp Vlan 20,40-60 # switchport l2proto-tunnel lacp Vlan 10-12 # switchport l2proto-tunnel lldp Vlan 10,12 -# switchport l2proto-tunnel stp Vlan 20-21,25-26 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 20-21,25-26 From 418622b3ffed0e447e71e919a1c4dc6a4699ad25 Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:02:53 -0500 Subject: [PATCH 13/14] Update overridden_example_01.txt --- models/enterprise_sonic/br_l2pt/overridden_example_01.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/overridden_example_01.txt b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt index 1073621b..fea7b08a 100644 --- a/models/enterprise_sonic/br_l2pt/overridden_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt @@ -1,6 +1,6 @@ -# Using Overridden +# Using "overridden" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -42,7 +42,7 @@ - 25-26 state: overridden -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet0 # ! @@ -54,4 +54,4 @@ # no shutdown # switchport l2proto-tunnel cdp Vlan 20,40-60 # switchport l2proto-tunnel lacp Vlan 10-12 -# switchport l2proto-tunnel stp Vlan 25-26 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 25-26 From 813daeaceac33028122c5d5600c43d1ce11fa94f Mon Sep 17 00:00:00 2001 From: allenkting <70622916+allenkting@users.noreply.github.com> Date: Wed, 14 May 2025 13:03:16 -0500 Subject: [PATCH 14/14] Update replaced_example_01.txt --- models/enterprise_sonic/br_l2pt/replaced_example_01.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/enterprise_sonic/br_l2pt/replaced_example_01.txt b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt index 0fa71dce..8653f5d3 100644 --- a/models/enterprise_sonic/br_l2pt/replaced_example_01.txt +++ b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt @@ -1,6 +1,6 @@ -# Using Replaced +# Using "replaced" state # -# Before State: +# Before state: # ------------- # sonic# show running-configuration interface Ethernet 0 # ! @@ -41,7 +41,7 @@ - 20-45 state: replaced -# After State: +# After state: # ------------ # sonic# show running-configuration interface Ethernet 0 # ! @@ -63,4 +63,4 @@ # unreliable-los auto # no shutdown # switchport l2proto-tunnel lldp Vlan 100 -# switchport l2proto-tunnel stp Vlan 100-150 \ No newline at end of file +# switchport l2proto-tunnel stp Vlan 100-150