config

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config contains the configuration tree

Package config contains the configuration tree

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimulateTrafficCounters added in v0.1.3

func SimulateTrafficCounters(ctx context.Context, delay time.Duration, node *Node)

SimulateTrafficCounters simulates a select set of traffic-related counters for all ports under the given root configuration

Types

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 NewSwitchConfig

func NewSwitchConfig(ports map[simapi.PortID]*simapi.Port) *Node

NewSwitchConfig creates a new switch skeleton configuration and returns its root node

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

Jump to

Keyboard shortcuts

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