Clixon SNMP frontend

Added two new config options to clixon-config.yang: `CLICON_HTTP_DATA_ROOT`
Added new files: apps/snmp/snmp_mib_yang.[ch] for generic MIB/YANG handling
Test: killall quiet
Test: added specific MIB for generic code: <CLICON_SNMP_MIB>NET-SNMP-EXAMPLES-MIB</CLICON_SNMP_MIB>
This commit is contained in:
Olof hagsand 2022-05-04 15:03:08 +02:00
parent 80651503fd
commit 3dbfbf5b31
12 changed files with 561 additions and 243 deletions

View file

@ -133,7 +133,7 @@ static const map_str2int yang_regexp_map[] = {
* @param[in] dbglevel Debug level
* @retval 0 OK
* @retval -1 Error
* @note CLICON_FEATURE and CLICON_YANG_DIR are treated specially since they are lists
* @note CLICON_FEATURE, CLICON_YANG_DIR and CLICON_SNMP_MIB are treated specially since they are lists
*/
int
clicon_option_dump(clicon_handle h,
@ -161,7 +161,7 @@ clicon_option_dump(clicon_handle h,
else
clicon_debug(dbglevel, "%s = NULL", keys[i]);
}
/* Next print CLICON_FEATURE and CLICON_YANG_DIR from config tree
/* Next print CLICON_FEATURE, CLICON_YANG_DIR and CLICON_SNMP_DIR from config tree
* Since they are lists they are placed in the config tree.
*/
x = NULL;
@ -176,6 +176,12 @@ clicon_option_dump(clicon_handle h,
continue;
clicon_debug(dbglevel, "%s =\t \"%s\"", xml_name(x), xml_body(x));
}
x = NULL;
while ((x = xml_child_each(clicon_conf_xml(h), x, CX_ELMNT)) != NULL) {
if (strcmp(xml_name(x), "CLICON_SNMP_MIB") != 0)
continue;
clicon_debug(dbglevel, "%s =\t \"%s\"", xml_name(x), xml_body(x));
}
retval = 0;
done:
if (keys)
@ -333,7 +339,8 @@ parse_configfile(clicon_handle h,
continue;
/* List options for configure options that are lists or leaf-lists: append to main */
if (strcmp(name,"CLICON_FEATURE")==0 ||
strcmp(name,"CLICON_YANG_DIR")==0){
strcmp(name,"CLICON_YANG_DIR")==0 ||
strcmp(name,"CLICON_SNMP_MIB")==0){
if (xml_addsub(xt, xec) < 0)
goto done;
continue;
@ -381,6 +388,8 @@ parse_configfile(clicon_handle h,
continue;
if (strcmp(name,"CLICON_YANG_DIR")==0)
continue;
if (strcmp(name,"CLICON_SNMP_MIB")==0)
continue;
if (clicon_hash_add(copt,
name,
body,
@ -424,7 +433,8 @@ clicon_option_add(clicon_handle h,
cxobj *x;
if (strcmp(name, "CLICON_FEATURE")==0 ||
strcmp(name, "CLICON_YANG_DIR")==0){
strcmp(name, "CLICON_YANG_DIR")==0 ||
strcmp(name, "CLICON_SNMP_MIB")==0){
if ((x = clicon_conf_xml(h)) == NULL){
clicon_err(OE_UNIX, ENOENT, "option %s not found (clicon_conf_xml_set has not been called?)", name);
goto done;

View file

@ -1350,7 +1350,7 @@ yang_find_prefix_by_namespace(yang_stmt *ys,
goto done;
}
/*! Given a yang statement and local prefi valid in module , find namespace
/*! Given a yang statement and local prefix valid in module, find namespace
*
* @param[in] ys Yang statement in module tree (or module itself)
* @param[in] prefix Local prefix to access module with (direct pointer)
@ -3757,7 +3757,7 @@ yang_anydata_add(yang_stmt *yp,
/*! Find extension argument and return if extension exists and its argument value
*
* @param[in] ys Yang statement where unknown statement may occur referncing to extension
* @param[in] ys Yang statement where unknown statement may occur referencing to extension
* @param[in] name Name of the extension
* @param[in] ns The namespace of the module where the extension is defined
* @param[out] exist The extension exists.
@ -3774,7 +3774,7 @@ yang_anydata_add(yang_stmt *yp,
* // use extension value
* }
* @endcode
* @see ys_populate_unknown Called when parsing YANGo
* @see ys_populate_unknown Called when parsing YANG
*/
int
yang_extension_value(yang_stmt *ys,