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

Move tx_disable/tx_disabled_channel/rx_los/tx_fault to get_transceiver_status API #359

Merged
merged 5 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 0 additions & 3 deletions sonic_platform_base/sfp_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ def get_transceiver_bulk_status(self):
tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not.
reset_status |BOOLEAN |reset status, True if SFP in reset, False if not.
lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not.
tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not.
tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0
| |to channel 3.
temperature |INT |module temperature in Celsius
voltage |INT |supply voltage in mV
tx<n>bias |INT |TX Bias Current in mA, n is the channel number,
Expand Down
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_xcvr/api/public/c_cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def get_transceiver_status(self):
tuning_in_progress = BOOLEAN ; tuning in progress status
wavelength_unlock_status = BOOLEAN ; laser unlocked status
target_output_power_oor = BOOLEAN ; target output power out of range flag
fine_tuning_oor = BOOLEAN ; fine tuning out of range flag
fine_tuning_oor = BOOLEAN ; fine tuning out of range flag
tuning_not_accepted = BOOLEAN ; tuning not accepted flag
invalid_channel_num = BOOLEAN ; invalid channel number flag
tuning_complete = BOOLEAN ; tuning complete flag
Expand Down
21 changes: 8 additions & 13 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,12 @@ def get_transceiver_info(self):
return xcvr_info

def get_transceiver_bulk_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
tx_disable = self.get_tx_disable()
tx_disabled_channel = self.get_tx_disable_channel()
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
rx_power = self.get_rx_power()
tx_power = self.get_tx_power()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None or \
temp is None or \
read_failed = temp is None or \
voltage is None or \
tx_bias is None or \
rx_power is None or \
Expand All @@ -198,15 +190,11 @@ def get_transceiver_bulk_status(self):
return None

bulk_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disabled_channel": tx_disabled_channel,
"temperature": temp,
"voltage": voltage
}

for i in range(1, self.NUM_CHANNELS + 1):
bulk_status["tx%ddisable" % i] = tx_disable[i-1] if self.get_tx_disable_support() else 'N/A'
bulk_status["tx%dbias" % i] = tx_bias[i - 1]
bulk_status["rx%dpower" % i] = float("{:.3f}".format(self.mw_to_dbm(rx_power[i - 1]))) if rx_power[i - 1] != 'N/A' else 'N/A'
bulk_status["tx%dpower" % i] = float("{:.3f}".format(self.mw_to_dbm(tx_power[i - 1]))) if tx_power[i - 1] != 'N/A' else 'N/A'
Expand Down Expand Up @@ -1620,6 +1608,8 @@ def get_transceiver_status(self):
rxoutput_status_hostlane6 = BOOLEAN ; rx output status on host lane 6
rxoutput_status_hostlane7 = BOOLEAN ; rx output status on host lane 7
rxoutput_status_hostlane8 = BOOLEAN ; rx output status on host lane 8
tx_disable = BOOLEAN ; tx disable status
longhuan-cisco marked this conversation as resolved.
Show resolved Hide resolved
tx_disabled_channel = INTEGER ; disabled TX channels
txfault = BOOLEAN ; tx fault flag on media lane
txlos_hostlane1 = BOOLEAN ; tx loss of signal flag on host lane 1
txlos_hostlane2 = BOOLEAN ; tx loss of signal flag on host lane 2
Expand Down Expand Up @@ -1738,6 +1728,11 @@ def get_transceiver_status(self):
if rx_output_status_dict:
for lane in range(1, self.NUM_CHANNELS+1):
trans_status['rxoutput_status_hostlane%d' % lane] = rx_output_status_dict.get('RxOutputStatus%d' % lane)
if self.get_tx_disable_support():
trans_status['tx_disabled_channel'] = self.get_tx_disable_channel()
tx_disable = self.get_tx_disable()
for lane in range(1, self.NUM_CHANNELS+1):
trans_status['tx%ddisable' % lane] = tx_disable[lane - 1]
tx_fault = self.get_tx_fault()
if tx_fault:
for lane in range(1, self.NUM_CHANNELS+1):
Expand Down
29 changes: 19 additions & 10 deletions sonic_platform_base/sonic_xcvr/api/public/sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,34 @@ def get_transceiver_info(self):

return xcvr_info

def get_transceiver_bulk_status(self):
def get_transceiver_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
tx_disable = self.get_tx_disable()
tx_disabled_channel = self.get_tx_disable_channel()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None
if read_failed:
return None

trans_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
longhuan-cisco marked this conversation as resolved.
Show resolved Hide resolved
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
"tx_disabled_channel": tx_disabled_channel
}

return trans_status

def get_transceiver_bulk_status(self):
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
rx_power = self.get_rx_power()
tx_power = self.get_tx_power()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None or \
temp is None or \
read_failed = temp is None or \
voltage is None or \
tx_bias is None or \
rx_power is None or \
Expand All @@ -91,10 +104,6 @@ def get_transceiver_bulk_status(self):
return None

bulk_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
"tx_disabled_channel": tx_disabled_channel,
"temperature": temp,
"voltage": voltage
}
Expand Down
29 changes: 19 additions & 10 deletions sonic_platform_base/sonic_xcvr/api/public/sff8472.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,34 @@ def get_transceiver_info(self):

return xcvr_info

def get_transceiver_bulk_status(self):
def get_transceiver_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
tx_disable = self.get_tx_disable()
tx_disabled_channel = self.get_tx_disable_channel()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None
if read_failed:
return None

trans_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
"tx_disabled_channel": tx_disabled_channel
}

return trans_status

def get_transceiver_bulk_status(self):
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
rx_power = self.get_rx_power()
tx_power = self.get_tx_power()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None or \
temp is None or \
read_failed = temp is None or \
voltage is None or \
tx_bias is None or \
rx_power is None or \
Expand All @@ -83,10 +96,6 @@ def get_transceiver_bulk_status(self):
return None

bulk_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
"tx_disabled_channel": tx_disabled_channel,
"temperature": temp,
"voltage": voltage
}
Expand Down
29 changes: 19 additions & 10 deletions sonic_platform_base/sonic_xcvr/api/public/sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,34 @@ def get_transceiver_info(self):

return xcvr_info

def get_transceiver_bulk_status(self):
def get_transceiver_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
tx_disable = self.get_tx_disable()
tx_disabled_channel = self.get_tx_disable_channel()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None
if read_failed:
return None

trans_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
"tx_disabled_channel": tx_disabled_channel
}

return trans_status

def get_transceiver_bulk_status(self):
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
rx_power = self.get_rx_power()
tx_power = self.get_tx_power()
read_failed = rx_los is None or \
tx_fault is None or \
tx_disable is None or \
tx_disabled_channel is None or \
temp is None or \
read_failed = temp is None or \
voltage is None or \
tx_bias is None or \
rx_power is None or \
Expand All @@ -98,10 +111,6 @@ def get_transceiver_bulk_status(self):
return None

bulk_status = {
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
"tx_disabled_channel": tx_disabled_channel,
"temperature": temp,
"voltage": voltage
}
Expand Down
7 changes: 1 addition & 6 deletions sonic_platform_base/sonic_xcvr/api/xcvr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ def get_transceiver_bulk_status(self):
========================================================================
keys |Value Format |Information
---------------------------|---------------|----------------------------
rx_los |bool |RX loss-of-signal status, True if has RX los, False if not.
tx_fault |bool |TX fault status, True if has TX fault, False if not.
tx_disable |bool |TX disable status, True TX disabled, False if not.
tx_disabled_channel |int |disabled TX channels in hex, bits 0 to 3 represent channel 0
| |to channel 3 (for example).
temperature |float |module temperature in Celsius
voltage |float |supply voltage in mV
tx<n>bias |float |TX Bias Current in mA, n is the channel number,
Expand Down Expand Up @@ -135,7 +130,7 @@ def get_transceiver_threshold_info(self):

def get_transceiver_status(self):
"""
Retrieves transceiver status of this SFP (applicable for CMIS/C-CMIS)
Retrieves transceiver status of this SFP

Returns:
A dict which may contain following keys/values (there could be more for C-CMIS) :
Expand Down
Loading