1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Merge branch 'develop' of git.rwth-aachen.de:acs/public/villas/VILLASnode into develop

This commit is contained in:
Steffen Vogel 2019-02-06 13:18:55 +01:00
commit ac22c393b7
6 changed files with 131 additions and 6 deletions

View file

@ -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)

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;
@ -467,9 +471,9 @@ void SuperNode::stopInterfaces()
void SuperNode::stop()
{
int ret;
#ifdef WITH_HOOKS
int ret;
if (stats > 0) {
ret = task_destroy(&task);
if (ret)
@ -583,7 +587,7 @@ extern "C" {
return ssn->getInterfaces();
}
#ifdef WITH_WEB
struct web * super_node_get_web(struct super_node *sn)
{
SuperNode *ssn = reinterpret_cast<SuperNode *>(sn);
@ -591,7 +595,7 @@ extern "C" {
return reinterpret_cast<web *>(w);
}
#endif
struct lws_context * web_get_context(struct web *w)
{
Web *ws = reinterpret_cast<Web *>(w);
@ -613,8 +617,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
}

View file

@ -0,0 +1,117 @@
#!/bin/bash
#
# Integration loopback test for villas-pipe.
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @author Marvin Klimke <marvin.klimke@rwth-aachen.de>
# @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 <http://www.gnu.org/licenses/>.
##################################################################################
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