dellemc / dellemc.enterprise_sonic / 2.4.0 / module / sonic_mac Manage MAC configuration on SONiC | "added in version" 2.1.0 of dellemc.enterprise_sonic" Authors: Shade Talabi (@stalabi1) preview | supported by communitydellemc.enterprise_sonic.sonic_mac (2.4.0) — module
Install with ansible-galaxy collection install dellemc.enterprise_sonic:==2.4.0
collections: - name: dellemc.enterprise_sonic version: 2.4.0
This module provides configuration management of MAC for devices running SONiC
# 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 # # # 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
# 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 # # # 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 # # # 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
state: choices: - merged - deleted - replaced - overridden default: merged description: - The state of the configuration after module completion type: str config: description: - A list of MAC configurations. elements: dict suboptions: mac: description: - Configuration attributes for MAC. suboptions: aging_time: default: 600 description: - Time in seconds of inactivity before the MAC entry is timed out. type: int dampening_interval: default: 5 description: - Interval for which mac movements are observed before disabling MAC learning on a port. type: int dampening_threshold: default: 5 description: - Number of MAC movements allowed per second before disabling MAC learning on a port. type: int mac_table_entries: description: - Configuration attributes for MAC table entries. elements: dict suboptions: interface: description: - Specifies the interface for the MAC table entry. type: str mac_address: description: - MAC address for the dynamic or static MAC table entry. required: true type: str vlan_id: description: - ID number of VLAN on which the MAC address is present. required: true type: int type: list type: dict vrf_name: default: default description: - Specifies the VRF name. type: str type: list
after: description: The resulting configuration model invocation. returned: when changed sample: 'The configuration returned will always be in the same format of the parameters above. ' type: list before: description: The configuration prior to the model invocation. returned: always sample: 'The configuration returned will always be in the same format of the parameters above. ' type: list commands: description: The set of commands pushed to the remote device. returned: always sample: - command 1 - command 2 - command 3 type: list