Skip to content

[sonic-cfggen] Add Mellanox platform specific code to read base mac from machine.conf #2991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/sonic-config-engine/sonic_device_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ def get_system_mac():
version_info = get_sonic_version_info()

if (version_info['asic_type'] == 'mellanox'):
get_mac_cmd = "sudo decode-syseeprom -m"
# With Mellanox ONIE release(2019.05-5.2.0012) and above
# "onie_base_mac" was added to /host/machine.conf:
# onie_base_mac=e4:1d:2d:44:5e:80
# So we have another way to get the mac address besides decode syseeprom
# By this can mitigate the dependency on the hw-management service
base_mac_key = "onie_base_mac"
machine_vars = get_machine_info()
if machine_vars is not None and base_mac_key in machine_vars:
mac = machine_vars[base_mac_key]
mac = mac.strip()
return mac
else:
get_mac_cmd = "sudo decode-syseeprom -m"
else:
get_mac_cmd = "ip link show eth0 | grep ether | awk '{print $2}'"

Expand Down