Documentation ¶
Index ¶
- Constants
- func AddMissingIndexName(path string) []string
- func AnonymizePathIndices(path string) string
- func CheckKeyValue(path string, rwPath *ReadWritePathElem, val *configapi.TypedValue) error
- func CheckPathIndexIsValid(index string) error
- func ExtractIndexNames(path string) ([]string, []string)
- func ExtractPaths(deviceEntry *yang.Entry, parentState yang.TriState, parentPath string, ...) (ReadOnlyPathMap, ReadWritePathMap)
- func GetParentPath(path string) string
- func IsPathValid(path string) error
- func Paths(readOnly ReadOnlyPathMap) []string
- func PathsRW(rwPathMap ReadWritePathMap) []string
- func RemovePathIndices(path string) string
- type ReadOnlyAttrib
- type ReadOnlyPathMap
- type ReadOnlySubPathMap
- type ReadWritePathElem
- type ReadWritePathMap
Constants ¶
const IndexAllowedChars = `^([a-zA-Z0-9\*\-\._])+$`
IndexAllowedChars - regexp to restrict characters in index names
const MatchOnIndex = `(\[.*?]).*?`
MatchOnIndex - regexp to find indices in paths names
Variables ¶
This section is empty.
Functions ¶
func AddMissingIndexName ¶
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 ¶
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 ¶
CheckPathIndexIsValid - check that index values have only the specified chars
func ExtractIndexNames ¶
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 GetParentPath ¶ added in v0.10.24
GetParentPath returns the immediate parent path of the specified path; empty string if "/" is given
func IsPathValid ¶ added in v0.10.12
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 ¶
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