[Marvell] Utilize eeprom for system mac and remove dependency on get_hwsku (#5882)

Utilize eeprom for system mac and remove dependency on get_hwsku

Co-authored-by: Carl Keene <keene@nokia.com>
This commit is contained in:
carl-nokia 2020-11-11 18:11:00 -05:00 committed by GitHub
parent 89d9471654
commit dbb6373e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -391,9 +391,14 @@ def get_system_mac(namespace=None):
elif (version_info['asic_type'] == 'marvell'): elif (version_info['asic_type'] == 'marvell'):
# Try valid mac in eeprom, else fetch it from eth0 # Try valid mac in eeprom, else fetch it from eth0
platform = get_platform() platform = get_platform()
hwsku = get_hwsku() machine_key = "onie_machine"
profile_cmd = 'cat' + HOST_DEVICE_PATH + '/' + platform +'/'+ hwsku +'/profile.ini | grep switchMacAddress | cut -f2 -d=' machine_vars = get_machine_info()
hw_mac_entry_cmds = [ profile_cmd, "sudo decode-syseeprom -m", "ip link show eth0 | grep ether | awk '{print $2}'" ] 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: else:
mac_address_cmd = "cat /sys/class/net/eth0/address" mac_address_cmd = "cat /sys/class/net/eth0/address"
if namespace is not None: if namespace is not None: