Skip to content

[show] add support for muxcable metrics - #1615

Merged
vdahiya12 merged 3 commits into
sonic-net:masterfrom
vdahiya12:metrics-cli
May 21, 2021
Merged

[show] add support for muxcable metrics#1615
vdahiya12 merged 3 commits into
sonic-net:masterfrom
vdahiya12:metrics-cli

Conversation

@vdahiya12

@vdahiya12 vdahiya12 commented May 17, 2021

Copy link
Copy Markdown
Contributor

Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com

What I did

Added support for show muxcable metrics. This essentially records what events came to different modules per se
for toggling the mux from one state to another.
for example

admin@sonic$ show muxcable metrics Ethernet0 --json

{
"linkmgrd_switch_active_start": "2021-May-13 10:00:21.420898",
"linkmgrd_switch_standby_end": "2021-May-13 10:01:15.696728",
"linkmgrd_switch_unknown_end": "2021-May-13 10:00:26.123319",
"xcvrd_switch_standby_end": "2021-May-13 10:01:15.696051",
"xcvrd_switch_standby_start": "2021-May-13 10:01:15.690835"
}

or

admin@sonic:$ show muxcable metrics Ethernet0

PORT EVENT TIME
--------- ---------------------------- ---------------------------
Ethernet0 linkmgrd_switch_active_start 2021-May-13 10:00:21.420898
Ethernet0 linkmgrd_switch_standby_end 2021-May-13 10:01:15.696728
Ethernet0 linkmgrd_switch_unknown_end 2021-May-13 10:00:26.123319
Ethernet0 xcvrd_switch_standby_end 2021-May-13 10:01:15.696051
Ethernet0 xcvrd_switch_standby_start 2021-May-13 10:01:15.690835

How I did it

added changes in show/muxcable.py by reading and publishing the state DB contents for the corresponding table

How to verify it

unit tests are added for verifying.

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)

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Comment thread tests/muxcable_test.py Outdated
Comment thread tests/muxcable_test.py Outdated
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
jleveque
jleveque previously approved these changes May 17, 2021
"non_fatal|UnxCmplt": "0"
},
"MUX_METRICS_TABLE|Ethernet0": {
"linkmgrd_switch_active_start": "2021-May-13 10:00:21.420898",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is it possible the same date format as does linkmgrd, yyyy-mmm-dd?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's actually taken care in the xcvrd now, this version was running on old xcvrd changes, I will update the comment and testcases.

`admin@STR43-0101-0101-01LT0:~$ redis-cli -n 6 hgetall "MUX_METRICS_TABLE|Ethernet0"

  1. "linkmgrd_switch_active_start"
  2. "2021-May-13 10:00:21.420898"
  3. "linkmgrd_switch_unknown_end"
  4. "2021-May-13 10:00:26.123319"
  5. "xcvrd_switch_standby_start"
  6. "2021-May-17 18:15:11.057528"
  7. "xcvrd_switch_standby_end"
  8. "2021-May-17 18:15:11.062379"
  9. "linkmgrd_switch_standby_end"
  10. "2021-May-17 18:15:11.062887"`

tahmed-dev
tahmed-dev previously approved these changes May 17, 2021
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
@vdahiya12
vdahiya12 dismissed stale reviews from tahmed-dev and jleveque via 94c3b47 May 18, 2021 18:22
@vdahiya12
vdahiya12 merged commit 5d1ad05 into sonic-net:master May 21, 2021
@vdahiya12
vdahiya12 deleted the metrics-cli branch May 21, 2021 00:22
yxieca pushed a commit that referenced this pull request May 27, 2021
* [show] add support for muxcable metrics
What I did
Added support for show muxcable metrics. This essentially records what events came to different modules per se
for toggling the mux from one state to another.
for example

admin@sonic$ show muxcable metrics Ethernet0 --json

{
"linkmgrd_switch_active_start": "2021-May-13 10:00:21.420898",
"linkmgrd_switch_standby_end": "2021-May-13 10:01:15.696728",
"linkmgrd_switch_unknown_end": "2021-May-13 10:00:26.123319",
"xcvrd_switch_standby_end": "2021-May-13 10:01:15.696051",
"xcvrd_switch_standby_start": "2021-May-13 10:01:15.690835"
}

or

admin@sonic:$ show muxcable metrics Ethernet0

PORT EVENT TIME
--------- ---------------------------- ---------------------------
Ethernet0 linkmgrd_switch_active_start 2021-May-13 10:00:21.420898
Ethernet0 linkmgrd_switch_standby_end 2021-May-13 10:01:15.696728
Ethernet0 linkmgrd_switch_unknown_end 2021-May-13 10:00:26.123319
Ethernet0 xcvrd_switch_standby_end 2021-May-13 10:01:15.696051
Ethernet0 xcvrd_switch_standby_start 2021-May-13 10:01:15.690835

How I did it
added changes in show/muxcable.py by reading and publishing the state DB contents for the corresponding table


Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
gitsabari pushed a commit to gitsabari/sonic-utilities that referenced this pull request Jun 15, 2021
* [show] add support for muxcable metrics
What I did
Added support for show muxcable metrics. This essentially records what events came to different modules per se
for toggling the mux from one state to another.
for example

admin@sonic$ show muxcable metrics Ethernet0 --json

{
"linkmgrd_switch_active_start": "2021-May-13 10:00:21.420898",
"linkmgrd_switch_standby_end": "2021-May-13 10:01:15.696728",
"linkmgrd_switch_unknown_end": "2021-May-13 10:00:26.123319",
"xcvrd_switch_standby_end": "2021-May-13 10:01:15.696051",
"xcvrd_switch_standby_start": "2021-May-13 10:01:15.690835"
}

or

admin@sonic:$ show muxcable metrics Ethernet0

PORT EVENT TIME
--------- ---------------------------- ---------------------------
Ethernet0 linkmgrd_switch_active_start 2021-May-13 10:00:21.420898
Ethernet0 linkmgrd_switch_standby_end 2021-May-13 10:01:15.696728
Ethernet0 linkmgrd_switch_unknown_end 2021-May-13 10:00:26.123319
Ethernet0 xcvrd_switch_standby_end 2021-May-13 10:01:15.696051
Ethernet0 xcvrd_switch_standby_start 2021-May-13 10:01:15.690835

How I did it
added changes in show/muxcable.py by reading and publishing the state DB contents for the corresponding table


Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-utilities that referenced this pull request Aug 10, 2021
* [show] add support for muxcable metrics
What I did
Added support for show muxcable metrics. This essentially records what events came to different modules per se
for toggling the mux from one state to another.
for example

admin@sonic$ show muxcable metrics Ethernet0 --json

{
"linkmgrd_switch_active_start": "2021-May-13 10:00:21.420898",
"linkmgrd_switch_standby_end": "2021-May-13 10:01:15.696728",
"linkmgrd_switch_unknown_end": "2021-May-13 10:00:26.123319",
"xcvrd_switch_standby_end": "2021-May-13 10:01:15.696051",
"xcvrd_switch_standby_start": "2021-May-13 10:01:15.690835"
}

or

admin@sonic:$ show muxcable metrics Ethernet0

PORT EVENT TIME
--------- ---------------------------- ---------------------------
Ethernet0 linkmgrd_switch_active_start 2021-May-13 10:00:21.420898
Ethernet0 linkmgrd_switch_standby_end 2021-May-13 10:01:15.696728
Ethernet0 linkmgrd_switch_unknown_end 2021-May-13 10:00:26.123319
Ethernet0 xcvrd_switch_standby_end 2021-May-13 10:01:15.696051
Ethernet0 xcvrd_switch_standby_start 2021-May-13 10:01:15.690835

How I did it
added changes in show/muxcable.py by reading and publishing the state DB contents for the corresponding table


Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.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.

4 participants