diff --git a/models/enterprise_sonic/mac/deleted_example_01.txt b/models/enterprise_sonic/mac/deleted_example_01.txt new file mode 100644 index 00000000..67ccc876 --- /dev/null +++ b/models/enterprise_sonic/mac/deleted_example_01.txt @@ -0,0 +1,38 @@ +# Using deleted +# +# Before state: +# ------------- +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 30 +# MAC Move Dampening Interval : 20 +# sonic# show running-configuration | grep mac +# mac address-table 00:11:11:11:11:11 Vlan1 Ethernet20 +# mac address-table 00:22:22:22:22:22 Vlan2 Ethernet24 +# mac address-table aging-time 10 + + - name: Delete MAC cofigurations + dellemc.enterprise_sonic.sonic_mac: + config: + - vrf_name: 'default' + mac: + aging_time: 10 + dampening_interval: 20 + dampening_threshold: 30 + mac_table_entries: + - mac_address: '00:11:11:11:11:11' + vlan_id: 1 + interface: 'Ethernet20' + - mac_address: '00:22:22:22:22:22' + vlan_id: 2 + interface: 'Ethernet24' + state: deleted + +# After state: +# ------------ +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 5 +# MAC Move Dampening Interval : 5 +# sonic# show running-configuration | grep mac +# (No mac configuration pressent) diff --git a/models/enterprise_sonic/mac/merged_example_01.txt b/models/enterprise_sonic/mac/merged_example_01.txt new file mode 100644 index 00000000..bb920b0e --- /dev/null +++ b/models/enterprise_sonic/mac/merged_example_01.txt @@ -0,0 +1,42 @@ +# Using merged +# +# Before state: +# ------------- +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 5 +# MAC Move Dampening Interval : 5 +# sonic# show running-configuration | grep mac +# (No mac configuration pressent) + + - name: Merge MAC configurations + dellemc.enterprise_sonic.sonic_mac: + config: + - vrf_name: 'default' + mac: + aging_time: 50 + dampening_interval: 20 + dampening_threshold: 30 + mac_table_entries: + - mac_address: '00:00:5e:00:53:af' + vlan_id: 1 + interface: 'Ethernet20' + - mac_address: '00:33:33:33:33:33' + vlan_id: 2 + interface: 'Ethernet24' + - mac_address: '00:00:4e:00:24:af' + vlan_id: 3 + interface: 'Ethernet28' + state: merged + +# After state: +# ------------ +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 30 +# MAC Move Dampening Interval : 20 +# sonic# show running-configuration | grep mac +# mac address-table 00:00:5e:00:53:af Vlan1 Ethernet20 +# mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24 +# mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28 +# mac address-table aging-time 50 diff --git a/models/enterprise_sonic/mac/overridden_example_01.txt b/models/enterprise_sonic/mac/overridden_example_01.txt new file mode 100644 index 00000000..fe1c5303 --- /dev/null +++ b/models/enterprise_sonic/mac/overridden_example_01.txt @@ -0,0 +1,42 @@ +# Using overridden +# +# Before state: +# ------------- +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 60 +# MAC Move Dampening Interval : 30 +# sonic# show running-configuration | grep mac +# mac address-table 00:00:5e:00:53:af Vlan3 Ethernet24 +# mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24 +# mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28 +# mac address-table 00:44:44:44:44:44 Vlan2 Ethernet20 +# mac address-table aging-time 45 + + - name: Override MAC cofigurations + dellemc.enterprise_sonic.sonic_mac: + config: + - vrf_name: 'default' + mac: + aging_time: 10 + dampening_interval: 20 + dampening_threshold: 30 + mac_table_entries: + - mac_address: '00:11:11:11:11:11' + vlan_id: 1 + interface: 'Ethernet20' + - mac_address: '00:22:22:22:22:22' + vlan_id: 2 + interface: 'Ethernet24' + state: overridden + +# After state: +# ------------ +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 30 +# MAC Move Dampening Interval : 20 +# sonic# show running-configuration | grep mac +# mac address-table 00:11:11:11:11:11 Vlan1 Ethernet20 +# mac address-table 00:22:22:22:22:22 Vlan2 Ethernet24 +# mac address-table aging-time 10 diff --git a/models/enterprise_sonic/mac/replaced_example_01.txt b/models/enterprise_sonic/mac/replaced_example_01.txt new file mode 100644 index 00000000..7c4ee535 --- /dev/null +++ b/models/enterprise_sonic/mac/replaced_example_01.txt @@ -0,0 +1,43 @@ +# Using replaced +# +# Before state: +# ------------- +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 30 +# MAC Move Dampening Interval : 20 +# sonic# show running-configuration | grep mac +# mac address-table 00:00:5e:00:53:af Vlan1 Ethernet20 +# mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24 +# mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28 +# mac address-table aging-time 50 + + - name: Replace MAC configurations + dellemc.enterprise_sonic.sonic_mac: + config: + - vrf_name: 'default' + mac: + aging_time: 45 + dampening_interval: 30 + dampening_threshold: 60 + mac_table_entries: + - mac_address: '00:00:5e:00:53:af' + vlan_id: 3 + interface: 'Ethernet24' + - mac_address: '00:44:44:44:44:44' + vlan_id: 2 + interface: 'Ethernet20' + state: replaced + +# After state: +# ------------ +# +# sonic# show mac dampening +# MAC Move Dampening Threshold : 60 +# MAC Move Dampening Interval : 30 +# sonic# show running-configuration | grep mac +# mac address-table 00:00:5e:00:53:af Vlan3 Ethernet24 +# mac address-table 00:33:33:33:33:33 Vlan2 Ethernet24 +# mac address-table 00:00:4e:00:24:af Vlan3 Ethernet28 +# mac address-table 00:44:44:44:44:44 Vlan2 Ethernet20 +# mac address-table aging-time 45 diff --git a/models/enterprise_sonic/mac/sonic_mac.yaml b/models/enterprise_sonic/mac/sonic_mac.yaml new file mode 100644 index 00000000..3a206866 --- /dev/null +++ b/models/enterprise_sonic/mac/sonic_mac.yaml @@ -0,0 +1,78 @@ +--- +GENERATOR_VERSION: '1.0' +NETWORK_OS: sonic +RESOURCE: mac +COPYRIGHT: Copyright 2024 Dell Inc. or its subsidiaries. All Rights Reserved. +DOCUMENTATION: | + module: sonic_mac + version_added: "2.1.0" + notes: + - Tested against Enterprise SONiC Distribution by Dell Technologies. + - Supports C(check_mode). + short_description: Manage MAC configuration on SONiC + description: + - This module provides configuration management of MAC for devices running SONiC + author: "Shade Talabi (@stalabi1)" + options: + config: + description: + - A list of MAC configurations. + type: list + elements: dict + suboptions: + vrf_name: + description: + - Specifies the VRF name. + type: str + default: 'default' + mac: + description: + - Configuration attributes for MAC. + type: dict + suboptions: + aging_time: + description: + - Time in seconds of inactivity before the MAC entry is timed out. + type: int + default: 600 + dampening_interval: + description: + - Interval for which mac movements are observed before disabling MAC learning on a port. + type: int + default: 5 + dampening_threshold: + description: + - Number of MAC movements allowed per second before disabling MAC learning on a port. + type: int + default: 5 + mac_table_entries: + description: + - Configuration attributes for MAC table entries. + type: list + elements: dict + suboptions: + mac_address: + description: + - MAC address for the dynamic or static MAC table entry. + type: str + required: True + vlan_id: + description: + - ID number of VLAN on which the MAC address is present. + type: int + required: True + interface: + description: + - Specifies the interface for the MAC table entry. + type: str + state: + description: + - The state of the configuration after module completion + type: str + choices: ['merged', 'deleted', 'replaced', 'overridden'] + default: merged +EXAMPLES: + - deleted_example_01.txt + - merged_example_01.txt + - overridden_example_01.txt + - replaced_example_01.txt