yumapro  20.10-14
YumaPro SDK
YANG XPath Support

YANG Specific XPath Expression Handling. More...

Collaboration diagram for YANG XPath Support:

Functions

status_t xpath_yang_parse_path (tk_chain_t *tkc, ncx_module_t *mod, xpath_source_t source, xpath_pcb_t *pcb)
 Parse the leafref path as a leafref path. More...
 
status_t xpath_yang_parse_path_ex (tk_chain_t *tkc, ncx_module_t *mod, xpath_source_t source, xpath_pcb_t *pcb, boolean logerrors, ncx_leafref_class_t *leafref_class)
 Parse the leafref path as a leafref path (extended) More...
 
status_t xpath_yang_parse_path_ex2 (tk_chain_t *tkc, ncx_module_t *mod, xpath_source_t source, xpath_pcb_t *pcb, boolean logerrors, boolean is_xpath, ncx_leafref_class_t *leafref_class)
 Parse the leafref path as a leafref path (extended2) More...
 
status_t xpath_yang_validate_path (ncx_module_t *mod, obj_template_t *obj, xpath_pcb_t *pcb, boolean schemainst, obj_template_t **leafobj)
 Validate the previously parsed leafref path. More...
 
status_t xpath_yang_validate_path_ex (ncx_module_t *mod, obj_template_t *obj, xpath_pcb_t *pcb, boolean schemainst, obj_template_t **leafobj, boolean logerrors, boolean is_xpath)
 Validate the previously parsed leafref path (extended) More...
 
status_t xpath_yang_validate_path_dev (ncx_module_t *mod, obj_template_t *obj, xpath_pcb_t *pcb, boolean schemainst, obj_template_t **leafobj, boolean logerrors, boolean is_xpath, ncx_module_t *rootmod)
 Validate the previously parsed leafref path (deviation) More...
 
status_t xpath_yang_validate_xmlpath (xmlTextReaderPtr reader, xpath_pcb_t *pcb, obj_template_t *pathobj, boolean logerrors, obj_template_t **targobj)
 Validate an instance-identifier expression (XML path) within an XML PDU context. More...
 
status_t xpath_yang_validate_xmlkey (xmlTextReaderPtr reader, xpath_pcb_t *pcb, obj_template_t *obj, boolean logerrors)
 Validate a key XML attribute value given in (XML Key) More...
 
val_value_txpath_yang_make_instanceid_val (xpath_pcb_t *pcb, status_t *retres, val_value_t **deepest)
 Make a value subtree out of an instance-identifier Used by yangcli to send PDUs from CLI target parameters. More...
 
status_t xpath_yang_get_namespaces (const xpath_pcb_t *pcb, ncx_prefix_info_t *nsid_array, uint32 max_nsids, uint32 *num_nsids)
 Get the namespace URI IDs used in the specified XPath expression;. More...
 
val_value_txpath_yang_make_instanceid_str (const xmlChar *target, status_t *retres, val_value_t **targval)
 Return the instance ID string for the target object. More...
 

Detailed Description

YANG Specific XPath Expression Handling.

Function Documentation

◆ xpath_yang_get_namespaces()

status_t xpath_yang_get_namespaces ( const xpath_pcb_t pcb,
ncx_prefix_info_t nsid_array,
uint32  max_nsids,
uint32 *  num_nsids 
)

Get the namespace URI IDs used in the specified XPath expression;.

usually an instance-identifier or schema-instance node but this function simply reports all the TK_TT_MSTRING tokens that have an nsid set

The XPath pcb must be previously parsed and found valid

Parameters
pcbthe XPath parser control block to use
nsid_arrayaddress of return array of ncx_prefix_info_t
max_nsidsnumber of NSIDs that can be held
num_nsidsaddress of return number of NSIDs written to the buffer. No duplicates will be present in the buffer
Return values
nsid_array[0..*num_nsids]returned structs used in the XPath expression
*num_nsidsnumber of NSIDs written to the array
Returns
status
Here is the call graph for this function:

◆ xpath_yang_make_instanceid_str()

val_value_t* xpath_yang_make_instanceid_str ( const xmlChar *  target,
status_t retres,
val_value_t **  targval 
)

Return the instance ID string for the target object.

Return a value struct from root containing all the predicate assignments in the instance identifier

Parameters
targetstring that represent XPath for the instance-identifier
retresaddress of return status
targvaladdress of return value
Return values
*retresreturn status for the operation
*targvalthe target node within the returned subtree from root
Returns
malloced value node representing the instance-identifier from root to the targobj, NULL if error
Here is the call graph for this function:

◆ xpath_yang_make_instanceid_val()

val_value_t* xpath_yang_make_instanceid_val ( xpath_pcb_t pcb,
status_t retres,
val_value_t **  deepest 
)

Make a value subtree out of an instance-identifier Used by yangcli to send PDUs from CLI target parameters.

The XPath pcb must be previously parsed and found valid It must be an instance-identifier value, not a leafref path

Parameters
pcbthe leafref parser control block, possibly cloned from from the typdef
retresaddress of return status (may be NULL)
deepestaddress of return deepest node created (may be NULL)
Return values
*retresreturn status
*deepestpointer to end of instance-id chain node
Returns
malloced value subtree representing the instance-identifier in internal val_value_t data structures
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_yang_parse_path()

status_t xpath_yang_parse_path ( tk_chain_t tkc,
ncx_module_t mod,
xpath_source_t  source,
xpath_pcb_t pcb 
)

Parse the leafref path as a leafref path.

DOES NOT VALIDATE PATH NODES USED IN THIS PHASE A 2-pass validation is used in case the path expression is defined within a grouping. This pass is used on all objects, even in groupings

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkcparent token chain (may be NULL)
modmodule in progress
sourcecontext for this expression
XP_SRC_LEAFREF or XP_SRC_INSTANCEID
pcbinitialized xpath parser control block for the leafref path; use xpath_new_pcb to initialize before calling this fn. The pcb->exprstr field must be set
Return values
pcb->tkcis filled and then validated for well-formed leafref or instance-identifier syntax
Returns
status
Here is the call graph for this function:

◆ xpath_yang_parse_path_ex()

status_t xpath_yang_parse_path_ex ( tk_chain_t tkc,
ncx_module_t mod,
xpath_source_t  source,
xpath_pcb_t pcb,
boolean  logerrors,
ncx_leafref_class_t leafref_class 
)

Parse the leafref path as a leafref path (extended)

DOES NOT VALIDATE PATH NODES USED IN THIS PHASE A 2-pass validation is used in case the path expression is defined within a grouping. This pass is used on all objects, even in groupings

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkcparent token chain (may be NULL)
modmodule in progress
sourcecontext for this expression
XP_SRC_LEAFREF or XP_SRC_INSTANCEID
pcbinitialized xpath parser control block for the leafref path; use xpath_new_pcb to initialize before calling this fn. The pcb->exprstr field must be set
logerrorsTRUE to log errors
FALSE to suppress error messages
leafref_classaddress of return leafref class
NULL if not used
Return values
*leafref_classleafref classification for the expr
pcb->tkcis filled and then validated for well-formed leafref or instance-identifier syntax
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_yang_parse_path_ex2()

status_t xpath_yang_parse_path_ex2 ( tk_chain_t tkc,
ncx_module_t mod,
xpath_source_t  source,
xpath_pcb_t pcb,
boolean  logerrors,
boolean  is_xpath,
ncx_leafref_class_t leafref_class 
)

Parse the leafref path as a leafref path (extended2)

DOES NOT VALIDATE PATH NODES USED IN THIS PHASE A 2-pass validation is used in case the path expression is defined within a grouping. This pass is used on all objects, even in groupings

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
tkcparent token chain (may be NULL)
modmodule in progress
sourcecontext for this expression
XP_SRC_LEAFREF or XP_SRC_INSTANCEID
pcbinitialized xpath parser control block for the leafref path; use xpath_new_pcb to initialize before calling this fn. The pcb->exprstr field must be set
logerrorsTRUE to log errors
FALSE to suppress error messages
is_xpathTRUE to allow predicate leafs other than keys
This allows yangcli to generate content-match
leafref_classaddress of return leafref class
NULL if not used
Return values
*leafref_classleafref classification for the expr
pcb->tkcis filled and then validated for well-formed leafref or instance-identifier syntax
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_yang_validate_path()

status_t xpath_yang_validate_path ( ncx_module_t mod,
obj_template_t obj,
xpath_pcb_t pcb,
boolean  schemainst,
obj_template_t **  leafobj 
)

Validate the previously parsed leafref path.

  • QNames are valid
  • object structure referenced is valid
  • objects are all 'config true'
  • target object is a leaf
  • leafref represents a single instance

A 2-pass validation is used in case the path expression is defined within a grouping. This pass is used only on cooked (real) objects

Called after all 'uses' and 'augment' expansion so validation against cooked object tree can be done

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
modmodule containing the 'obj' (in progress) NULL if no object in progress
objobject using the leafref data type
pcbthe leafref parser control block, possibly cloned from from the typdef
schemainstTRUE if ncx:schema-instance string FALSE to use the pcb->source field to determine the exact parse mode
leafobjaddress of the return target object
Return values
*leafobjthe target leaf found by parsing the path (NO_ERR)
Returns
status
Here is the call graph for this function:

◆ xpath_yang_validate_path_dev()

status_t xpath_yang_validate_path_dev ( ncx_module_t mod,
obj_template_t obj,
xpath_pcb_t pcb,
boolean  schemainst,
obj_template_t **  leafobj,
boolean  logerrors,
boolean  is_xpath,
ncx_module_t rootmod 
)

Validate the previously parsed leafref path (deviation)

  • QNames are valid
  • object structure referenced is valid
  • objects are all 'config true'
  • target object is a leaf
  • leafref represents a single instance

YPW-1416: add rootmod parameter to track module in progress after replacing leafref type make sure module in progress is found instead of calling check_import and reparsing

A 2-pass validation is used in case the path expression is defined within a grouping. This pass is used only on cooked (real) objects

Called after all 'uses' and 'augment' expansion so validation against cooked object tree can be done

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
modmodule containing the 'obj' (in progress) NULL if no object in progress
objobject using the leafref data type
pcbthe leafref parser control block, possibly cloned from from the typdef
schemainstTRUE if ncx:schema-instance string
FALSE to use the pcb->source field to determine the exact parse mode
leafobjaddress of the return target object
logerrorsTRUE to log errors, FALSE to suppress errors val_parse uses FALSE if basetype NCX_BT_UNION
is_xpathTRUE to allow predicate leafs other than keys This allows yangcli to generate content-match filters
rootmodroot module being parsed; used during deviation processing for validating leafref; module will not get found and then duplicated
Return values
*leafobjthe target leaf found by parsing the path (NO_ERR)
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_yang_validate_path_ex()

status_t xpath_yang_validate_path_ex ( ncx_module_t mod,
obj_template_t obj,
xpath_pcb_t pcb,
boolean  schemainst,
obj_template_t **  leafobj,
boolean  logerrors,
boolean  is_xpath 
)

Validate the previously parsed leafref path (extended)

  • QNames are valid
  • object structure referenced is valid
  • objects are all 'config true'
  • target object is a leaf
  • leafref represents a single instance

A 2-pass validation is used in case the path expression is defined within a grouping. This pass is used only on cooked (real) objects

Called after all 'uses' and 'augment' expansion so validation against cooked object tree can be done

Error messages are printed by this function!! Do not duplicate error messages upon error return

Parameters
modmodule containing the 'obj' (in progress) NULL if no object in progress
objobject using the leafref data type
pcbthe leafref parser control block, possibly cloned from from the typdef
schemainstTRUE if ncx:schema-instance string FALSE to use the pcb->source field to determine the exact parse mode
leafobjaddress of the return target object
logerrorsTRUE to log errors
FALSE to suppress error messages
is_xpathTRUE to allow predicate leafs other than keys
This allows yangcli to generate content-match
Return values
*leafobjthe target leaf found by parsing the path (NO_ERR)
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xpath_yang_validate_xmlkey()

status_t xpath_yang_validate_xmlkey ( xmlTextReaderPtr  reader,
xpath_pcb_t pcb,
obj_template_t obj,
boolean  logerrors 
)

Validate a key XML attribute value given in (XML Key)

an <edit-config> operation with an 'insert' attribute Check that a complete set of predicates is present for the specified list of leaf-list

Parameters
readerXML reader to use
pcbinitialized XPath parser control block with a possibly unchecked pcb->exprstr. This function will call tk_tokenize_xpath_string if it has not already been called.
objlist or leaf-list object associated with the pcb->exprstr predicate expression (MAY be NULL if first-pass parsing and object is not known yet – parsed in XML attribute)
logerrorsTRUE if log_error and ncx_print_errormsg should be used to log XPath errors and warnings
FALSE if internal error info should be recorded in the xpath_result_t struct instead !!! use FALSE unless DEBUG mode !!!
Returns
status
Here is the call graph for this function:

◆ xpath_yang_validate_xmlpath()

status_t xpath_yang_validate_xmlpath ( xmlTextReaderPtr  reader,
xpath_pcb_t pcb,
obj_template_t pathobj,
boolean  logerrors,
obj_template_t **  targobj 
)

Validate an instance-identifier expression (XML path) within an XML PDU context.

Parameters
readerXML reader to use
pcbinitialized XPath parser control block with a possibly unchecked pcb->exprstr. This function will call tk_tokenize_xpath_string if it has not already been called.
pathobjobject to create identifier for
logerrorsTRUE if log_error and ncx_print_errormsg should be used to log XPath errors and warnings
FALSE if internal error info should be recorded in the xpath_result_t struct instead !!! use FALSE unless DEBUG mode !!!
targobjaddress of return target object
Return values
*targobjis set to the object that this instance-identifier references, if NO_ERR
Returns
status
Here is the call graph for this function: