Skip to content

Commit

Permalink
[devices]: Fixed trancevier presence getter on Mellanox. (#2144)
Browse files Browse the repository at this point in the history
Signed-off-by: Nazarii Hnydyn <nazariig@mellanox.com>
  • Loading branch information
nazariig authored and lguohan committed Oct 12, 2018
1 parent 7d51f83 commit 33d4140
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion device/mellanox/x86_64-mlnx_msn2010-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0

# parameters for SFP presence
SFP_STATUS_INSERTED = '1'

class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
Expand Down Expand Up @@ -71,7 +74,7 @@ def get_presence(self, port_num):
content = reg_file.readline().rstrip()

# content is a string with the qsfp status
if content == "1":
if content == SFP_STATUS_INSERTED:
return True

return False
Expand Down
5 changes: 4 additions & 1 deletion device/mellanox/x86_64-mlnx_msn2100-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0

# parameters for SFP presence
SFP_STATUS_INSERTED = '1'

class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
Expand Down Expand Up @@ -70,7 +73,7 @@ def get_presence(self, port_num):
content = reg_file.readline().rstrip()

# content is a string with the qsfp status
if content == "good":
if content == SFP_STATUS_INSERTED:
return True

return False
Expand Down
5 changes: 4 additions & 1 deletion device/mellanox/x86_64-mlnx_msn2410-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0

# parameters for SFP presence
SFP_STATUS_INSERTED = '1'

class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
Expand Down Expand Up @@ -71,7 +74,7 @@ def get_presence(self, port_num):
content = reg_file.readline().rstrip()

# content is a string with the qsfp status
if content == "good":
if content == SFP_STATUS_INSERTED:
return True

return False
Expand Down
5 changes: 4 additions & 1 deletion device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0

# parameters for SFP presence
SFP_STATUS_INSERTED = '1'

class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
Expand Down Expand Up @@ -70,7 +73,7 @@ def get_presence(self, port_num):
content = reg_file.readline().rstrip()

# content is a string with the qsfp status
if content == "good":
if content == SFP_STATUS_INSERTED:
return True

return False
Expand Down
5 changes: 4 additions & 1 deletion device/mellanox/x86_64-mlnx_msn2740-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0

# parameters for SFP presence
SFP_STATUS_INSERTED = '1'

class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
Expand Down Expand Up @@ -70,7 +73,7 @@ def get_presence(self, port_num):
content = reg_file.readline().rstrip()

# content is a string with the qsfp status
if content == "good":
if content == SFP_STATUS_INSERTED:
return True

return False
Expand Down

0 comments on commit 33d4140

Please sign in to comment.