Skip to content
Snippets Groups Projects
Verified Commit c6bac710 authored by Amin Ben Romdhane's avatar Amin Ben Romdhane Committed by IOPSYS Dev
Browse files

Add support for displaying the schema data model with '-d' option

parent 65e37b4b
Branches
No related tags found
1 merge request!33Add support for displaying the schema data model with '-d' option
Pipeline #206148 passed
......@@ -42,7 +42,8 @@ static void usage(char *prog)
fprintf(stderr, "\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " -l <0-7> Set the loglevel\n");
fprintf(stderr, " -h Displays this help\n");
fprintf(stderr, " -d Display the schema data model supported by micro-service\n");
fprintf(stderr, " -h Display this help\n");
fprintf(stderr, "\n");
}
......@@ -73,9 +74,9 @@ int main(int argc, char **argv)
.cb = config_reload_cb,
};
int log_level = DEFAULT_LOG_LEVEL;
int c = 0;
int c = 0, dm_type = 0;
while ((c = getopt(argc, argv, "hl:")) != -1) {
while ((c = getopt(argc, argv, "hdl:")) != -1) {
switch (c) {
case 'l':
log_level = (int)strtod(optarg, NULL);
......@@ -83,6 +84,9 @@ int main(int argc, char **argv)
log_level = DEFAULT_LOG_LEVEL;
}
break;
case 'd':
dm_type++;
break;
case 'h':
usage(argv[0]);
return EXIT_SUCCESS;
......@@ -98,6 +102,11 @@ int main(int argc, char **argv)
bbfdm_ubus_set_log_level(log_level);
bbfdm_ubus_load_data_model(tDynamicObj);
if (dm_type > 0) {
int res = bbfdm_print_data_model_schema(&bbfdm_ctx, dm_type);
exit(res);
}
openlog("sysmngr", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
#ifdef SYSMNGR_REBOOTS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment