Skip to content

sachinholla/sonic-gnmi

This branch is 1 commit ahead of, 231 commits behind sonic-net/sonic-gnmi:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ce1a273 · Jan 18, 2024
Jun 19, 2023
Nov 28, 2022
Jul 25, 2022
Dec 19, 2023
Nov 28, 2022
Nov 21, 2022
Dec 19, 2023
Nov 28, 2022
Jul 28, 2023
Oct 10, 2023
Jan 16, 2024
Dec 19, 2023
Nov 28, 2022
Jul 3, 2023
Jul 27, 2023
Aug 21, 2023
Jun 14, 2021
Jan 16, 2024
Jun 16, 2023
Jun 16, 2023
Dec 23, 2019
Mar 23, 2018
Oct 10, 2023
Oct 13, 2022
Jan 18, 2024
Jun 16, 2023
May 19, 2022
Mar 10, 2022

Repository files navigation

SONiC-telemetry

Description

This repository contains implementation for the sonic system telemetry services:

  • dial-in mode system telemetry server: telemetry
  • dial-out mode system telemetry client dialout_client_cli

Getting Started

Prerequisites

Install go in your system https://golang.org/doc/install. Requires golang1.8+.

Installing

To install dial-in mode system telemetry server, run

go get -u github.com/sonic-net/sonic-gnmi/telemetry

To install dial-out mode system telemetry client, run

go get -u github.com/sonic-net/sonic-gnmi/dialout/dialout_client_cli

There is also a test program dialout_server_cli for collecting data from dial-out mode system telemetry client. Note: it is for testing purpose only.

go get -u github.com/sonic-net/sonic-gnmi/dialout/dialout_server_cli

The binaries will be installed under $GOPATH/bin/, they may be copied to any SONiC switch and run there.

You can also build a debian package and install it:

git clone https://github.com/sonic-net/sonic-gnmi.git
pushd sonic-gnmi
dpkg-buildpackage -rfakeroot -b -us -uc
popd

Running

Streaming events

SONiC publishes events of interest via gNMI. Sample events could be bgp-state change, link-state change. A sample query URL is as below. gnmi_cli -client_types=gnmi -a 127.0.0.1:50051 -t EVENTS -logtostderr -insecure -v 7 -streaming_type ON_CHANGE -q all -qt s

The events URL can take the following optional parameters.
heartbeat:
[heartbeat=<N>]
    The SONiC switch publishes periodic hearbeats when there are no events to publish.
    The frequency of the heartbeat can be controlled by this parameter as beat in every N seconds.

usecache:
[usecache=true/false]
    The SONiC switch does offline cache when gNMI client is down.
    The cached events are delivered upon nest gNMI connection
    Only one client should use the cache service
    The cached events are delivered upon nest gNMI connection
    If you are running test clients, use this param to turn off cache use.

Sample URL:
gnmi_cli -client_types=gnmi -a 127.0.0.1:50051 -t EVENTS -logtostderr -insecure -v 7 -streaming_type ON_CHANGE -q all[heartbeat=5][usecache=false] -qt s

gnmi_cli is updated with following args

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

Need Help?

For general questions, setup help, or troubleshooting:

For bug reports or feature requests, please open an Issue.

Contribution guide

See the contributors guide for information about how to contribute.

GitHub Workflow

We're following basic GitHub Flow. If you have no idea what we're talking about, check out GitHub's official guide. Note that merge is only performed by the repository maintainer.

Guide for performing commits:

  • Isolate each commit to one component/bugfix/issue/feature
  • Use a standard commit message format:
[component/folder touched]: Description intent of your changes

[List of changes]

Signed-off-by: Your Name your@email.com

For example:

swss-common: Stabilize the ConsumerTable

* Fixing autoreconf
* Fixing unit-tests by adding checkers and initialize the DB before start
* Adding the ability to select from multiple channels
* Health-Monitor - The idea of the patch is that if something went wrong with the notification channel,
  we will have the option to know about it (Query the LLEN table length).

  Signed-off-by: user@dev.null
  • Each developer should fork this repository and add the team as a Contributor
  • Push your changes to your private fork and do "pull-request" to this repository
  • Use a pull request to do code review
  • Use issues to keep track of what is going on

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 75.4%
  • Python 21.8%
  • Makefile 1.4%
  • Other 1.4%