mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Feature #11634: Replace core DM node using micro-services
This commit is contained in:
parent
ec7a3d9cc5
commit
bc4c5acc7e
14 changed files with 104 additions and 69 deletions
|
|
@ -83,7 +83,7 @@ static void usage(char *prog)
|
|||
|
||||
static void bbfdm_cleanup(struct bbfdm_context *u)
|
||||
{
|
||||
bbf_global_clean(DEAMON_DM_ROOT_OBJ);
|
||||
bbf_global_clean(DEAMON_DM_ROOT_OBJ, DEAMON_DM_VENDOR_EXTENSION, DEAMON_DM_VENDOR_EXTENSION_EXCLUDE, input_json ? false : true);
|
||||
|
||||
if (!input_json) { // It's not a micro-service instance
|
||||
free_path_list(&u->instances);
|
||||
|
|
@ -268,6 +268,7 @@ static bool is_object_schema_update_available(struct bbfdm_context *u)
|
|||
.bbf_ctx.iscommand = true,
|
||||
.bbf_ctx.isevent = true,
|
||||
.bbf_ctx.isinfo = true,
|
||||
.bbf_ctx.enable_plugins = input_json ? false : true,
|
||||
.bbf_ctx.dm_type = BBFDM_USP
|
||||
};
|
||||
|
||||
|
|
@ -1490,6 +1491,8 @@ int main(int argc, char **argv)
|
|||
|
||||
if (!input_json) { // It's not a micro-service instance
|
||||
|
||||
bbf_global_init(DEAMON_DM_ROOT_OBJ, DEAMON_DM_VENDOR_EXTENSION, DEAMON_DM_VENDOR_EXTENSION_EXCLUDE, true);
|
||||
|
||||
err = bbfdm_init(&bbfdm_ctx.ubus_ctx);
|
||||
if (err != UBUS_STATUS_OK)
|
||||
goto exit;
|
||||
|
|
|
|||
|
|
@ -645,6 +645,8 @@ static int cli_exec_command(cli_data_t *cli_data, int argc, char *argv[])
|
|||
goto end;
|
||||
}
|
||||
|
||||
bbf_global_init(CLI_DM_ROOT_OBJ, CLI_DM_VENDOR_EXTENSION, CLI_DM_VENDOR_EXTENSION_EXCLUDE, input_json ? false : true);
|
||||
|
||||
bbf_ctx_init(&cli_data->bbf_ctx, CLI_DM_ROOT_OBJ, CLI_DM_VENDOR_EXTENSION, CLI_DM_VENDOR_EXTENSION_EXCLUDE);
|
||||
|
||||
cli_data->bbf_ctx.dm_type = cli_data->proto;
|
||||
|
|
@ -682,13 +684,13 @@ end:
|
|||
if (strcasecmp(cli_data->in_type, "DotSO") == 0) {
|
||||
if (CLI_DM_ROOT_OBJ) {
|
||||
bbf_ctx_clean(&cli_data->bbf_ctx);
|
||||
bbf_global_clean(CLI_DM_ROOT_OBJ);
|
||||
bbf_global_clean(CLI_DM_ROOT_OBJ, CLI_DM_VENDOR_EXTENSION, CLI_DM_VENDOR_EXTENSION_EXCLUDE, input_json ? false : true);
|
||||
}
|
||||
free_dotso_plugin(cli_lib_handle);
|
||||
} else if (strcasecmp(cli_data->in_type, "JSON") == 0) {
|
||||
if (CLI_DM_ROOT_OBJ) {
|
||||
bbf_ctx_clean(&cli_data->bbf_ctx);
|
||||
bbf_global_clean(CLI_DM_ROOT_OBJ);
|
||||
bbf_global_clean(CLI_DM_ROOT_OBJ, CLI_DM_VENDOR_EXTENSION, CLI_DM_VENDOR_EXTENSION_EXCLUDE, input_json ? false : true);
|
||||
}
|
||||
free_json_plugin();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ int bbf_entry_method(struct dmctx *ctx, int cmd)
|
|||
return bbf_fault_map(ctx, FAULT_9005);
|
||||
}
|
||||
|
||||
load_plugins(ctx);
|
||||
load_plugins(ctx->dm_entryobj, ctx->dm_vendor_extension, ctx->dm_vendor_extension_exclude, ctx->enable_plugins);
|
||||
|
||||
dmentry_instance_lookup_inparam(ctx);
|
||||
|
||||
|
|
@ -259,9 +259,14 @@ int bbf_entry_method(struct dmctx *ctx, int cmd)
|
|||
return bbf_fault_map(ctx, fault);
|
||||
}
|
||||
|
||||
void bbf_global_clean(DMOBJ *dm_entryobj)
|
||||
void bbf_global_init(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins)
|
||||
{
|
||||
free_plugins(dm_entryobj);
|
||||
load_plugins(dm_entryobj, dm_VendorExtension, dm_VendorExtensionExclude, enable_plugins);
|
||||
}
|
||||
|
||||
void bbf_global_clean(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins)
|
||||
{
|
||||
free_plugins(dm_entryobj, dm_VendorExtension, dm_VendorExtensionExclude, enable_plugins);
|
||||
dm_dynamic_cleanmem(&global_memhead);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ int bbf_fault_map(struct dmctx *ctx, int fault);
|
|||
|
||||
int bbf_entry_method(struct dmctx *ctx, int cmd);
|
||||
|
||||
void bbf_global_clean(DMOBJ *dm_entryobj);
|
||||
void bbf_global_init(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins);
|
||||
void bbf_global_clean(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins);
|
||||
|
||||
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]);
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,21 @@ static bool check_stats_folder(bool json_path)
|
|||
#endif /* (BBFDM_ENABLE_JSON_PLUGIN || BBFDM_ENABLE_DOTSO_PLUGIN) */
|
||||
|
||||
|
||||
static void disable_srv_obj(DMOBJ *entryobj, char *srv_parent_dm, char *srv_obj)
|
||||
{
|
||||
DMOBJ *dm_entryobj = NULL;
|
||||
char obj_path[1024];
|
||||
|
||||
if (!entryobj || !srv_parent_dm || !srv_obj)
|
||||
return;
|
||||
|
||||
snprintf(obj_path, sizeof(obj_path), "%s%s.", srv_parent_dm, srv_obj);
|
||||
|
||||
bool obj_exists = find_entry_obj(entryobj, obj_path, &dm_entryobj);
|
||||
if (obj_exists == true && dm_entryobj)
|
||||
dm_entryobj->bbfdm_type = BBFDM_NONE;
|
||||
}
|
||||
|
||||
static bool add_service_to_main_tree(DMOBJ *main_dm, char *srv_name, char *srv_parent_dm, char *srv_obj)
|
||||
{
|
||||
DMOBJ *dm_entryobj = NULL;
|
||||
|
|
@ -126,6 +141,9 @@ static bool add_service_to_main_tree(DMOBJ *main_dm, char *srv_name, char *srv_p
|
|||
if (obj_exists == false || !dm_entryobj)
|
||||
return false;
|
||||
|
||||
// Disable service object if it already exists in the main tree
|
||||
disable_srv_obj(main_dm, srv_parent_dm, srv_obj);
|
||||
|
||||
if (dm_entryobj->nextdynamicobj == NULL) {
|
||||
dm_entryobj->nextdynamicobj = calloc(__INDX_DYNAMIC_MAX, sizeof(struct dm_dynamic_obj));
|
||||
dm_entryobj->nextdynamicobj[INDX_JSON_MOUNT].idx_type = INDX_JSON_MOUNT;
|
||||
|
|
@ -404,48 +422,50 @@ int get_leaf_idx(DMLEAF **entryleaf)
|
|||
return idx;
|
||||
}
|
||||
|
||||
void load_plugins(struct dmctx *ctx)
|
||||
void load_plugins(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins)
|
||||
{
|
||||
if (ctx->enable_plugins) {
|
||||
if (enable_plugins) {
|
||||
#ifdef BBFDM_ENABLE_JSON_PLUGIN
|
||||
// Load dynamic objects and parameters exposed via JSON file plugin
|
||||
if (check_stats_folder(true)) {
|
||||
free_json_plugins();
|
||||
free_specific_dynamic_node(ctx->dm_entryobj, INDX_JSON_MOUNT);
|
||||
load_json_plugins(ctx);
|
||||
}
|
||||
// Load dynamic objects and parameters exposed via JSON file plugin
|
||||
if (check_stats_folder(true)) {
|
||||
free_json_plugins();
|
||||
free_specific_dynamic_node(dm_entryobj, INDX_JSON_MOUNT);
|
||||
load_json_plugins(dm_entryobj);
|
||||
}
|
||||
#endif /* BBFDM_ENABLE_JSON_PLUGIN */
|
||||
|
||||
#ifdef BBFDM_ENABLE_DOTSO_PLUGIN
|
||||
// Load dynamic objects and parameters exposed via a dotso plugin
|
||||
if (check_stats_folder(false)) {
|
||||
free_dotso_plugins();
|
||||
free_specific_dynamic_node(ctx->dm_entryobj, INDX_LIBRARY_MOUNT);
|
||||
load_dotso_plugins(ctx);
|
||||
}
|
||||
// Load dynamic objects and parameters exposed via a dotso plugin
|
||||
if (check_stats_folder(false)) {
|
||||
free_dotso_plugins();
|
||||
free_specific_dynamic_node(dm_entryobj, INDX_LIBRARY_MOUNT);
|
||||
load_dotso_plugins(dm_entryobj);
|
||||
}
|
||||
#endif /* BBFDM_ENABLE_DOTSO_PLUGIN */
|
||||
|
||||
#ifdef BBF_VENDOR_EXTENSION
|
||||
// Load objects and parameters exposed via vendor extension plugin
|
||||
if (first_boot == false) {
|
||||
free_specific_dynamic_node(ctx->dm_entryobj, INDX_VENDOR_MOUNT);
|
||||
load_vendor_dynamic_arrays(ctx);
|
||||
}
|
||||
// Load objects and parameters exposed via vendor extension plugin
|
||||
if (first_boot == false) {
|
||||
free_specific_dynamic_node(dm_entryobj, INDX_VENDOR_MOUNT);
|
||||
load_vendor_dynamic_arrays(dm_entryobj, dm_VendorExtension, dm_VendorExtensionExclude);
|
||||
}
|
||||
#endif /* BBF_VENDOR_EXTENSION */
|
||||
}
|
||||
|
||||
first_boot = true;
|
||||
}
|
||||
|
||||
void free_plugins(DMOBJ *dm_entryobj)
|
||||
void free_plugins(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins)
|
||||
{
|
||||
free_all_dynamic_nodes(dm_entryobj);
|
||||
|
||||
if (enable_plugins) {
|
||||
#ifdef BBFDM_ENABLE_JSON_PLUGIN
|
||||
free_json_plugins();
|
||||
free_json_plugins();
|
||||
#endif /* BBFDM_ENABLE_JSON_PLUGIN */
|
||||
|
||||
#ifdef BBFDM_ENABLE_DOTSO_PLUGIN
|
||||
free_dotso_plugins();
|
||||
free_dotso_plugins();
|
||||
#endif /* BBFDM_ENABLE_DOTSO_PLUGIN */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ int get_entry_idx(DMOBJ *entryobj);
|
|||
int get_obj_idx(DMOBJ **entryobj);
|
||||
int get_leaf_idx(DMLEAF **entryleaf);
|
||||
|
||||
void load_plugins(struct dmctx *ctx);
|
||||
void free_plugins(DMOBJ *dm_entryobj);
|
||||
void load_plugins(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins);
|
||||
void free_plugins(DMOBJ *dm_entryobj, DM_MAP_VENDOR *dm_VendorExtension[], DM_MAP_VENDOR_EXCLUDE *dm_VendorExtensionExclude, bool enable_plugins);
|
||||
|
||||
#endif //__DMPLUGIN_H__
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static void free_all_list_open_library(struct list_head *library_list)
|
|||
}
|
||||
}
|
||||
|
||||
int load_dotso_plugins(struct dmctx *ctx)
|
||||
int load_dotso_plugins(DMOBJ *entryobj)
|
||||
{
|
||||
struct dirent *ent = NULL;
|
||||
DIR *dir = NULL;
|
||||
|
|
@ -70,7 +70,7 @@ int load_dotso_plugins(struct dmctx *ctx)
|
|||
for (int i = 0; dynamic_obj[i].path; i++) {
|
||||
|
||||
DMOBJ *dm_entryobj = NULL;
|
||||
bool obj_exists = find_entry_obj(ctx->dm_entryobj, dynamic_obj[i].path, &dm_entryobj);
|
||||
bool obj_exists = find_entry_obj(entryobj, dynamic_obj[i].path, &dm_entryobj);
|
||||
if (obj_exists == false || !dm_entryobj)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#define LIBRARY_FOLDER_PATH "/usr/lib/bbfdm"
|
||||
|
||||
int load_dotso_plugins(struct dmctx *ctx);
|
||||
int load_dotso_plugins(DMOBJ *entryobj);
|
||||
int free_dotso_plugins(void);
|
||||
|
||||
#endif //__DOTSO_PLUGIN_H__
|
||||
|
|
|
|||
|
|
@ -1882,7 +1882,7 @@ void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, int json
|
|||
FREE(full_obj);
|
||||
}
|
||||
|
||||
int load_json_plugins(struct dmctx *ctx)
|
||||
int load_json_plugins(DMOBJ *entryobj)
|
||||
{
|
||||
struct dirent *ent = NULL;
|
||||
DIR *dir = NULL;
|
||||
|
|
@ -1916,7 +1916,7 @@ int load_json_plugins(struct dmctx *ctx)
|
|||
char *obj_path = replace_str(key, "{BBF_VENDOR_PREFIX}", BBF_VENDOR_PREFIX);
|
||||
find_prefix_obj(obj_path, obj_prefix, MAX_DM_LENGTH);
|
||||
|
||||
bool obj_exists = find_entry_obj(ctx->dm_entryobj, obj_prefix, &dm_entryobj);
|
||||
bool obj_exists = find_entry_obj(entryobj, obj_prefix, &dm_entryobj);
|
||||
if (obj_exists == 0 || !dm_entryobj) {
|
||||
FREE(obj_path);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ void save_loaded_json_files(struct list_head *json_list, json_object *data);
|
|||
void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, int json_version, struct list_head *list);
|
||||
void find_prefix_obj(char *full_obj, char *prefix_obj, size_t len);
|
||||
|
||||
int load_json_plugins(struct dmctx *ctx);
|
||||
int load_json_plugins(DMOBJ *entryobj);
|
||||
int free_json_plugins(void);
|
||||
|
||||
#endif //__DMENTRYJSON_H__
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ static void overwrite_obj(DMOBJ *entryobj, DMOBJ *dmobj)
|
|||
}
|
||||
}
|
||||
|
||||
static void load_vendor_extension_arrays(struct dmctx *ctx)
|
||||
static void load_vendor_extension_arrays(DMOBJ *entryobj, DM_MAP_VENDOR *vendor_map_obj)
|
||||
{
|
||||
char vendor_list[512] = {0};
|
||||
size_t length = 0;
|
||||
|
|
@ -76,8 +76,6 @@ static void load_vendor_extension_arrays(struct dmctx *ctx)
|
|||
|
||||
for (int idx = length - 1; idx >= 0; idx--) {
|
||||
|
||||
DM_MAP_VENDOR *vendor_map_obj = ctx->dm_vendor_extension[0];
|
||||
|
||||
for (int j = 0; vendor_map_obj && vendor_map_obj[j].vendor; j++) {
|
||||
|
||||
if (DM_STRCMP(vendor_map_obj[j].vendor, tokens[idx]) != 0)
|
||||
|
|
@ -88,7 +86,7 @@ static void load_vendor_extension_arrays(struct dmctx *ctx)
|
|||
for (int i = 0; vendor_obj[i].path; i++) {
|
||||
|
||||
DMOBJ *dm_entryobj = NULL;
|
||||
bool obj_exists = find_entry_obj(ctx->dm_entryobj, vendor_obj[i].path, &dm_entryobj);
|
||||
bool obj_exists = find_entry_obj(entryobj, vendor_obj[i].path, &dm_entryobj);
|
||||
if (obj_exists == false || !dm_entryobj)
|
||||
continue;
|
||||
|
||||
|
|
@ -139,7 +137,7 @@ static void load_vendor_extension_arrays(struct dmctx *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void load_vendor_extension_overwrite_arrays(struct dmctx *ctx)
|
||||
static void load_vendor_extension_overwrite_arrays(DMOBJ *entryobj, DM_MAP_VENDOR *vendor_map_obj)
|
||||
{
|
||||
char vendor_list[512] = {0};
|
||||
size_t length = 0;
|
||||
|
|
@ -149,8 +147,6 @@ static void load_vendor_extension_overwrite_arrays(struct dmctx *ctx)
|
|||
|
||||
for (int idx = length - 1; idx >= 0; idx--) {
|
||||
|
||||
DM_MAP_VENDOR *vendor_map_obj = ctx->dm_vendor_extension[1];
|
||||
|
||||
for (int j = 0; vendor_map_obj && vendor_map_obj[j].vendor; j++) {
|
||||
|
||||
if (DM_STRCMP(vendor_map_obj[j].vendor, tokens[idx]) != 0)
|
||||
|
|
@ -161,7 +157,7 @@ static void load_vendor_extension_overwrite_arrays(struct dmctx *ctx)
|
|||
|
||||
for (int i = 0; dynamic_overwrite_obj[i].path; i++) {
|
||||
|
||||
bool obj_exists = find_entry_obj(ctx->dm_entryobj, dynamic_overwrite_obj[i].path, &dm_entryobj);
|
||||
bool obj_exists = find_entry_obj(entryobj, dynamic_overwrite_obj[i].path, &dm_entryobj);
|
||||
if (obj_exists == false || !dm_entryobj)
|
||||
continue;
|
||||
|
||||
|
|
@ -187,16 +183,16 @@ static void load_vendor_extension_overwrite_arrays(struct dmctx *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void exclude_obj(struct dmctx *ctx, char *in_obj)
|
||||
static void exclude_obj(DMOBJ *dm_entryobj, char *in_obj)
|
||||
{
|
||||
DMNODE node = {.current_object = ""};
|
||||
|
||||
char *obj_path = replace_str(in_obj, ".{i}.", ".");
|
||||
dm_exclude_obj(ctx->dm_entryobj, &node, obj_path);
|
||||
dm_exclude_obj(dm_entryobj, &node, obj_path);
|
||||
FREE(obj_path);
|
||||
}
|
||||
|
||||
static void exclude_param(struct dmctx *ctx, char *in_param)
|
||||
static void exclude_param(DMOBJ *dm_entryobj, char *in_param)
|
||||
{
|
||||
DMOBJ *entryobj = NULL;
|
||||
char obj_prefix[256] = {'\0'};
|
||||
|
|
@ -208,29 +204,28 @@ static void exclude_param(struct dmctx *ctx, char *in_param)
|
|||
if (ret)
|
||||
DM_STRNCPY(obj_prefix, in_param, ret - in_param + 2);
|
||||
|
||||
bool obj_exists = find_entry_obj(ctx->dm_entryobj, obj_prefix, &entryobj);
|
||||
bool obj_exists = find_entry_obj(dm_entryobj, obj_prefix, &entryobj);
|
||||
|
||||
if (entryobj && obj_exists == true) {
|
||||
DMLEAF *leaf = entryobj->leaf;
|
||||
|
||||
for (; (leaf && leaf->parameter); leaf++) {
|
||||
|
||||
char *full_param;
|
||||
char param[1024];
|
||||
|
||||
dmastrcat(&full_param, obj_prefix, leaf->parameter);
|
||||
if (strcmp(full_param, in_param) == 0) {
|
||||
snprintf(param, sizeof(param), obj_prefix, leaf->parameter);
|
||||
|
||||
if (strcmp(param, in_param) == 0) {
|
||||
leaf->bbfdm_type = BBFDM_NONE;
|
||||
dmfree(full_param);
|
||||
return;
|
||||
}
|
||||
|
||||
dmfree(full_param);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void load_vendor_extension_exclude_arrays(struct dmctx *ctx)
|
||||
static void load_vendor_extension_exclude_arrays(DMOBJ *entryobj, DM_MAP_VENDOR_EXCLUDE *vendor_map_exclude_obj)
|
||||
{
|
||||
char vendor_list[512] = {0};
|
||||
size_t length = 0;
|
||||
|
|
@ -240,8 +235,6 @@ static void load_vendor_extension_exclude_arrays(struct dmctx *ctx)
|
|||
|
||||
for (int idx = length - 1; idx >= 0; idx--) {
|
||||
|
||||
DM_MAP_VENDOR_EXCLUDE *vendor_map_exclude_obj = ctx->dm_vendor_extension_exclude;
|
||||
|
||||
for (int j = 0; vendor_map_exclude_obj && vendor_map_exclude_obj[j].vendor; j++) {
|
||||
|
||||
if (DM_STRCMP(vendor_map_exclude_obj[j].vendor, tokens[idx]) != 0)
|
||||
|
|
@ -252,9 +245,9 @@ static void load_vendor_extension_exclude_arrays(struct dmctx *ctx)
|
|||
for (; *dynamic_exclude_obj; dynamic_exclude_obj++) {
|
||||
|
||||
if ((*dynamic_exclude_obj)[DM_STRLEN(*dynamic_exclude_obj) - 1] == '.')
|
||||
exclude_obj(ctx, *dynamic_exclude_obj);
|
||||
exclude_obj(entryobj, *dynamic_exclude_obj);
|
||||
else
|
||||
exclude_param(ctx, *dynamic_exclude_obj);
|
||||
exclude_param(entryobj, *dynamic_exclude_obj);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -263,9 +256,9 @@ static void load_vendor_extension_exclude_arrays(struct dmctx *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
void load_vendor_dynamic_arrays(struct dmctx *ctx)
|
||||
void load_vendor_dynamic_arrays(DMOBJ *entryobj, DM_MAP_VENDOR *VendorExtension[], DM_MAP_VENDOR_EXCLUDE *VendorExtensionExclude)
|
||||
{
|
||||
load_vendor_extension_arrays(ctx);
|
||||
load_vendor_extension_overwrite_arrays(ctx);
|
||||
load_vendor_extension_exclude_arrays(ctx);
|
||||
load_vendor_extension_arrays(entryobj, VendorExtension[0]);
|
||||
load_vendor_extension_overwrite_arrays(entryobj, VendorExtension[1]);
|
||||
load_vendor_extension_exclude_arrays(entryobj, VendorExtensionExclude);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@
|
|||
|
||||
#include "../dmcommon.h"
|
||||
|
||||
void load_vendor_dynamic_arrays(struct dmctx *ctx);
|
||||
void load_vendor_dynamic_arrays(DMOBJ *entryobj, DM_MAP_VENDOR *VendorExtension[], DM_MAP_VENDOR_EXCLUDE *VendorExtensionExclude);
|
||||
|
||||
#endif //__VENDOR_PLUGIN_H__
|
||||
|
|
|
|||
|
|
@ -44,12 +44,17 @@ static int teardown_commit(void **state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int group_teardown(void **state)
|
||||
static int group_init(void **state)
|
||||
{
|
||||
bbf_global_clean(TR181_ROOT_TREE);
|
||||
bbf_global_init(TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int group_teardown(void **state)
|
||||
{
|
||||
bbf_global_clean(TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void validate_parameter(struct dmctx *ctx, const char *name, const char *value, const char *type)
|
||||
{
|
||||
|
|
@ -1634,7 +1639,7 @@ int main(void)
|
|||
cmocka_unit_test_setup_teardown(test_api_bbfdm_valid_json_v1_event, setup, teardown_commit),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, group_teardown);
|
||||
return cmocka_run_group_tests(tests, group_init, group_teardown);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,15 @@ static int teardown_revert(void **state)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int group_init(void **state)
|
||||
{
|
||||
bbf_global_init(TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int group_teardown(void **state)
|
||||
{
|
||||
bbf_global_clean(TR181_ROOT_TREE);
|
||||
bbf_global_clean(TR181_ROOT_TREE, TR181_VENDOR_EXTENSION, TR181_VENDOR_EXTENSION_EXCLUDE, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -855,5 +861,5 @@ int main(void)
|
|||
cmocka_unit_test_setup_teardown(test_api_bbfdm_library_delete_object, setup, teardown_commit),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, group_teardown);
|
||||
return cmocka_run_group_tests(tests, group_init, group_teardown);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue