client

package
v0.0.0-...-a37c8fb Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package client provides helper functions for OpenConfig CLI tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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) []*openconfig.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

Jump to

Keyboard shortcuts

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