[multi-asic] Make asic-id in DEVICE_METADATA optional (#7866)

Discussion and requirement in Chassis discussion forum to NOT make the asic-id field in the DEVICE_METADATA mandatory. If this field "asic-id" is not present the orchagent will be started without the -i <asic_id> parameter

Ref: https://github.com/Azure/sonic-buildimage/blob/master/dockers/docker-orchagent/orchagent.sh#L39

How I did it
Made the check to see if the asic-id is valid and update the asic-id field in the DEVICE_METADATA
This commit is contained in:
judyjoseph 2021-06-25 15:56:26 -07:00 committed by GitHub
parent 6b30d2fb05
commit e5a6a45fa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -392,14 +392,16 @@ def main():
'platform': platform,
'mac': mac,
}}}
# The ID needs to be passed to the SAI to identify the asic.
if asic_name is not None:
device_id = get_asic_device_id(asic_id)
# if the device_id obtained is None, exit with error
if device_id is None:
print('Failed to get device ID for', asic_name, file=sys.stderr)
sys.exit(1)
hardware_data['DEVICE_METADATA']['localhost'].update(asic_id=device_id)
print('Warning: Failed to get device ID from asic.conf file for', asic_name, file=sys.stderr)
else:
hardware_data['DEVICE_METADATA']['localhost'].update(asic_id=device_id)
deep_update(data, hardware_data)
paths = ['/', '/usr/share/sonic/templates']