diff --git a/tests/common/devices/sonic.py b/tests/common/devices/sonic.py index 51d0b37dba1..a6151941e6b 100644 --- a/tests/common/devices/sonic.py +++ b/tests/common/devices/sonic.py @@ -293,6 +293,9 @@ def _get_sonic_release(self): output = self.command("sonic-cfggen -y /etc/sonic/sonic_version.yml -v release") if len(output['stdout_lines']) == 0: + # get release from OS version + if self.os_version: + return self.os_version.split('.')[0][0:6] return 'none' return output["stdout_lines"][0].strip()