pluginregistry

package
v0.10.24 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelPlugin

type ModelPlugin interface {
	// GetInfo returns the model plugin info
	GetInfo() *ModelPluginInfo

	// Capabilities returns the model plugin gNMI capabilities response
	Capabilities(ctx context.Context) *gnmi.CapabilityResponse

	// Validate validates the specified JSON configuration against the plugin's schema
	Validate(ctx context.Context, jsonData []byte) error

	// GetPathValues extracts typed path values from the specified configuration change JSON
	GetPathValues(ctx context.Context, pathPrefix string, jsonData []byte) ([]*configapi.PathValue, error)
}

ModelPlugin defines the expected behaviour of a model plugin

type ModelPluginInfo added in v0.10.16

type ModelPluginInfo struct {
	// The ID is used to identify and index the plugin.
	// Since the final value (comprised of ModelInfoResponse.ModelInfo.Name and ModelInfoResponse.ModelInfo.Version)
	// is discovered only after the plugin has been loaded and
	// a temporary one is generated if the plugin fails to load.
	// The ID is then used to lookup the plugin when a gNMI Set request is received,
	// and it is learned via the gNMI Extension 101 and 102
	ID             string
	Endpoint       string
	Info           api.ModelInfo
	Client         api.ModelPluginServiceClient
	ReadOnlyPaths  path.ReadOnlyPathMap
	ReadWritePaths path.ReadWritePathMap
	// Status indicates whether a plugin was correctly loaded
	Status modelPluginStatus
	// Error is an optional field populated only if the plugin failed to be correctly discovered
	Error string
}

ModelPluginInfo is a record of information compiled from the configuration model plugin

func (*ModelPluginInfo) Capabilities added in v0.10.16

func (p *ModelPluginInfo) Capabilities(ctx context.Context) *gnmi.CapabilityResponse

Capabilities returns the model plugin gNMI capabilities response

func (*ModelPluginInfo) GetInfo added in v0.10.16

func (p *ModelPluginInfo) GetInfo() *ModelPluginInfo

GetInfo returns the model plugin info

func (*ModelPluginInfo) GetPathValues added in v0.10.16

func (p *ModelPluginInfo) GetPathValues(ctx context.Context, pathPrefix string, jsonData []byte) ([]*configapi.PathValue, error)

GetPathValues extracts typed path values from the specified configuration change JSON

func (*ModelPluginInfo) Validate added in v0.10.16

func (p *ModelPluginInfo) Validate(ctx context.Context, jsonData []byte) error

Validate validates the specified JSON configuration against the plugin's schema

type PluginRegistry

type PluginRegistry interface {
	// Start the plugin registry
	Start()
	// Stop the plugin registry
	Stop()

	// GetPlugin returns the plugin with the specified ID
	GetPlugin(model configapi.TargetType, version configapi.TargetVersion) (ModelPlugin, bool)

	// GetPlugins returns list of all registered plugins
	GetPlugins() []ModelPlugin
}

PluginRegistry is a set of available configuration model plugins

func NewPluginRegistry

func NewPluginRegistry(endpoints ...string) PluginRegistry

NewPluginRegistry creates a plugin registry that will search the specified gRPC ports to look for model plugins

Jump to

Keyboard shortcuts

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