Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_presence implementation for SFP on Mellanox platforms #1056

Merged
merged 1 commit into from
Oct 20, 2017
Merged
Show file tree
Hide file tree
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
17 changes: 16 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 @@ -46,8 +46,23 @@ def __init__(self):
SfpUtilBase.__init__(self)

def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False

raise NotImplementedError
try:
reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1))
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

content = reg_file.readline().rstrip()

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

return False

def get_low_power_mode(self, port_num):

Expand Down
17 changes: 16 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 @@ -46,8 +46,23 @@ def __init__(self):
SfpUtilBase.__init__(self)

def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False

raise NotImplementedError
try:
reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1))
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

content = reg_file.readline().rstrip()

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

return False

def get_low_power_mode(self, port_num):

Expand Down
17 changes: 16 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 @@ -46,8 +46,23 @@ def __init__(self):
SfpUtilBase.__init__(self)

def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False

raise NotImplementedError
try:
reg_file = open("/bsp/qsfp/qsfp%d_status" % (port_num+1))
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

content = reg_file.readline().rstrip()

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

return False

def get_low_power_mode(self, port_num):

Expand Down