2019-02-25 17:05:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2021-09-22 10:42:03 +02:00
|
|
|
# Integration loopback test for villas pipe.
|
2019-02-25 17:05:28 +01:00
|
|
|
#
|
2022-03-15 09:18:01 -04:00
|
|
|
# @author Steffen Vogel <svogel2@eonerc.rwth-aachen.de>
|
2019-02-25 17:05:28 +01:00
|
|
|
# @author Marvin Klimke <marvin.klimke@rwth-aachen.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
# @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
2019-02-25 17:05:28 +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
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "Test is broken"
|
|
|
|
exit 99
|
2019-02-25 17:05:28 +01:00
|
|
|
|
|
|
|
LOCAL_ADDR=137.226.133.195
|
|
|
|
REMOTE_ADDR=157.230.251.200
|
|
|
|
REMOTE_USER=root
|
2019-03-12 17:00:23 +01:00
|
|
|
REMOTE="ssh ${REMOTE_USER}@${REMOTE_ADDR}"
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2019-03-12 16:46:28 +01:00
|
|
|
PATH=/projects/villas/node/build/src:${PATH}
|
2019-03-12 17:00:23 +01:00
|
|
|
${REMOTE} PATH=/projects/villas/node/build/src:${PATH}
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
DIR=$(mktemp -d)
|
|
|
|
pushd ${DIR}
|
|
|
|
|
|
|
|
function finish {
|
|
|
|
popd
|
|
|
|
rm -rf ${DIR}
|
|
|
|
}
|
|
|
|
trap finish EXIT
|
2019-02-25 17:05:28 +01:00
|
|
|
|
|
|
|
FORMAT="villas.binary"
|
|
|
|
VECTORIZE="1"
|
|
|
|
|
|
|
|
RATE=100
|
|
|
|
NUM_SAMPLES=100
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
cat > src.json << EOF
|
2019-02-25 17:05:28 +01:00
|
|
|
{
|
2021-08-10 10:12:48 -04:00
|
|
|
"logging": {
|
|
|
|
"level": "debug"
|
2019-02-25 17:05:28 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"nodes": {
|
|
|
|
"rtp_node": {
|
|
|
|
"type": "rtp",
|
|
|
|
"format": "${FORMAT}",
|
|
|
|
"vectorize": ${VECTORIZE},
|
|
|
|
"rate": ${RATE},
|
|
|
|
"rtcp": {
|
|
|
|
"enabled": true,
|
|
|
|
"mode": "aimd",
|
|
|
|
"throttle_mode": "decimate"
|
2019-02-25 17:05:28 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"aimd": {
|
|
|
|
"a": 10,
|
|
|
|
"b": 0.5
|
2019-02-25 17:05:28 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"in": {
|
|
|
|
"address": "0.0.0.0:33466",
|
|
|
|
"signals": {
|
|
|
|
"count": 5,
|
|
|
|
"type": "float"
|
2019-02-25 17:05:28 +01:00
|
|
|
}
|
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"out": {
|
|
|
|
"address": "${REMOTE_ADDR}:33464"
|
2019-02-25 17:05:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# UDP ports: 33434 - 33534
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
cat > dest.json << EOF
|
2019-02-25 17:05:28 +01:00
|
|
|
{
|
2021-08-10 10:12:48 -04:00
|
|
|
"logging": {
|
|
|
|
"level": "debug"
|
2019-02-25 17:05:28 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"nodes": {
|
|
|
|
"rtp_node": {
|
|
|
|
"type": "rtp",
|
|
|
|
"format": "${FORMAT}",
|
|
|
|
"vectorize": ${VECTORIZE},
|
|
|
|
"rate": ${RATE},
|
2019-02-25 17:05:28 +01:00
|
|
|
"rtcp": {
|
2021-08-10 10:12:48 -04:00
|
|
|
"enabled": true,
|
|
|
|
"mode": "aimd",
|
|
|
|
"throttle_mode": "decimate"
|
2019-02-25 17:05:28 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"aimd": {
|
|
|
|
"a": 10,
|
|
|
|
"b": 0.5
|
2019-02-25 17:05:28 +01:00
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"in": {
|
|
|
|
"address": "0.0.0.0:33464",
|
|
|
|
"signals": {
|
|
|
|
"count": 5,
|
|
|
|
"type": "float"
|
2019-02-25 17:05:28 +01:00
|
|
|
}
|
|
|
|
},
|
2021-08-10 10:12:48 -04:00
|
|
|
"out": {
|
|
|
|
"address": "${LOCAL_ADDR}:33466"
|
2019-02-25 17:05:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
scp dest.json ${REMOTE_USER}@${REMOTE_ADDR}:${CONFIG_FILE_DEST}
|
2019-03-12 16:46:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
${REMOTE} villas pipe -l ${NUM_SAMPLES} ${CONFIG_FILE_DEST} rtp_node > output.dat &
|
2019-02-25 17:05:28 +01:00
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas signal mixed -v 5 -r ${RATE} -l ${NUM_SAMPLES} > input.dat
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas pipe src.json rtp_node < input.dat
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
scp ${REMOTE_USER}@${REMOTE_ADDR}:output.dat output.dat
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
villas compare ${CMPFLAGS} input.dat output.dat
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
${REMOTE} rm -f output.dat ${CONFIG_FILE_DEST}
|
2019-02-25 17:05:28 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
kill %%
|
|
|
|
wait %%
|