parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendElemInPath

func AppendElemInPath(path *config.Path, name, key string) *config.Path

AppendElemInPath adds a pathElem to the config gnmi path

func CleanConfig2String

func CleanConfig2String(cfg map[string]interface{}) (map[string]interface{}, *string, error)

CleanConfig2String returns a clean config and a string clean means removing the prefixes in the json elements

func CreatePathElem

func CreatePathElem(e *yang.Entry) *config.PathElem

CreatePathElem returns a config path element from a yang Entry

func DeepCopy

func DeepCopy(in interface{}) (interface{}, error)

Make a deep copy from in into out object.

func GetTypeKind

func GetTypeKind(e *yang.Entry) string

GetTypeKind return a string of the kind of the yang entry

func GetTypeName

func GetTypeName(e *yang.Entry) string

GetypeName return a string of the type of the yang entry

func GnmiPath2ConfigPath

func GnmiPath2ConfigPath(inPath *gnmi.Path) *config.Path

GnmiPath2ConfigPath converts the gnmi path to config path

func GnmiPathToName

func GnmiPathToName(path *config.Path) string

GnmiPathToName converts a config gnmi path to a name where each element of the path is seperated by a "-"

func GnmiPathToXPath

func GnmiPathToXPath(path *config.Path, keys bool) *string

GnmiPathToXPath converts a config gnmi path with or withour keys to a string pointer

func ProcessLeafRef

func ProcessLeafRef(e *yang.Entry, resfullPath string, activeResPath *config.Path) (*config.Path, *config.Path, bool)

ProcessLeafRef processes the leafref and returns if a leafref localPath, remotePath and if the leafRef is local or external to the resource used for yang parser

func RemoveFirstEntry

func RemoveFirstEntry(s string) string

RemoveFirstEntry removes the first entry of the xpath, so it trims the first element of the /

func RemoveHierarchicalKeys

func RemoveHierarchicalKeys(d []byte, hids []string) ([]byte, error)

RemoveHierarchicalKeys removes the hierarchical keys from the data

func TransformPathAsRelative2Resource

func TransformPathAsRelative2Resource(localPath, activeResPath *config.Path) *config.Path

TransformPathAsRelative2Resource returns a relative path

func TransformPathToLeafRefPath

func TransformPathToLeafRefPath(path *config.Path) *config.Path

TransformPathToLeafRefPath returns a config gnmi path tailored for leafrefs For a leafRef path the last entry of the name should be a key in the previous element

func XpathToGnmiPath

func XpathToGnmiPath(p string, offset int) (path *config.Path)

XpathToGnmiPath convertss a xpath string to a config gnmi path

Types

type Option

type Option func(p *Parser)

Option can be used to manipulate Options.

func WithLogger

func WithLogger(log logging.Logger) Option

WithLogger specifies how the Parser should log messages.

type Parser

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

func NewParser

func NewParser(opts ...Option) *Parser

Jump to

Keyboard shortcuts

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