Documentation ¶
Index ¶
- func FindAllDataNodes(gs ygot.GoStruct, path *gpb.Path) ([]interface{}, bool)
- func FindAllSchemaPaths(gs ygot.GoStruct, path *gpb.Path) ([]string, bool)
- func FindAllSchemaTypes(gs ygot.GoStruct, path *gpb.Path) ([]reflect.Type, bool)
- func NewGoStruct(m *Model, jsonData []byte) (ygot.ValidatedGoStruct, error)
- type ConfigCallback
- type DataAndPath
- type DataCallback
- type GoStructEnumData
- type JSONUnmarshaler
- type Model
- func (m *Model) CheckModels(models []*gpb.ModelData) error
- func (m *Model) FindAllData(gs ygot.GoStruct, path *gpb.Path) ([]*DataAndPath, bool)
- func (m *Model) FindAllPaths(path *gpb.Path) ([]string, bool)
- func (m *Model) FindSchema(t reflect.Type) *yang.Entry
- func (m *Model) FindSchemaByName(parent *yang.Entry, name string) *yang.Entry
- func (m *Model) FindSchemaByPath(path string) (*yang.Entry, error)
- func (m *Model) FindSchemaPaths(prefix, path *gpb.Path) ([]string, bool)
- func (m *Model) GetModelData() []*gpb.ModelData
- func (m *Model) SupportedModels() []string
- func (m *Model) ValidatePathSchema(path *gpb.Path) bool
- type ModelData
- func (mdata *ModelData) ChangeRoot(root ygot.ValidatedGoStruct) error
- func (mdata *ModelData) Close()
- func (mdata *ModelData) Create(keys []string, key string, tag string, value string) error
- func (mdata *ModelData) Delete(keys []string, key string) error
- func (mdata *ModelData) GetRoot() ygot.ValidatedGoStruct
- func (mdata *ModelData) GetSyncUpdatePath(prefix *gpb.Path, paths []*gpb.Path) []string
- func (mdata *ModelData) Lock()
- func (mdata *ModelData) RLock()
- func (mdata *ModelData) RUnlock()
- func (mdata *ModelData) Replace(keys []string, key string, tag string, value string) error
- func (mdata *ModelData) RunSyncUpdate(syncIgnoreTime time.Duration, syncPaths []string)
- func (mdata *ModelData) SetDelete(jsonTree map[string]interface{}, prefix, path *gpb.Path) (*gpb.UpdateResult, error)
- func (mdata *ModelData) SetReplaceOrUpdate(jsonTree map[string]interface{}, op gpb.UpdateResult_Operation, ...) (*gpb.UpdateResult, error)
- func (mdata *ModelData) Unlock()
- func (mdata *ModelData) UpdateEnd()
- func (mdata *ModelData) UpdateStart()
- type OnChangeCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindAllDataNodes ¶
FindAllDataNodes - finds all nodes matched to the gNMI Path.
func FindAllSchemaPaths ¶
FindAllSchemaPaths - finds all schema nodes matched to the gNMI Path.
func FindAllSchemaTypes ¶
FindAllSchemaTypes - finds all schema nodes matched to the gNMI Path.
func NewGoStruct ¶
func NewGoStruct(m *Model, jsonData []byte) (ygot.ValidatedGoStruct, error)
NewGoStruct - creates a ValidatedGoStruct of this model from jsonData. If jsonData is nil, creates an empty GoStruct.
Types ¶
type ConfigCallback ¶
type ConfigCallback interface { DataCallback ConfigCallback(ygot.GoStruct) error }
ConfigCallback is an interface to be invoked by the configuration
type DataAndPath ¶
type DataAndPath struct { Value interface{} Path string }
DataAndPath - used to retrieve of the data and gNMI path from ygot go structure.
func FindAllData ¶
FindAllData - finds all nodes matched to the gNMI Path.
type DataCallback ¶
type DataCallback interface { }
DataCallback is an interface to be invoked by the modeled data control
type GoStructEnumData ¶
type GoStructEnumData map[string]map[int64]ygot.EnumDefinition
GoStructEnumData is the data type to maintain GoStruct enum type.
type JSONUnmarshaler ¶
JSONUnmarshaler is the signature of the Unmarshal() function in the GoStruct code generated by openconfig ygot library.
type Model ¶
type Model struct { StructRootType reflect.Type SchemaTree map[string]*yang.Entry SchemaTreeRoot *yang.Entry JSONUnmarshaler JSONUnmarshaler EnumData GoStructEnumData // contains filtered or unexported fields }
Model contains the model data and GoStruct information for the device.
func NewCustomModel ¶
func NewCustomModel( modelData []*gpb.ModelData, structRootType reflect.Type, schemaTree map[string]*yang.Entry, jSONUnmarshaler JSONUnmarshaler, enumData GoStructEnumData, ) *Model
NewCustomModel returns an instance of Model struct.
func (*Model) CheckModels ¶
CheckModels checks whether models are supported by the model. Return error if anything is unsupported.
func (*Model) FindAllData ¶
FindAllData - finds all data nodes matched to the gNMI Path.
func (*Model) FindAllPaths ¶
FindAllPaths - finds all XPaths against to the gNMI Path that has wildcard
func (*Model) FindSchema ¶
FindSchema - find the yang.Entry for schema info.
func (*Model) FindSchemaByName ¶
FindSchemaByName - find the yang.Entry for schema info.
func (*Model) FindSchemaByPath ¶
FindSchemaByPath - find the yang.Entry for schema info.
func (*Model) FindSchemaPaths ¶
FindSchemaPaths - validates all schema of the gNMI Path.
func (*Model) GetModelData ¶
GetModelData - returns ModelData of the model.
func (*Model) SupportedModels ¶
SupportedModels returns a list of supported models.
type ModelData ¶
type ModelData struct {
// contains filtered or unexported fields
}
ModelData - the data instance for the model
func NewModelData ¶
func NewModelData(m *Model, jsonData []byte, yamlData []byte, callback DataCallback, disableYdbChannel bool) (*ModelData, error)
NewModelData creates a ValidatedGoStruct of this model from jsonData. If jsonData is nil, creates an empty GoStruct.
func (*ModelData) ChangeRoot ¶
func (mdata *ModelData) ChangeRoot(root ygot.ValidatedGoStruct) error
ChangeRoot - replaces the root of the Model Data
func (*ModelData) GetRoot ¶
func (mdata *ModelData) GetRoot() ygot.ValidatedGoStruct
GetRoot - replaces the root of the Model Data
func (*ModelData) GetSyncUpdatePath ¶
GetSyncUpdatePath - synchronizes the data in the path
func (*ModelData) RUnlock ¶
func (mdata *ModelData) RUnlock()
RUnlock - Unlock of the YDB instance for read.
func (*ModelData) RunSyncUpdate ¶
RunSyncUpdate - synchronizes & update the data in the path. It locks model data.
func (*ModelData) SetDelete ¶
func (mdata *ModelData) SetDelete(jsonTree map[string]interface{}, prefix, path *gpb.Path) (*gpb.UpdateResult, error)
SetDelete deletes the path from the json tree if the path exists. If success, it calls the callback function to apply the change to the device hardware.
func (*ModelData) SetReplaceOrUpdate ¶
func (mdata *ModelData) SetReplaceOrUpdate(jsonTree map[string]interface{}, op gpb.UpdateResult_Operation, prefix, path *gpb.Path, val *gpb.TypedValue) (*gpb.UpdateResult, error)
SetReplaceOrUpdate validates the replace or update operation to be applied to the device, modifies the json tree of the config struct, then calls the callback function to apply the operation to the device hardware.
func (*ModelData) UpdateEnd ¶
func (mdata *ModelData) UpdateEnd()
UpdateEnd - indicates the end of ModelData construction
func (*ModelData) UpdateStart ¶
func (mdata *ModelData) UpdateStart()
UpdateStart - indicates the start of ModelData construction
type OnChangeCallback ¶
type OnChangeCallback interface { DataCallback OnChangeStarted(changes ygot.GoStruct) OnChangeCreated(path []string, changes ygot.GoStruct) OnChangeReplaced(path []string, changes ygot.GoStruct) OnChangeDeleted(path []string) OnChangeFinished(changes ygot.GoStruct) }
OnChangeCallback is an interface to be invoked upon the model data changes