Documentation ¶
Index ¶
- 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 GetStateMode
- type ModelPlugin
- type ModelRegistry
- type PathMap
- type ReadOnlyAttrib
- type ReadOnlyPathMap
- type ReadOnlySubPathMap
- type ReadWritePathElem
- type ReadWritePathMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 GetStateMode ¶
type GetStateMode int
GetStateMode defines the Getstate handling
const ( // GetStateNone - device type does not support Operational State at all GetStateNone GetStateMode = iota // GetStateOpState - device returns all its op state attributes by querying // GetRequest_STATE and GetRequest_OPERATIONAL GetStateOpState // GetStateExplicitRoPaths - device returns all its op state attributes by querying // exactly what the ReadOnly paths from YANG - wildcards are handled by device GetStateExplicitRoPaths // GetStateExplicitRoPathsExpandWildcards - where there are wildcards in the // ReadOnly paths 2 calls have to be made - 1) to expand the wildcards in to // real paths (since the device doesn't do it) and 2) to query those expanded // wildcard paths - this is the Stratum 1.0.0 method GetStateExplicitRoPathsExpandWildcards )
type ModelPlugin ¶
type ModelPlugin interface { ModelData() (string, string, []*gnmi.ModelData, string) UnmarshalConfigValues(jsonTree []byte) (*ygot.ValidatedGoStruct, error) Validate(*ygot.ValidatedGoStruct, ...ygot.ValidationOption) error Schema() (map[string]*yang.Entry, error) GetStateMode() int }
ModelPlugin is a set of methods that each model plugin should implement
type ModelRegistry ¶
type ModelRegistry struct { ModelPlugins map[string]ModelPlugin ModelReadOnlyPaths map[string]ReadOnlyPathMap ModelReadWritePaths map[string]ReadWritePathMap LocationStore map[string]string }
ModelRegistry is the object for the saving information about device models
func (*ModelRegistry) Capabilities ¶
func (registry *ModelRegistry) Capabilities() []*gnmi.ModelData
Capabilities returns an aggregated set of modelData in gNMI capabilities format with duplicates removed
func (*ModelRegistry) RegisterModelPlugin ¶
func (registry *ModelRegistry) RegisterModelPlugin(moduleName string) (string, string, error)
RegisterModelPlugin adds an external model plugin to the model registry at startup or through the 'admin' gRPC interface. Once plugins are loaded they cannot be unloaded
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 { Datatype devicechange.ValueType Description string Units 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 { ValueType devicechange.ValueType Units string Description string 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