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

gnmi_cli - Tool updte #44

Merged
merged 2 commits into from
Oct 10, 2022
Merged

Conversation

renukamanavalan
Copy link
Contributor

Why I did it

To make the tool usable in scripting environment

How I did it

When configured via args:

  • Write responses only to a o/p file instead of stdout.
  • For on change events, filter for a specific event.
  • Exit upon receiving N responses.
  • Exit upon timeout.

The above would help use gnmi_cli as tool in scripting environment that does testing.

Sample Usage:
To receive any/all event until killed:
gnmi_cli -client_types=gnmi -a 127.0.0.1:50051 -t EVENTS -logtostderr -insecure -v 7 -qt s -q all[heartbeat=5] -streaming_type ON_CHANGE

To receive events to a file:
Add "-output_file=<file>"

To filter out for specific event:
Add "-expected_event=<event module:event tag>"

e.g. "-expected_event=sonic-events-bgp:bgp-state"

To read N events and exit
Add "-expected_count <N>"

To run with a max timeout:
Add "-streaming_timeout 10"

The following cmd will run the tool until it receives 5 test events or timeout upon 10s, whichever is earlier and receives events are written into file "/tmp/ee".

gnmi_cli -client_types=gnmi -a 127.0.0.1:50051 -t EVENTS -logtostderr -insecure -v 7 -qt s -q all[heartbeat=5] -streaming_type ON_CHANGE -output_file=/tmp/ee -expected_event=":test-tag" -expected_count 5 -streaming_timeout 10

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

renukamanavalan and others added 2 commits October 9, 2022 10:21
* syntax

* Update gnmi_cli
When configured via args:
    1) Write responses only to a o/p file instead of stdout.
    2) For on change events, filter for a specific event.
    3) Exit upon receiving N responses.
    4) Exit upon timeout.

The above would help use gnmi_cli as tool in scripting environment that does testing.
@renukamanavalan renukamanavalan merged commit 4f45e3a into sonic-net:master Oct 10, 2022
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