Documentation ¶
Index ¶
- Constants
- func AddMissingIndexName(path string) []string
- func AnonymizePathIndices(path string) string
- func CheckPathIndexIsValid(index string) error
- func ExtractIndexNames(path string) ([]string, []string)
- func ExtractPaths(deviceEntry *yang.Entry, parentState yang.TriState, parentPath string, ...) (ReadOnlyPathMap, ReadWritePathMap)
- func Paths(readOnly ReadOnlyPathMap) []string
- func PathsRW(rwPathMap ReadWritePathMap) []string
- func RemovePathIndices(path string) string
- type Config
- type ModelPlugin
- type ModelRegistry
- type PathMap
- 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 ¶ added in v0.7.19
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 ¶ added in v0.7.19
AnonymizePathIndices anonymizes index value in a path (replaces it with *)
func CheckPathIndexIsValid ¶ added in v0.7.19
CheckPathIndexIsValid - check that index values have only the specified chars
func ExtractIndexNames ¶ added in v0.6.15
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 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 ModelPlugin ¶
type ModelPlugin struct { Info configmodel.ModelInfo Model configmodel.ConfigModel ReadOnlyPaths ReadOnlyPathMap ReadWritePaths ReadWritePathMap }
ModelPlugin is a config model
type ModelRegistry ¶
type ModelRegistry struct {
// contains filtered or unexported fields
}
ModelRegistry is a registry of config models
func NewModelRegistry ¶ added in v0.7.9
func NewModelRegistry(config Config, plugins ...*ModelPlugin) (*ModelRegistry, error)
NewModelRegistry creates a new model registry
func (*ModelRegistry) Capabilities ¶
func (r *ModelRegistry) Capabilities() ([]*gnmi.ModelData, error)
Capabilities returns an aggregated set of modelData in gNMI capabilities format with duplicates removed
func (*ModelRegistry) GetPlugin ¶ added in v0.7.9
func (r *ModelRegistry) GetPlugin(name string) (*ModelPlugin, error)
GetPlugin gets a model plugin by name
func (*ModelRegistry) GetPlugins ¶ added in v0.7.9
func (r *ModelRegistry) GetPlugins() ([]*ModelPlugin, error)
GetPlugins gets a list of model plugins
type PathMap ¶
type PathMap interface { JustPaths() []string TypeForPath(path string) (devicechange.ValueType, error) }
PathMap is an interface that is implemented by ReadOnly- and ReadWrite- PathMaps
type ReadOnlyAttrib ¶
type ReadOnlyAttrib struct { ValueType devicechange.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) (devicechange.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
type ReadWritePathMap ¶
type ReadWritePathMap map[string]ReadWritePathElem
ReadWritePathMap is a map of ReadWrite paths a 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) (devicechange.ValueType, error)
TypeForPath finds the type from the model for a particular path