path

package
v0.10.22 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const IndexAllowedChars = `^([a-zA-Z0-9\*\-\._])+$`

IndexAllowedChars - regexp to restrict characters in index names

View Source
const MatchOnIndex = `(\[.*?]).*?`

MatchOnIndex - regexp to find indices in paths names

Variables

This section is empty.

Functions

func AddMissingIndexName

func AddMissingIndexName(path string) []string

AddMissingIndexName - a delete might just include the index at the end and not the index attribute e.g. /cont1a/list5[key1=abc][key2=123] - this means that we want to delete it and all of its children To match the model path though this has to include the key index name e.g. /cont1a/list5[key1=abc][key2=123]/key1 OR /cont1a/list5[key1=abc][key2=123]/key2

func AnonymizePathIndices

func AnonymizePathIndices(path string) string

AnonymizePathIndices anonymizes index value in a path (replaces it with *)

func CheckKeyValue added in v0.10.12

func CheckKeyValue(path string, rwPath *ReadWritePathElem, val *configapi.TypedValue) error

CheckKeyValue checks that if this is a Key attribute, that the value is the same as its parent's key

func CheckPathIndexIsValid

func CheckPathIndexIsValid(index string) error

CheckPathIndexIsValid - check that index values have only the specified chars

func ExtractIndexNames

func ExtractIndexNames(path string) ([]string, []string)

ExtractIndexNames - get an ordered array of index names and index values

func ExtractPaths

func ExtractPaths(deviceEntry *yang.Entry, parentState yang.TriState, parentPath string,
	subpathPrefix string) (ReadOnlyPathMap, ReadWritePathMap)

ExtractPaths is a recursive function to extract a list of read only paths from a YGOT schema

func IsPathValid added in v0.10.12

func IsPathValid(path string) error

IsPathValid tests for valid paths. Path is valid if it 1) starts with a slash 2) is followed by at least one of alphanumeric or any of : = - _ [ ] 3) and any further combinations of 1+2 Two contiguous slashes are not allowed Paths not starting with slash are not allowed

func Paths

func Paths(readOnly ReadOnlyPathMap) []string

Paths extract the read only path up to the first read only container

func PathsRW

func PathsRW(rwPathMap ReadWritePathMap) []string

PathsRW extract the read write path

func RemovePathIndices

func RemovePathIndices(path string) string

RemovePathIndices removes the index value from a path to allow it to be compared to a model path

Types

type ReadOnlyAttrib

type ReadOnlyAttrib struct {
	ValueType   configapi.ValueType
	TypeOpts    []uint8
	Description string
	Units       string
	Enum        map[int]string
	IsAKey      bool
	AttrName    string
}

ReadOnlyAttrib is the known metadata about a Read Only leaf

type ReadOnlyPathMap

type ReadOnlyPathMap map[string]ReadOnlySubPathMap

ReadOnlyPathMap abstracts the read only path

func (ReadOnlyPathMap) JustPaths

func (ro ReadOnlyPathMap) JustPaths() []string

JustPaths extracts keys from a read only path map

func (ReadOnlyPathMap) TypeForPath

func (ro ReadOnlyPathMap) TypeForPath(path string) (configapi.ValueType, error)

TypeForPath finds the type from the model for a particular path

type ReadOnlySubPathMap

type ReadOnlySubPathMap map[string]ReadOnlyAttrib

ReadOnlySubPathMap abstracts the read only subpath

type ReadWritePathElem

type ReadWritePathElem struct {
	ReadOnlyAttrib
	Mandatory bool
	Default   string
	Range     []string
	Length    []string
}

ReadWritePathElem holds data about a leaf or container

func FindPathFromModel added in v0.10.12

func FindPathFromModel(path string, rwPaths ReadWritePathMap, exact bool) (bool, *ReadWritePathElem, error)

FindPathFromModel ...

type ReadWritePathMap

type ReadWritePathMap map[string]ReadWritePathElem

ReadWritePathMap is a map of ReadWrite paths their metadata

func (ReadWritePathMap) JustPaths

func (rw ReadWritePathMap) JustPaths() []string

JustPaths extracts keys from a read write path map expandSubPaths is not relevant for RW paths

func (ReadWritePathMap) TypeForPath

func (rw ReadWritePathMap) TypeForPath(path string) (configapi.ValueType, error)

TypeForPath finds the type from the model for a particular path

Jump to

Keyboard shortcuts

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