pluginregistry

package
v0.10.13 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 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 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
}

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

func (*ModelPlugin) Capabilities added in v0.10.11

func (p *ModelPlugin) Capabilities(ctx context.Context, jsonData []byte) *gnmi.CapabilityResponse

Capabilities returns the model plugin gNMI capabilities response

func (*ModelPlugin) GetPathValues

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

GetPathValues extracts typed path values from the specified configuration change JSON

func (*ModelPlugin) Validate

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

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

type PluginRegistry

type PluginRegistry struct {
	// contains filtered or unexported fields
}

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

func (*PluginRegistry) GetPlugin

func (r *PluginRegistry) GetPlugin(id string) (*ModelPlugin, bool)

GetPlugin returns the plugin with the specified ID NOTE this method might get slow if we have a lot of plugins loaded. Do we see that as a possibility? If so we might need to re-work the registry and index the plugins using the ID while using an autogenerated ID for the ones that fail to load (eg: unknown-fee754)

func (*PluginRegistry) GetPlugins

func (r *PluginRegistry) GetPlugins() []*ModelPlugin

GetPlugins returns list of all registered plugins

func (*PluginRegistry) Start

func (r *PluginRegistry) Start()

Start the plugin registry

func (*PluginRegistry) Stop

func (r *PluginRegistry) Stop()

Stop the plugin registry

Jump to

Keyboard shortcuts

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