Skip to content

Add new fields to status table in STATE_DB#2

Open
longhuan-cisco wants to merge 12 commits intomasterfrom
add_to_status_tbl
Open

Add new fields to status table in STATE_DB#2
longhuan-cisco wants to merge 12 commits intomasterfrom
add_to_status_tbl

Conversation

@longhuan-cisco
Copy link
Copy Markdown
Owner

@longhuan-cisco longhuan-cisco commented Oct 11, 2022

Note
This PR is for internal review.
This PR has a dependency: longhuan-cisco/sonic-platform-common#1

  1. Add following new fields (provided by cmis.py:get_transceiver_status() API and c_cmis.py:get_transceiver_status() API ) to status table(TRANSCEIVER_STATUS) in STATE_DB
  2. Add corresponding DB update/delete handling along the xcvrd flow.

For the status table's DB schema, refer to this HLD from PR sonic-net/SONiC#1076

following SW fields(non-eeprom-fetched) are already present in today's status table:

status                       = 1*255VCHAR                       ; code of the module status (plug in, plug out)
error                        = 1*255VCHAR                       ; module error (N/A or a string consisting of error descriptions joined by "|", like "error1 | error2" )

following HW fields (eeprom-fetched) are added:

module_state                 = 1*255VCHAR                       ; current module state (ModuleLowPwr, ModulePwrUp, ModuleReady, ModulePwrDn, Fault)
module_fault_cause           = 1*255VCHAR                       ; reason of entering the module fault state
datapath_firmware_fault      = BOOLEAN                          ; datapath (DSP) firmware fault
module_firmware_fault        = BOOLEAN                          ; module firmware fault
module_state_changed         = BOOLEAN                          ; module state changed
datapath_hostlane1           = 1*255VCHAR                       ; data path state indicator on host lane 1
datapath_hostlane2           = 1*255VCHAR                       ; data path state indicator on host lane 2
datapath_hostlane3           = 1*255VCHAR                       ; data path state indicator on host lane 3
datapath_hostlane4           = 1*255VCHAR                       ; data path state indicator on host lane 4
datapath_hostlane5           = 1*255VCHAR                       ; data path state indicator on host lane 5
datapath_hostlane6           = 1*255VCHAR                       ; data path state indicator on host lane 6
datapath_hostlane7           = 1*255VCHAR                       ; data path state indicator on host lane 7
datapath_hostlane8           = 1*255VCHAR                       ; data path state indicator on host lane 8
txoutput_status              = BOOLEAN                          ; tx output status on media lane
rxoutput_status_hostlane1    = BOOLEAN                          ; rx output status on host lane 1
rxoutput_status_hostlane2    = BOOLEAN                          ; rx output status on host lane 2
rxoutput_status_hostlane3    = BOOLEAN                          ; rx output status on host lane 3
rxoutput_status_hostlane4    = BOOLEAN                          ; rx output status on host lane 4
rxoutput_status_hostlane5    = BOOLEAN                          ; rx output status on host lane 5
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
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
txlos_hostlane3              = BOOLEAN                          ; tx loss of signal flag on host lane 3
txlos_hostlane4              = BOOLEAN                          ; tx loss of signal flag on host lane 4
txlos_hostlane5              = BOOLEAN                          ; tx loss of signal flag on host lane 5
txlos_hostlane6              = BOOLEAN                          ; tx loss of signal flag on host lane 6
txlos_hostlane7              = BOOLEAN                          ; tx loss of signal flag on host lane 7
txlos_hostlane8              = BOOLEAN                          ; tx loss of signal flag on host lane 8
txcdrlol_hostlane1           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 1
txcdrlol_hostlane2           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 2
txcdrlol_hostlane3           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 3
txcdrlol_hostlane4           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 4
txcdrlol_hostlane5           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 5
txcdrlol_hostlane6           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 6
txcdrlol_hostlane7           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 7
txcdrlol_hostlane8           = BOOLEAN                          ; tx clock and data recovery loss of lock on host lane 8
rxlos                        = BOOLEAN                          ; rx loss of signal flag on media lane
rxcdrlol                     = BOOLEAN                          ; rx clock and data recovery loss of lock on media lane
config_state_hostlane1       = 1*255VCHAR                       ; configuration status for the data path of host line 1
config_state_hostlane2       = 1*255VCHAR                       ; configuration status for the data path of host line 2
config_state_hostlane3       = 1*255VCHAR                       ; configuration status for the data path of host line 3
config_state_hostlane4       = 1*255VCHAR                       ; configuration status for the data path of host line 4
config_state_hostlane5       = 1*255VCHAR                       ; configuration status for the data path of host line 5
config_state_hostlane6       = 1*255VCHAR                       ; configuration status for the data path of host line 6
config_state_hostlane7       = 1*255VCHAR                       ; configuration status for the data path of host line 7
config_state_hostlane8       = 1*255VCHAR                       ; configuration status for the data path of host line 8
dpinit_pending_hostlane1     = BOOLEAN                          ; data path configuration updated on host lane 1 
dpinit_pending_hostlane2     = BOOLEAN                          ; data path configuration updated on host lane 2
dpinit_pending_hostlane3     = BOOLEAN                          ; data path configuration updated on host lane 3
dpinit_pending_hostlane4     = BOOLEAN                          ; data path configuration updated on host lane 4
dpinit_pending_hostlane5     = BOOLEAN                          ; data path configuration updated on host lane 5
dpinit_pending_hostlane6     = BOOLEAN                          ; data path configuration updated on host lane 6
dpinit_pending_hostlane7     = BOOLEAN                          ; data path configuration updated on host lane 7
dpinit_pending_hostlane8     = BOOLEAN                          ; data path configuration updated on host lane 8
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
tuning_not_accepted          = BOOLEAN                          ; tuning not accepted flag
invalid_channel_num          = BOOLEAN                          ; invalid channel number flag
tuning_complete              = BOOLEAN                          ; tuning complete flag
temphighalarm_flag           = BOOLEAN                          ; temperature high alarm flag 
temphighwarning_flag         = BOOLEAN                          ; temperature high warning flag
templowalarm_flag            = BOOLEAN                          ; temperature low alarm flag
templowwarning_flag          = BOOLEAN                          ; temperature low warning flag
vcchighalarm_flag            = BOOLEAN                          ; vcc high alarm flag
vcchighwarning_flag          = BOOLEAN                          ; vcc high warning flag
vcclowalarm_flag             = BOOLEAN                          ; vcc low alarm flag
vcclowwarning_flag           = BOOLEAN                          ; vcc low warning flag
txpowerhighalarm_flag        = BOOLEAN                          ; tx power high alarm flag
txpowerlowalarm_flag         = BOOLEAN                          ; tx power low alarm flag
txpowerhighwarning_flag      = BOOLEAN                          ; tx power high warning flag
txpowerlowwarning_flag       = BOOLEAN                          ; tx power low alarm flag
rxpowerhighalarm_flag        = BOOLEAN                          ; rx power high alarm flag
rxpowerlowalarm_flag         = BOOLEAN                          ; rx power low alarm flag
rxpowerhighwarning_flag      = BOOLEAN                          ; rx power high warning flag
rxpowerlowwarning_flag       = BOOLEAN                          ; rx power low warning flag
txbiashighalarm_flag         = BOOLEAN                          ; tx bias high alarm flag
txbiaslowalarm_flag          = BOOLEAN                          ; tx bias low alarm flag
txbiashighwarning_flag       = BOOLEAN                          ; tx bias high warning flag
txbiaslowwarning_flag        = BOOLEAN                          ; tx bias low warning flag
lasertemphighalarm_flag      = BOOLEAN                          ; laser temperature high alarm flag
lasertemplowalarm_flag       = BOOLEAN                          ; laser temperature low alarm flag
lasertemphighwarning_flag    = BOOLEAN                          ; laser temperature high warning flag
lasertemplowwarning_flag     = BOOLEAN                          ; laser temperature low warning flag
prefecberhighalarm_flag      = BOOLEAN                          ; prefec ber high alarm flag
prefecberlowalarm_flag       = BOOLEAN                          ; prefec ber low alarm flag
prefecberhighwarning_flag    = BOOLEAN                          ; prefec ber high warning flag
prefecberlowwarning_flag     = BOOLEAN                          ; prefec ber low warning flag
postfecberhighalarm_flag     = BOOLEAN                          ; postfec ber high alarm flag
postfecberlowalarm_flag      = BOOLEAN                          ; postfec ber low alarm flag
postfecberhighwarning_flag   = BOOLEAN                          ; postfec ber high warning flag
postfecberlowwarning_flag    = BOOLEAN                          ; postfec ber low warning flag
biasxihighalarm_flag         = BOOLEAN                          ; bias xi high alarm flag
biasxilowalarm_flag          = BOOLEAN                          ; bias xi low alarm flag
biasxihighwarning_flag       = BOOLEAN                          ; bias xi high warning flag
biasxilowwarning_flag        = BOOLEAN                          ; bias xi low warning flag
biasxqhighalarm_flag         = BOOLEAN                          ; bias xq high alarm flag
biasxqlowalarm_flag          = BOOLEAN                          ; bias xq low alarm flag
biasxqhighwarning_flag       = BOOLEAN                          ; bias xq high warning flag
biasxqlowwarning_flag        = BOOLEAN                          ; bias xq low warning flag
biasxphighalarm_flag         = BOOLEAN                          ; bias xp high alarm flag
biasxplowalarm_flag          = BOOLEAN                          ; bias xp low alarm flag
biasxphighwarning_flag       = BOOLEAN                          ; bias xp high warning flag
biasxplowwarning_flag        = BOOLEAN                          ; bias xp low warning flag
biasyihighalarm_flag         = BOOLEAN                          ; bias yi high alarm flag
biasyilowalarm_flag          = BOOLEAN                          ; bias yi low alarm flag
biasyihighwarning_flag       = BOOLEAN                          ; bias yi high warning flag
biasyilowwarning_flag        = BOOLEAN                          ; bias yi low warning flag
biasyqhighalarm_flag         = BOOLEAN                          ; bias yq high alarm flag
biasyqlowalarm_flag          = BOOLEAN                          ; bias yq low alarm flag
biasyqhighwarning_flag       = BOOLEAN                          ; bias yq high warning flag
biasyqlowwarning_flag        = BOOLEAN                          ; bias yq low warning flag
biasyphighalarm_flag         = BOOLEAN                          ; bias yp high alarm flag
biasyplowalarm_flag          = BOOLEAN                          ; bias yp low alarm flag
biasyphighwarning_flag       = BOOLEAN                          ; bias yp high warning flag
biasyplowwarning_flag        = BOOLEAN                          ; bias yp low warning flag
cdshorthighalarm_flag        = BOOLEAN                          ; cd short high alarm flag
cdshortlowalarm_flag         = BOOLEAN                          ; cd short low alarm flag
cdshorthighwarning_flag      = BOOLEAN                          ; cd short high warning flag
cdshortlowwarning_flag       = BOOLEAN                          ; cd short low warning flag
cdlonghighalarm_flag         = BOOLEAN                          ; cd long high alarm flag
cdlonglowalarm_flag          = BOOLEAN                          ; cd long low alarm flag
cdlonghighwarning_flag       = BOOLEAN                          ; cd long high warning flag
cdlonglowwarning_flag        = BOOLEAN                          ; cd long low warning flag
dgdhighalarm_flag            = BOOLEAN                          ; dgd high alarm flag
dgdlowalarm_flag             = BOOLEAN                          ; dgd low alarm flag
dgdhighwarning_flag          = BOOLEAN                          ; dgd high warning flag
dgdlowwarning_flag           = BOOLEAN                          ; dgd low warning flag
sopmdhighalarm_flag          = BOOLEAN                          ; sopmd high alarm flag
sopmdlowalarm_flag           = BOOLEAN                          ; sopmd low alarm flag
sopmdhighwarning_flag        = BOOLEAN                          ; sopmd high warning flag
sopmdlowwarning_flag         = BOOLEAN                          ; sopmd low warning flag
pdlhighalarm_flag            = BOOLEAN                          ; pdl high alarm flag
pdllowalarm_flag             = BOOLEAN                          ; pdl low alarm flag
pdlhighwarning_flag          = BOOLEAN                          ; pdl high warning flag
pdllowwarning_flag           = BOOLEAN                          ; pdl low warning flag
osnrhighalarm_flag           = BOOLEAN                          ; osnr high alarm flag
osnrlowalarm_flag            = BOOLEAN                          ; osnr low alarm flag
osnrhighwarning_flag         = BOOLEAN                          ; osnr high warning flag
osnrlowwarning_flag          = BOOLEAN                          ; osnr low warning flag
esnrhighalarm_flag           = BOOLEAN                          ; esnr high alarm flag
esnrlowalarm_flag            = BOOLEAN                          ; esnr low alarm flag
esnrhighwarning_flag         = BOOLEAN                          ; esnr high warning flag
esnrlowwarning_flag          = BOOLEAN                          ; esnr low warning flag
cfohighalarm_flag            = BOOLEAN                          ; cfo high alarm flag
cfolowalarm_flag             = BOOLEAN                          ; cfo low alarm flag
cfohighwarning_flag          = BOOLEAN                          ; cfo high warning flag
cfolowwarning_flag           = BOOLEAN                          ; cfo low warning flag
txcurrpowerhighalarm_flag    = BOOLEAN                          ; txcurrpower high alarm flag
txcurrpowerlowalarm_flag     = BOOLEAN                          ; txcurrpower low alarm flag
txcurrpowerhighwarning_flag  = BOOLEAN                          ; txcurrpower high warning flag
txcurrpowerlowwarning_flag   = BOOLEAN                          ; txcurrpower low warning flag
rxtotpowerhighalarm_flag     = BOOLEAN                          ; rxtotpower high alarm flag
rxtotpowerlowalarm_flag      = BOOLEAN                          ; rxtotpower low alarm flag
rxtotpowerhighwarning_flag   = BOOLEAN                          ; rxtotpower high warning flag
rxtotpowerlowwarning_flag    = BOOLEAN                          ; rxtotpower low warning flag
rxsigpowerhighalarm_flag     = BOOLEAN                          ; rxsigpower high alarm flag
rxsigpowerlowalarm_flag      = BOOLEAN                          ; rxsigpower low alarm flag
rxsigpowerhighwarning_flag   = BOOLEAN                          ; rxsigpower high warning flag
rxsigpowerlowwarning_flag    = BOOLEAN                          ; rxsigpower low warning flag

UT output:
status_tbl_ut_output.txt

* Push new fields to DOM_SENSOR table in STATE_DB

* Remove empty line

Signed-off-by: Longyin Huang longhuan@cisco.com
fvs = swsscommon.FieldValuePairs([('status', status), ('error', error_descriptions)])
status_tbl.set(logical_port_name, fvs)

# Update port SFP status table for HW fields
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have created 2 different functions to update *status_table_hw and *status_table_sw but does it update same status table? what are variables here?

Copy link
Copy Markdown
Owner Author

@longhuan-cisco longhuan-cisco Oct 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one is for updating SW fields which are non eeprom-fetched ('status' 'error' ); one is for updating HW fields which are eeprom-fetched. I updated in the PR description about which are SW fields, which are HW fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants