Skip to content
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
375 changes: 36 additions & 339 deletions sonic_platform_base/sonic_xcvr/api/public/c_cmis.py

Large diffs are not rendered by default.

388 changes: 97 additions & 291 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py

Large diffs are not rendered by default.

65 changes: 55 additions & 10 deletions sonic_platform_base/sonic_xcvr/api/public/sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,65 @@ def get_transceiver_info(self):
return xcvr_info

def get_transceiver_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
"""
Retrieves the current status of the transceiver module.

Accesses non-latched registers to gather information about the TX output statuses.

Returns:
dict: A dictionary containing boolean values for various status fields, as defined in
the TRANSCEIVER_STATUS table in STATE_DB.
"""
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 \
read_failed = tx_disable is None or \
tx_disabled_channel is None
if read_failed:
return None

trans_status = dict()
for lane in range(1, len(rx_los) + 1):
trans_status['rxlos%d' % lane] = rx_los[lane - 1]
for lane in range(1, len(tx_fault) + 1):
trans_status['txfault%d' % lane] = tx_fault[lane - 1]
for lane in range(1, len(tx_disable) + 1):
trans_status['tx%ddisable' % lane] = tx_disable[lane - 1]
trans_status['tx_disabled_channel'] = tx_disabled_channel

return trans_status

def get_transceiver_bulk_status(self):
def get_transceiver_status_flags(self):
"""
Retrieves the current flag status of the transceiver module.

Accesses latched registers to gather information about TX and RX related flags.

Returns:
dict: A dictionary containing boolean values for various flags, as defined in
the TRANSCEIVER_STATUS_FLAGS table in STATE_DB.
"""
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
read_failed = rx_los is None or \
tx_fault is None

if read_failed:
return None

trans_status_flags = dict()
for lane in range(1, len(rx_los) + 1):
trans_status_flags['rx%dlos' % lane] = rx_los[lane - 1]
for lane in range(1, len(tx_fault) + 1):
trans_status_flags['tx%dfault' % lane] = tx_fault[lane - 1]

return trans_status_flags

def get_transceiver_dom_real_value(self):
"""
Retrieves DOM sensor values for this transceiver

The returned dictionary contains floating-point values corresponding to various
DOM sensor readings, as defined in the TRANSCEIVER_DOM_SENSOR table in STATE_DB.

Returns:
Dictionary
"""
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
Expand All @@ -118,6 +154,15 @@ def get_transceiver_bulk_status(self):
return bulk_status

def get_transceiver_threshold_info(self):
"""
Retrieves threshold info for this xcvr

The returned dictionary contains floating-point values corresponding to various
DOM sensor threshold readings, as defined in the TRANSCEIVER_DOM_THRESHOLD table in STATE_DB.

Returns:
Dictionary
"""
threshold_info_keys = ['temphighalarm', 'temphighwarning',
'templowalarm', 'templowwarning',
'vcchighalarm', 'vcchighwarning',
Expand Down
65 changes: 55 additions & 10 deletions sonic_platform_base/sonic_xcvr/api/public/sff8472.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,65 @@ def get_transceiver_info(self):
return xcvr_info

def get_transceiver_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
"""
Retrieves the current status of the transceiver module.

Accesses non-latched registers to gather information about the TX statuses.

Returns:
dict: A dictionary containing boolean values for various status fields, as defined in
the TRANSCEIVER_STATUS table in STATE_DB.
"""
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 \
read_failed = tx_disable is None or \
tx_disabled_channel is None
if read_failed:
return None

trans_status = dict()
for lane in range(1, len(rx_los) + 1):
trans_status['rxlos%d' % lane] = rx_los[lane - 1]
for lane in range(1, len(tx_fault) + 1):
trans_status['txfault%d' % lane] = tx_fault[lane - 1]
for lane in range(1, len(tx_disable) + 1):
trans_status['tx%ddisable' % lane] = tx_disable[lane - 1]
trans_status['tx_disabled_channel'] = tx_disabled_channel

return trans_status

def get_transceiver_bulk_status(self):
def get_transceiver_status_flags(self):
"""
Retrieves the current flag status of the transceiver module.

Accesses non-latched registers to gather TX and RX-related flags. Unlike other
module types, SFF-8472 does not support latched registers for these flags.

Returns:
dict: A dictionary containing boolean values for various flags, as defined in
the TRANSCEIVER_STATUS_FLAGS table in STATE_DB.
"""
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
read_failed = rx_los is None or \
tx_fault is None
if read_failed:
return None

trans_status_flags = dict()
for lane in range(1, len(rx_los) + 1):
trans_status_flags['rx%dlos' % lane] = rx_los[lane - 1]
for lane in range(1, len(tx_fault) + 1):
trans_status_flags['tx%dfault' % lane] = tx_fault[lane - 1]

return trans_status_flags

def get_transceiver_dom_real_value(self):
"""
Retrieves DOM sensor values for this transceiver

The returned dictionary contains floating-point values corresponding to various
DOM sensor readings, as defined in the TRANSCEIVER_DOM_SENSOR table in STATE_DB.

Returns:
Dictionary
"""
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
Expand Down Expand Up @@ -116,6 +152,15 @@ def get_transceiver_bulk_status(self):
return bulk_status

def get_transceiver_threshold_info(self):
"""
Retrieves threshold info for this xcvr

The returned dictionary contains floating-point values corresponding to various
DOM sensor threshold readings, as defined in the TRANSCEIVER_DOM_THRESHOLD table in STATE_DB.

Returns:
Dictionary
"""
threshold_info_keys = ['temphighalarm', 'temphighwarning',
'templowalarm', 'templowwarning',
'vcchighalarm', 'vcchighwarning',
Expand Down
64 changes: 54 additions & 10 deletions sonic_platform_base/sonic_xcvr/api/public/sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,64 @@ def get_transceiver_info(self):
return xcvr_info

def get_transceiver_status(self):
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
"""
Retrieves the current status of the transceiver module.

Accesses non-latched registers to gather information about the TX statuses.

Returns:
dict: A dictionary containing boolean values for various status fields, as defined in
the TRANSCEIVER_STATUS table in STATE_DB.
"""
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 \
read_failed = tx_disable is None or \
tx_disabled_channel is None
if read_failed:
return None

trans_status = dict()
for lane in range(1, len(rx_los) + 1):
trans_status['rxlos%d' % lane] = rx_los[lane - 1]
for lane in range(1, len(tx_fault) + 1):
trans_status['txfault%d' % lane] = tx_fault[lane - 1]
for lane in range(1, len(tx_disable) + 1):
trans_status['tx%ddisable' % lane] = tx_disable[lane - 1]
trans_status['tx_disabled_channel'] = tx_disabled_channel

return trans_status

def get_transceiver_bulk_status(self):
def get_transceiver_status_flags(self):
"""
Retrieves the current flag status of the transceiver module.

Accesses latched registers to gather information about TX and RX related flags.

Returns:
dict: A dictionary containing boolean values for various flags, as defined in
the TRANSCEIVER_STATUS_FLAGS table in STATE_DB.
"""
rx_los = self.get_rx_los()
tx_fault = self.get_tx_fault()
read_failed = rx_los is None or \
tx_fault is None
if read_failed:
return None

trans_status_flags = dict()
for lane in range(1, len(rx_los) + 1):
trans_status_flags['rx%dlos' % lane] = rx_los[lane - 1]
for lane in range(1, len(tx_fault) + 1):
trans_status_flags['tx%dfault' % lane] = tx_fault[lane - 1]

return trans_status_flags

def get_transceiver_dom_real_value(self):
"""
Retrieves DOM sensor values for this transceiver

The returned dictionary contains floating-point values corresponding to various
DOM sensor readings, as defined in the TRANSCEIVER_DOM_SENSOR table in STATE_DB.

Returns:
Dictionary
"""
temp = self.get_module_temperature()
voltage = self.get_voltage()
tx_bias = self.get_tx_bias()
Expand All @@ -127,6 +162,15 @@ def get_transceiver_bulk_status(self):
return bulk_status

def get_transceiver_threshold_info(self):
"""
Retrieves threshold info for this xcvr

The returned dictionary contains floating-point values corresponding to various
DOM sensor threshold readings, as defined in the TRANSCEIVER_DOM_THRESHOLD table in STATE_DB.

Returns:
Dictionary
"""
threshold_info_keys = ['temphighalarm', 'temphighwarning',
'templowalarm', 'templowwarning',
'vcchighalarm', 'vcchighwarning',
Expand Down
Loading
Loading