Documentation ¶
Index ¶
- Constants
- func CVL_LOG(level CVLLogLevel, fmtStr string, args ...interface{})
- func ClearValidationTimeStats()
- func Debug(on bool)
- func Finish()
- func GetErrorString(retCode CVLRetCode) string
- func TRACE_LOG(tracelevel CVLTraceLevel, fmtStr string, args ...interface{})
- func ValidationSessOpen() (*CVL, CVLRetCode)
- type CVL
- func (c *CVL) GetDepDataForDelete(redisKey string) ([]string, []string)
- func (c *CVL) GetDepTables(yangModule string, tableName string) ([]string, CVLRetCode)
- func (c *CVL) GetOrderedTables(yangModule string) ([]string, CVLRetCode)
- func (c *CVL) SortDepTables(inTableList []string) ([]string, CVLRetCode)
- func (c *CVL) ValidateConfig(jsonData string) CVLRetCode
- func (c *CVL) ValidateEditConfig(cfgData []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 CVLEditConfigData
- type CVLErrorInfo
- type CVLOperation
- type CVLRetCode
- type CVLValidateType
- 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 ( OP_NONE CVLOperation = 0 //Used to just validate the config without any operation OP_CREATE = 1 << 0 //For Create operation OP_UPDATE = 1 << 1 //For Update operation OP_DELETE = 1 << 2 //For Delete operation )
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 GetErrorString ¶
func GetErrorString(retCode CVLRetCode) string
Fetch the Error Message from CVL Return Code.
func ValidationSessOpen ¶
func ValidationSessOpen() (*CVL, CVLRetCode)
Types ¶
type CVL ¶
type CVL struct {
// contains filtered or unexported fields
}
Struct for CVL session
func (*CVL) 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)
Get the list of dependent tables for a given table in a YANG module
func (*CVL) GetOrderedTables ¶
func (c *CVL) GetOrderedTables(yangModule string) ([]string, CVLRetCode)
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) SortDepTables ¶
func (c *CVL) SortDepTables(inTableList []string) ([]string, CVLRetCode)
Sort list of given tables as per their dependency
func (*CVL) ValidateConfig ¶
func (c *CVL) ValidateConfig(jsonData string) CVLRetCode
Validate data for operation
func (*CVL) ValidateEditConfig ¶
func (c *CVL) ValidateEditConfig(cfgData []CVLEditConfigData) (cvlErr CVLErrorInfo, ret CVLRetCode)
Validate config data based on edit operation
func (*CVL) ValidateFields ¶
func (c *CVL) ValidateFields(key string, field string, value string) CVLRetCode
Validate key, field and value
func (*CVL) ValidateIncrementalConfig ¶
func (c *CVL) ValidateIncrementalConfig(jsonData string) CVLRetCode
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
Validate key and data
func (*CVL) ValidateStartupConfig ¶
func (c *CVL) ValidateStartupConfig(jsonData string) CVLRetCode
type CVLEditConfigData ¶
type CVLEditConfigData struct { VType CVLValidateType //Validation type VOp CVLOperation //Operation type Key string //Key format : "PORT|Ethernet4" Data map[string]string //Value : {"alias": "40GE0/28", "mtu" : 9100, "admin_status": down} }
Strcture for key and data in API
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 }
CVL Error Structure.
type CVLOperation ¶
type CVLOperation uint
type CVLRetCode ¶
type CVLRetCode int
Error code
func Initialize ¶
func Initialize() CVLRetCode
func ValidationSessClose ¶
func ValidationSessClose(c *CVL) CVLRetCode
type CVLValidateType ¶
type CVLValidateType uint
const ( VALIDATE_NONE CVLValidateType = iota //Data is used as dependent data VALIDATE_SYNTAX //Syntax is checked and data is used as dependent data VALIDATE_SEMANTICS //Semantics is checked VALIDATE_ALL //Syntax and Semantics are checked )
type 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
Retrieve global stats
type YValidator ¶
type YValidator struct {
// contains filtered or unexported fields
}
YANG Validator used for external semantic validation including custom/platform validation