configtree

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package configtree contains the configuration tree

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configurable added in v0.1.8

type Configurable interface {
	// RefreshConfig refreshes the config tree state from any relevant external source state
	RefreshConfig()

	// UpdateConfig updates external target state using the config tree state.
	UpdateConfig()
}

Configurable provides an abstraction of a config tree-based configuration mechanism

type GNMIConfigurable added in v0.1.8

type GNMIConfigurable struct {
	Configurable Configurable
	// contains filtered or unexported fields
}

GNMIConfigurable provides a base implementation of a gNMI server backed by a config tree

func NewGNMIConfigurable added in v0.1.8

func NewGNMIConfigurable(root *Node) *GNMIConfigurable

NewGNMIConfigurable creates a new gNMI configurable backed by the specified config tree root.

func (*GNMIConfigurable) AddSubscribeResponder added in v0.1.8

func (c *GNMIConfigurable) AddSubscribeResponder(responder SubscribeResponder)

AddSubscribeResponder adds the given subscribe responder to the specified device

func (*GNMIConfigurable) ProcessConfigGet added in v0.1.8

func (c *GNMIConfigurable) ProcessConfigGet(prefix *gnmi.Path, paths []*gnmi.Path) ([]*gnmi.Notification, error)

ProcessConfigGet provides internals of a gNMI get request

func (*GNMIConfigurable) ProcessConfigSet added in v0.1.8

func (c *GNMIConfigurable) ProcessConfigSet(prefix *gnmi.Path, updates []*gnmi.Update, replacements []*gnmi.Update, deletes []*gnmi.Path) ([]*gnmi.UpdateResult, error)

ProcessConfigSet provides internals of a gNMI set request

func (*GNMIConfigurable) RemoveSubscribeResponder added in v0.1.8

func (c *GNMIConfigurable) RemoveSubscribeResponder(responder SubscribeResponder)

RemoveSubscribeResponder removes the specified subscribe responder from the specified device

func (*GNMIConfigurable) Root added in v0.1.8

func (c *GNMIConfigurable) Root() *Node

Root returns the root node of the backing config tree

func (*GNMIConfigurable) SendToAllResponders added in v0.1.10

func (c *GNMIConfigurable) SendToAllResponders(response *gnmi.SubscribeResponse)

SendToAllResponders sends the specified notification(s) to all responders

type Node

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

Node represents a single node in the configuration tree

func NewRoot

func NewRoot() *Node

NewRoot creates a new configuration tree root

func (*Node) Add

func (n *Node) Add(name string, key map[string]string, value *gnmi.TypedValue) *Node

Add adds a child node, identified by name and key; if the node already exists, it will not be replaced, but it's value will be updated

func (*Node) AddPath

func (n *Node) AddPath(path string, value *gnmi.TypedValue) *Node

AddPath iteratively adds the nodes along the given path and returns the last node added

func (*Node) Delete

func (n *Node) Delete(name string, key map[string]string) *Node

Delete deletes the specified child node, identified by name and key; returns the deleted node or nil if node did not exist

func (*Node) DeletePath

func (n *Node) DeletePath(path string) *Node

DeletePath iteratively gets the nodes along the given path and deletes the last node specified; nil if not found

func (*Node) FindAll

func (n *Node) FindAll(path string) []*Node

FindAll finds all nodes matching the specified path, which can include wildcard "..." as key value

func (*Node) Get

func (n *Node) Get(name string, key map[string]string) *Node

Get finds the immediate child node, identified by name and key; returns nil if the node does not exist

func (*Node) GetPath

func (n *Node) GetPath(path string) *Node

GetPath iteratively gets the nodes along the given path and returns the last node specified; nil if not found

func (*Node) Key

func (n *Node) Key() map[string]string

Key returns the node key

func (*Node) MatchesKey

func (n *Node) MatchesKey(key map[string]string) bool

MatchesKey returns true if the node's key matches the given key, which can include wild-cards

func (*Node) Name

func (n *Node) Name() string

Name returns the node name

func (*Node) Path

func (n *Node) Path() string

Path returns the full node path

func (*Node) ReplacePath

func (n *Node) ReplacePath(path string, value *gnmi.TypedValue) *Node

ReplacePath performs like AddPath, but replaces the leaf node entirely, including its child nodes

func (*Node) Value

func (n *Node) Value() *gnmi.TypedValue

Value returns the node value; nil if node is a parent node to other children

type SubscribeResponder added in v0.1.8

type SubscribeResponder interface {
	// GetConnection returns the peer connection address
	GetConnection() *misc.Connection

	// Send queues up the specified response to asynchronously sends on the backing stream
	Send(response *gnmi.SubscribeResponse)
}

SubscribeResponder is an abstraction for sending SubscribeResponse messages to controllers

Jump to

Keyboard shortcuts

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