Ticket refs #1365: TR-157: Device.SoftwareModules. object

This commit is contained in:
Amin Ben Ramdhane 2019-12-07 13:29:43 +01:00
parent 1e11720828
commit fd60013d1a
11 changed files with 1490 additions and 318 deletions

View file

@ -22,7 +22,6 @@ libbbfdm_la_SOURCES += \
../dmtree/tr181/device.c \
../dmtree/tr181/deviceinfo.c \
../dmtree/tr181/managementserver.c \
../dmtree/tr181/softwaremodules.c \
../dmtree/tr181/times.c \
../dmtree/tr181/upnp.c \
../dmtree/tr181/x_iopsys_eu_ice.c \
@ -73,7 +72,8 @@ endif
if BBF_TR157
libbbfdm_la_SOURCES += \
../dmtree/tr157/bulkdata.c
../dmtree/tr157/bulkdata.c \
../dmtree/tr157/softwaremodules.c
endif
if BBF_TR064

View file

@ -1444,7 +1444,6 @@ int is_section_unnamed(char *section_name)
return 1;
}
void add_dmmap_list_section(struct list_head *dup_list, char* section_name, char* instance)
{
struct dmmap_sect *dmsect;

View file

@ -54,6 +54,11 @@ char *__dmjson_get_value_array_all(json_object *mainjobj, char *delim, int argc,
#define dmjson_get_value_array_all(MAINJOBJ,DELIM,ARGC,args...) \
__dmjson_get_value_array_all(MAINJOBJ, DELIM, ARGC, ##args);
#define dmjson_foreach_obj_in_array(MAINJOBJ,ARROBJ,OBJ,INDEX,ARGC,args...) \
for (INDEX = 0, ARROBJ = NULL, OBJ = __dmjson_select_obj_in_array_idx(MAINJOBJ, &(ARROBJ), INDEX, ARGC, ##args);\
OBJ; \
OBJ = __dmjson_select_obj_in_array_idx(MAINJOBJ, &(ARROBJ), ++INDEX, 0))
#define dmjson_foreach_value_in_array(MAINJOBJ,ARROBJ,VAL,INDEX,ARGC,args...) \
for (INDEX = 0, ARROBJ = NULL, VAL = __dmjson_get_value_in_array_idx(MAINJOBJ, &(ARROBJ), NULL, INDEX, ARGC, ##args);\
VAL; \

View file

@ -125,7 +125,7 @@ const char *file, const char *func, int line,
char **s, const char *format, ...
)
{
char buf[512];
char buf[2048];
va_list arg;
int ret;
va_start(arg,format);
@ -148,7 +148,7 @@ const char *file, const char *func, int line,
char **s, char *obj, char *lastname
)
{
char buf[512];
char buf[2048];
int olen = strlen(obj);
memcpy(buf, obj, olen);
int llen = strlen(lastname) + 1;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,103 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2019 iopsys Software Solutions AB
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#ifndef __SOFTWAREMODULES_H
#define __SOFTWAREMODULES_H
extern DMOBJ tSoftwareModulesObj[];
extern DMLEAF tSoftwareModulesParams[];
extern DMLEAF tSoftwareModulesExecEnvParams[];
extern DMLEAF tSoftwareModulesDeploymentUnitParams[];
extern DMOBJ tSoftwareModulesExecutionUnitObj[];
extern DMLEAF tSoftwareModulesExecutionUnitParams[];
int browseSoftwareModulesExecEnvInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseSoftwareModulesDeploymentUnitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int browseSoftwareModulesExecutionUnitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_SoftwareModules_ExecEnvNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModules_DeploymentUnitNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModules_ExecutionUnitNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecEnv_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecEnv_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecEnv_Reset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecEnv_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecEnv_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecEnv_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_Type(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_InitialRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecEnv_InitialRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecEnv_RequestedRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecEnv_RequestedRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecEnv_CurrentRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_InitialExecutionUnitRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecEnv_InitialExecutionUnitRunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecEnv_Vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_Version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_ParentExecEnv(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_AllocatedDiskSpace(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_AvailableDiskSpace(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_AllocatedMemory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_AvailableMemory(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_ActiveExecutionUnits(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecEnv_ProcessorRefList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_UUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_DUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesDeploymentUnit_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesDeploymentUnit_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_Resolved(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_Description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_Vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_Version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_VendorLogList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_VendorConfigList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_ExecutionUnitList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesDeploymentUnit_ExecutionEnvRef(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_EUID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecutionUnit_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecutionUnit_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_ExecEnvLabel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_RequestedState(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecutionUnit_RequestedState(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecutionUnit_ExecutionFaultCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_ExecutionFaultMessage(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_AutoStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecutionUnit_AutoStart(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecutionUnit_RunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_SoftwareModulesExecutionUnit_RunLevel(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_SoftwareModulesExecutionUnit_Vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_Version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_Description(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_DiskSpaceInUse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_MemoryInUse(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_References(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_AssociatedProcessList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_VendorLogList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_VendorConfigList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_SupportedDataModelList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_SoftwareModulesExecutionUnit_ExecutionEnvRef(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_exe_cenv_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int get_du_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
char *get_deployment_unit_reference(struct dmctx *ctx, char *package_name, char *package_env);
void get_deployment_unit_name_version(char *uuid, char **name, char **version, char **env);
char *get_softwaremodules_uuid(char *url);
char *get_softwaremodules_url(char *uuid);
#endif //__SOFTWAREMODULES_H

View file

@ -23,7 +23,6 @@
#include "x_iopsys_eu_logincfg.h"
#include "x_iopsys_eu_power_mgmt.h"
#include "x_iopsys_eu_syslog.h"
#include "softwaremodules.h"
#include "xmpp.h"
#include "x_iopsys_eu_owsd.h"
#include "x_iopsys_eu_dropbear.h"
@ -57,6 +56,7 @@
#endif
#ifdef BBF_TR157
#include "bulkdata.h"
#include "softwaremodules.h"
#endif
/* *** BBFDM *** */
@ -88,7 +88,6 @@ DMOBJ tRoot_181_Obj[] = {
{CUSTOM_PREFIX"LoginCfg", &DMREAD, NULL, NULL, NULL, NULL,NULL, &DMNONE, NULL, NULL, tSe_LoginCfgParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"PowerManagement", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tSe_PowerManagementParam, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"SyslogCfg", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, NULL, tSe_SyslogCfgParam, NULL, BBFDM_BOTH},
{"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, tSoftwareModulesObj, NULL, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"Owsd", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, XIopsysEuOwsdObj, XIopsysEuOwsdParams, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"Dropbear", &DMWRITE, add_dropbear_instance, delete_dropbear_instance, NULL, browseXIopsysEuDropbear, NULL, &DMNONE, NULL, NULL, X_IOPSYS_EU_DropbearParams, NULL, BBFDM_BOTH},
{CUSTOM_PREFIX"Buttons", &DMREAD, NULL, NULL, NULL, browseXIopsysEuButton, NULL, &DMNONE, NULL, NULL, X_IOPSYS_EU_ButtonParams, NULL, BBFDM_BOTH},
@ -118,6 +117,7 @@ DMOBJ tRoot_181_Obj[] = {
{"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tXMPPObj, tXMPPParams, NULL, BBFDM_BOTH},
#ifdef BBF_TR157
{"BulkData", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataObj, tBulkDataParams, NULL, BBFDM_BOTH},
{"SoftwareModules", &DMREAD, NULL, NULL, NULL, NULL, NULL, &DMNONE, NULL, tSoftwareModulesObj, tSoftwareModulesParams, NULL, BBFDM_BOTH},
#endif
{0}
};

View file

@ -1,244 +0,0 @@
/*
* Copyright (C) 2019 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#include <ctype.h>
#include <uci.h>
#include <stdio.h>
#include "dmbbf.h"
#include "dmuci.h"
#include "dmubus.h"
#include "dmcommon.h"
#include "softwaremodules.h"
/* *** Device.SoftwareModules. *** */
DMOBJ tSoftwareModulesObj[] = {
/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextjsonobj, nextobj, leaf, linker, bbfdm_type*/
{"DeploymentUnit", &DMREAD, NULL, NULL, NULL, browsesoftwaremodules_deploymentunitInst, NULL, NULL, NULL, NULL, tSoftwareModulesDeploymentUnitParams, NULL, BBFDM_BOTH},
{0}
};
/* *** Device.SoftwareModules.DeploymentUnit.{i}. *** */
DMLEAF tSoftwareModulesDeploymentUnitParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
{"UUID", &DMREAD, DMT_STRING, get_deploymentunit_uuid, NULL, NULL, NULL, BBFDM_BOTH},
{"Name", &DMREAD, DMT_STRING, get_deploymentunit_name, NULL, NULL, NULL, BBFDM_BOTH},
{"Resolved", &DMREAD, DMT_BOOL, get_deploymentunit_resolved, NULL, NULL, NULL, BBFDM_BOTH},
{"URL", &DMREAD, DMT_STRING, get_deploymentunit_url, NULL, NULL, NULL, BBFDM_BOTH},
{"Vendor", &DMREAD, DMT_STRING, get_deploymentunit_vendor, NULL, NULL, NULL, BBFDM_BOTH},
{"Version", &DMREAD, DMT_STRING, get_deploymentunit_version, NULL, NULL, NULL, BBFDM_BOTH},
{"ExecutionEnvRef", &DMREAD, DMT_STRING, get_deploymentunit_execution_env_ref, NULL, NULL, NULL, BBFDM_BOTH},
{0}
};
int get_deploymentunit_uuid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "uuid", value);
return 0;
}
int get_deploymentunit_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "name", value);
return 0;
}
int get_deploymentunit_resolved(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "resolved", value);
return 0;
}
int get_deploymentunit_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "url", value);
return 0;
}
int get_deploymentunit_vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "vendor", value);
return 0;
}
int get_deploymentunit_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "version", value);
return 0;
}
int get_deploymentunit_execution_env_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *softsection = (struct uci_section *)data;
dmuci_get_value_by_section_string(softsection, "execution_env_ref", value);
return 0;
}
char *add_softwaremodules_deploymentunit(char *uuid, char*url, char *username, char *password, char *name, char *version)
{
char *value;
char *instance;
struct uci_section *deploymentsection = NULL;
char duname[16];
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "UUID", uuid, deploymentsection) {
DMUCI_SET_VALUE_BY_SECTION(bbfdm, deploymentsection, "URL", url);
DMUCI_SET_VALUE_BY_SECTION(bbfdm,deploymentsection, "URL", url);
DMUCI_SET_VALUE_BY_SECTION(bbfdm,deploymentsection, "Name", name);
DMUCI_SET_VALUE_BY_SECTION(bbfdm,deploymentsection, "Version", version);
DMUCI_SET_VALUE_BY_SECTION(bbfdm,deploymentsection, "username", username);
DMUCI_SET_VALUE_BY_SECTION(bbfdm,deploymentsection, "password", password);
DMUCI_SET_VALUE_BY_SECTION(bbfdm,deploymentsection, "Resolved", "1");
dmuci_get_value_by_section_string(deploymentsection, "duinstance", &instance);
goto end;
}
instance = get_last_instance(DMMAP, "deploymentunit", "duinstance");
if (!instance)
sprintf(duname, "du%d", 0);
else
sprintf(duname, "du%s", instance);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, NULL, "deploymentunit");
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "UUID", uuid);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "URL", url);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "Name", name);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "Version", version);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "username", username);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "password", password);
DMUCI_SET_VALUE(bbfdm, "dmmap", duname, "Resolved", "1");
instance = get_last_instance(DMMAP, "deploymentunit", "duinstance");
return instance;
end:
return instance;
}
int update_softwaremodules_url(char *uuid, char *url)
{
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "UUID", uuid, s) {
DMUCI_SET_VALUE_BY_SECTION(bbfdm, s, "URL", url);
return 1;
}
return 0;
}
char *get_softwaremodules_uuid(char *url)
{
char *uuid;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "url", url, s) {
dmuci_get_value_by_section_string(s, "UUID", &uuid);
return uuid;
}
return "";
}
char *get_softwaremodules_url(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "URL", &url);
return url;
}
return "";
}
char *get_softwaremodules_username(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "username", &url);
return url;
}
return "";
}
char *get_softwaremodules_pass(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "password", &url);
return url;
}
return "";
}
char *get_softwaremodules_instance(char *uuid)
{
char *url;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "duinstance", &url);
return url;
}
return "";
}
char *get_softwaremodules_name(char *uuid)
{
char *name;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "Name", &name);
return name;
}
return "";
}
char *get_softwaremodules_version(char *uuid)
{
char *version;
struct uci_section *s = NULL;
uci_path_foreach_option_eq(bbfdm, "dmmap", "deploymentunit", "uuid", uuid, s) {
dmuci_get_value_by_section_string(s, "Version", &version);
return version;
}
return "";
}
int browsesoftwaremodules_deploymentunitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *idu = NULL, *idu_last = NULL;
char *permission = "1";
struct uci_section *s = NULL;
uci_path_foreach_sections(bbfdm, "dmmap", "deploymentunit", s) {
idu = handle_update_instance(1, dmctx, &idu_last, update_instance_alias_bbfdm, 3, s, "duinstance", "duinstance_alias");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, idu) == DM_STOP)
break;
}
return 0;
}

View file

@ -1,37 +0,0 @@
/*
* Copyright (C) 2019 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
*/
#ifndef __SOFTWARE_MODULE_H
#define __SOFTWARE_MODULE_H
extern DMOBJ tSoftwareModulesObj[];
extern DMLEAF tSoftwareModulesDeploymentUnitParams[];
int browsesoftwaremodules_deploymentunitInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int update_softwaremodules_url(char *uuid, char *url);
char *get_softwaremodules_uuid(char *url);
char *get_softwaremodules_username(char *uuid);
char *get_softwaremodules_pass(char *uuid);
char *get_softwaremodules_instance(char *uuid);
char *get_softwaremodules_version(char *uuid);
char *add_softwaremodules_deploymentunit(char *uuid, char*url, char *username, char *password, char *name, char *version);
char *get_softwaremodules_name(char *uuid);
char *get_softwaremodules_url(char *uuid);
int get_deploymentunit_uuid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_resolved(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_url(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_vendor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_version(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_deploymentunit_execution_env_ref(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif

View file

@ -162,10 +162,18 @@ static inline json_object *ubus_call_req(char *obj, char *method, struct ubus_ar
sprintf(p, "{");
for (i = 0; i < u_args_size; i++) {
p += strlen(p);
if (i == 0)
sprintf(p, "\"%s\": \"%s\"", u_args[i].key, u_args[i].val);
else
sprintf(p, ", \"%s\": \"%s\"", u_args[i].key, u_args[i].val);
if (i == 0){
if(u_args[i].type != Integer)
sprintf(p, "\"%s\": \"%s\"", u_args[i].key, u_args[i].val);
else
sprintf(p, "\"%s\": %s", u_args[i].key, u_args[i].val);
}
else{
if(u_args[i].type != Integer)
sprintf(p, ", \"%s\": \"%s\"", u_args[i].key, u_args[i].val);
else
sprintf(p, ", \"%s\": %s", u_args[i].key, u_args[i].val);
}
}
p += strlen(p);
sprintf(p, "}");

View file

@ -2776,7 +2776,18 @@
"usp"
],
"read": true,
"write": true
"write": true,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].status"
}
}
]
},
"Status": {
"type": "string",
@ -2790,6 +2801,17 @@
"Up",
"Error",
"Disabled"
],
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].status"
}
}
]
},
"Reset": {
@ -2816,7 +2838,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].name"
}
}
]
},
"Type": {
"type": "string",
@ -2825,7 +2858,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].type"
}
}
]
},
"InitialRunLevel": {
"type": "unsignedInt",
@ -2884,7 +2928,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].vendor"
}
}
]
},
"Version": {
"type": "string",
@ -2893,7 +2948,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].version"
}
}
]
},
"ParentExecEnv": {
"type": "string",
@ -2915,7 +2981,18 @@
},
"unit": "kilobytes",
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].allocateddiskspace"
}
}
]
},
"AvailableDiskSpace": {
"type": "int",
@ -2928,7 +3005,18 @@
},
"unit": "kilobytes",
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].availablediskspace"
}
}
]
},
"AllocatedMemory": {
"type": "int",
@ -2941,7 +3029,18 @@
},
"unit": "kilobytes",
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].allocatedmemory"
}
}
]
},
"AvailableMemory": {
"type": "int",
@ -2954,7 +3053,18 @@
},
"unit": "kilobytes",
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "environment",
"args": {},
"key": "environment[i-1].availablememory"
}
}
]
},
"ActiveExecutionUnits": {
"type": "string",
@ -2990,7 +3100,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].uuid"
}
}
]
},
"DUID": {
"type": "string",
@ -2999,7 +3120,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].duid"
}
}
]
},
"Alias": {
"type": "string",
@ -3017,7 +3149,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].name"
}
}
]
},
"Status": {
"type": "string",
@ -3051,7 +3194,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].url"
}
}
]
},
"Description": {
"type": "string",
@ -3060,7 +3214,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].description"
}
}
]
},
"Vendor": {
"type": "string",
@ -3069,7 +3234,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].vendor"
}
}
]
},
"Version": {
"type": "string",
@ -3078,7 +3254,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].version"
}
}
]
},
"VendorLogList": {
"type": "string",
@ -3114,7 +3301,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "du_list",
"args": {},
"key": "deployment_unit[i-1].environment"
}
}
]
}
},
"Device.SoftwareModules.ExecutionUnit.{i}.": {
@ -3132,7 +3330,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].euid"
}
}
]
},
"Alias": {
"type": "string",
@ -3150,7 +3359,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].name"
}
}
]
},
"ExecEnvLabel": {
"type": "string",
@ -3159,7 +3379,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].name"
}
}
]
},
"Status": {
"type": "string",
@ -3243,7 +3474,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].vendor"
}
}
]
},
"Version": {
"type": "string",
@ -3252,7 +3494,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].version"
}
}
]
},
"Description": {
"type": "string",
@ -3261,7 +3514,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].description"
}
}
]
},
"DiskSpaceInUse": {
"type": "int",
@ -3274,7 +3538,18 @@
},
"unit": "kilobytes",
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].disk_space"
}
}
]
},
"MemoryInUse": {
"type": "int",
@ -3287,7 +3562,18 @@
},
"unit": "kilobytes",
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].memory_space"
}
}
]
},
"References": {
"type": "string",
@ -3340,7 +3626,18 @@
"usp"
],
"read": true,
"write": false
"write": false,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "softwaremanagement",
"method": "eu_list",
"args": {},
"key": "execution_unit[i-1].environment"
}
}
]
},
"Device.SoftwareModules.ExecutionUnit.{i}.Extensions.": {
"type": "object",