C-API: Extended yang_apply return value with: 2

Test: openconfig: ensure openconfig dirs searched before locally cached
This commit is contained in:
Olof hagsand 2024-08-13 13:32:06 +02:00
parent c08dac2e5d
commit 9da4939ee0
3 changed files with 8 additions and 4 deletions

View file

@ -201,7 +201,8 @@ typedef struct yang_stmt yang_stmt;
*
* @param[in] yn yang node
* @param[in] arg Argument
* @retval n OK, abort traversal and return to caller with "n"
* @retval 2 Locally abort this subtree, continue with others
* @retval 1 OK, abort traversal and return to caller with "n"
* @retval 0 OK, continue with next
* @retval -1 Error, abort
*/

View file

@ -3403,7 +3403,8 @@ yang_features(clixon_handle h,
* @param[in] fn Callback
* @param[in] depth Depth argument: where to start. If <=0 call the calling node yn, if 1 start with its children, etc
* @param[in] arg Argument
* @retval n OK, aborted at first encounter of first match
* @retval 2 OK, yn was skipped
* @retval 1 OK, aborted at first encounter of first match
* @retval 0 OK, all nodes traversed
* @retval -1 Error, aborted at first error encounter
* @code
@ -3441,7 +3442,9 @@ yang_apply(yang_stmt *yn,
ys = yn->ys_stmt[i];
if ((ret = yang_apply(ys, keyword, fn, depth-1, arg)) < 0)
goto done;
if (ret > 0){
if (ret == 2)
continue;
else if (ret > 0){
retval = ret;
goto done;
}

View file

@ -63,8 +63,8 @@ cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
<CLICON_YANG_DIR>${YANG_INSTALLDIR}</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${OPENCONFIG}</CLICON_YANG_DIR>
<CLICON_YANG_DIR>${YANG_INSTALLDIR}</CLICON_YANG_DIR>
<CLICON_YANG_AUGMENT_ACCEPT_BROKEN>true</CLICON_YANG_AUGMENT_ACCEPT_BROKEN>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>