From 9aaed6d7a81bc053ae736755ea11777cca31097f Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Wed, 30 Jan 2019 11:20:26 +0100 Subject: [PATCH 1/5] Increase minimal required version of jansson to 2.10 due to dependencies on json_dumpfd and json_loadfd methods --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d8d145b2..7bf0bb0c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ find_program(PROTOBUF_COMPILER NAMES protoc) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig:/usr/lib64/pkgconfig") -pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson>=2.7) +pkg_check_modules(JANSSON IMPORTED_TARGET REQUIRED jansson>=2.10) pkg_check_modules(LIBWEBSOCKETS IMPORTED_TARGET REQUIRED libwebsockets>=2.3.0) pkg_check_modules(PROTOBUF IMPORTED_TARGET protobuf>=2.6.0) pkg_check_modules(PROTOBUFC IMPORTED_TARGET libprotobuf-c>=1.1.0) From ad12431aaa4029fdf0fd517a9d094b26488f00ec Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Wed, 30 Jan 2019 11:59:09 +0100 Subject: [PATCH 2/5] formats: fix parentheses around char array expression --- lib/formats/csv.c | 2 +- lib/formats/villas_human.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/formats/csv.c b/lib/formats/csv.c index 9de170515..910c96510 100644 --- a/lib/formats/csv.c +++ b/lib/formats/csv.c @@ -121,7 +121,7 @@ static size_t csv_sscan_single(struct io *io, const char *buf, size_t len, struc if (sig->type == SIGNAL_TYPE_AUTO) { /* Find end of the current column */ - next = strpbrk(ptr, (char[]) { io->separator, io->delimiter, 0 }); + next = strpbrk(ptr, ((char[]) { io->separator, io->delimiter, 0 })); if (next == NULL) goto out; diff --git a/lib/formats/villas_human.c b/lib/formats/villas_human.c index 4c4fb6b07..929c93312 100644 --- a/lib/formats/villas_human.c +++ b/lib/formats/villas_human.c @@ -146,7 +146,7 @@ static size_t villas_human_sscan_single(struct io *io, const char *buf, size_t l if (sig->type == SIGNAL_TYPE_AUTO) { /* Find end of the current column */ - next = strpbrk(ptr, (char[]) { io->separator, io->delimiter, 0 }); + next = strpbrk(ptr, ((char[]) { io->separator, io->delimiter, 0 })); if (next == NULL) goto out; From 664ec1f46fccbf878a6be5b928597b2d27be566f Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Wed, 30 Jan 2019 12:00:53 +0100 Subject: [PATCH 3/5] super_node: add some checks for compiler defines WITH_API and WITH_WEB --- lib/super_node.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/super_node.cpp b/lib/super_node.cpp index a87e6899e..246a0ae3a 100644 --- a/lib/super_node.cpp +++ b/lib/super_node.cpp @@ -53,8 +53,12 @@ SuperNode::SuperNode() : affinity(0), hugepages(DEFAULT_NR_HUGEPAGES), stats(0), +#ifdef WITH_API api(this), +#ifdef WITH_WEB web(&api), +#endif +#endif json(nullptr) { nodes.state = STATE_DESTROYED; @@ -470,9 +474,9 @@ void SuperNode::stopInterfaces() void SuperNode::stop() { - int ret; #ifdef WITH_HOOKS + int ret; if (stats > 0) { ret = task_destroy(&task); if (ret) @@ -586,7 +590,7 @@ extern "C" { return ssn->getInterfaces(); } - +#ifdef WITH_WEB struct web * super_node_get_web(struct super_node *sn) { SuperNode *ssn = reinterpret_cast(sn); @@ -594,7 +598,7 @@ extern "C" { return reinterpret_cast(w); } - +#endif struct lws_context * web_get_context(struct web *w) { Web *ws = reinterpret_cast(w); From 1b0dcbbd2cbddb9f36ad49a8dac01378d9f3518d Mon Sep 17 00:00:00 2001 From: Marvin Klimke Date: Wed, 30 Jan 2019 17:24:17 +0100 Subject: [PATCH 4/5] rtp: add test script with two villas node instances on one machine --- tests/integration/pipe-loopback-rtp-dual.sh | 117 ++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100755 tests/integration/pipe-loopback-rtp-dual.sh diff --git a/tests/integration/pipe-loopback-rtp-dual.sh b/tests/integration/pipe-loopback-rtp-dual.sh new file mode 100755 index 000000000..cda8dca58 --- /dev/null +++ b/tests/integration/pipe-loopback-rtp-dual.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# Integration loopback test for villas-pipe. +# +# @author Steffen Vogel +# @author Marvin Klimke +# @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# 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 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################## + +SCRIPT=$(realpath $0) +SCRIPTPATH=$(dirname ${SCRIPT}) +source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh + +CONFIG_FILE_SRC=$(mktemp) +CONFIG_FILE_DEST=$(mktemp) +INPUT_FILE=$(mktemp) +OUTPUT_FILE=$(mktemp) + +FORMAT="villas.binary" +VECTORIZE="1" + +RATE=10000 +NUM_SAMPLES=100 + +cat > ${CONFIG_FILE_SRC} << EOF +{ + "nodes" : { + "rtp_node" : { + "type" : "rtp", + "format" : "${FORMAT}", + "vectorize" : ${VECTORIZE}, + "rate" : ${RATE}, + "rtcp" : { + "enabled" : false, + "mode" : "aimd", + "throttle_mode" : "decimate" + }, + "aimd" : { + "a" : 10, + "b" : 0.5 + }, + "in" : { + "address" : "0.0.0.0:12002", + "signals" : { + "count" : 5, + "type" : "float" + } + }, + "out" : { + "address" : "127.0.0.1:12000" + } + } + } +} +EOF + +cat > ${CONFIG_FILE_DEST} << EOF +{ + "nodes" : { + "rtp_node" : { + "type" : "rtp", + "format" : "${FORMAT}", + "vectorize" : ${VECTORIZE}, + "rate" : ${RATE}, + "rtcp": { + "enabled" : false, + "mode" : "aimd", + "throttle_mode" : "decimate" + }, + "aimd" : { + "a" : 10, + "b" : 0.5 + }, + "in" : { + "address" : "0.0.0.0:12000", + "signals" : { + "count" : 5, + "type" : "float" + } + }, + "out" : { + "address" : "127.0.0.1:12002" + } + } + } +} +EOF + +villas-signal mixed -v 5 -l ${NUM_SAMPLES} > ${INPUT_FILE} + +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE_DEST} rtp_node > ${OUTPUT_FILE} & + +villas-pipe ${CONFIG_FILE_SRC} rtp_node < ${INPUT_FILE} + +# Compare data +villas-test-cmp ${CMPFLAGS} ${INPUT_FILE} ${OUTPUT_FILE} +RC=$? + +rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} + +exit $RC From 263f0c550af86c59dfbeeb2cdebc15a75c602e15 Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Thu, 31 Jan 2019 10:39:08 +0100 Subject: [PATCH 5/5] super_node: place WITH_WEB switch around wrapper for a libwebsocket method to avoid linker error if libvillas is compiled with WITH_WEB=OFF --- include/villas/super_node.h | 2 ++ lib/super_node.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/villas/super_node.h b/include/villas/super_node.h index 81ad888dc..7e4729ae3 100644 --- a/include/villas/super_node.h +++ b/include/villas/super_node.h @@ -42,4 +42,6 @@ struct lws_vhost * web_get_vhost(struct web *w); enum state web_get_state(struct web *w); +#ifdef WITH_WEB int web_callback_on_writable(struct web *w, struct lws *wsi); +#endif diff --git a/lib/super_node.cpp b/lib/super_node.cpp index 246a0ae3a..213eb95c7 100644 --- a/lib/super_node.cpp +++ b/lib/super_node.cpp @@ -620,8 +620,10 @@ extern "C" { return ws->getState(); } +#ifdef WITH_WEB int web_callback_on_writable(struct web *w, struct lws *wsi) { return lws_callback_on_writable(wsi); } +#endif }