2019-01-30 17:24:17 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2021-09-22 10:42:03 +02:00
|
|
|
# Integration loopback test for villas pipe.
|
2019-01-30 17:24:17 +01:00
|
|
|
#
|
|
|
|
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
|
|
|
# @author Marvin Klimke <marvin.klimke@rwth-aachen.de>
|
2021-08-10 10:12:48 -04:00
|
|
|
# @copyright 2014-2021, Institute for Automation of Complex Power Systems, EONERC
|
2019-01-30 17:24:17 +01:00
|
|
|
# @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/>.
|
|
|
|
##################################################################################
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
echo "Test is broken"
|
|
|
|
exit 99
|
2019-02-12 20:57:08 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
set -e
|
|
|
|
|
|
|
|
DIR=$(mktemp -d)
|
|
|
|
pushd ${DIR}
|
|
|
|
|
|
|
|
function finish {
|
|
|
|
popd
|
|
|
|
rm -rf ${DIR}
|
|
|
|
}
|
|
|
|
trap finish EXIT
|
2019-01-30 17:24:17 +01:00
|
|
|
|
|
|
|
FORMAT="villas.binary"
|
|
|
|
VECTORIZE="1"
|
|
|
|
|
2019-02-13 09:32:49 +01:00
|
|
|
RATE=100
|
2019-03-18 15:42:26 +01:00
|
|
|
NUM_SAMPLES=2000
|
2019-01-30 17:24:17 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
cat > src.json << EOF
|
2019-01-30 17:24:17 +01:00
|
|
|
{
|
2021-08-10 10:12:48 -04:00
|
|
|
"logging": {
|
|
|
|
"level": "info"
|
2019-02-15 10:19:58 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"nodes": {
|
|
|
|
"rtp_node": {
|
|
|
|
"type": "rtp",
|
|
|
|
"format": "${FORMAT}",
|
|
|
|
"vectorize": ${VECTORIZE},
|
|
|
|
"rate": ${RATE},
|
|
|
|
"rtcp": true,
|
|
|
|
"aimd": {
|
|
|
|
"a": 10,
|
|
|
|
"b": 0.5,
|
|
|
|
"hook_type": "decimate"
|
2019-01-30 17:24:17 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"in": {
|
|
|
|
"address": "0.0.0.0:12002",
|
|
|
|
"signals": {
|
|
|
|
"count": 5,
|
|
|
|
"type": "float"
|
2019-01-30 17:24:17 +01:00
|
|
|
}
|
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"out": {
|
|
|
|
"address": "127.0.0.1:12000"
|
2019-01-30 17:24:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
cat > dest.json << EOF
|
2019-01-30 17:24:17 +01:00
|
|
|
{
|
2021-08-10 10:12:48 -04:00
|
|
|
"logging": {
|
|
|
|
"level": "info"
|
2019-02-15 10:19:58 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"nodes": {
|
|
|
|
"rtp_node": {
|
|
|
|
"type": "rtp",
|
|
|
|
"format": "${FORMAT}",
|
|
|
|
"vectorize": ${VECTORIZE},
|
|
|
|
"rate": ${RATE},
|
|
|
|
"rtcp": true,
|
|
|
|
"aimd": {
|
|
|
|
"a": 10,
|
|
|
|
"b": 0.5,
|
|
|
|
|
|
|
|
"hook_type": "decimate"
|
2019-01-30 17:24:17 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"in": {
|
|
|
|
"address": "0.0.0.0:12000",
|
|
|
|
"signals": {
|
|
|
|
"count": 5,
|
|
|
|
"type": "float"
|
2019-01-30 17:24:17 +01:00
|
|
|
}
|
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"out": {
|
|
|
|
"address": "127.0.0.1:12002"
|
2019-01-30 17:24:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas pipe -l ${NUM_SAMPLES} dest.json rtp_node > output.dat &
|
2019-02-15 10:19:58 +01:00
|
|
|
|
|
|
|
sleep 1
|
2019-01-30 17:24:17 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas signal mixed -v 5 -r ${RATE} -l ${NUM_SAMPLES} > input.dat
|
2019-01-30 17:24:17 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas pipe ${CONFIG_FILE_SRC} rtp_node > output.dat < input.dat
|
2019-01-30 17:24:17 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas compare ${CMPFLAGS} input.dat output.dat
|
2019-02-15 10:19:58 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
kill %%
|
|
|
|
wait %%
|