Documentation ¶
Overview ¶
Package configtree contains the configuration tree
Index ¶
- type Configurable
- type GNMIConfigurable
- func (c *GNMIConfigurable) AddSubscribeResponder(responder SubscribeResponder)
- func (c *GNMIConfigurable) ProcessConfigGet(prefix *gnmi.Path, paths []*gnmi.Path) ([]*gnmi.Notification, error)
- func (c *GNMIConfigurable) ProcessConfigSet(prefix *gnmi.Path, updates []*gnmi.Update, replacements []*gnmi.Update, ...) ([]*gnmi.UpdateResult, error)
- func (c *GNMIConfigurable) RemoveSubscribeResponder(responder SubscribeResponder)
- func (c *GNMIConfigurable) Root() *Node
- func (c *GNMIConfigurable) SendToAllResponders(response *gnmi.SubscribeResponse)
- type Node
- func (n *Node) Add(name string, key map[string]string, value *gnmi.TypedValue) *Node
- func (n *Node) AddPath(path string, value *gnmi.TypedValue) *Node
- func (n *Node) Delete(name string, key map[string]string) *Node
- func (n *Node) DeletePath(path string) *Node
- func (n *Node) FindAll(path string) []*Node
- func (n *Node) Get(name string, key map[string]string) *Node
- func (n *Node) GetPath(path string) *Node
- func (n *Node) Key() map[string]string
- func (n *Node) MatchesKey(key map[string]string) bool
- func (n *Node) Name() string
- func (n *Node) Path() string
- func (n *Node) ReplacePath(path string, value *gnmi.TypedValue) *Node
- func (n *Node) Value() *gnmi.TypedValue
- type SubscribeResponder
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 (*Node) Add ¶
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 ¶
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 ¶
DeletePath iteratively gets the nodes along the given path and deletes the last node specified; nil if not found
func (*Node) FindAll ¶
FindAll finds all nodes matching the specified path, which can include wildcard "..." as key value
func (*Node) Get ¶
Get finds the immediate child node, identified by name and key; returns nil if the node does not exist
func (*Node) GetPath ¶
GetPath iteratively gets the nodes along the given path and returns the last node specified; nil if not found
func (*Node) MatchesKey ¶
MatchesKey returns true if the node's key matches the given key, which can include wild-cards
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