Skip to content
New issue

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

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

Already on GitHub? # to your account

CMD line Utils for Tx Port Monitoring Feature #1

Closed
wants to merge 3 commits into from
Closed

Conversation

vivekrnv
Copy link
Owner

@vivekrnv vivekrnv commented Mar 1, 2021

What I did

Added CMD line Utilities for Tx Port Monitoring Feature.
Related PR's:
sonic-swss: vivekrnv/sonic-swss#1
sonic-swss-common vivekrnv/sonic-swss-common#1

How I did it

  • Added tx_error_threshold subgroup under config.interface (Specific to interface)
  • Added tx_error_stat_poll_period under config (Global across interfaces)
  • Added txerror under show.interface

How to verify it

Using redis-cli & Counter DB


admin@device:~$ show interface txerror
Port       Status    sai_port_id          Last Updated On        Tx Error Threshold
---------  --------  -------------------  -------------------  --------------------
Ethernet8  OK        oid:0x10000000004c5  2021-03-01.14:45:19                    20
Ethernet0  OK        oid:0x10000000004a4  2021-03-01.14:45:19                    30


admin@device:~$ redis-cli -n 2
127.0.0.1:6379[2]> hget "COUNTERS:oid:0x10000000004c5" SAI_PORT_STAT_IF_OUT_ERRORS
"0"

127.0.0.1:6379[2]> hset "COUNTERS:oid:0x10000000004c5" SAI_PORT_STAT_IF_OUT_ERRORS "25"
(integer) 0
127.0.0.1:6379[2]> hget "COUNTERS:oid:0x10000000004c5" SAI_PORT_STAT_IF_OUT_ERRORS
"25"

admin@device:~$ show interface txerror
Port       Status    sai_port_id          Last Updated On        Tx Error Threshold
---------  --------  -------------------  -------------------  --------------------
Ethernet8  ERROR     oid:0x10000000004c5  2021-03-01.14:46:04                    20
Ethernet0  OK        oid:0x10000000004a4  2021-03-01.14:46:04                    30

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

None

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

CMD: 1
admin@device:~$ sudo config tx_error_stat_poll_period --help
Usage: config tx_error_stat_poll_period [OPTIONS] <period>

  Polling period for Tx error statistics, Enter 0 to disable, xxx for
  default After Every Diable, any state information related to this feature
  is cleared out.

Options:
  -?, -h, --help  Show this message and exit.

CMD: 2
admin@device:~$ sudo config interface tx_error_threshold --help
Usage: config interface tx_error_threshold [OPTIONS] COMMAND [ARGS]...

  Set or Remove threshold of tx error count

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  clear  Clear threshold for Tx Error Monitoring
  set    Set threshold of for Tx error count

CMD: 3
admin@device:~$ sudo config interface tx_error_threshold set --help
Usage: config interface tx_error_threshold set [OPTIONS] <interface_name>
                                               <interface_tx_err_threshold>

  Set threshold of for Tx error count

Options:
  -?, -h, --help  Show this message and exit.

CMD: 4
sudo config interface tx_error_threshold set Ethernet16 1000

CMD: 5
admin@device:~$ show interface txerror
Port        Status    sai_port_id          Last Updated On        Tx Error Threshold
----------  --------  -------------------  -------------------  --------------------
Ethernet16  OK        oid:0x1000000000462  2021-03-01.14:46:53                  1000
Ethernet8   ERROR     oid:0x10000000004c5  2021-03-01.14:46:04                    20
Ethernet0   OK        oid:0x10000000004a4  2021-03-01.14:46:49                    30



@vivekrnv vivekrnv changed the title Temp CMD line Utils for Tx Port Monitoring Feature Mar 1, 2021
@vivekrnv vivekrnv requested a review from dprital March 1, 2021 15:05
@dgsudharsan
Copy link
Collaborator

Please avoid long commands with multiple underscores. The config commands could be
config tx_error polling-interval <interface_name>
config interface tx_error threshold <add/remove> <interface_name>

Copy link
Collaborator

@dgsudharsan dgsudharsan left a comment

Choose a reason for hiding this comment

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

Please use two separate tables for interface config vs tx_err global config( which has only interval as of now).

ctx.fail("Interface name is invalid. Please enter a valid interface name!!")

if config_db.get_entry('TX_ERR_CFG', interface_name):
if interface_name.startswith("Ethernet"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check might not be needed as only a key that was set earlier would be present in the DB and set already does this check

@dgsudharsan
Copy link
Collaborator

dgsudharsan commented Mar 10, 2021

Please display the polling interval in the show command before tabulating the port tx_error status or display it using a separate show command

vivekrnv pushed a commit that referenced this pull request Jan 25, 2024
…aidump_by_route_size (sonic-net#2972)

* * [saidump]
•	Saidump for DNX-SAI sonic-net/sonic-buildimage#13561

Solution and modification:
To use the redis-db SAVE option to save the snapshot of DB each time and recover later, instead of looping through each entry in the table and saving it.

(1) Updated sonic-buildimage/build_debian.sh, to install Python library rdbtools into the host.
(2) Updated sonic-buildimage/src/sonic-sairedis/saidump/saidump.cpp, add a new option -r, which updates the rdbtools's output-JSON files' format.
(3) Add a new script file: files/scripts/saidump.sh, to do the below steps
  For each ASIC0, such as ASIC0,

  #1. Save the Redis data.
  sudo sonic-db-cli -n asic$1 SAVE > /dev/null

  #2. Move dump files to /var/run/redisX/
  docker exec database$1 sh -c "mv /var/lib/redis/dump.rdb /var/run/redis$1/"

  #3. Run rdb command to convert the dump files into JSON files
  sudo python /usr/local/bin/rdb --command json  /var/run/redis$1/dump.rdb | sudo tee /var/run/redis$1/dump.json > /dev/null

  #4. Run saidump -r to update the JSON files' format as same as the saidump before. Then we can get the saidump result in standard output.
  docker exec syncd$1 sh -c "saidump -r /var/run/redis$1/dump.json"

  #5. clear
  sudo rm -f /var/run/redis$1/dump.rdb
  sudo rm -f /var/run/redis$1/dump.json

(4) Update sonic-buildimage/src/sonic-utilities/scripts/generate_dump, replace saidump with saidump.sh
* * [saidump]
•	Saidump for DNX-SAI sonic-net/sonic-buildimage#13561
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants