Version: v0.0.0-...-eb42da6 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 20



Package client provides helper functions for OpenConfig CLI tools.



View Source
const (
	// HostnameArg is the value to be replaced by the actual hostname
	HostnameArg = "HOSTNAME"


This section is empty.


func ParseFlags

func ParseFlags() (username string, password string, subscriptions, addrs []string,
	opts []grpc.DialOption)

ParseFlags registers some additional common flags, parses the flags, and returns the resulting gRPC options, and other settings to connect to the gRPC interface.

func ParseHostnames

func ParseHostnames(list string) ([]string, error)

ParseHostnames parses a comma-separated list of names and replaces HOSTNAME with the current hostname in it


type Client

type Client struct {
	// contains filtered or unexported fields

Client is a connected gRPC client

func New

func New(username, password, addr string, opts []grpc.DialOption) *Client

New creates a new gRPC client and connects it

func (*Client) Get

func (c *Client) Get(path string) []*gnmi.Notification

Get sends a get request and returns the responses

func (*Client) Subscribe

func (c *Client) Subscribe(wg *sync.WaitGroup, subscriptions []string,
	publish PublishFunc)

Subscribe sends subscriptions, and consumes responses. The given publish function is used to publish SubscribeResponses received for the given subscriptions, when connected to the given host, with the given user/pass pair, or the client-side cert specified in the gRPC opts. This function does not normally return so it should probably be run in its own goroutine. When this function returns, the given WaitGroup is marked as done.

type PublishFunc

type PublishFunc func(addr string, message proto.Message)

PublishFunc is the method to publish responses

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL