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

CLI for training lab 5. #1

Open
wants to merge 1 commit into
base: 201911
Choose a base branch
from
Open

CLI for training lab 5. #1

wants to merge 1 commit into from

Conversation

raphaelt-nvidia
Copy link
Owner

Signed-off-by: Raphael Tryster raphaelt@nvidia.com

What I did

Implemented a solution for Lab 5 in SONiC training based on one of the solutions provided in the Wiki, with some changes. These include using the counters DB instead of calls to SAI to retrieve the tx error counter, passing the statistics data by reference so that the difference between successive counter readings would be used correctly, and added python code to handle some not found conditions.

Why I did it

I used a prepared solution, studied it with gdb and modified it based on what I observed in gdb, because so much of the way code is written in C++ is unfamiliar that I expected writing from scratch would take an order of magnitude more than the time allotted, and I would get more benefit from studying and modifying existing code.

How I verified it

Configure polling period, e.g.

sudo config tx_error_stat_poll_period 30

Configure error threshold, e.g.

sudo config interface tx_error_threshold set Ethernet0 10

Disable automatic refresh of counters, so that counter values can be injected into DB and stay there:

counterpoll port disable

Lookup OID of port being tested, e.g.

redis-cli -n 2 hgetall "COUNTERS_PORT_NAME_MAP" | grep -A1 "Ethernet0"
Ethernet0
oid:0x10000000008d4

Inject tx errors to that port and verify that DB was updated:

redis-cli -n 2 hset "COUNTERS:oid:0x10000000008d4" "SAI_PORT_STAT_IF_OUT_ERRORS" "20"
(integer) 0
redis-cli -n 2 hget "COUNTERS:oid:0x10000000008d4" "SAI_PORT_STAT_IF_OUT_ERRORS"
"20"

Show status within the poll period:

show interfaces tx_error
Port status statistics

Ethernet0 error 20

Show status after the poll period:

show interfaces tx_error
Port status statistics

Ethernet0 ok 20

Repeat sequences of the above commands to verify that status becomes error when the delta exceeds the threshold, and ok when it doesn't.

Details if related

Signed-off-by: Raphael Tryster <raphaelt@nvidia.com>
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.

1 participant