yumapro  25.10-3
YumaPro SDK
Loading...
Searching...
No Matches
YANG SID File

Support YANG to CBOR SID File. More...

Collaboration diagram for YANG SID File:

Functions

status_t sid_file_init (void)
 Initialize the SID FIle Parser Module. More...
 
void sid_file_cleanup (void)
 Cleanup the SID FIle Parser Module. More...
 
val_value_tsid_file_load (ncx_module_t *mod, status_t *res)
 
  • Load the SID file for the specified YANG module.
More...
 
val_value_tsid_file_load_update (ncx_module_t *mod, const xmlChar *parmstr, boolean is_date, status_t *res)
 
  • Load the SID file for the specified YANG module.
More...
 
status_t sid_file_apply (uint32 sid_tree_id, val_value_t *sidfile, ncx_module_t *mod, boolean internal, boolean update_mode)
 Apply the SID file contents to specified YANG module. More...
 
obj_template_tsid_file_get_obj (void)
 Get the OBJ template for the SID file. More...
 
status_t sid_file_get_ranges (val_value_t *sidfile, dlq_hdr_t *sid_rangeQ, uint32 *total)
 Get the assignment ranges from the SID file val_value_t. More...
 
status_t sid_file_add_range (ncx_sid_t range_start, uint32 range_size, dlq_hdr_t *sid_rangeQ)
 Add a specified range struct to the end of the sid_rangeQ. More...
 
status_t sid_file_check_ranges (ncx_sid_t sid, dlq_hdr_t *sid_rangeQ, boolean set_highest, ncx_sid_range_t **ret_range)
 Check if a SID value is in range. More...
 
status_t sid_file_verify_ranges (dlq_hdr_t *sid_rangeQ)
 Verify that all the SID ranges are separate and do not overlap. More...
 

Detailed Description

Support YANG to CBOR SID File.

Implement obj_template_t schema to val_value conversion of SID files.

Function Documentation

◆ sid_file_add_range()

status_t sid_file_add_range ( ncx_sid_t  range_start,
uint32  range_size,
dlq_hdr_t *  sid_rangeQ 
)

Add a specified range struct to the end of the sid_rangeQ.

An ncx_sid_range_t struct will be created and added to the rangeQ

Parameters
range_startSID number to start the range
range_sizenumber of SID numbers in range
[out]sid_rangeQinitialized Q for receiving the ncx_sid_range_t structs
Returns
status
  • need to clean entries from sid_rangeQ even if error returned
Here is the call graph for this function:

◆ sid_file_apply()

status_t sid_file_apply ( uint32  sid_tree_id,
val_value_t sidfile,
ncx_module_t mod,
boolean  internal,
boolean  update_mode 
)

Apply the SID file contents to specified YANG module.

For augments, the expanded nodes in the augmented tree will be updated. The sid_dict registry will be updated for each schema item.

Parameters
sid_tree_idYANG SID Tree ID to use (from sid_dict)
sidfilevalue tree representing a SID file to apply. value treated as const.
[out]modmodule to load SID file for
  • mod data structures and maybe other modules for augment will get SID assignments
internal
  • TRUE if this is an internal module
  • FALSE if OK to export SIDs
update_mode
  • TRUE for yangdum –sid-update-file mode
  • FALSE for all other modes (netconfd and yangcli)
Returns
status
Here is the call graph for this function:

◆ sid_file_check_ranges()

status_t sid_file_check_ranges ( ncx_sid_t  sid,
dlq_hdr_t *  sid_rangeQ,
boolean  set_highest,
ncx_sid_range_t **  ret_range 
)

Check if a SID value is in range.

A Queue of ncx_sid_range_t structs will be checked

Parameters
sidSID number to check
sid_rangeQQ of ncx_sid_range_t to check
set_highestTRUE to set sid_range_used if sid is highest in range
[out]ret_rangereturn pointer to found range
  • may be NULL to ignore
Returns
status
  • NO_ERR if sid is in range
    • *ret_range set if non-NULL
  • ERR_NCX_MISSING_PARM if sid=0 or sid_rangeQ is NULL
  • ERR_NCX_NOT_IN_RANGE if no range that could fit

◆ sid_file_cleanup()

void sid_file_cleanup ( void  )

Cleanup the SID FIle Parser Module.

Here is the caller graph for this function:

◆ sid_file_get_obj()

obj_template_t * sid_file_get_obj ( void  )

Get the OBJ template for the SID file.

Returns
pointer to the SID file object; NULL if init sequence error

◆ sid_file_get_ranges()

status_t sid_file_get_ranges ( val_value_t sidfile,
dlq_hdr_t *  sid_rangeQ,
uint32 *  total 
)

Get the assignment ranges from the SID file val_value_t.

An ncx_sid_range_t struct will be created and added to the rangeQ

Parameters
sidfileSID file as a val_value_t tree
[out]sid_rangeQinitialized Q for receiving the ncx_sid_range_t structs
[out]totalif non-NULL set to number of SIDs in all ranges found
Returns
status
  • need to clean entries from sid_rangeQ even if error returned
Here is the call graph for this function:

◆ sid_file_init()

status_t sid_file_init ( void  )

Initialize the SID FIle Parser Module.

Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sid_file_load()

val_value_t * sid_file_load ( ncx_module_t mod,
status_t res 
)

  • Load the SID file for the specified YANG module.

Just creates a val_value_t representing the JSON contents Does not apply the SIDs to the module

Parameters
modmodule to load SID file for
[out]resaddress of return status
  • *res return status
Returns
malloced val_value_t representing the SID file. Must be freed with val_free_value.

◆ sid_file_load_update()

val_value_t * sid_file_load_update ( ncx_module_t mod,
const xmlChar *  parmstr,
boolean  is_date,
status_t res 
)

  • Load the SID file for the specified YANG module.

Just creates a val_value_t representing the JSON contents Does not apply the SIDs to the module

Parameters
modmodule to load SID file for
parmstr–sid-update-file parameter string
is_date
  • TRUE if parmstr is a date string
  • FALSE if parmstr is a filespec
[out]resaddress of return status
  • *res return status
Returns
malloced val_value_t representing the SID file. Must be freed with val_free_value.

◆ sid_file_verify_ranges()

status_t sid_file_verify_ranges ( dlq_hdr_t *  sid_rangeQ)

Verify that all the SID ranges are separate and do not overlap.

Generate log_error messages if problems found

Parameters
sid_rangeQQ of ncx_sid_range_t to check
Returns
status
  • NO_ERR if all ranges OK or less than 2 ranges
  • ERR_NCX_MISSING_PARM if sid_rangeQ is NULL
  • ERR_NCX_INVALID_VALUE if range overlap found