Documentation ¶
Index ¶
- Constants
- func AddFormatterFunc(s string, f Formatter) error
- func CVL_LOG(level CVLLogLevel, fmtStr string, args ...interface{})
- func ClearValidationTimeStats()
- func CreateFindKeyExpression(tableName string, keyFldValPair map[string]string) string
- func Debug(on bool)
- func Finish()
- func GetErrorString(retCode CVLRetCode) string
- func ReconfigureRedisOptions(opt redis.Options)
- func RunLua(name string, args ...interface{}) (interface{}, error)
- func SplitRedisKey(key string) (string, string)
- func TRACE_LOG(tracelevel CVLTraceLevel, fmtStr string, args ...interface{})
- func ValidationSessOpen(dbAccess cmn.DBAccess) (*CVL, CVLRetCode)
- type CVL
- func (c *CVL) GetAllReferringTables(tableName string) map[string][]string
- func (c *CVL) GetDepDataForDelete(redisKey string) []CVLDepDataForDelete
- func (c *CVL) GetDepTables(yangModule string, tableName string) ([]string, CVLRetCode)
- func (c *CVL) GetOrderedDepTables(yangModule, tableName string) ([]string, CVLRetCode)
- func (c *CVL) GetOrderedTables(yangModule string) ([]string, CVLRetCode)
- func (c *CVL) LoadHint(key string) (interface{}, bool)
- func (c *CVL) SortDepList(inTables []string) ([]string, CVLRetCode)
- func (c *CVL) SortDepTables(inTableList []string) ([]string, CVLRetCode)
- func (c *CVL) StoreHint(key string, value interface{}) CVLRetCode
- func (c *CVL) ValidateConfig(jsonData string) CVLRetCode
- func (c *CVL) ValidateEditConfig(cfgData []cmn.CVLEditConfigData) (cvlErr CVLErrorInfo, ret CVLRetCode)
- func (c *CVL) ValidateFields(key string, field string, value string) CVLRetCode
- func (c *CVL) ValidateIncrementalConfig(jsonData string) CVLRetCode
- func (c *CVL) ValidateKeyData(key string, data string) CVLRetCode
- func (c *CVL) ValidateKeys(key []string) CVLRetCode
- func (c *CVL) ValidateStartupConfig(jsonData string) CVLRetCode
- type CVLDepDataForDelete
- type CVLErrorInfo
- type CVLRetCode
- type DepDataCacheType
- type DepDataCallBack
- type DepDataCountCallBack
- type ValidationTimeStats
- type YValidator
Constants ¶
const ( APPL_DB uint8 = 0 + iota ASIC_DB COUNTERS_DB LOGLEVEL_DB CONFIG_DB PFC_WD_DB FLEX_COUNTER_DB = PFC_WD_DB STATE_DB SNMP_OVERLAY_DB INVALID_DB )
DB number
const ( CVL_SUCCESS CVLRetCode = iota CVL_ERROR CVL_NOT_IMPLEMENTED CVL_INTERNAL_UNKNOWN CVL_FAILURE CVL_SYNTAX_ERROR = CVLRetCode(yparser.YP_SYNTAX_ERROR) CVL_SEMANTIC_ERROR = CVLRetCode(yparser.YP_SEMANTIC_ERROR) CVL_SYNTAX_MISSING_FIELD = CVLRetCode(yparser.YP_SYNTAX_MISSING_FIELD) CVL_SYNTAX_INVALID_FIELD = CVLRetCode(yparser.YP_SYNTAX_INVALID_FIELD) /* Invalid Field */ CVL_SYNTAX_INVALID_INPUT_DATA = CVLRetCode(yparser.YP_SYNTAX_INVALID_INPUT_DATA) /*Invalid Input Data */ CVL_SYNTAX_MULTIPLE_INSTANCE = CVLRetCode(yparser.YP_SYNTAX_MULTIPLE_INSTANCE) /* Multiple Field Instances */ CVL_SYNTAX_DUPLICATE = CVLRetCode(yparser.YP_SYNTAX_DUPLICATE) /* Duplicate Fields */ CVL_SYNTAX_ENUM_INVALID = CVLRetCode(yparser.YP_SYNTAX_ENUM_INVALID) /* Invalid enum value */ CVL_SYNTAX_ENUM_INVALID_NAME = CVLRetCode(yparser.YP_SYNTAX_ENUM_INVALID_NAME) /* Invalid enum name */ CVL_SYNTAX_ENUM_WHITESPACE = CVLRetCode(yparser.YP_SYNTAX_ENUM_WHITESPACE) /* Enum name with leading/trailing whitespaces */ CVL_SYNTAX_OUT_OF_RANGE = CVLRetCode(yparser.YP_SYNTAX_OUT_OF_RANGE) /* Value out of range/length/pattern (data) */ CVL_SYNTAX_MINIMUM_INVALID = CVLRetCode(yparser.YP_SYNTAX_MINIMUM_INVALID) /* min-elements constraint not honored */ CVL_SYNTAX_MAXIMUM_INVALID = CVLRetCode(yparser.YP_SYNTAX_MAXIMUM_INVALID) /* max-elements constraint not honored */ CVL_SEMANTIC_DEPENDENT_DATA_MISSING = CVLRetCode(yparser.YP_SEMANTIC_DEPENDENT_DATA_MISSING) /* Dependent Data is missing */ CVL_SEMANTIC_MANDATORY_DATA_MISSING = CVLRetCode(yparser.YP_SEMANTIC_MANDATORY_DATA_MISSING) /* Mandatory Data is missing */ CVL_SEMANTIC_KEY_ALREADY_EXIST = CVLRetCode(yparser.YP_SEMANTIC_KEY_ALREADY_EXIST) /* Key already existing. */ CVL_SEMANTIC_KEY_NOT_EXIST = CVLRetCode(yparser.YP_SEMANTIC_KEY_NOT_EXIST) /* Key is missing. */ CVL_SEMANTIC_KEY_DUPLICATE = CVLRetCode(yparser.YP_SEMANTIC_KEY_DUPLICATE) /* Duplicate key. */ CVL_SEMANTIC_KEY_INVALID = CVLRetCode(yparser.YP_SEMANTIC_KEY_INVALID) )
const DEFAULT_CACHE_DURATION uint16 = 300 /* 300 sec */
const MAX_BULK_ENTRIES_IN_PIPELINE int = 50
const MAX_DEVICE_METADATA_FETCH_RETRY = 60
const PLATFORM_SCHEMA_PATH = "platform/"
Variables ¶
This section is empty.
Functions ¶
func AddFormatterFunc ¶
func ClearValidationTimeStats ¶
func ClearValidationTimeStats()
ClearValidationTimeStats Clear global stats
func CreateFindKeyExpression ¶
CreateFindKeyExpression Create expression for searching DB entries based on given key fields and values. Expressions created will be like CFG_L2MC_STATIC_MEMBER_TABLE|*|*|Ethernet0
func GetErrorString ¶
func GetErrorString(retCode CVLRetCode) string
GetErrorString Fetch the Error Message from CVL Return Code.
func ReconfigureRedisOptions ¶
func ReconfigureRedisOptions(opt redis.Options)
func RunLua ¶
RunLua is a temporary API to run a named lua script in ConfigDb. Script name can be one of "count_entries" or "filter_entries". TODO move the script definitions to DBAL and remove this API
func SplitRedisKey ¶
func ValidationSessOpen ¶
func ValidationSessOpen(dbAccess cmn.DBAccess) (*CVL, CVLRetCode)
Types ¶
type CVL ¶
type CVL struct {
// contains filtered or unexported fields
}
CVL Struct for CVL session
func (*CVL) GetAllReferringTables ¶
GetAllReferringTables Returns list of all tables and fields which has leaf-ref to given table. For ex. tableName="PORT" will return all tables and fields which has leaf-ref to "PORT" table.
func (*CVL) GetDepDataForDelete ¶
func (c *CVL) GetDepDataForDelete(redisKey string) []CVLDepDataForDelete
GetDepDataForDelete Get the dependent (Redis keys) to be deleted or modified for a given entry getting deleted
func (*CVL) GetDepTables ¶
func (c *CVL) GetDepTables(yangModule string, tableName string) ([]string, CVLRetCode)
GetDepTables Get the list of dependent tables for a given table in a YANG module
func (*CVL) GetOrderedDepTables ¶
func (c *CVL) GetOrderedDepTables(yangModule, tableName string) ([]string, CVLRetCode)
func (*CVL) GetOrderedTables ¶
func (c *CVL) GetOrderedTables(yangModule string) ([]string, CVLRetCode)
GetOrderedTables Get the order list(parent then child) of tables in a given YANG module within a single model this is obtained using leafref relation
func (*CVL) SortDepList ¶
func (c *CVL) SortDepList(inTables []string) ([]string, CVLRetCode)
SortDepList Sort list of given tables as per their dependency, returns LIST names, useful for testing
func (*CVL) SortDepTables ¶
func (c *CVL) SortDepTables(inTableList []string) ([]string, CVLRetCode)
SortDepTables Sort list of given tables as per their dependency
func (*CVL) StoreHint ¶
func (c *CVL) StoreHint(key string, value interface{}) CVLRetCode
StoreHint saves hints which are passed to the Custom Validation Callbacks Caller guarantees that no other CRUD ops are in progress key == nil: Clear all Hints
func (*CVL) ValidateConfig ¶
func (c *CVL) ValidateConfig(jsonData string) CVLRetCode
ValidateConfig Validate data for operation
func (*CVL) ValidateEditConfig ¶
func (c *CVL) ValidateEditConfig(cfgData []cmn.CVLEditConfigData) (cvlErr CVLErrorInfo, ret CVLRetCode)
ValidateEditConfig Validate config data based on edit operation
func (*CVL) ValidateFields ¶
func (c *CVL) ValidateFields(key string, field string, value string) CVLRetCode
ValidateFields Validate key, field and value
func (*CVL) ValidateIncrementalConfig ¶
func (c *CVL) ValidateIncrementalConfig(jsonData string) CVLRetCode
ValidateIncrementalConfig Steps:
Check config data syntax Fetch the depedent data Merge config and dependent data Finally validate
func (*CVL) ValidateKeyData ¶
func (c *CVL) ValidateKeyData(key string, data string) CVLRetCode
ValidateKeyData Validate key and data
func (*CVL) ValidateKeys ¶
func (c *CVL) ValidateKeys(key []string) CVLRetCode
ValidateKeys Validate key only
func (*CVL) ValidateStartupConfig ¶
func (c *CVL) ValidateStartupConfig(jsonData string) CVLRetCode
type CVLDepDataForDelete ¶
type CVLDepDataForDelete struct { RefKey string //Ref Key which is getting deleted Entry map[string]map[string]string //Entry or field which should be deleted as a result }
CVLDepDataForDelete Structure for dependent entry to be deleted
type CVLErrorInfo ¶
type CVLErrorInfo struct { TableName string /* Table having error */ ErrCode CVLRetCode /* CVL Error return Code. */ CVLErrDetails string /* CVL Error Message details. */ Keys []string /* Keys of the Table having error. */ Value string /* Field Value throwing error */ Field string /* Field Name throwing error . */ Msg string /* Detailed error message. */ ConstraintErrMsg string /* Constraint error message. */ ErrAppTag string }
CVLErrorInfo Struct for CVL Error Info
func (CVLErrorInfo) Message ¶
func (err CVLErrorInfo) Message() string
Message returns the user defined error message if it exists; an auto formatted message otherwise. It may not be suitable for end user consumption always.
func (CVLErrorInfo) String ¶
func (err CVLErrorInfo) String() string
type CVLRetCode ¶
type CVLRetCode int
CVLRetCode CVL Error codes
func Initialize ¶
func Initialize() CVLRetCode
func ValidationSessClose ¶
func ValidationSessClose(c *CVL) CVLRetCode
type DepDataCacheType ¶
type DepDataCacheType map[string]interface{}
DepDataCacheType cache type for dependent data
type DepDataCallBack ¶
type DepDataCountCallBack ¶
type ValidationTimeStats ¶
ValidationTimeStats CVL validations stats Maintain time stats for call to ValidateEditConfig(). Hits : Total number of times ValidateEditConfig() called Time : Total time spent in ValidateEditConfig() Peak : Highest time spent in ValidateEditConfig()
func GetValidationTimeStats ¶
func GetValidationTimeStats() ValidationTimeStats
GetValidationTimeStats Retrieve global stats
type YValidator ¶
type YValidator struct {
// contains filtered or unexported fields
}
YValidator YANG Validator used for external semantic validation including custom/platform validation