Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoAddress = errors.New("data source configuration does not define required 'address' value") ErrNoResources = errors.New("no telemetry resources configured for server") )
Errors related to loading and parsing data source configurations.
Functions ¶
func Add ¶
func Add(cfg *ServerConfig)
Add a ServerConfig to the globally tracked server configs. The configs contained there are define config options for the different networking devices to connect to over gRPC to collect telemetry.
This is set globally because of restrictions around variable scoping during plugin initialization and a fairly locked down interface for interacting with the plugin SDK.
Types ¶
type AuthConfig ¶
type AuthConfig struct { Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` ClientID string `yaml:"clientID,omitempty"` }
AuthConfig holds the configuration options for OpenConfig authentication messages, which may be required if the server has auth set up.
type KeepaliveConfig ¶
type KeepaliveConfig struct { Interval time.Duration `yaml:"interval,omitempty"` Timeout time.Duration `yaml:"timeout,omitempty"` }
KeepaliveConfig provides options for configuring gRPC client connection keepalive behavior.
type ResourcesConfig ¶
type ResourcesConfig struct { // Name is the OpenConfig path that identifies the system resource to stream telemetry // data, e.g. `/interfaces/interface/state/counters`. Name string `yaml:"name,omitempty"` // The interval at which data is reported and streamed to the plugin, in milliseconds. SampleInterval time.Duration `yaml:"sampleInterval"` }
ResourcesConfig is the configuration for resource streams which the plugin should subscribe to.
type ServerConfig ¶
type ServerConfig struct { // Address ([http[s]://]HOST[:PORT]) of the OpenConfig gRPC server to target. Address string `yaml:"address,omitempty"` MaxSendSize int `yaml:"maxSendSize,omitempty"` MaxRecvSize int `yaml:"maxRecvSize,omitempty"` Timeout time.Duration `yaml:"timeout,omitempty"` Keepalive KeepaliveConfig `yaml:"keepalive,omitempty"` // TLS configuration options for the gRPC client connection. TLS TLSConfig `yaml:"tls,omitempty"` // Auth holds configuration options for the OpenConfig login authentication // which may be required for a server. Auth AuthConfig `yaml:"auth,omitempty"` // Contexts allow users to define arbitrary context key-value pairs to be globally // applied to the devices for a plugin instance. Context map[string]string `yaml:"context,omitempty"` // Resources lists the resource identifiers which the plugin instance should subscribe to. Resources []ResourcesConfig `yaml:"resources,omitempty"` }
ServerConfig is the configuration for the gRPC server. This is loaded in from the plugin configuration's dynamic registration block.
func Get ¶
func Get() []*ServerConfig
Get the global server configs. These configs define the configuration options for gRPC servers that will stream network telemetry to the plugin.
If this configuration has not been set yet, a nil slice is returned.
func Load ¶
func Load(raw map[string]interface{}) (*ServerConfig, error)
Load the configuration for the plugin's UDP server which will listen for the streamed OpenConfig telemetry data.
This also performs basic validation of the data being loaded. It ensures that required fields are not empty.
type TLSConfig ¶
type TLSConfig struct { // ServerRootCAs is a collection of paths to PEM-encoded x509 certificate authorities, // used by clients to verify server certificates. ServerRootCAs []string `yaml:"serverRootCAs,omitempty"` // Cert is the path to the PEM-encoded public key to be used for TLS communication. Cert string `yaml:"cert,omitempty"` // Key is the path to the PEM-encoded private key to be used for TLS communication. Key string `yaml:"key,omitempty"` // InsecureSkipVerify controls whether a client verifies the server's certificate // chain and host name. InsecureSkipVerify bool `yaml:"insecureSkipVerify,omitempty"` }
TLSConfig holds the configuration options for setting up TLS on the gRPC connection.