Skip to content
Snippets Groups Projects
Verified Commit 503b72e0 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 48b45d54
Branches devel
No related tags found
1 merge request!34Add support for displaying the schema data model with '-d' option
Pipeline #206256 passed
......@@ -252,22 +252,26 @@ static void ethmngr_usage(char *prog)
fprintf(stderr, "\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " -l <log level> As per syslog, 0 to 7\n");
fprintf(stderr, " -d <schema dm> Display the schema data model supported by micro-service\n");
fprintf(stderr, " -h <help> To print this help menu\n");
fprintf(stderr, "\n");
}
int main(int argc, char **argv)
{
int ch;
int ch, dm_type = 0;
int log_level = 6; // default LOG_INFO
while ((ch = getopt(argc, argv, "hl:")) != -1) {
while ((ch = getopt(argc, argv, "hdl:")) != -1) {
switch (ch) {
case 'l':
log_level = (int)strtoul(optarg, NULL, 10);
if (log_level < 0 || log_level > 7)
log_level = 6;
break;
case 'd':
dm_type++;
break;
case 'h':
ethmngr_usage(argv[0]);
exit(0);
......@@ -276,13 +280,18 @@ int main(int argc, char **argv)
}
}
openlog("ethmngr", LOG_PID|LOG_CONS|LOG_NDELAY, LOG_LOCAL1);
memset(&bbfdm_ctx, 0, sizeof(struct bbfdm_context));
bbfdm_ubus_set_service_name(&bbfdm_ctx, "ethmngr");
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("ethmngr", LOG_PID|LOG_CONS|LOG_NDELAY, LOG_LOCAL1);
if (bbfdm_ubus_regiter_init(&bbfdm_ctx))
goto out;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment