[Mellanox] Fix issue: need import initialize_sdk_handle in get_sdk_handle (#6435)

Found test_sfp.py failed due to use a method without importing it.
This commit is contained in:
Junchao-Mellanox 2021-01-14 01:42:04 +08:00 committed by GitHub
parent 68e9b83f3e
commit 0a49edb68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,6 @@ class Chassis(ChassisBase):
def initialize_sfp(self):
from sonic_platform.sfp import SFP
from sonic_platform.sfp import initialize_sdk_handle
self.sfp_module = SFP
@ -137,6 +136,7 @@ class Chassis(ChassisBase):
def get_sdk_handle(self):
if not self.sdk_handle:
from sonic_platform.sfp import initialize_sdk_handle
self.sdk_handle = initialize_sdk_handle()
if self.sdk_handle is None:
logger.log_error('Failed to open SDK handle')