libyang 5.7.1
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Loading...
Searching...
No Matches
Data validation options
Collaboration diagram for Data validation options:

Macros

#define LYD_VALIDATE_MULTI_ERROR   0x0004
#define LYD_VALIDATE_NO_DEFAULTS   0x0010
#define LYD_VALIDATE_NO_STATE   0x0001
#define LYD_VALIDATE_NOT_FINAL   0x0020
#define LYD_VALIDATE_OPERATIONAL   0x0008
#define LYD_VALIDATE_OPTS_MASK   0x0000FFFF
#define LYD_VALIDATE_PRESENT   0x0002

Detailed Description

Various options to change data validation behaviour, both for the parser and separate validation.

Default separate validation behavior:

  • the provided data are expected to provide complete datastore content (both the configuration and state data) and performs data validation according to all YANG rules, specifics follow,
  • instantiated (status) obsolete data print a warning,
  • all types are fully resolved (leafref/instance-identifier targets, unions) and must be valid (lists have all the keys, leaf(-lists) correct values),
  • when statements on existing nodes are evaluated. Depending on the previous when state (from previous validation or parsing), the node is silently auto-deleted if the state changed from true to false, otherwise a validation error is raised if it evaluates to false,
  • if-feature statements are evaluated,
  • data from several cases behave based on their previous state (from previous validation or parsing). If there existed already a case and another one was added, the previous one is silently auto-deleted. Otherwise (if data from 2 or more cases were created) a validation error is raised,
  • default values are added.

Macro Definition Documentation

◆ LYD_VALIDATE_MULTI_ERROR

#define LYD_VALIDATE_MULTI_ERROR   0x0004

Do not stop validation on the first error but generate all the detected errors.

Definition at line 209 of file parser_data.h.

◆ LYD_VALIDATE_NO_DEFAULTS

#define LYD_VALIDATE_NO_DEFAULTS   0x0010

Do not add any default nodes during validation, other implicit nodes (such as NP containers) are still added. Validation will fail if a default node is required for it to pass.

Definition at line 212 of file parser_data.h.

◆ LYD_VALIDATE_NO_STATE

#define LYD_VALIDATE_NO_STATE   0x0001

Consider state data not allowed and raise an error if they are found. Also, no implicit state data are added.

Definition at line 206 of file parser_data.h.

◆ LYD_VALIDATE_NOT_FINAL

#define LYD_VALIDATE_NOT_FINAL   0x0020

Skip final validation tasks that require for all the data nodes to either exist or not, based on the YANG constraints (including skipping type plugin validate_tree callbacks). Once the data satisfy this requirement, the final validation should be performed.

Definition at line 215 of file parser_data.h.

◆ LYD_VALIDATE_OPERATIONAL

#define LYD_VALIDATE_OPERATIONAL   0x0008

Semantic constraint violations are reported only as warnings instead of errors (see RFC 8342 sec. 5.3).

Definition at line 210 of file parser_data.h.

◆ LYD_VALIDATE_OPTS_MASK

#define LYD_VALIDATE_OPTS_MASK   0x0000FFFF

Mask for all the LYD_VALIDATE_* options.

Definition at line 220 of file parser_data.h.

◆ LYD_VALIDATE_PRESENT

#define LYD_VALIDATE_PRESENT   0x0002

Validate only modules whose data actually exist.

Definition at line 208 of file parser_data.h.