Skip to content
Snippets Groups Projects
Commit 2dd55d9c authored by Vivek Dutta's avatar Vivek Dutta
Browse files

Align with bbfdm

parent ad4b75dc
Branches
No related tags found
1 merge request!19Align with bbfdm
Pipeline #95674 failed
bulkdatad
*.o
*.so
*.gcda
*.gcno
*.log
docs/index.md
......@@ -14,4 +14,20 @@ variables:
stages:
- static_code_analysis
- compilation_test
- deploy
run_compilation_test:
stage: compilation_test
image: ${COMMON_IMAGE}
allow_failure: false
script:
- "./gitlab-ci/install-dependencies.sh"
- "./gitlab-ci/setup.sh"
- "./gitlab-ci/compilation-test.sh"
artifacts:
when: always
paths:
- timestamp.log
- /tmp/memory-report.xml
title: "Bulkdata documentation"
title: "Bulkdata"
nav:
- "arch"
......
title: "Bulkdata API"
title: "Bulkdata"
nav:
- "ubus"
......
title: "Bulkdata"
hide: true
title: "Bulkdata UCI"
title: "Bulkdata"
nav:
- "..."
title: "Bulkdata"
hide: true
title: "Bulkdata Developer Guide"
title: "Bulkdata"
nav:
- "..."
#!/bin/bash
echo "$0 preparation script"
pwd
source ./gitlab-ci/shared.sh
# build package
date +%s > timestamp.log
build_bulkdata
supervisorctl update
supervisorctl restart all
supervisorctl status all
exec_cmd ubus -t 20 wait_for bbfdm
supervisorctl stop all
supervisorctl status
grep -q "Leak_" /tmp/memory-report.xml
error_on_zero $?
echo "Compilation Test :: PASS"
#!/bin/bash
echo "install dependencies for unit-test script"
pwd
source ./gitlab-ci/shared.sh
# install bbfdm
install_bbfdm
[program:ubusd]
autorestart=false
startretries=0
priority=1
command=/bin/bash -c "/usr/sbin/ubusd"
[program:rpcd]
autorestart=false
startretries=0
priority=2
command=/bin/bash -c "/usr/sbin/rpcd"
[program:bbfdmd]
autorestart=false
startretries=0
priority=3
command=/bin/bash -c "/usr/sbin/bbfdmd"
[program:bulkdatad]
autorestart=false
startretries=0
priority=4
command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/tmp/memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /usr/sbin/bulkdatad"
#!/bin/bash
echo "preparation script"
mkdir -p /var/state/
cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/
cp -rf ./test/files/* /
#!/bin/bash
function cleanup()
{
echo ""
}
function check_ret()
{
ret=$1
if [ "$ret" -ne 0 ]; then
echo "Validation of last command failed, ret(${ret})"
exit $ret
fi
}
function error_on_zero()
{
ret=$1
if [ "$ret" -eq 0 ]; then
echo "Validation of last command failed, ret(${ret})"
exit $ret
fi
}
function exec_cmd()
{
echo "executing $@"
$@ >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to execute $@"
exit 1
fi
}
function clean_stunc()
{
make -C src clean
rm *.gcno
rm *.gcda
}
function build_bulkdata()
{
export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage -D_GNU_SOURCE"
export LDFLAGS="--coverage"
make clean
make
exec_cmd ln -s ${PWD}/bulkdatad /usr/sbin/bulkdatad
}
function install_bbfdm()
{
[ -d "/opt/dev/bbfdm" ] && rm -rf /opt/dev/bbfdm
if [ -n "${BBFDM_BRANCH}" ]; then
exec_cmd git clone -b ${BBFDM_BRANCH} https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
else
exec_cmd git clone https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
fi
cd /opt/dev/bbfdm
./gitlab-ci/install-dependencies.sh install
./gitlab-ci/setup.sh install
}
......@@ -17,7 +17,7 @@
#include <libubox/blobmsg_json.h>
#include "utils.h"
#define USP_OBJECT_NAME "usp.raw"
#define DM_OBJECT_NAME "bbfdm"
static unsigned char LogLevel = DEFAULT_LOG_LEVEL;
static bool g_usp_object_available = false;
......@@ -199,8 +199,8 @@ static void get_value_single_cb(struct ubus_request *req, int type __attribute__
__P_MAX
};
const struct blobmsg_policy p[__P_MAX] = {
{ "parameter", BLOBMSG_TYPE_STRING },
{ "value", BLOBMSG_TYPE_STRING }
{ "path", BLOBMSG_TYPE_STRING },
{ "data", BLOBMSG_TYPE_STRING }
};
if (!msg)
......@@ -245,8 +245,8 @@ static void get_value_group_cb(struct ubus_request *req, int type __attribute__(
__P_MAX
};
const struct blobmsg_policy p[__P_MAX] = {
{ "parameter", BLOBMSG_TYPE_STRING },
{ "value", BLOBMSG_TYPE_STRING },
{ "path", BLOBMSG_TYPE_STRING },
{ "data", BLOBMSG_TYPE_STRING },
{ "type", BLOBMSG_TYPE_STRING }
};
......@@ -285,7 +285,7 @@ static int uspd_call(struct ubus_context *ctx, char *method,
uint32_t id;
if (ubus_lookup_id(ctx, USP_OBJECT_NAME, &id))
if (ubus_lookup_id(ctx, DM_OBJECT_NAME, &id))
return -1;
// Invoke Ubus to get data from uspd
......@@ -309,7 +309,10 @@ int get_value_single(vendor_data_t *arg)
blob_buf_init(&bb, 0);
blobmsg_add_string(&bb, "path", arg->path);
void *table = blobmsg_open_table(&bb, "optional");
blobmsg_add_string(&bb, "proto", "cwmp");
blobmsg_add_string(&bb, "format", "raw");
blobmsg_close_table(&bb, table);
// Invoke Ubus to get data from uspd
res = uspd_call(ubus_ctx, "get", &bb, get_value_single_cb, arg);
......@@ -333,7 +336,10 @@ int get_value_group(vendor_data_t *arg)
blob_buf_init(&bb, 0);
blobmsg_add_string(&bb, "path", arg->path);
void *table = blobmsg_open_table(&bb, "optional");
blobmsg_add_string(&bb, "proto", "cwmp");
blobmsg_add_string(&bb, "format", "raw");
blobmsg_close_table(&bb, table);
// Invoke Ubus to get data from uspd
res = uspd_call(ubus_ctx, "get", &bb, get_value_group_cb, arg);
......@@ -717,7 +723,7 @@ static void lookup_event_cb(struct ubus_context *ctx __attribute__((unused)),
return;
path = blobmsg_data(attr);
if (strcmp(path, USP_OBJECT_NAME) == 0) {
if (strcmp(path, DM_OBJECT_NAME) == 0) {
g_usp_object_available = true;
uloop_end();
}
......@@ -754,7 +760,7 @@ int wait_for_usp_raw_object(void)
ubus_register_event_handler(uctx, &add_event, "ubus.object.add");
// check if object already present
ret = ubus_lookup_id(uctx, USP_OBJECT_NAME, &ubus_id);
ret = ubus_lookup_id(uctx, DM_OBJECT_NAME, &ubus_id);
if (ret == 0) {
g_usp_object_available = true;
goto end;
......@@ -772,7 +778,7 @@ end:
ubus_free(uctx);
if (g_usp_object_available == false) {
ERR("%s object not found", USP_OBJECT_NAME);
ERR("%s object not found", DM_OBJECT_NAME);
return -1;
}
......
config bulkdata 'bulkdata'
option log_level '3'
option enable '1'
config profile 'profile_1'
option name 'test'
option protocol 'HTTP'
option reporting_interval '60'
option encoding_type 'JSON'
option http_url 'http://localhost'
option http_method 'PUT'
option enable '1'
config profile_parameter 'profile_1_parameter_1'
option dm_parent 'profile_1'
option name 'test_data'
option reference 'Device.DeviceInfo.Uptime'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment