Skip to content

Commit

Permalink
[Marvell] Utilize eeprom for system mac and remove dependency on get_…
Browse files Browse the repository at this point in the history
…hwsku (sonic-net#5882)

Utilize eeprom for system mac and remove dependency on get_hwsku

Co-authored-by: Carl Keene <[email protected]>
  • Loading branch information
2 people authored and santhosh-kt committed Feb 25, 2021
1 parent 137338e commit ade66fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,14 @@ def get_system_mac(namespace=None):
elif (version_info['asic_type'] == 'marvell'):
# Try valid mac in eeprom, else fetch it from eth0
platform = get_platform()
hwsku = get_hwsku()
profile_cmd = 'cat' + HOST_DEVICE_PATH + '/' + platform +'/'+ hwsku +'/profile.ini | grep switchMacAddress | cut -f2 -d='
hw_mac_entry_cmds = [ profile_cmd, "sudo decode-syseeprom -m", "ip link show eth0 | grep ether | awk '{print $2}'" ]
machine_key = "onie_machine"
machine_vars = get_machine_info()
if machine_vars is not None and machine_key in machine_vars:
hwsku = machine_vars[machine_key]
profile_cmd = 'cat' + HOST_DEVICE_PATH + '/' + platform + '/' + hwsku + '/profile.ini | grep switchMacAddress | cut -f2 -d='
else:
profile_cmd = "false"
hw_mac_entry_cmds = ["sudo decode-syseeprom -m", profile_cmd, "ip link show eth0 | grep ether | awk '{print $2}'"]
else:
mac_address_cmd = "cat /sys/class/net/eth0/address"
if namespace is not None:
Expand Down

0 comments on commit ade66fb

Please sign in to comment.