yparser

package
v0.0.0-...-5f1191e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YP_NOP = 1 + iota
	YP_OP_CREATE
	YP_OP_UPDATE
	YP_OP_DELETE
)

Variables

This section is empty.

Functions

func CVL_LOG

func CVL_LOG(level CVLLogLevel, fmtStr string, args ...interface{})

func Debug

func Debug(on bool)

func Finish

func Finish()

func GetModelNs

func GetModelNs(module *YParserModule) (ns, prefix string)

func Initialize

func Initialize()

func ParseSchemaFile

func ParseSchemaFile(modelFile string) (*YParserModule, YParserError)

ParseSchemaFile Parse YIN schema file

func TRACE_LOG

func TRACE_LOG(tracelevel CVLTraceLevel, fmtStr string, args ...interface{})

Types

type WhenExpression

type WhenExpression struct {
	Expr      string   //when expression
	NodeNames []string //node names under when condition
}

type XpathExpression

type XpathExpression struct {
	Expr    string
	ErrCode string
	ErrStr  string
}

type YParser

type YParser struct {
	// contains filtered or unexported fields
}

func (*YParser) AddChildNode

func (yp *YParser) AddChildNode(module *YParserModule, parent *YParserNode, name string) *YParserNode

AddChildNode Add child node to a parent node

func (*YParser) AddMultiLeafNodes

func (yp *YParser) AddMultiLeafNodes(module *YParserModule, parent *YParserNode, multiLeaf []*YParserLeafValue) YParserError

AddMultiLeafNodes dd child node to a parent node

func (*YParser) DestroyCache

func (yp *YParser) DestroyCache() YParserError

func (*YParser) FreeNode

func (yp *YParser) FreeNode(node *YParserNode) YParserError

func (*YParser) IsLeafrefMatchedInUnion

func (yp *YParser) IsLeafrefMatchedInUnion(module *YParserModule, xpath, value string) bool

IsLeafrefMatchedInUnion Check if value matches with leafref node in union

func (*YParser) MergeSubtree

func (yp *YParser) MergeSubtree(root, node *YParserNode) (*YParserNode, YParserError)

MergeSubtree Merge source with destination

func (*YParser) NodeDump

func (yp *YParser) NodeDump(root *YParserNode) string

NodeDump Return entire subtree in XML format in string

func (*YParser) SetOperation

func (yp *YParser) SetOperation(op string) YParserError

SetOperation Set operation

func (*YParser) ValidateSyntax

func (yp *YParser) ValidateSyntax(data, depData *YParserNode) YParserError

ValidateSyntax Perform syntax checks

type YParserCtx

type YParserCtx C.struct_ly_ctx

type YParserError

type YParserError struct {
	ErrCode   YParserRetCode /* Error Code describing type of error. */
	Msg       string         /* Detailed error message. */
	ErrTxt    string         /* High level error message. */
	TableName string         /* List/Table having error */
	Keys      []string       /* Keys of the Table having error. */
	Field     string         /* Field Name throwing error . */
	Value     string         /* Field Value throwing error */
	ErrAppTag string         /* Error App Tag. */
}

YParserError YParser Error Structure

type YParserLeafValue

type YParserLeafValue struct {
	Name  string
	Value string
}

type YParserListInfo

type YParserListInfo struct {
	ListName        string
	Module          *YParserModule
	DbName          string
	ModelName       string
	RedisTableName  string //To which Redis table it belongs to, used for 1 Redis to N Yang List
	Keys            []string
	RedisKeyDelim   string
	RedisKeyPattern string
	RedisTableSize  int
	MapLeaf         []string            //for 'mapping  list'
	LeafRef         map[string][]string //for storing all leafrefs for a leaf in a table,
	//multiple leafref possible for union
	DfltLeafVal      map[string]string //Default value for leaf/leaf-list
	XpathExpr        map[string][]*XpathExpression
	CustValidation   map[string][]string
	WhenExpr         map[string][]*WhenExpression //multiple when expression for choice/case etc
	MandatoryNodes   map[string]bool
	DependentOnTable string //for table on which it is dependent
	Key              string //Static key, value comes from sonic-extension:tbl-key
}

YParserListInfo Important schema information to be loaded at bootup time

func GetModelListInfo

func GetModelListInfo(module *YParserModule) []*YParserListInfo

GetModelListInfo Get model info for YANG list and its subtree

type YParserModule

type YParserModule C.struct_lys_module

type YParserNode

type YParserNode C.struct_lyd_node

func FindNode

func FindNode(root *YParserNode, xpath string) *YParserNode

type YParserRetCode

type YParserRetCode int
const (
	YP_SUCCESS YParserRetCode = 1000 + iota
	YP_SYNTAX_ERROR
	YP_SEMANTIC_ERROR
	YP_SYNTAX_MISSING_FIELD
	YP_SYNTAX_INVALID_FIELD            /* Invalid Field  */
	YP_SYNTAX_INVALID_INPUT_DATA       /*Invalid Input Data */
	YP_SYNTAX_MULTIPLE_INSTANCE        /* Multiple Field Instances */
	YP_SYNTAX_DUPLICATE                /* Duplicate Fields  */
	YP_SYNTAX_ENUM_INVALID             /* Invalid enum value */
	YP_SYNTAX_ENUM_INVALID_NAME        /* Invalid enum name  */
	YP_SYNTAX_ENUM_WHITESPACE          /* Enum name with leading/trailing whitespaces */
	YP_SYNTAX_OUT_OF_RANGE             /* Value out of range/length/pattern (data) */
	YP_SYNTAX_MINIMUM_INVALID          /* min-elements constraint not honored  */
	YP_SYNTAX_MAXIMUM_INVALID          /* max-elements constraint not honored */
	YP_SEMANTIC_DEPENDENT_DATA_MISSING /* Dependent Data is missing */
	YP_SEMANTIC_MANDATORY_DATA_MISSING /* Mandatory Data is missing */
	YP_SEMANTIC_KEY_ALREADY_EXIST      /* Key already existing */
	YP_SEMANTIC_KEY_NOT_EXIST          /* Key is missing */
	YP_SEMANTIC_KEY_DUPLICATE          /* Duplicate key */
	YP_SEMANTIC_KEY_INVALID            /* Invalid key */
	YP_INTERNAL_UNKNOWN
)

type YParserSNode

type YParserSNode C.struct_lys_node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL