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..57fcd184 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_01.txt @@ -0,0 +1,38 @@ +# Using "deleted" state +# +# 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 + bridge_l2pt_params: + - 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 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..65042e27 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_02.txt @@ -0,0 +1,49 @@ +# Using "deleted" state +# +# 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 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..4337662b --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_03.txt @@ -0,0 +1,37 @@ +# Using "deleted" state +# +# 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 L2PT configurations for protocol + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + bridge_l2pt_params: + - protocol: 'LACP' + - protocol: '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 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..0399b2c3 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_04.txt @@ -0,0 +1,42 @@ +# Using "deleted" state +# +# 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 + bridge_l2pt_params: + - protocol: 'LACP' + vlan_ids: + - 11 + - protocol: '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 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..5f0ae6c2 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/deleted_example_05.txt @@ -0,0 +1,53 @@ +# Using "deleted" state +# +# 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 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..3bfdeb9d --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/merged_example_01.txt @@ -0,0 +1,45 @@ +# Using "merged" state +# +# 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 + bridge_l2pt_params: + - protocol: 'LACP' + vlan_ids: + - 10-12 + - protocol: 'CDP' + vlan_ids: + - 20 + - 40-60 + - protocol: '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 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..6a653eed --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/merged_example_02.txt @@ -0,0 +1,51 @@ +# Using "merged" state +# +# 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 + bridge_l2pt_params: + - protocol: 'LLDP' + vlan_ids: + - 12 + - protocol: 'LACP' + vlan_ids: + - 12 + - protocol: 'CDP' + vlan_ids: + - 20 + - 45-60 + - protocol: '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 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..fea7b08a --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/overridden_example_01.txt @@ -0,0 +1,57 @@ +# Using "overridden" state +# +# 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: Override interface L2PT configurations + dellemc.enterprise_sonic.sonic_br_l2pt: + config: + - name: Ethernet0 + bridge_l2pt_params: + - protocol: 'LACP' + vlan_ids: + - 10-12 + - protocol: 'CDP' + vlan_ids: + - 20 + - 40-60 + - protocol: '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 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..8653f5d3 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/replaced_example_01.txt @@ -0,0 +1,66 @@ +# Using "replaced" state +# +# 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 + bridge_l2pt_params: + - protocol: 'LLDP' + vlan_ids: + - 10-12 + - protocol: 'LACP' + vlan_ids: + - 8 + - 12-14 + - protocol: '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 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..b5ceba41 --- /dev/null +++ b/models/enterprise_sonic/br_l2pt/sonic_br_l2pt.yaml @@ -0,0 +1,61 @@ +GENERATOR_VERSION: '1.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 + on devices running SONiC. + author: Allen Ting (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 + bridge_l2pt_params: + description: VLAN ID list per supported Layer 2 protocol. + type: list + elements: dict + suboptions: + 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. + - Ranges can be specified in the list of VLAN IDs using the delimiter '-'. + type: list + elements: str + state: + description: + - The state of the configuration after module completion. + 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 + - deleted_example_05.txt + - replaced_example_01.txt + - overridden_example_01.txt \ No newline at end of file