Documentation
¶
Index ¶
- Constants
- func AppendElemInPath(path *config.Path, name, key string) *config.Path
- func CleanCacheValueForComparison(path *config.Path, cacheValue interface{}, valueType string) (x1 interface{}, err error)
- func CleanConfig2String(cfg map[string]interface{}) (map[string]interface{}, *string, error)
- func CleanDeviceValueForComparison(deviceValue interface{}) (interface{}, error)
- func CompareValues(path *config.Path, cacheValue, deviceValue interface{}, valueType string) (jsondiff.Patch, error)
- func ConfigGnmiPathToName(path *config.Path) string
- func ConfigGnmiPathToXPath(path *config.Path, keys bool) *string
- func CreatePathElem(e *yang.Entry) *config.PathElem
- func DeepCopy(in interface{}) (interface{}, error)
- func GetKeyInfo(keys map[string]string) ([]string, []string)
- func GetTypeKind(e *yang.Entry) string
- func GetTypeName(e *yang.Entry) string
- func GetValueType(value interface{}) string
- func GnmiPath2ConfigPath(inPath *gnmi.Path) *config.Path
- func GnmiPathToXPath(path *gnmi.Path, keys bool) *string
- func ProcessLeafRef(e *yang.Entry, resfullPath string, activeResPath *config.Path) (*config.Path, *config.Path, bool)
- func RemoveFirstEntry(s string) string
- func RemoveHierarchicalKeys(d []byte, hids []string) ([]byte, error)
- func TransformPathAsRelative2Resource(localPath, activeResPath *config.Path) *config.Path
- func TransformPathToLeafRefPath(path *config.Path) *config.Path
- func XpathToGnmiPath(p string, offset int) (path *config.Path)
- type ConfigTreeAction
- type Option
- type Parser
- type TraceCtxt
Constants ¶
const ( // values Slice = "slice" NonSlice = "nonSlice" // errors ErrJSONMarshal = "cannot marshal JSON object" ErrJSONCompare = "cannot compare JSON objects" ErrJSONMarshalIndent = "cannot marshal JSON object with indent" )
Variables ¶
This section is empty.
Functions ¶
func AppendElemInPath ¶
AppendElemInPath adds a pathElem to the config gnmi path
func CleanCacheValueForComparison ¶ added in v0.1.4
func CleanCacheValueForComparison(path *config.Path, cacheValue interface{}, valueType string) (x1 interface{}, err error)
we update the cache value for comparison 1. any map[string]interface{} -> will come from another subscription 2. any key in the path can be removed since this is part of the path iso data comparison 3. if the value is a slice we should remove all strings/int/floats, if the data is not a slice we remove all slices -> the gnmi server splits slice data and non slice data
func CleanConfig2String ¶
CleanConfig2String returns a clean config and a string clean means removing the prefixes in the json elements
func CleanDeviceValueForComparison ¶ added in v0.1.4
func CleanDeviceValueForComparison(deviceValue interface{}) (interface{}, error)
CleanDeviceValueForComparison cleans the data coming from the device it cleans the prefixes of the yang value; key and value
func CompareValues ¶ added in v0.1.4
func CompareValues(path *config.Path, cacheValue, deviceValue interface{}, valueType string) (jsondiff.Patch, error)
CompareValues compares the 2 values and provides a json diff result
func ConfigGnmiPathToName ¶ added in v0.1.1
ConfigGnmiPathToName converts a config gnmi path to a name where each element of the path is seperated by a "-"
func ConfigGnmiPathToXPath ¶ added in v0.1.2
ConfigGnmiPathToXPath converts a config gnmi path with or withour keys to a string pointer
func CreatePathElem ¶
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 GetKeyInfo ¶ added in v0.1.4
GetKeyInfo returns all keys and values in a []slice
func GetTypeKind ¶
GetTypeKind return a string of the kind of the yang entry
func GetTypeName ¶
GetypeName return a string of the type of the yang entry
func GetValueType ¶ added in v0.1.4
func GetValueType(value interface{}) string
GetValueType return if a value is a slice or not
func GnmiPath2ConfigPath ¶
GnmiPath2ConfigPath converts the gnmi path to config path
func GnmiPathToXPath ¶
GnmiPathToXPath converts a 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 ¶
RemoveFirstEntry removes the first entry of the xpath, so it trims the first element of the /
func RemoveHierarchicalKeys ¶
RemoveHierarchicalKeys removes the hierarchical keys from the data
func TransformPathAsRelative2Resource ¶
TransformPathAsRelative2Resource returns a relative path
func TransformPathToLeafRefPath ¶
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
Types ¶
type ConfigTreeAction ¶ added in v0.1.4
type ConfigTreeAction string
ConfigTreeAction defines the states the resource object is reporting
const ( ConfigTreeActionGet ConfigTreeAction = "get" ConfigTreeActionDelete ConfigTreeAction = "delete" ConfigTreeActionCreate ConfigTreeAction = "create" ConfigTreeActionUpdate ConfigTreeAction = "update" )
func (*ConfigTreeAction) String ¶ added in v0.1.4
func (c *ConfigTreeAction) String() string
type Option ¶
type Option func(p *Parser)
Option can be used to manipulate Options.
func WithLogger ¶
WithLogger specifies how the Parser should log messages.