From b6480ac07d1fb7ea21faa1294d0e4cb7cbdf1fa6 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Tue, 21 May 2024 13:02:20 +0200 Subject: [PATCH] clixon-config.yang: Added CLICON_DEBUG, Removed: CLICON_NETCONF_DUPLICATE_ALLOW Rearranged and grouped options clixon-lib.yang: Added debug types Removed git reliance in test - moved to configure script --- CHANGELOG.md | 4 +- apps/backend/backend_client.c | 5 +- apps/cli/cli_common.c | 16 +- apps/cli/cli_main.c | 19 ++ apps/cli/clixon_cli_api.h | 1 + configure | 3 +- configure.ac | 3 +- example/main/example_cli.cli | 3 + lib/clixon/clixon_debug.h | 9 +- lib/src/clixon_xml_map.c | 9 +- test/config.sh.in | 2 + test/lib.sh | 3 - test/test_debug.sh | 7 + yang/clixon/clixon-config@2024-04-01.yang | 226 +++++++++++----------- yang/clixon/clixon-lib@2024-04-01.yang | 184 ++++++++++++++---- 15 files changed, 320 insertions(+), 174 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6181e5e7..8b058306 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,13 +29,15 @@ Expected: June 2024 * CLI support for multiple inline commands separated by semi-colon * New `clixon-config@2024-04-01.yang` revision * Added options: + - `CLICON_DEBUG`: Debug flags, partly implemented. - `CLICON_YANG_SCHEMA_MOUNT_SHARE`: Share same YANGs of several moint-points - `CLICON_SOCK_PRIO`: Enable socket event priority - `CLICON_XMLDB_MULTI`: Split datastore into multiple sub files - - `CLICON_NETCONF_DUPLICATE_ALLOW`: Disable duplicate check in NETCONF messages - `CLICON_CLI_OUTPUT_FORMAT`: Default CLI output format - `CLICON_AUTOLOCK`: Implicit locks * New `clixon-lib@2024-04-01.yang` revision + - Added: debug bits type + - Added: xmldb-split extension - Added: Default format ### API changes on existing protocol/config features diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c index 01cfb6b4..c5e928a8 100644 --- a/apps/backend/backend_client.c +++ b/apps/backend/backend_client.c @@ -644,10 +644,7 @@ from_client_edit_config(clixon_handle h, */ if ((ret = xml_yang_validate_minmax(xc, 1, &xret)) < 0) goto done; - /* Disable duplicate check in NETCONF messages.*/ - if (clicon_option_bool(h, "CLICON_NETCONF_DUPLICATE_ALLOW")) - ; - else if (ret == 1 && (ret = xml_yang_validate_unique_recurse(xc, &xret)) < 0) + if (ret == 1 && (ret = xml_yang_validate_unique_recurse(xc, &xret)) < 0) goto done; /* xmldb_put (difflist handling) requires list keys */ if (ret == 1 && (ret = xml_yang_validate_list_key_only(xc, &xret)) < 0) diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 941a4dd9..9382e5a9 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -632,6 +632,17 @@ cli_del(clixon_handle h, return retval; } +/*! Get debug level of CLI client + */ +int +cli_debug_show(clixon_handle h, + cvec *cvv, + cvec *argv) +{ + cligen_output(stdout, "CLI debug:0x%x\n", clixon_debug_get()); + return 0; +} + /*! Set debug level on CLI client (not backend daemon) * * @param[in] h Clixon handle @@ -644,8 +655,8 @@ cli_del(clixon_handle h, */ int cli_debug_cli(clixon_handle h, - cvec *cvv, - cvec *argv) + cvec *cvv, + cvec *argv) { int retval = -1; cg_var *cv; @@ -736,7 +747,6 @@ cli_debug_restconf(clixon_handle h, return retval; } - /*! Set syntax mode * * @param[in] h Clixon handle diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 584b2649..e8c03c9e 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -751,6 +751,7 @@ main(int argc, break; } } + argc -= optind; argv += optind; @@ -761,6 +762,24 @@ main(int argc, /* Defer: Wait to the last minute to print help message */ if (help) usage(h, argv[0]); + /* Unless -D, set debug level to CLICON_DEBUG set + * Only works for one value. + */ + { + char *dstr; + int d = 0; + + dstr = clicon_option_str(h, "CLICON_DEBUG"); + if (dbg == 0 && dstr && strlen(dstr)){ + if ((d = clixon_debug_str2key(dstr)) < 0 && + sscanf(optarg, "%d", &d) != 1){ + clixon_err(OE_CFG, 0, "Parsing CLICON_DEBUG: %s", dstr); + goto done; + } + clixon_debug_init(h, d); + clixon_log_init(h, __PROGRAM__, d?LOG_DEBUG:LOG_INFO, logdst); + } + } /* Split remaining argv/argc into and */ if (options_split(h, argv0, argc, argv, &restarg) < 0) diff --git a/apps/cli/clixon_cli_api.h b/apps/cli/clixon_cli_api.h index c6de2631..f8ea2936 100644 --- a/apps/cli/clixon_cli_api.h +++ b/apps/cli/clixon_cli_api.h @@ -91,6 +91,7 @@ int cli_merge(clixon_handle h, cvec *vars, cvec *argv); int cli_create(clixon_handle h, cvec *vars, cvec *argv); int cli_remove(clixon_handle h, cvec *vars, cvec *argv); int cli_del(clixon_handle h, cvec *vars, cvec *argv); +int cli_debug_show(clixon_handle h, cvec *cvv, cvec *argv); int cli_debug_cli(clixon_handle h, cvec *vars, cvec *argv); int cli_debug_backend(clixon_handle h, cvec *vars, cvec *argv); int cli_debug_restconf(clixon_handle h, cvec *vars, cvec *argv); diff --git a/configure b/configure index 59b7b31d..d2d26942 100755 --- a/configure +++ b/configure @@ -2814,7 +2814,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CLIXON_VERSION_MAJOR="7" CLIXON_VERSION_MINOR="1" CLIXON_VERSION_PATCH="0" -CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}.PRE\"" +# Use GIT, if this does not work, need a fallback mechanism +CLIXON_VERSION="$(git log --pretty="format:%(describe) %ci" -n1)" # Debug flag # Check whether --enable-debug was given. diff --git a/configure.ac b/configure.ac index 53a4c84b..a4131d74 100644 --- a/configure.ac +++ b/configure.ac @@ -51,7 +51,8 @@ AC_CONFIG_AUX_DIR(config-aux) CLIXON_VERSION_MAJOR="7" CLIXON_VERSION_MINOR="1" CLIXON_VERSION_PATCH="0" -CLIXON_VERSION="\"${CLIXON_VERSION_MAJOR}.${CLIXON_VERSION_MINOR}.${CLIXON_VERSION_PATCH}.PRE\"" +# Use GIT, if this does not work, need a fallback mechanism +CLIXON_VERSION="$(git log --pretty="format:%(describe) %ci" -n1)" # Debug flag AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Build with debug symbols, default: no]),[ diff --git a/example/main/example_cli.cli b/example/main/example_cli.cli index 93c8579c..500027d0 100644 --- a/example/main/example_cli.cli +++ b/example/main/example_cli.cli @@ -86,6 +86,9 @@ show("Show a particular state of the system"){ auto("Show expand x"){ @datamodelshow, cli_show_auto("candidate", "default", true, false, "report-all"); } + debug("Show debug"), cli_debug_show();{ + cli("Show cli debug"), cli_debug_show(); + } xpath("Show configuration") ("XPATH expression") [("Namespace")], show_conf_xpath("candidate"); version("Show version"), cli_show_version("candidate", "text", "/"); diff --git a/lib/clixon/clixon_debug.h b/lib/clixon/clixon_debug.h index 9e6f5570..ca1b0171 100644 --- a/lib/clixon/clixon_debug.h +++ b/lib/clixon/clixon_debug.h @@ -48,13 +48,14 @@ /* Debug flags are seperated into subject areas and detail * @see dbgmap Symbolic mapping (if you change here you may need to change dbgmap) + * @see clixon_debug in clixon-lib.yang */ /* Detail level */ #define CLIXON_DBG_ALWAYS 0x00000000 /* Unconditionally logged */ #define CLIXON_DBG_DETAIL 0x01000000 /* Details: traces, parse trees, etc */ #define CLIXON_DBG_DETAIL2 0x02000000 /* Extra details */ -#define CLIXON_DBG_DETAIL3 0x03000000 /* Probably more detail than you want */ -#define CLIXON_DBG_DMASK 0x03000000 /* Detail mask */ +#define CLIXON_DBG_DETAIL3 0x04000000 /* Probably more detail than you want */ +#define CLIXON_DBG_DMASK 0x07000000 /* Detail mask */ #define CLIXON_DBG_DSHIFT 24 /* Subject area */ @@ -71,11 +72,11 @@ #define CLIXON_DBG_SNMP 0x00000400 /* SNMP frontend */ #define CLIXON_DBG_NACM 0x00000800 /* NACM processing */ #define CLIXON_DBG_PROC 0x00001000 /* Process handling */ -#define CLIXON_DBG_DATASTORE 0x00002000 /* Datastore management */ +#define CLIXON_DBG_DATASTORE 0x00002000 /* Datastore xmldb management */ #define CLIXON_DBG_EVENT 0x00004000 /* Event processing */ #define CLIXON_DBG_RPC 0x00008000 /* RPC handling */ #define CLIXON_DBG_STREAM 0x00010000 /* Notification streams */ -#define CLIXON_DBG_PARSE 0x00020000 /* Parser */ +#define CLIXON_DBG_PARSE 0x00020000 /* Parser: XML,YANG, etc */ /* External applications */ #define CLIXON_DBG_APP 0x00100000 /* External application */ diff --git a/lib/src/clixon_xml_map.c b/lib/src/clixon_xml_map.c index 3cd36c07..f87ee720 100644 --- a/lib/src/clixon_xml_map.c +++ b/lib/src/clixon_xml_map.c @@ -1589,8 +1589,8 @@ yang_enum2int(yang_stmt *ytype, } /*! Given a YANG (bits) type node and a bit string, return the bit position. - * Example: * + * Example: * type bits { * bit stateA { * position "0"; << This one @@ -1603,7 +1603,7 @@ yang_enum2int(yang_stmt *ytype, * If the position is not specified, it will be automatically assigned as defined * in RFC7950, section 9.7.4.2 * - * @param[in] ytype YANG type noden + * @param[in] ytype YANG type node * @param[in] bitstr bit (flag) string * @param[out] bitpos position for the given bit (flag) * @retval 1 OK, result in flagpos @@ -1653,8 +1653,7 @@ yang_bits_pos(yang_stmt *ytype, goto done; } -/*! Given a YANG (bits) type node and string value, return the - * SNMP value for all bits (flags) that are set. +/*! Given a YANG (bits) type node and string value, return SNMP value for bits set. * * @param[in] h Clixon handle * @param[in] ytype YANG type noden @@ -1665,6 +1664,7 @@ yang_bits_pos(yang_stmt *ytype, * @retval 0 Invalid, not found * @retval -1 Error * @see yang_val2bitsstr + * XXX de-snmp:ize */ int yang_bitsstr2val(clixon_handle h, @@ -1739,6 +1739,7 @@ yang_bitsstr2val(clixon_handle h, * @retval 0 Invalid, not found * @retval -1 Error * @see yang_bitsstr2val + * XXX de-snmp:ize */ int yang_val2bitsstr(clixon_handle h, diff --git a/test/config.sh.in b/test/config.sh.in index 77f9c9f2..48c7e50c 100755 --- a/test/config.sh.in +++ b/test/config.sh.in @@ -78,6 +78,8 @@ CLIXON_CONFIG_REV="2024-04-01" CLIXON_RESTCONF_REV="2022-08-01" CLIXON_EXAMPLE_REV="2022-11-01" +CLIXON_VERSION="@CLIXON_VERSION@" + # Length of TSL RSA key # Problem with small key such as 1024 not allowed in centos8 for example (why is this) # Problem with long keys are they take time to generate, eg on ARM diff --git a/test/lib.sh b/test/lib.sh index 1c307299..09c3b53f 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -41,9 +41,6 @@ if [ -f ./config.sh ]; then fi fi -# Note that this relies on git being present in shell -CLIXON_VERSION="$(git log --pretty="format:%(describe) %ci" -n1)" - # Test number from start : ${testnr:=0} diff --git a/test/test_debug.sh b/test/test_debug.sh index f7e24e92..da9e42e5 100755 --- a/test/test_debug.sh +++ b/test/test_debug.sh @@ -84,6 +84,13 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" " new "Set cli debug using cli" expectpart "$($clixon_cli -1 -f $cfg -l o debug cli 1)" 0 "^$" +# Run cli debug +new "get cli debug, expect 0" +expectpart "$($clixon_cli -1 -f $cfg show debug cli)" 0 "CLI debug:0x0" + +new "get cli debug expect 2" +expectpart "$($clixon_cli -1 -f $cfg -o CLICON_DEBUG=msg show debug cli)" 0 "CLI debug:0x2" + new "Set backend debug using cli" expectpart "$($clixon_cli -1 -f $cfg -l o debug backend 1)" 0 "^$" diff --git a/yang/clixon/clixon-config@2024-04-01.yang b/yang/clixon/clixon-config@2024-04-01.yang index f098fb43..75e652ea 100644 --- a/yang/clixon/clixon-config@2024-04-01.yang +++ b/yang/clixon/clixon-config@2024-04-01.yang @@ -52,10 +52,10 @@ module clixon-config { revision 2024-04-01 { description "Added options: + CLICON_DEBUG: Debug flags. CLICON_YANG_SCHEMA_MOUNT_SHARE: Share same YANGs of equal moint-points. CLICON_SOCK_PRIO: Enable socket event priority CLICON_XMLDB_MULTI: Split datastore into multiple sub files - CLICON_NETCONF_DUPLICATE_ALLOW: Disable duplicate check in NETCONF messages. CLICON_CLI_OUTPUT_FORMAT: Default CLI output format CLICON_AUTOLOCK: Implicit locks Released in Clixon 7.1"; @@ -456,6 +456,14 @@ module clixon-config { Ensure that YANG_INSTALLDIR (default /usr/local/share/clixon) is present in the path"; } + leaf CLICON_DEBUG{ + type cl:clixon_debug_t; + description + "Debug flags as bitfields. + Can also be given directly as -D to clixon commands (which overrides this) + Note only partly implemented; + - Only CLI, only single value, cannot be combined with -D, not in RPC"; + } leaf CLICON_CONFIGFILE{ type string; description @@ -539,12 +547,6 @@ module clixon-config { Note this is similar to what happens to YANG nodes that are disabled by a false if-feature statement."; } - leaf CLICON_BACKEND_DIR { - type string; - description - "Location of backend .so plugins. Load all .so - plugins in this dir as backend plugins"; - } leaf CLICON_YANG_SCHEMA_MOUNT{ type boolean; description @@ -568,12 +570,89 @@ module clixon-config { Only if CLICON_YANG_SCHEMA_MOUNT is enabled"; default false; } + leaf CLICON_YANG_AUGMENT_ACCEPT_BROKEN { + type boolean; + default false; + description + "Debug option. If enabled, accept broken augments on the form: + augment { ... } + where is an XPath which MUST be an existing node but for many + yangmodels do not. + There are several cases why this may be the case: + - syntax errors, + - features that need to be enabled + - wrong XPaths, etc + This option should be enabled only for passing some testcases it should + normally never be enabled in system YANGs that are used in a system."; + } + leaf CLICON_YANG_LIBRARY { + type boolean; + default true; + description + "Enable YANG library support as state data according to RFC8525. + If enabled, module info will appear when doing netconf get or + restconf GET. + The module state data is on the form: + ... + instead where the module state is on the form: + ... + See also CLICON_XMLDB_MODSTATE where the module state info is used to tag datastores + with module information."; + } + leaf CLICON_BACKEND_DIR { + type string; + description + "Location of backend .so plugins. Load all .so + plugins in this dir as backend plugins"; + } leaf CLICON_BACKEND_REGEXP { type string; description "Regexp of matching backend plugins in CLICON_BACKEND_DIR"; default "(.so)$"; } + leaf CLICON_BACKEND_USER { + type string; + description + "User name for backend (both foreground and daemonized). + If you set this value the backend if started as root will lower + the privileges after initialization. + The ownership of files created by the backend will also be set to this + user (eg datastores). + It also sets the backend unix socket owner to this user, but its group + is set by CLICON_SOCK_GROUP. + See also CLICON_BACKEND_PRIVILEGES setting"; + } + leaf CLICON_BACKEND_PRIVILEGES { + type priv_mode; + default none; + description + "Backend privileges mode. + If CLICON_BACKEND_USER user is set, mode can be set to drop_perm or + drop_temp. + Drop privs may not be used together with CLICON_XMLDB_MULTI"; + } + leaf CLICON_BACKEND_PIDFILE { + type string; + mandatory true; + description "Process-id file of backend daemon"; + } + leaf CLICON_BACKEND_RESTCONF_PROCESS { + type boolean; + default false; + description + "If set, enable process-control of restconf daemon, ie start/stop restconf + daemon internally from backend daemon. + Also, if set, restconf daemon queries backend for its config + if not set, restconf daemon reads its config from main config file + It uses clixon-restconf.yang for config and clixon-lib.yang for RPC + Process control of restconf daemon is as follows: + - on RPC start, if enable is true, start the service, if false, error or ignore it + - on RPC stop, stop the service + - on backend start make the state as configured + - on enable change, make the state as configured + Disable if you start the restconf daemon by other means."; + } leaf CLICON_NETCONF_DIR{ type string; description "Location of netconf (frontend) .so plugins"; @@ -616,16 +695,6 @@ module clixon-config { RFC6242 for example. This only applies to the external NETCONF"; } - leaf CLICON_NETCONF_DUPLICATE_ALLOW { - type boolean; - default false; - description - "Disable duplicate check in NETCONF messages. - In Clixon 7.0, a stricter check of duplicate entries in incoming NETCONF messages was made. - More specifically: lists and leaf-lists with non-unique entries. - Enable to disable this check, and to allow duplicates in incoming NETCONF messages. - Note that this is an error by such a client, but there is some legacy code that uses this"; - } leaf CLICON_NETCONF_CREATOR_ATTR { type boolean; default false; @@ -641,6 +710,21 @@ module clixon-config { config"; status obsolete; } + leaf CLICON_NETCONF_MONITORING { + type boolean; + default true; + description + "Enable Netconf monitoring support as state data according to RFC6022. + If enabled, netconf monitoring info will appear when doing netconf get or + restconf GET."; + } + leaf CLICON_NETCONF_MONITORING_LOCATION { + type string; + description + "Extra Netconf monitoring location directory where schemas can be retrieved + apart from NETCONF. + Only if CLICON_NETCONF_MONITORING"; + } leaf CLICON_RESTCONF_API_ROOT { type string; default "/restconf"; @@ -952,48 +1036,6 @@ module clixon-config { non-prio events is disabled This is useful if the backend opens other sockets, such as the controller"; } - leaf CLICON_BACKEND_USER { - type string; - description - "User name for backend (both foreground and daemonized). - If you set this value the backend if started as root will lower - the privileges after initialization. - The ownership of files created by the backend will also be set to this - user (eg datastores). - It also sets the backend unix socket owner to this user, but its group - is set by CLICON_SOCK_GROUP. - See also CLICON_BACKEND_PRIVILEGES setting"; - } - leaf CLICON_BACKEND_PRIVILEGES { - type priv_mode; - default none; - description - "Backend privileges mode. - If CLICON_BACKEND_USER user is set, mode can be set to drop_perm or - drop_temp. - Drop privs may not be used together with CLICON_XMLDB_MULTI"; - } - leaf CLICON_BACKEND_PIDFILE { - type string; - mandatory true; - description "Process-id file of backend daemon"; - } - leaf CLICON_BACKEND_RESTCONF_PROCESS { - type boolean; - default false; - description - "If set, enable process-control of restconf daemon, ie start/stop restconf - daemon internally from backend daemon. - Also, if set, restconf daemon queries backend for its config - if not set, restconf daemon reads its config from main config file - It uses clixon-restconf.yang for config and clixon-lib.yang for RPC - Process control of restconf daemon is as follows: - - on RPC start, if enable is true, start the service, if false, error or ignore it - - on RPC stop, stop the service - - on backend start make the state as configured - - on enable change, make the state as configured - Disable if you start the restconf daemon by other means."; - } leaf CLICON_AUTOCOMMIT { type int32; default 0; @@ -1014,17 +1056,6 @@ module clixon-config { Also, any edits in candidate are discarded if the client closes the connection. This effectively disables shared candidate"; } - leaf CLICON_XMLDB_DIR { - type string; - mandatory true; - description - "Directory where datastores such as \"running\", \"candidate\" and \"startup\" - are placed. - If CLICON_XMLDB_MULTI is enabled, this is the directory where a datastore - subdir is stored, such as \"running.d/\" - "; - } - leaf CLICON_DATASTORE_CACHE { type datastore_cache; default cache; @@ -1036,6 +1067,16 @@ module clixon-config { Note that from 7.0 this is OBSOLETED, only datastore_cache is supported"; status obsolete; } + leaf CLICON_XMLDB_DIR { + type string; + mandatory true; + description + "Directory where datastores such as \"running\", \"candidate\" and \"startup\" + are placed. + If CLICON_XMLDB_MULTI is enabled, this is the directory where a datastore + subdir is stored, such as \"running.d/\" + "; + } leaf CLICON_XMLDB_FORMAT { type cl:datastore_format; default xml; @@ -1138,21 +1179,6 @@ module clixon-config { If true: The symbols defined by this shared object will be made available for symbol res‐ olution of subsequently loaded shared objects."; } - leaf CLICON_YANG_AUGMENT_ACCEPT_BROKEN { - type boolean; - default false; - description - "Debug option. If enabled, accept broken augments on the form: - augment { ... } - where is an XPath which MUST be an existing node but for many - yangmodels do not. - There are several cases why this may be the case: - - syntax errors, - - features that need to be enabled - - wrong XPaths, etc - This option should be enabled only for passing some testcases it should - normally never be enabled in system YANGs that are used in a system."; - } leaf CLICON_NAMESPACE_NETCONF_DEFAULT { type boolean; default false; @@ -1162,7 +1188,6 @@ module clixon-config { If defined, top-level rpc calls need not have namespaces (eg using xmlns=) since the default NETCONF namespace will be assumed. (This is not standard). See rfc6241 3.1: urn:ietf:params:xml:ns:netconf:base:1.0."; - } leaf CLICON_STARTUP_MODE { type startup_mode; @@ -1218,20 +1243,6 @@ module clixon-config { If this option is set, Clixon disables NACM if a datastore does NOT contain a NACM config on load."; } - leaf CLICON_YANG_LIBRARY { - type boolean; - default true; - description - "Enable YANG library support as state data according to RFC8525. - If enabled, module info will appear when doing netconf get or - restconf GET. - The module state data is on the form: - ... - instead where the module state is on the form: - ... - See also CLICON_XMLDB_MODSTATE where the module state info is used to tag datastores - with module information."; - } leaf CLICON_MODULE_SET_ID { type string; default "0"; @@ -1244,21 +1255,6 @@ module clixon-config { If CLICON_MODULE_LIBRARY_RFC7895 is enabled, it sets the modules-state/module-set-id instead"; } - leaf CLICON_NETCONF_MONITORING { - type boolean; - default true; - description - "Enable Netconf monitoring support as state data according to RFC6022. - If enabled, netconf monitoring info will appear when doing netconf get or - restconf GET."; - } - leaf CLICON_NETCONF_MONITORING_LOCATION { - type string; - description - "Extra Netconf monitoring location directory where schemas can be retrieved - apart from NETCONF. - Only if CLICON_NETCONF_MONITORING"; - } leaf CLICON_STREAM_DISCOVERY_RFC5277 { type boolean; default false; diff --git a/yang/clixon/clixon-lib@2024-04-01.yang b/yang/clixon/clixon-lib@2024-04-01.yang index ce934c60..0ebfb11e 100644 --- a/yang/clixon/clixon-lib@2024-04-01.yang +++ b/yang/clixon/clixon-lib@2024-04-01.yang @@ -71,7 +71,8 @@ module clixon-lib { revision 2024-04-01 { description - "Added: xmldb-split extension + "Added: debug bits type + Added: xmldb-split extension Added: Default format Released in Clixon 7.1"; } @@ -187,6 +188,113 @@ module clixon-lib { } } } + typedef clixon_debug_t { + description + "Debug flags. + Flags are seperated into subject areas and detail + Can also be given directly as -D to clixon commands + Note there are also constants in the code thaht need to be in sync with these values"; + type bits { + /* Subjects: */ + bit default { + description "Default logs"; + position 0; + } + bit msg { + description "In/out messages"; + position 1; + } + bit init { + description "Initialization"; + position 2; + } + bit xml { + description "XML processing"; + position 3; + } + bit xpath { + description "XPath processing"; + position 4; + } + bit yang { + description "YANG processing"; + position 5; + } + bit backend { + description "Backend-specific"; + position 6; + } + bit cli { + description "CLI frontend"; + position 7; + } + bit netconf { + description "NETCONF frontend"; + position 8; + } + bit restconf { + description "RESTCONF frontend"; + position 9; + } + bit snmp { + description "SNMP frontend"; + position 10; + } + bit nacm { + description "NACM processing"; + position 11; + } + bit proc { + description "Process handling"; + position 12; + } + bit datastore { + description "Datastore xmldb management"; + position 13; + } + bit event { + description "Event processing"; + position 14; + } + bit rpc { + description "RPC handling"; + position 15; + } + bit stream { + description "Notification streams"; + position 16; + } + bit parse { + description "Parser: XML,YANG, etc"; + position 17; + } + bit app { + description "External applications"; + position 20; + } + bit app2 { + description "External application"; + position 21; + } + bit app3 { + description "External application 2"; + position 22; + } + /* Detail level: */ + bit detail { + description "Details: traces, parse trees, etc"; + position 24; + } + bit detail2 { + description "Extra details"; + position 25; + } + bit detail3 { + description "Probably more detail than you want"; + position 26; + } + } + } identity snmp { description "SNMP"; @@ -276,44 +384,27 @@ module clixon-lib { } } container datastores{ - list datastore{ - description "Per datastore statistics for cxobj"; - key "name"; - leaf name{ - description "Name of datastore (eg running)."; - type string; - } - leaf nr{ - description "Number of XML objects. That is number of residing xml/json objects + list datastore{ + description "Per datastore statistics for cxobj"; + key "name"; + leaf name{ + description "Name of datastore (eg running)."; + type string; + } + leaf nr{ + description "Number of XML objects. That is number of residing xml/json objects in the internal 'cxobj' representation."; - type uint64; + type uint64; + } + leaf size{ + description "Size in bytes of internal datastore cache of datastore tree."; + type uint64; + } } - leaf size{ - description "Size in bytes of internal datastore cache of datastore tree."; - type uint64; - } - } } container module-sets{ - list module-set{ - description "Statistics per group of module, eg top-level and mount-points"; - key "name"; - leaf name{ - description "Name of YANG module."; - type string; - } - leaf nr{ - description - "Total number of YANG objects in set"; - type uint64; - } - leaf size{ - description - "Total size in bytes of internal YANG object representation for module set"; - type uint64; - } - list module{ - description "Statistics per module (if modules set in input)"; + list module-set{ + description "Statistics per group of module, eg top-level and mount-points"; key "name"; leaf name{ description "Name of YANG module."; @@ -321,16 +412,33 @@ module clixon-lib { } leaf nr{ description - "Number of YANG objects. That is number of residing YANG objects"; + "Total number of YANG objects in set"; type uint64; } leaf size{ description - "Size in bytes of internal YANG object representation."; + "Total size in bytes of internal YANG object representation for module set"; type uint64; } + list module{ + description "Statistics per module (if modules set in input)"; + key "name"; + leaf name{ + description "Name of YANG module."; + type string; + } + leaf nr{ + description + "Number of YANG objects. That is number of residing YANG objects"; + type uint64; + } + leaf size{ + description + "Size in bytes of internal YANG object representation."; + type uint64; + } + } } - } } } }