dellemc.enterprise_sonic.sonic_mac 模块 – 在 SONiC 上管理 MAC 配置
注意
此模块是 dellemc.enterprise_sonic 集合(版本 2.5.1)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install dellemc.enterprise_sonic。
要在 playbook 中使用它,请指定:dellemc.enterprise_sonic.sonic_mac。
dellemc.enterprise_sonic 2.1.0 中的新功能
概要
- 此模块提供在运行 SONiC 的设备上对 MAC 进行配置管理 
参数
| 参数 | 注释 | 
|---|---|
| MAC 配置的列表。 | |
| MAC 的配置属性。 | |
| MAC 条目超时之前的不活动时间(以秒为单位)。 默认值:  | |
| 观察 MAC 移动以在端口上禁用 MAC 学习的时间间隔。 默认值:  | |
| 在端口上禁用 MAC 学习之前允许的每秒 MAC 移动次数。 默认值:  | |
| MAC 表条目的配置属性。 | |
| 指定 MAC 表条目的接口。 | |
| 动态或静态 MAC 表条目的 MAC 地址。 | |
| 存在 MAC 地址的 VLAN 的 ID 号。 | |
| 指定 VRF 名称。 默认值:  | |
| 模块完成后配置的状态 选择 
 | 
注释
注意
- 已针对戴尔科技的 Enterprise SONiC 发行版进行测试。 
- 支持 - check_mode。
示例
# 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
# 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)
返回值
常见的返回值记录在 这里,以下是此模块独有的字段
| 键 | 描述 | 
|---|---|
| 生成的配置模块调用。 已返回: 当发生更改时 示例:  | |
| 生成的配置模块调用。 已返回: 当  示例:  | |
| 模块调用之前的配置。 已返回: 始终 示例:  | |
| 推送到远程设备的命令集。 已返回: 始终 示例:  | 
