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

[sfputil] Expose error status fetched from STATE_DB or platform API to CLI #1658

Merged
merged 4 commits into from
Jun 25, 2021

Conversation

stephenxs
Copy link
Collaborator

@stephenxs stephenxs commented Jun 8, 2021

What I did

Expose error status fetched from STATE_DB or platform API to CLI.
The command is

  • sfputil show error-status [-hw|--fetch-from-hardware] [<interface_name>]
  • and show interfaces transceiver error-status [-hw|--fetch-from-hardware] [<interface_name>]

The error status will be fetched from

  • STATE_DB by default
  • hardware via platform API if the parameter --fetch-from-hardware is provided.
    In this case, the CLI will call platform API in the pmon docker and format the output.

Signed-off-by: Stephen Sun stephens@nvidia.com

How I did it

How to verify it

Manually test and unit test

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

admin@sonic:~$ show interfaces transceiver error-status 
Port         Error Status
-----------  ----------------------------------------------------
Ethernet0    OK
Ethernet4    OK
Ethernet8    Long range for non-Mellanox cable or module
Ethernet12   OK
Ethernet16   OK
Ethernet20   OK
Ethernet24   Blocking EEPROM from being read|High temperature
Ethernet28   OK
Ethernet32   OK
Ethernet36   OK
Ethernet40   OK
Ethernet44   OK
Ethernet48   OK
Ethernet52   OK
Ethernet56   OK
Ethernet60   OK
Ethernet64   OK
Ethernet68   OK
Ethernet72   OK
Ethernet76   OK
Ethernet80   OK
Ethernet84   OK
Ethernet88   Blocking EEPROM from being read|Bus stuck (I2C data or clock shorted)
Ethernet92   OK
Ethernet96   OK
Ethernet100  OK
Ethernet104  OK
Ethernet108  OK
Ethernet112  Long range for non-Mellanox cable or module
Ethernet116  OK
Ethernet120  OK
Ethernet124  OK
admin@sonic:~$ show interfaces transceiver error-status Ethernet100
Port         Error Status
-----------  --------------
Ethernet100  OK

@jleveque
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stephenxs
Copy link
Collaborator Author

Looks like it's the same error as that in sonic-net/sonic-buildimage#7848

- Available on Mellanox platform only
- Platform API to fetch SFP error status via calling SDK API
- CLI to call platform API in pmon docker and format the output

Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun <stephens@nvidia.com>
Signed-off-by: Stephen Sun <stephens@nvidia.com>
@jleveque
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stephenxs
Copy link
Collaborator Author

Failed by dependencies on sonic-yang-mgmt

2021-06-15T01:43:11.5665980Z WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
2021-06-15T01:43:11.6248398Z + sudo pip3 install sonic_config_engine-1.0-py3-none-any.whl
2021-06-15T01:43:12.0754958Z Processing ./sonic_config_engine-1.0-py3-none-any.whl
2021-06-15T01:43:12.1672716Z ERROR: Could not find a version that satisfies the requirement sonic-yang-mgmt>=1.0 (from sonic-config-engine) (from versions: none)
2021-06-15T01:43:12.1677335Z ERROR: No matching distribution found for sonic-yang-mgmt>=1.0
2021-06-15T01:43:12.2184916Z ##[error]Bash exited with code '1'.

sfputil/main.py Show resolved Hide resolved
sfputil/main.py Show resolved Hide resolved
sfputil/main.py Show resolved Hide resolved
sfputil/main.py Show resolved Hide resolved
show/interfaces/__init__.py Show resolved Hide resolved
@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@jleveque is it ok to merge now?

@jleveque
Copy link
Contributor

@jleveque is it ok to merge now?

It appears so. The unrelated test failures have been fixed and tests are now passing.

@jleveque jleveque merged commit 38f8c06 into sonic-net:master Jun 25, 2021
@stephenxs stephenxs deleted the sfp-error-status branch June 25, 2021 23:01
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-utilities that referenced this pull request Aug 10, 2021
…o CLI (sonic-net#1658)

Expose error status fetched from STATE_DB or platform API to CLI.

The command is
- `sfputil show error-status [-hw|--fetch-from-hardware] [<interface_name>]`
- and `show interfaces transceiver error-status [-hw|--fetch-from-hardware] [<interface_name>]`

The error status will be fetched from
- `STATE_DB` by default
- hardware via platform API if the parameter `--fetch-from-hardware` is provided.
  In this case, the CLI will call platform API in the pmon docker and format the output.

Signed-off-by: Stephen Sun <stephens@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants