Skip to content
Merged
Changes from all 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
10 changes: 7 additions & 3 deletions ansible/library/port_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
ALLOWED_HEADER = ['name', 'lanes', 'alias', 'index', 'speed']

MACHINE_CONF = '/host/machine.conf'
ONIE_PLATFORM = 'onie_platform'
ABOOT_PLATFORM = 'aboot_platform'
ONIE_PLATFORM_KEY = 'onie_platform'
ABOOT_PLATFORM_KEY = 'aboot_platform'

KVM_PLATFORM = 'x86_64-kvm_x86_64-r0'

class SonicPortAliasMap():
"""
Expand All @@ -56,12 +58,14 @@ def __init__(self, hwsku):
return

def get_platform_type(self):
if not os.path.exists(MACHINE_CONF):
return KVM_PLATFORM
with open(MACHINE_CONF) as machine_conf:
for line in machine_conf:
tokens = line.split('=')
key = tokens[0].strip()
value = tokens[1].strip()
if key == ONIE_PLATFORM or key == ABOOT_PLATFORM:
if key == ONIE_PLATFORM_KEY or key == ABOOT_PLATFORM_KEY:
return value
return None

Expand Down