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

Use spaces for indention of shell scripts

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2024-02-29 21:54:10 +01:00
parent 5d3b4bd4d6
commit ab5a3004bf
71 changed files with 1536 additions and 1536 deletions

View file

@ -7,20 +7,20 @@
# SPDX-License-Identifier: Apache-2.0
ensure_loop(){
num="$1"
dev="/dev/loop$num"
if test -b "$dev"; then
echo "$dev is a usable loop device."
return 0
fi
num="$1"
dev="/dev/loop$num"
if test -b "$dev"; then
echo "$dev is a usable loop device."
return 0
fi
echo "Attempting to create $dev for docker ..."
if ! mknod -m660 $dev b 7 $num; then
echo "Failed to create $dev!" 1>&2
return 3
fi
echo "Attempting to create $dev for docker ..."
if ! mknod -m660 $dev b 7 $num; then
echo "Failed to create $dev!" 1>&2
return 3
fi
return 0
return 0
}
LOOP_A=$(losetup -f)

View file

@ -3,17 +3,17 @@
export_or_unset()
{
local var=$1
local var=$1
if [ -z "${!var+x}" ]; then
return
fi
if [ -z "${!var+x}" ]; then
return
fi
if [ -n "$2" ]; then
export $var="$2"
else
unset $var
fi
if [ -n "$2" ]; then
export $var="$2"
else
unset $var
fi
}
@ -21,16 +21,16 @@ if direnv_version "2.30.0" \
&& has nix \
&& nix show-config experimental-features 2>/dev/null | grep -wqF flakes
then
local oldtmp="$TMP"
local oldtemp="$TEMP"
local oldtmpdir="$TMPDIR"
local oldtempdir="$TEMPDIR"
local oldtmp="$TMP"
local oldtemp="$TEMP"
local oldtmpdir="$TMPDIR"
local oldtempdir="$TEMPDIR"
watch_file ../packaging/nix/*.nix
use flake ../packaging/nix#villas-python
watch_file ../packaging/nix/*.nix
use flake ../packaging/nix#villas-python
export_or_unset TMP "$oldtmp"
export_or_unset TEMP "$oldtemp"
export_or_unset TMPDIR "$oldtmpdir"
export_or_unset TEMPDIR "$oldtempdir"
export_or_unset TMP "$oldtmp"
export_or_unset TEMP "$oldtemp"
export_or_unset TMPDIR "$oldtmpdir"
export_or_unset TEMPDIR "$oldtempdir"
fi

View file

@ -21,20 +21,20 @@ IB_MODES=("RC")
# Check if user is superuser. SU is used for namespace
if [[ "$EUID" -ne 0 ]]; then
echo "Please run as root"
exit 99
echo "Please run as root"
exit 99
fi
# Check whether cpuset cset command is availble
if [[ ! $(command -v cset) ]]; then
echo "Cset is not availble for root. Please install it: https://github.com/lpechacek/cpuset"
exit 99
echo "Cset is not availble for root. Please install it: https://github.com/lpechacek/cpuset"
exit 99
fi
# Check if Infiniband card is present
if [[ ! $(lspci | grep Infiniband) ]]; then
echo "Did not find any Infiniband cards in system"
exit 99
echo "Did not find any Infiniband cards in system"
exit 99
fi
# Create list of configs and check whether they are valid
@ -43,32 +43,32 @@ OIFS=$IFS; IFS=$'\n'; CONFIG_FILES=($(ls configs | sed -e "s/.conf//")); IFS=$OI
NODETYPES=()
if [[ ! $1 ]]; then
echo "Please define for which node-type to run the script"
exit 1
echo "Please define for which node-type to run the script"
exit 1
elif [[ $1 == all ]]; then
echo "Benchmarking the following nodes:"
for NODETYPE in "${CONFIG_FILES[@]}"
do
echo ${NODETYPE}
NODETYPES+=(${NODETYPE})
done
echo "Benchmarking the following nodes:"
for NODETYPE in "${CONFIG_FILES[@]}"
do
echo ${NODETYPE}
NODETYPES+=(${NODETYPE})
done
else
FOUND=0
FOUND=0
for NODETYPE in "${CONFIG_FILES[@]}"
do
if [[ $1 == ${NODETYPE} ]]; then
NODETYPES=$1
FOUND=1
break
fi
done
for NODETYPE in "${CONFIG_FILES[@]}"
do
if [[ $1 == ${NODETYPE} ]]; then
NODETYPES=$1
FOUND=1
break
fi
done
if [[ ${FOUND} == 0 ]]; then
echo "Please define a valid node-type for which a config file is present in ./configs!"
exit 1
fi
if [[ ${FOUND} == 0 ]]; then
echo "Please define a valid node-type for which a config file is present in ./configs!"
exit 1
fi
fi
# SET PATHS
@ -89,17 +89,17 @@ echo ${CONFIG_FILES[1]}
for NODETYPE in "${NODETYPES[@]}"
do
# CREATE PATH CONFIG FILES
# CREATE PATH CONFIG FILES
# Set target and source config file, which is the same for both runs
# Set target and source config file, which is the same for both runs
cat > ${CONFIG_SOURCE} <<EOF
@include "${CONFIG//\/tmp\/}"
paths = (
{
in = "siggen",
out = ("source_node", "results_in"),
}
{
in = "siggen",
out = ("source_node", "results_in"),
}
)
EOF
@ -107,150 +107,150 @@ cat > ${CONFIG_TARGET} <<EOF
@include "${CONFIG//\/tmp\/}"
paths = (
{
in = "target_node",
out = "results_out",
{
in = "target_node",
out = "results_out",
original_sequence_no = true
}
original_sequence_no = true
}
)
EOF
# SPECIAL TREATMENT FOR SOME NODES
# SPECIAL TREATMENT FOR SOME NODES
# Some nodes require special treatment:
# * loopback node: target_node is identical to source_node
# * infiniband node: one node must be executed in a namespace
# Some nodes require special treatment:
# * loopback node: target_node is identical to source_node
# * infiniband node: one node must be executed in a namespace
# loopback
if [ "${NODETYPE}" == "loopback" ]; then
# loopback
if [ "${NODETYPE}" == "loopback" ]; then
cat > ${CONFIG_TARGET} <<EOF
@include "${CONFIG//\/tmp\/}"
paths = (
{
in = "siggen",
out = ("source_node", "results_in"),
},
{
in = "source_node",
out = "results_out",
{
in = "siggen",
out = ("source_node", "results_in"),
},
{
in = "source_node",
out = "results_out",
original_sequence_no = true
}
original_sequence_no = true
}
)
EOF
fi
fi
# infiniband
if [ "${NODETYPE}" == "infiniband" ]; then
NAMESPACE_CMD='ip netns exec namespace0'
else
NAMESPACE_CMD=''
fi
# infiniband
if [ "${NODETYPE}" == "infiniband" ]; then
NAMESPACE_CMD='ip netns exec namespace0'
else
NAMESPACE_CMD=''
fi
# RUN THROUGH MODES
for IB_MODE in "${IB_MODES[@]}"
do
LOG_DIR=$(date +%Y%m%d_%H-%M-%S)_benchmark_${NODETYPE}_${IB_MODE}
# RUN THROUGH MODES
for IB_MODE in "${IB_MODES[@]}"
do
LOG_DIR=$(date +%Y%m%d_%H-%M-%S)_benchmark_${NODETYPE}_${IB_MODE}
for NUM_VALUE in "${NUM_VALUES[@]}"
do
for RATE_SAMPLE in "${RATE_SAMPLES[@]}"
do
NUM_SAMPLE=$((${RATE_SAMPLE} * ${TIME_TO_RUN}))
#TIME_TO_RUN=$((${NUM_SAMPLE} / ${RATE_SAMPLE}))
for NUM_VALUE in "${NUM_VALUES[@]}"
do
for RATE_SAMPLE in "${RATE_SAMPLES[@]}"
do
NUM_SAMPLE=$((${RATE_SAMPLE} * ${TIME_TO_RUN}))
#TIME_TO_RUN=$((${NUM_SAMPLE} / ${RATE_SAMPLE}))
echo "#####"
echo "## START ${IB_MODE}"
echo "## NUM_VALUES: ${NUM_VALUE}"
echo "## RATE_SAMPLES: ${RATE_SAMPLE}"
echo "## NUM_SAMPLES: ${NUM_SAMPLE}"
echo "#####"
echo "## START ${IB_MODE}"
echo "## NUM_VALUES: ${NUM_VALUE}"
echo "## RATE_SAMPLES: ${RATE_SAMPLE}"
echo "## NUM_SAMPLES: ${NUM_SAMPLE}"
# Set wrapper of config file
# Set wrapper of config file
cat > ${CONFIG} <<EOF
logging = {
level = 0,
facilities = "all",
level = 0,
facilities = "all",
}
http = {
enabled = false,
enabled = false,
},
nodes = {
siggen = {
type = "signal",
siggen = {
type = "signal",
signal = "mixed",
values = ${NUM_VALUE},
frequency = 3,
rate = ${RATE_SAMPLE},
limit = ${NUM_SAMPLE},
signal = "mixed",
values = ${NUM_VALUE},
frequency = 3,
rate = ${RATE_SAMPLE},
limit = ${NUM_SAMPLE},
monitor_missed = false
},
monitor_missed = false
},
results_in = {
type = "file",
results_in = {
type = "file",
format = "csv",
uri = "${LOG_DIR}/$(printf "%03d" ${COUNT})_${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_input.csv",
format = "csv",
uri = "${LOG_DIR}/$(printf "%03d" ${COUNT})_${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_input.csv",
buffer_size = 500000000
},
buffer_size = 500000000
},
results_out = {
type = "file",
results_out = {
type = "file",
format = "csv",
uri = "${LOG_DIR}/$(printf "%03d" ${COUNT})_${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_output.csv",
format = "csv",
uri = "${LOG_DIR}/$(printf "%03d" ${COUNT})_${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}_output.csv",
buffer_size = 500000000
},
buffer_size = 500000000
},
EOF
cat configs/${NODETYPE}.conf | sed -e "s/\${NUM_VALUE}/${NUM_VALUE}/" -e "s/\${IB_MODE}/${IB_MODE}/" >> ${CONFIG}
cat configs/${NODETYPE}.conf | sed -e "s/\${NUM_VALUE}/${NUM_VALUE}/" -e "s/\${IB_MODE}/${IB_MODE}/" >> ${CONFIG}
cat >> ${CONFIG} <<EOF
}
EOF
# Start receiving node
VILLAS_LOG_PREFIX=$(colorize "[target] ") \
cset proc --set=real-time-0 --exec ../../build/src/villas-node -- ${CONFIG_TARGET} &
target_node_proc=$!
# Start receiving node
VILLAS_LOG_PREFIX=$(colorize "[target] ") \
cset proc --set=real-time-0 --exec ../../build/src/villas-node -- ${CONFIG_TARGET} &
target_node_proc=$!
# Wait for node to complete init
sleep 2
# Wait for node to complete init
sleep 2
if [ ! "${NODETYPE}" == "loopback" ]; then
# Start sending pipe
VILLAS_LOG_PREFIX=$(colorize "[source] ") \
${NAMESPACE_CMD} cset proc --set=real-time-1 --exec ../../build/src/villas-node -- ${CONFIG_SOURCE} &
source_node_proc=$!
fi
if [ ! "${NODETYPE}" == "loopback" ]; then
# Start sending pipe
VILLAS_LOG_PREFIX=$(colorize "[source] ") \
${NAMESPACE_CMD} cset proc --set=real-time-1 --exec ../../build/src/villas-node -- ${CONFIG_SOURCE} &
source_node_proc=$!
fi
sleep $((${TIME_TO_RUN} + 5))
sleep $((${TIME_TO_RUN} + 5))
# Stop node
kill $target_node_proc
# Stop node
kill $target_node_proc
sleep 1
sleep 1
echo "## STOP ${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}"
echo ""
echo "## STOP ${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}"
echo ""
((COUNT++))
((COUNT++))
sleep 1
done
done
sleep 1
done
done
# Since this script will be executed as sudo we should chmod the
# log dir 777. Otherwise too many unnecessary 'sudo rm -rf' will be invoked.
chmod -R 777 ${LOG_DIR}
done
# Since this script will be executed as sudo we should chmod the
# log dir 777. Otherwise too many unnecessary 'sudo rm -rf' will be invoked.
chmod -R 777 ${LOG_DIR}
done
done
rm ${CONFIG} ${CONFIG_TARGET} ${CONFIG_SOURCE}

View file

@ -12,16 +12,16 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"http": {
"port": 8080
}
"http": {
"port": 8080
}
}
EOF

View file

@ -12,21 +12,21 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"http": {
"port": 8080
},
"nodes": {
"node1": {
"type": "loopback"
}
}
"http": {
"port": 8080
},
"nodes": {
"node1": {
"type": "loopback"
}
}
}
EOF

View file

@ -12,44 +12,44 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"http": {
"port": 8080
},
"nodes": {
"testnode1": {
"type": "websocket",
"dummy": "value1"
},
"testnode2": {
"type": "socket",
"dummy": "value2",
"http": {
"port": 8080
},
"nodes": {
"testnode1": {
"type": "websocket",
"dummy": "value1"
},
"testnode2": {
"type": "socket",
"dummy": "value2",
"in": {
"address": "*:12001",
"signals": [
{ "name": "sig1", "unit": "Volts", "type": "float", "init": 123.0 },
{ "name": "sig2", "unit": "Ampere", "type": "integer", "init": 123 }
]
},
"out": {
"address": "127.0.0.1:12000"
}
}
},
"paths": [
{
"in": "testnode2",
"out": "testnode1"
}
]
"in": {
"address": "*:12001",
"signals": [
{ "name": "sig1", "unit": "Volts", "type": "float", "init": 123.0 },
{ "name": "sig2", "unit": "Ampere", "type": "integer", "init": 123 }
]
},
"out": {
"address": "127.0.0.1:12000"
}
}
},
"paths": [
{
"in": "testnode2",
"out": "testnode1"
}
]
}
EOF

View file

@ -12,43 +12,43 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"http": {
"port": 8080
},
"nodes": {
"testnode1": {
"type": "websocket",
"dummy": "value1"
},
"testnode2": {
"type": "socket",
"dummy": "value2",
"http": {
"port": 8080
},
"nodes": {
"testnode1": {
"type": "websocket",
"dummy": "value1"
},
"testnode2": {
"type": "socket",
"dummy": "value2",
"in": {
"address": "*:12001",
"signals": [
{ "name": "sig1", "unit": "Volts", "type": "float", "init": 123.0 },
{ "name": "sig2", "unit": "Ampere", "type": "integer", "init": 123 }
]
},
"out": {
"address": "127.0.0.1:12000"
}
}
},
"paths": [
{
"in": "testnode2",
"out": "testnode1"
}
]
"in": {
"address": "*:12001",
"signals": [
{ "name": "sig1", "unit": "Volts", "type": "float", "init": 123.0 },
{ "name": "sig2", "unit": "Ampere", "type": "integer", "init": 123 }
]
},
"out": {
"address": "127.0.0.1:12000"
}
}
},
"paths": [
{
"in": "testnode2",
"out": "testnode1"
}
]
}
EOF

View file

@ -12,47 +12,47 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > base.json <<EOF
{
"http": {
"port": 8080
}
"http": {
"port": 8080
}
}
EOF
cat > local.json <<EOF
{
"http": {
"port": 8080
},
"nodes": {
"node1": {
"type" : "socket",
"format": "csv",
"http": {
"port": 8080
},
"nodes": {
"node1": {
"type" : "socket",
"format": "csv",
"in": {
"address" : "*:12000"
},
"out": {
"address": "127.0.0.1:12001"
}
}
},
"paths": [
{
"in": "node1",
"out": "node1",
"hooks": [
{ "type": "print" }
]
}
]
"in": {
"address" : "*:12000"
},
"out": {
"address": "127.0.0.1:12001"
}
}
},
"paths": [
{
"in": "node1",
"out": "node1",
"hooks": [
{ "type": "print" }
]
}
]
}
EOF

View file

@ -12,17 +12,17 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"http": {
"port": 8080
}
"http": {
"port": 8080
}
}
EOF

View file

@ -13,8 +13,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -41,23 +41,23 @@ exec 5<>${FIFO}
JOBS=""
for J in $(seq 1 ${RUNS}); do
(
set -e
trap "echo error-trap >> ${FIFO}" ERR
(
set -e
trap "echo error-trap >> ${FIFO}" ERR
FETCHED_CONF=$(mktemp -p ${DIR})
FETCHED_CONF=$(mktemp -p ${DIR})
curl -s http://localhost:8080/api/v2/config > ${FETCHED_CONF}
diff -u <(jq -S . < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF})
RC=$?
curl -s http://localhost:8080/api/v2/config > ${FETCHED_CONF}
diff -u <(jq -S . < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF})
RC=$?
if [ "$RC" -eq "0" ]; then
echo success >&5
else
echo error >&5
fi
) &
JOBS+=" $!"
if [ "$RC" -eq "0" ]; then
echo success >&5
else
echo error >&5
fi
) &
JOBS+=" $!"
done
echo "Waiting for jobs to complete: ${JOBS}"
@ -68,13 +68,13 @@ wait %1
echo "Check return codes"
for J in $(seq 1 ${RUNS}); do
read -t 10 -u 5 STATUS
read -t 10 -u 5 STATUS
if [ "${STATUS}" == "success" ]; then
let ++SUCCESS
else
let ++FAILED
fi
if [ "${STATUS}" == "success" ]; then
let ++SUCCESS
else
let ++FAILED
fi
done
echo "Success: ${SUCCESS} / ${RUNS}"

View file

@ -10,8 +10,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -22,13 +22,13 @@ FORMATS="villas.human csv tsv json opal.asyncip"
villas signal -v5 -n -l20 mixed > input.dat
for FORMAT in ${FORMATS}; do
villas convert -o ${FORMAT} < input.dat | tee ${TEMP} | \
villas convert -i ${FORMAT} > output.dat
villas convert -o ${FORMAT} < input.dat | tee ${TEMP} | \
villas convert -i ${FORMAT} > output.dat
CMP_FLAGS=""
if [ ${FORMAT} = "opal.asyncip" ]; then
CMP_FLAGS+=-T
fi
CMP_FLAGS=""
if [ ${FORMAT} = "opal.asyncip" ]; then
CMP_FLAGS+=-T
fi
villas compare ${CMP_FLAGS} input.dat output.dat
villas compare ${CMP_FLAGS} input.dat output.dat
done

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,20 +12,20 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"signals": [
{ "name": "signal1_positive", "expression": "smp.data.signal1 >= 0", "type": "boolean" },
{ "name": "abs(signal1)", "expression": "math.abs(smp.data.signal1)" },
{ "name": "signal4_scaled", "expression": "smp.data.signal4 * 100 + 55" },
{ "name": "sequence", "expression": "smp.sequence", "type": "integer" },
{ "name": "ts_origin", "expression": "smp.ts_origin[0] + smp.ts_origin[1] * 1e-9" }
]
"signals": [
{ "name": "signal1_positive", "expression": "smp.data.signal1 >= 0", "type": "boolean" },
{ "name": "abs(signal1)", "expression": "math.abs(smp.data.signal1)" },
{ "name": "signal4_scaled", "expression": "smp.data.signal4 * 100 + 55" },
{ "name": "sequence", "expression": "smp.sequence", "type": "integer" },
{ "name": "ts_origin", "expression": "smp.ts_origin[0] + smp.ts_origin[1] * 1e-9" }
]
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -22,43 +22,43 @@ global_var = 555
counter = 111
function prepare(cfg)
assert(true)
assert(cfg.custom.variable - 123.456 < 1e-9)
assert(cfg.custom.list[0] == 1)
assert(cfg.custom.list[1] - 2.0 < 1e-9)
assert(cfg.custom.list[2] == true)
assert(true)
assert(cfg.custom.variable - 123.456 < 1e-9)
assert(cfg.custom.list[0] == 1)
assert(cfg.custom.list[1] - 2.0 < 1e-9)
assert(cfg.custom.list[2] == true)
end
function start()
counter = 0
counter = 0
end
function process(smp)
assert(counter == smp.sequence)
assert(counter == smp.sequence)
counter = counter + 1
counter = counter + 1
smp.data.signal1 = smp.data.signal2 + smp.data.signal3
smp.data.signal1 = smp.data.signal2 + smp.data.signal3
return 0
return 0
end
EOF
cat > config.json <<EOF
{
"script": "script.lua",
"custom": {
"variable": 123.456,
"list": [1, 2.0, true]
},
"signals": [
{ "name": "global_var", "expression": "global_var" },
{ "name": "counter", "expression": "counter" },
{ "name": "signal1", "expression": "smp.data.signal1" },
{ "name": "ts_origin.sec", "expression": "smp.ts_origin.sec" },
{ "name": "ts_origin.sec", "expression": "smp.ts_origin.nsec" },
{ "name": "sequence", "expression": "smp.sequence" }
]
"script": "script.lua",
"custom": {
"variable": 123.456,
"list": [1, 2.0, true]
},
"signals": [
{ "name": "global_var", "expression": "global_var" },
{ "name": "counter", "expression": "counter" },
{ "name": "signal1", "expression": "smp.data.signal1" },
{ "name": "ts_origin.sec", "expression": "smp.ts_origin.sec" },
{ "name": "ts_origin.sec", "expression": "smp.ts_origin.nsec" },
{ "name": "sequence", "expression": "smp.sequence" }
]
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -25,5 +25,5 @@ villas hook -o offset=${OFFSET} shift_seq > output.dat < input.dat
# Compare shifted sequence no
diff -u \
<(sed -re '/^#/d;s/^[0-9]+\.[0-9]+([\+\-][0-9]+\.[0-9]+(e[\+\-][0-9]+)?)?\(([0-9]+)\).*/\3/g' output.dat) \
<(seq ${OFFSET} $((${NUM_SAMPLES}+${OFFSET}-1)))
<(sed -re '/^#/d;s/^[0-9]+\.[0-9]+([\+\-][0-9]+\.[0-9]+(e[\+\-][0-9]+)?)?\(([0-9]+)\).*/\3/g' output.dat) \
<(seq ${OFFSET} $((${NUM_SAMPLES}+${OFFSET}-1)))

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -14,32 +14,32 @@ FORMAT_TYPES=$(villas node -C 2>/dev/null | jq -r '.formats | join(" ")')
MISSING=0
for NODE in ${NODE_TYPES}; do
NODE=${NODE/./-}
[ ${NODE} == "loopback_internal" ] && continue
NODE=${NODE/./-}
[ ${NODE} == "loopback_internal" ] && continue
if [ ! -f "${SRCDIR}/etc/examples/nodes/${NODE}.conf" ]; then
echo "Missing example config for node-type: ${NODE}"
((MISSING++))
fi
if [ ! -f "${SRCDIR}/etc/examples/nodes/${NODE}.conf" ]; then
echo "Missing example config for node-type: ${NODE}"
((MISSING++))
fi
done
for HOOK in ${HOOK_TYPES}; do
[ ${HOOK} == "restart" ] || \
[ ${HOOK} == "drop" ] || \
[ ${HOOK} == "fix" ] && continue
[ ${HOOK} == "restart" ] || \
[ ${HOOK} == "drop" ] || \
[ ${HOOK} == "fix" ] && continue
if [ ! -f "${SRCDIR}/etc/examples/hooks/${HOOK}.conf" ]; then
echo "Missing example config for hook-type: ${HOOK}"
((MISSING++))
fi
if [ ! -f "${SRCDIR}/etc/examples/hooks/${HOOK}.conf" ]; then
echo "Missing example config for hook-type: ${HOOK}"
((MISSING++))
fi
done
for FORMAT in ${FORMAT_TYPES}; do
FORMAT=${FORMAT/./-}
if [ ! -f "${SRCDIR}/etc/examples/formats/${FORMAT}.conf" ]; then
echo "Missing example config for format-type: ${FORMAT}"
((MISSING++))
fi
FORMAT=${FORMAT/./-}
if [ ! -f "${SRCDIR}/etc/examples/formats/${FORMAT}.conf" ]; then
echo "Missing example config for format-type: ${FORMAT}"
((MISSING++))
fi
done
(( ${MISSING} == 0 ))

View file

@ -29,8 +29,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -39,66 +39,66 @@ NUM_VALUES=${NUM_VALUES:-3}
cat > config.json << EOF
{
"nodes": {
"can_node1": {
"type": "can",
"interface_name": "${CAN_IF}",
"sample_rate": 500000,
"in": {
"signals": [
{
"name": "sigin1",
"unit": "Volts",
"type": "float",
"enabled": true,
"can_id": 66,
"can_size": 4,
"can_offset": 0
},
{
"name": "sigin2",
"unit": "Volts",
"type": "float",
"enabled": true,
"can_id": 66,
"can_size": 4,
"can_offset": 4
},
{
"name": "sigin3",
"unit": "Volts",
"type": "float",
"enabled": true,
"can_id": 67,
"can_size": 8,
"can_offset": 0
}
]
},
"out": {
"signals": [
{
"type": "float",
"can_id": 66,
"can_size": 4,
"can_offset": 0
},
{
"type": "float",
"can_id": 66,
"can_size": 4,
"can_offset": 4
},
{
"type": "float",
"can_id": 67,
"can_size": 8,
"can_offset": 0
}
]
}
}
}
"nodes": {
"can_node1": {
"type": "can",
"interface_name": "${CAN_IF}",
"sample_rate": 500000,
"in": {
"signals": [
{
"name": "sigin1",
"unit": "Volts",
"type": "float",
"enabled": true,
"can_id": 66,
"can_size": 4,
"can_offset": 0
},
{
"name": "sigin2",
"unit": "Volts",
"type": "float",
"enabled": true,
"can_id": 66,
"can_size": 4,
"can_offset": 4
},
{
"name": "sigin3",
"unit": "Volts",
"type": "float",
"enabled": true,
"can_id": 67,
"can_size": 8,
"can_offset": 0
}
]
},
"out": {
"signals": [
{
"type": "float",
"can_id": 66,
"can_size": 4,
"can_offset": 0
},
{
"type": "float",
"can_id": 66,
"can_size": 4,
"can_offset": 4
},
{
"type": "float",
"can_id": 67,
"can_size": 8,
"can_offset": 0
}
]
}
}
}
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -30,23 +30,23 @@ EOF
cat > config.json <<EOF
{
"nodes": {
"example_node1": {
"type": "example",
"nodes": {
"example_node1": {
"type": "example",
"setting1": 66
},
"file": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": "example_node1",
"out": "file",
}
]
"setting1": 66
},
"file": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": "example_node1",
"out": "file",
}
]
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -27,47 +27,47 @@ EOF
cat > config.json <<EOF
{
"nodes": {
"sig": {
"type": "signal",
"nodes": {
"sig": {
"type": "signal",
"signal": "mixed",
"realtime": false,
"limit": 10,
"rate": 100,
"values": 5
},
"file": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": "sig",
"out": "file",
"hooks": [
{
"type": "average",
"signal": "mixed",
"realtime": false,
"limit": 10,
"rate": 100,
"values": 5
},
"file": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": "sig",
"out": "file",
"hooks": [
{
"type": "average",
"signals": [ "random", "sine", "square", "triangle", "ramp" ],
"offset": 0
},
{
"type": "skip_first",
"signals": [ "random", "sine", "square", "triangle", "ramp" ],
"offset": 0
},
{
"type": "skip_first",
"samples": 5
},
{
"type": "scale",
"samples": 5
},
{
"type": "scale",
"scale": 10,
"offset": 5,
"signal": "average"
}
]
}
]
"scale": 10,
"offset": 5,
"signal": "average"
}
]
}
]
}
EOF

View file

@ -10,28 +10,28 @@ set -e
# Check if tools are present
if ! command -v lspci > /dev/null; then
echo "lspci tool is missing"
exit 99
echo "lspci tool is missing"
exit 99
fi
# Check if user is superuser. SU is used for namespace
if [[ "${EUID}" -ne 0 ]]; then
echo "Please run as root"
exit 99
echo "Please run as root"
exit 99
fi
# Check if Infiniband card is present
if [[ ! $(lspci | grep Infiniband) ]]; then
echo "Did not find any Infiniband cards in system"
exit 99
echo "Did not find any Infiniband cards in system"
exit 99
fi
DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -40,63 +40,63 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
# Set config file with a MODE flag
cat > config.json <<EOF
{
"logging": {
"level": 0,
"facilities": "ib"
},
"http": {
"enabled": false
},
"nodes": {
"results": {
"type": "file",
"uri": "output.dat"
},
"ib_node_source": {
"type": "infiniband",
"rdma_port_space": "MODE",
"in": {
"address": "10.0.0.2:1337",
"max_wrs": 8192,
"cq_size": 8192,
"poll_mode": "BUSY",
"buffer_subtraction": 128
},
"out": {
"address": "10.0.0.1:1337",
"resolution_timeout": 1000,
"max_wrs": 8192,
"cq_size": 256,
"send_inline": true,
"max_inline_data": 60,
"use_fallback": true
}
},
"ib_node_target": {
"type": "infiniband",
"rdma_port_space": "MODE",
"in": {
"address": "10.0.0.1:1337",
"max_wrs": 8192,
"cq_size": 8192,
"poll_mode": "BUSY",
"buffer_subtraction": 128
}
}
}
"logging": {
"level": 0,
"facilities": "ib"
},
"http": {
"enabled": false
},
"nodes": {
"results": {
"type": "file",
"uri": "output.dat"
},
"ib_node_source": {
"type": "infiniband",
"rdma_port_space": "MODE",
"in": {
"address": "10.0.0.2:1337",
"max_wrs": 8192,
"cq_size": 8192,
"poll_mode": "BUSY",
"buffer_subtraction": 128
},
"out": {
"address": "10.0.0.1:1337",
"resolution_timeout": 1000,
"max_wrs": 8192,
"cq_size": 256,
"send_inline": true,
"max_inline_data": 60,
"use_fallback": true
}
},
"ib_node_target": {
"type": "infiniband",
"rdma_port_space": "MODE",
"in": {
"address": "10.0.0.1:1337",
"max_wrs": 8192,
"cq_size": 8192,
"poll_mode": "BUSY",
"buffer_subtraction": 128
}
}
}
}
EOF
# Set target config file, which is the same for both runs
cat > target.json <<EOF
{
"@include": "config.json",
"@include": "config.json",
"paths": [
{
"in": "ib_node_target",
"out": "results"
}
"paths": [
{
"in": "ib_node_target",
"out": "results"
}
]
}
EOF
@ -109,45 +109,45 @@ MODES=("RC" "UC" "UD")
# Run through modes
for MODE in "${MODES[@]}"; do
echo "## Start ${MODE}"
echo "## Start ${MODE}"
sed -i -e 's/MODE/'${MODE}'/g' config.json
sed -i -e 's/MODE/'${MODE}'/g' config.json
# Start receiving node
villas node target.json &
PID_PROC=$!
# Start receiving node
villas node target.json &
PID_PROC=$!
# Wait for node to complete init
sleep 1
# Wait for node to complete init
sleep 1
# Preprare fifo
FIFO=$(mktemp -p ${DIR} -t)
if [[ ! -p ${FIFO} ]]; then
mkfifo ${FIFO}
fi
# Preprare fifo
FIFO=$(mktemp -p ${DIR} -t)
if [[ ! -p ${FIFO} ]]; then
mkfifo ${FIFO}
fi
# Start sending pipe
ip netns exec namespace0 \
# Start sending pipe
ip netns exec namespace0 \
villas pipe -l ${NUM_SAMPLES} config.json ib_node_source >output.dat <${FIFO} &
PID_PIPE=$!
PID_PIPE=$!
# Keep pipe alive
sleep 5 >${FIFO} &
# Keep pipe alive
sleep 5 >${FIFO} &
# Wait for pipe to connect to node
sleep 3
# Wait for pipe to connect to node
sleep 3
# Write data to pipe
cat input.dat >${FIFO} &
# Write data to pipe
cat input.dat >${FIFO} &
# Wait for node to handle samples
sleep 2
# Wait for node to handle samples
sleep 2
# Stop node
kill ${PID_PIPE}
kill ${PID_PROC}
# Stop node
kill ${PID_PIPE}
kill ${PID_PROC}
villas compare input.dat output.dat
villas compare input.dat output.dat
sed -i -e 's/'${MODE}'/MODE/g' config.json
sed -i -e 's/'${MODE}'/MODE/g' config.json
done

View file

@ -12,10 +12,10 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
kill -SIGTERM 0 # kill all decendants
kill -SIGTERM 0 # kill all decendants
}
trap finish EXIT
@ -23,40 +23,40 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > config.json <<EOF
{
"nodes": {
"node1": {
"type": "socket",
"in": {
"address": "127.0.0.1:12000",
"signals": {
"type": "float",
"count": 1
}
},
"out": {
"address": "127.0.0.1:12001"
}
},
"node2": {
"type": "socket",
"in": {
"address": "127.0.0.1:12001",
"signals": {
"type": "float",
"count": 1
}
},
"out": {
"address": "127.0.0.1:12000"
}
}
},
"paths": [
{
"in": "node1",
"out": "node1"
}
]
"nodes": {
"node1": {
"type": "socket",
"in": {
"address": "127.0.0.1:12000",
"signals": {
"type": "float",
"count": 1
}
},
"out": {
"address": "127.0.0.1:12001"
}
},
"node2": {
"type": "socket",
"in": {
"address": "127.0.0.1:12001",
"signals": {
"type": "float",
"count": 1
}
},
"out": {
"address": "127.0.0.1:12000"
}
}
},
"paths": [
{
"in": "node1",
"out": "node1"
}
]
}
EOF

View file

@ -14,8 +14,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -25,54 +25,54 @@ EOF
cat > config.json <<EOF
{
"nodes": {
"sig_1": {
"type": "signal.v2",
"nodes": {
"sig_1": {
"type": "signal.v2",
"limit": 1,
"limit": 1,
"initial_sequenceno": 99,
"initial_sequenceno": 99,
"in": {
"signals": [
{ "name": "const1", "signal": "constant", "amplitude": 1 },
{ "name": "const2", "signal": "constant", "amplitude": 2 },
{ "name": "const3", "signal": "constant", "amplitude": 3 }
]
}
},
"sig_2": {
"type": "signal.v2",
"in": {
"signals": [
{ "name": "const1", "signal": "constant", "amplitude": 1 },
{ "name": "const2", "signal": "constant", "amplitude": 2 },
{ "name": "const3", "signal": "constant", "amplitude": 3 }
]
}
},
"sig_2": {
"type": "signal.v2",
"limit": 1,
"limit": 1,
"initial_sequenceno": 123,
"initial_sequenceno": 123,
"in": {
"signals": [
{ "name": "const1", "signal": "constant", "amplitude": 11 },
{ "name": "const2", "signal": "constant", "amplitude": 12 },
{ "name": "const3", "signal": "constant", "amplitude": 13 }
]
}
},
"file_1": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": [
"sig_1.hdr.sequence",
"sig_2.hdr.sequence",
"sig_1.data[const3]",
"sig_2.data[const2]"
],
"out": "file_1",
"mode": "all"
}
]
"in": {
"signals": [
{ "name": "const1", "signal": "constant", "amplitude": 11 },
{ "name": "const2", "signal": "constant", "amplitude": 12 },
{ "name": "const3", "signal": "constant", "amplitude": 13 }
]
}
},
"file_1": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": [
"sig_1.hdr.sequence",
"sig_2.hdr.sequence",
"sig_1.data[const3]",
"sig_2.data[const2]"
],
"out": "file_1",
"mode": "all"
}
]
}
EOF

View file

@ -16,36 +16,36 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"nodes": {
"sig_1": {
"type": "signal",
"values": 1,
"signal": "counter",
"offset": 100,
"limit": 10
},
"file_1": {
"type": "file",
"uri": "output1.dat"
}
},
"paths": [
{
"in": "sig_1",
"out": "file_1"
},
{
"in": "sig_1",
"out": "file_1"
}
]
"nodes": {
"sig_1": {
"type": "signal",
"values": 1,
"signal": "counter",
"offset": 100,
"limit": 10
},
"file_1": {
"type": "file",
"uri": "output1.dat"
}
},
"paths": [
{
"in": "sig_1",
"out": "file_1"
},
{
"in": "sig_1",
"out": "file_1"
}
]
}
EOF

View file

@ -18,47 +18,47 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"nodes": {
"sig_1": {
"type": "signal",
"values": 1,
"signal": "counter",
"offset": 100,
"limit": 10,
"realtime": false
},
"file_1": {
"type": "file",
"uri": "output1.dat"
},
"file_2": {
"type": "file",
"uri": "output2.dat"
}
},
"paths": [
{
"in": "sig_1",
"out": "file_1"
},
{
"in": "sig_1",
"out": "file_2"
},
{
"in": "sig_1"
},
{
"in": "sig_1"
}
]
"nodes": {
"sig_1": {
"type": "signal",
"values": 1,
"signal": "counter",
"offset": 100,
"limit": 10,
"realtime": false
},
"file_1": {
"type": "file",
"uri": "output1.dat"
},
"file_2": {
"type": "file",
"uri": "output2.dat"
}
},
"paths": [
{
"in": "sig_1",
"out": "file_1"
},
{
"in": "sig_1",
"out": "file_2"
},
{
"in": "sig_1"
},
{
"in": "sig_1"
}
]
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -65,52 +65,52 @@ for MODE in all any; do
cat > config.json <<EOF
{
"nodes": {
"sig_1": {
"type": "signal",
"nodes": {
"sig_1": {
"type": "signal",
"signal": "counter",
"values": 1,
"offset": 0.0,
"rate": 10.0,
"limit": 20
},
"sig_2": {
"type": "signal",
"signal": "counter",
"values": 1,
"offset": 0.0,
"rate": 10.0,
"limit": 20
},
"sig_2": {
"type": "signal",
"signal": "counter",
"values": 1,
"offset": 10.0,
"amplitude": 10.0,
"rate": 5.0,
"limit": 10
},
"sig_3": {
"type": "signal",
"signal": "counter",
"values": 1,
"offset": 10.0,
"amplitude": 10.0,
"rate": 5.0,
"limit": 10
},
"sig_3": {
"type": "signal",
"signal": "counter",
"values": 1,
"offset": 100.0,
"amplitude": 100.0,
"rate": 2.0,
"limit": 10
},
"file_1": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": [
"sig_1.data[counter]",
"sig_2.data[counter]",
"sig_3.data[counter]"
],
"out": "file_1",
"mode": "${MODE}"
}
]
"signal": "counter",
"values": 1,
"offset": 100.0,
"amplitude": 100.0,
"rate": 2.0,
"limit": 10
},
"file_1": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": [
"sig_1.data[counter]",
"sig_2.data[counter]",
"sig_3.data[counter]"
],
"out": "file_1",
"mode": "${MODE}"
}
]
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -28,35 +28,35 @@ EOF
cat > config.json <<EOF
{
"nodes": {
"node_1": {
"type": "socket",
"nodes": {
"node_1": {
"type": "socket",
"in": {
"address": ":12000",
"in": {
"address": ":12000",
"signals": [
{ "name": "sig1", "init": 1234.0 },
{ "name": "sig2", "init": 5678.0 }
]
},
"out": {
"address": "127.0.0.1:12000"
}
},
"file_1": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": "node_1",
"out": "file_1",
"mode": "all",
"rate": 10
}
]
"signals": [
{ "name": "sig1", "init": 1234.0 },
{ "name": "sig2", "init": 5678.0 }
]
},
"out": {
"address": "127.0.0.1:12000"
}
},
"file_1": {
"type": "file",
"uri": "output.dat"
}
},
"paths": [
{
"in": "node_1",
"out": "file_1",
"mode": "all",
"rate": 10
}
]
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -21,45 +21,45 @@ RATE="33.0"
cat > config.json <<EOF
{
"nodes": {
"stats_1": {
"type": "stats",
"node": "signal_1",
"rate": 10.0,
"in": {
"signals": [
{ "name": "gap", "stats": "signal_1.gap_sent.mean" },
{ "name": "total", "stats": "signal_1.owd.total" }
]
}
},
"signal_1": {
"type": "signal",
"limit": 100,
"signal": "sine",
"rate": ${RATE},
"in": {
"hooks": [
{ "type": "stats", "verbose": true }
]
}
},
"stats_log_1": {
"type": "file",
"format": "json",
"nodes": {
"stats_1": {
"type": "stats",
"node": "signal_1",
"rate": 10.0,
"in": {
"signals": [
{ "name": "gap", "stats": "signal_1.gap_sent.mean" },
{ "name": "total", "stats": "signal_1.owd.total" }
]
}
},
"signal_1": {
"type": "signal",
"limit": 100,
"signal": "sine",
"rate": ${RATE},
"in": {
"hooks": [
{ "type": "stats", "verbose": true }
]
}
},
"stats_log_1": {
"type": "file",
"format": "json",
"uri": "stats.json"
}
},
"paths": [
{
"in": "signal_1"
},
{
"in": "stats_1",
"out": "stats_log_1"
}
]
"uri": "stats.json"
}
},
"paths": [
{
"in": "signal_1"
},
{
"in": "stats_1",
"out": "stats_log_1"
}
]
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -24,39 +24,39 @@ mkdir ./logs
cat > config.json <<EOF
{
"logging": { "level": 2 },
"stats": 1,
"nodes": {
"test": {
"type": "test_rtt",
"cooldown": 2,
"output": "./logs",
"cases": [
{
"rates": 55.0,
"values": 5,
"limit": 100
},
{
"rates": [ 10, 10, 1000 ],
"values": [ 2, 10, 20, 50 ],
"duration": 5
}
],
"hooks": [
{
"type": "stats",
"verbose": false
}
]
}
},
"paths": [
{
"in": "test",
"out": "test"
}
]
"logging": { "level": 2 },
"stats": 1,
"nodes": {
"test": {
"type": "test_rtt",
"cooldown": 2,
"output": "./logs",
"cases": [
{
"rates": 55.0,
"values": 5,
"limit": 100
},
{
"rates": [ 10, 10, 1000 ],
"values": [ 2, 10, 20, 50 ],
"duration": 5
}
],
"hooks": [
{
"type": "stats",
"verbose": false
}
]
}
},
"paths": [
{
"in": "test",
"out": "test"
}
]
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -23,25 +23,25 @@ VECTORIZE="10"
HOST="localhost"
if [ -n "${CI}" ]; then
HOST="rabbitmq"
HOST="rabbitmq"
else
HOST="[::1]"
HOST="[::1]"
fi
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "amqp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"nodes": {
"node1": {
"type": "amqp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"uri": "amqp://guest:guest@${HOST}:5672/%2f",
"uri": "amqp://guest:guest@${HOST}:5672/%2f",
"exchange": "mytestexchange",
"routing_key": "abc"
}
}
"exchange": "mytestexchange",
"routing_key": "abc"
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -22,16 +22,16 @@ FORMAT="villas.human"
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "exec",
"format": "${FORMAT}",
"nodes": {
"node1": {
"type": "exec",
"format": "${FORMAT}",
"shell": true,
"shell": true,
"exec": "tee /tmp/test"
}
}
"exec": "tee /tmp/test"
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -21,21 +21,21 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "file",
"nodes": {
"node1": {
"type": "file",
"uri": "file.dat",
"uri": "file.dat",
"in": {
"epoch_mode": "original",
"eof": "wait"
},
"out": {
"flush": true
}
}
}
"in": {
"epoch_mode": "original",
"eof": "wait"
},
"out": {
"flush": true
}
}
}
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -24,31 +24,31 @@ NUM_SAMPLES=${NUM_SAMPLES:-100}
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "iec61850-9-2",
"nodes": {
"node1": {
"type": "iec61850-9-2",
"interface": "lo",
"interface": "lo",
"out": {
"svid": "1234",
"signals": [
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" }
]
},
"in": {
"signals": [
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" }
]
}
}
}
"out": {
"svid": "1234",
"signals": [
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" }
]
},
"in": {
"signals": [
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" },
{ "iec_type": "float32" }
]
}
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -21,11 +21,11 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "loopback"
}
}
"nodes": {
"node1": {
"type": "loopback"
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -23,32 +23,32 @@ VECTORIZE="10"
HOST="localhost"
if [ -n "${CI}" ]; then
HOST="mosquitto"
HOST="mosquitto"
else
HOST="localhost"
HOST="localhost"
fi
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "mqtt",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"nodes": {
"node1": {
"type": "mqtt",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"username": "guest",
"password": "guest",
"host": "${HOST}",
"port": 1883,
"username": "guest",
"password": "guest",
"host": "${HOST}",
"port": 1883,
"out": {
"publish": "test-topic"
},
"in": {
"subscribe": "test-topic"
}
}
}
"out": {
"publish": "test-topic"
},
"in": {
"subscribe": "test-topic"
}
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -24,26 +24,26 @@ VECTORIZE="10"
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "nanomsg",
"nodes": {
"node1": {
"type": "nanomsg",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"in": {
"endpoints": [ "tcp://127.0.0.1:12000" ],
"in": {
"endpoints": [ "tcp://127.0.0.1:12000" ],
"signals": {
"type": "float",
"count": 5
}
},
"out": {
"endpoints": [ "tcp://127.0.0.1:12000" ]
}
}
}
"signals": {
"type": "float",
"count": 5
}
},
"out": {
"endpoints": [ "tcp://127.0.0.1:12000" ]
}
}
}
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
NUM_SAMPLES=${NUM_SAMPLES:-100}
@ -24,20 +24,20 @@ NUM_SAMPLES=${NUM_SAMPLES:-100}
HOST="localhost"
if [ -n "${CI}" ]; then
HOST="redis"
HOST="redis"
fi
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "redis",
"format": "protobuf",
"vectorize": 10,
"nodes": {
"node1": {
"type": "redis",
"format": "protobuf",
"vectorize": 10,
"uri": "tcp://${HOST}:6379/0"
}
}
"uri": "tcp://${HOST}:6379/0"
}
}
}
EOF

View file

@ -16,8 +16,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -29,66 +29,66 @@ NUM_SAMPLES=2000
cat > src.json << EOF
{
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": true,
"aimd": {
"a": 10,
"b": 0.5,
"hook_type": "decimate"
},
"in": {
"address": "0.0.0.0:12002",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12000"
}
}
}
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": true,
"aimd": {
"a": 10,
"b": 0.5,
"hook_type": "decimate"
},
"in": {
"address": "0.0.0.0:12002",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12000"
}
}
}
}
EOF
cat > dest.json << EOF
{
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": true,
"aimd": {
"a": 10,
"b": 0.5,
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": true,
"aimd": {
"a": 10,
"b": 0.5,
"hook_type": "decimate"
},
"in": {
"address": "0.0.0.0:12000",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12002"
}
}
}
"hook_type": "decimate"
},
"in": {
"address": "0.0.0.0:12000",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12002"
}
}
}
}
EOF

View file

@ -24,8 +24,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -37,36 +37,36 @@ NUM_SAMPLES=100
cat > src.json << EOF
{
"logging": {
"level": "debug"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"aimd": {
"a": 10,
"b": 0.5
},
"in": {
"address": "0.0.0.0:33466",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "${REMOTE_ADDR}:33464"
}
}
}
"logging": {
"level": "debug"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"aimd": {
"a": 10,
"b": 0.5
},
"in": {
"address": "0.0.0.0:33466",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "${REMOTE_ADDR}:33464"
}
}
}
}
EOF
@ -74,36 +74,36 @@ EOF
cat > dest.json << EOF
{
"logging": {
"level": "debug"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"aimd": {
"a": 10,
"b": 0.5
},
"in": {
"address": "0.0.0.0:33464",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "${LOCAL_ADDR}:33466"
}
}
}
"logging": {
"level": "debug"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"aimd": {
"a": 10,
"b": 0.5
},
"in": {
"address": "0.0.0.0:33464",
"signals": {
"count": 5,
"type": "float"
}
},
"out": {
"address": "${LOCAL_ADDR}:33466"
}
}
}
}
EOF

View file

@ -16,8 +16,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -30,69 +30,69 @@ NUM_VALUES=5
cat > src.json << EOF
{
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"aimd": {
"a": 10,
"b": 0.75,
"start_rate": ${RATE}
},
"in": {
"address": "0.0.0.0:12002",
"signals": {
"count": ${NUM_VALUES},
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12000",
"fwmark": 123
}
}
}
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"aimd": {
"a": 10,
"b": 0.75,
"start_rate": ${RATE}
},
"in": {
"address": "0.0.0.0:12002",
"signals": {
"count": ${NUM_VALUES},
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12000",
"fwmark": 123
}
}
}
}
EOF
cat > dest.json << EOF
{
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"in": {
"address": "0.0.0.0:12000",
"signals": {
"count": ${NUM_VALUES},
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12002"
}
}
}
"logging": {
"level": "info"
},
"nodes": {
"rtp_node": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rate": ${RATE},
"rtcp": {
"enabled": true,
"mode": "aimd",
"throttle_mode": "decimate"
},
"in": {
"address": "0.0.0.0:12000",
"signals": {
"count": ${NUM_VALUES},
"type": "float"
}
},
"out": {
"address": "127.0.0.1:12002"
}
}
}
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -28,40 +28,40 @@ NUM_SAMPLES=$((10*${RATE}))
cat > config.json << EOF
{
"logging": {
"level": "debug"
},
"nodes": {
"node1": {
"type": "rtp",
"logging": {
"level": "debug"
},
"nodes": {
"node1": {
"type": "rtp",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"rtcp": {
"enabled": true,
"throttle_mode": "limit_rate"
},
"rtcp": {
"enabled": true,
"throttle_mode": "limit_rate"
},
"aimd": {
"start_rate": 1,
"a": 10,
"b": 0.5
},
"aimd": {
"start_rate": 1,
"a": 10,
"b": 0.5
},
"in": {
"address": "127.0.0.1:12000",
"in": {
"address": "127.0.0.1:12000",
"signals": {
"type": "float",
"count": 5
}
},
"out": {
"address": "127.0.0.1:12000"
}
}
}
"signals": {
"type": "float",
"count": 5
}
},
"out": {
"address": "127.0.0.1:12000"
}
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -25,20 +25,20 @@ for VECTORIZE in 1 5; do
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "shmem",
"out": {
"name": "/villas-test"
},
"in": {
"name": "/villas-test"
},
"queuelen": 1024,
"mode": "${MODE}",
"vectorize": ${VECTORIZE}
}
}
"nodes": {
"node1": {
"type": "shmem",
"out": {
"name": "/villas-test"
},
"in": {
"name": "/villas-test"
},
"queuelen": 1024,
"mode": "${MODE}",
"vectorize": ${VECTORIZE}
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -21,26 +21,26 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > config.json << EOF
{
"nodes": {
"node1": {
"type" : "socket",
"format": "protobuf",
"nodes": {
"node1": {
"type" : "socket",
"format": "protobuf",
"in": {
"address": "*:12000",
"in": {
"address": "*:12000",
"multicast": {
"enabled": true,
"multicast": {
"enabled": true,
"group" : "224.1.2.3",
"loop" : true
}
},
"out": {
"address": "224.1.2.3:12000"
}
}
}
"group" : "224.1.2.3",
"loop" : true
}
},
"out": {
"address": "224.1.2.3:12000"
}
}
}
}
EOF

View file

@ -7,13 +7,13 @@
# SPDX-License-Identifier: Apache-2.0
if ! modprobe -aqn sch_prio sch_netem cls_fw; then
echo "Netem / TC kernel modules are missing"
exit 99
echo "Netem / TC kernel modules are missing"
exit 99
fi
if [[ "${EUID}" -ne 0 ]]; then
echo "Test requires root permissions"
exit 99
echo "Test requires root permissions"
exit 99
fi
set -e
@ -22,8 +22,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -31,25 +31,25 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > config.json << EOF
{
"nodes": {
"node1": {
"type" : "socket",
"format": "protobuf",
"nodes": {
"node1": {
"type" : "socket",
"format": "protobuf",
"in": {
"address": "*:12000"
},
"out": {
"address": "127.0.0.1:12000",
"netem": {
"enabled": true,
"delay": 100000,
"jitter": 30000,
"loss": 20
}
}
}
}
"in": {
"address": "*:12000"
},
"out": {
"address": "127.0.0.1:12000",
"netem": {
"enabled": true,
"delay": 100000,
"jitter": 30000,
"loss": 20
}
}
}
}
}
EOF

View file

@ -9,16 +9,16 @@
set -e
if [[ "${EUID}" -ne 0 ]]; then
echo "Test requires root permissions"
exit 99
echo "Test requires root permissions"
exit 99
fi
DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -31,50 +31,50 @@ for LAYER in udp ip eth unix; do
for VECTORIZE in ${VECTORIZES}; do
case ${LAYER} in
udp)
LOCAL="127.0.0.1:12000"
REMOTE="127.0.0.1:12000"
;;
udp)
LOCAL="127.0.0.1:12000"
REMOTE="127.0.0.1:12000"
;;
ip)
# We use IP protocol number 253 which is reserved for experimentation and testing according to RFC 3692
LOCAL="127.0.0.1:254"
REMOTE="127.0.0.1:254"
;;
ip)
# We use IP protocol number 253 which is reserved for experimentation and testing according to RFC 3692
LOCAL="127.0.0.1:254"
REMOTE="127.0.0.1:254"
;;
eth)
LOCAL="00:00:00:00:00:00%lo:34997"
REMOTE="00:00:00:00:00:00%lo:34997"
;;
eth)
LOCAL="00:00:00:00:00:00%lo:34997"
REMOTE="00:00:00:00:00:00%lo:34997"
;;
unix)
LOCAL=$(mktemp)
REMOTE=${LOCAL}
;;
unix)
LOCAL=$(mktemp)
REMOTE=${LOCAL}
;;
esac
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "socket",
"nodes": {
"node1": {
"type": "socket",
"vectorize": ${VECTORIZE},
"format": "${FORMAT}",
"layer": "${LAYER}",
"vectorize": ${VECTORIZE},
"format": "${FORMAT}",
"layer": "${LAYER}",
"out": {
"address": "${REMOTE}"
},
"in": {
"address": "${LOCAL}",
"signals": {
"count": ${NUM_VALUES},
"type": "float"
}
}
}
}
"out": {
"address": "${REMOTE}"
},
"in": {
"address": "${LOCAL}",
"signals": {
"count": ${NUM_VALUES},
"type": "float"
}
}
}
}
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -24,33 +24,33 @@ NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > config1.json << EOF
{
"http": {
"port": 8081
},
"nodes": {
"node1": {
"type": "websocket",
"http": {
"port": 8081
},
"nodes": {
"node1": {
"type": "websocket",
"destinations": [
"ws://127.0.0.1:8080/node2.protobuf"
],
"destinations": [
"ws://127.0.0.1:8080/node2.protobuf"
],
"wait_connected": true
}
}
"wait_connected": true
}
}
}
EOF
cat > config2.json << EOF
{
"http": {
"port": 8080
},
"nodes": {
"node2": {
"type": "websocket"
}
}
"http": {
"port": 8080
},
"nodes": {
"node2": {
"type": "websocket"
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -24,25 +24,25 @@ FORMAT="protobuf"
cat > config.json << EOF
{
"nodes": {
"node1": {
"type": "zeromq",
"nodes": {
"node1": {
"type": "zeromq",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"pattern": "pubsub",
"out": {
"publish": "tcp://127.0.0.1:12000"
},
"in": {
"subscribe": "tcp://127.0.0.1:12000",
"signals": {
"type": "float",
"count": 5
}
}
}
}
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},
"pattern": "pubsub",
"out": {
"publish": "tcp://127.0.0.1:12000"
},
"in": {
"subscribe": "tcp://127.0.0.1:12000",
"signals": {
"type": "float",
"count": 5
}
}
}
}
}
EOF

View file

@ -15,8 +15,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT
@ -27,33 +27,33 @@ NUM_SAMPLES=${NUM_SAMPLES:-20}
NUM_VALUES=${NUM_VALUES:-5}
case ${LAYER} in
unix)
LOCAL="/var/run/villas-node.server.sock"
REMOTE="/var/run/villas-node.client.sock"
;;
unix)
LOCAL="/var/run/villas-node.server.sock"
REMOTE="/var/run/villas-node.client.sock"
;;
udp)
LOCAL="*:12000"
REMOTE="127.0.0.1:12001"
;;
udp)
LOCAL="*:12000"
REMOTE="127.0.0.1:12001"
;;
esac
cat > config.json << EOF
{
"nodes": {
"py-client": {
"type": "socket",
"layer": "${LAYER}",
"format": "${FORMAT}",
"nodes": {
"py-client": {
"type": "socket",
"layer": "${LAYER}",
"format": "${FORMAT}",
"in": {
"address": "${LOCAL}"
},
"out": {
"address": "${REMOTE}"
}
}
}
"in": {
"address": "${LOCAL}"
},
"out": {
"address": "${REMOTE}"
}
}
}
}
EOF
@ -64,9 +64,9 @@ python3 ${SRCDIR}/clients/python/client.py unix &
# Wait for client to be ready
if [ "${LAYER}" = "unix" ]; then
while [ ! -S "${REMOTE}" ]; do
sleep 1
done
while [ ! -S "${REMOTE}" ]; do
sleep 1
done
fi
sleep 1

View file

@ -15,9 +15,9 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
kill ${PID_RELAY}
popd
rm -rf ${DIR}
kill ${PID_RELAY}
}
trap finish EXIT
@ -25,25 +25,25 @@ NUM_SAMPLES=100
cat > config.json << EOF
{
"nodes": {
"relay1": {
"type": "websocket",
"nodes": {
"relay1": {
"type": "websocket",
"wait_connected": true,
"wait_connected": true,
"destinations": [
"http://localhost:8123/node"
]
},
},
"relay2": {
"type": "websocket",
"type": "websocket",
"wait_connected": true,
"wait_connected": true,
"destinations": [
"http://localhost:8123/node"
]
}
}
}
}
}
EOF

View file

@ -12,8 +12,8 @@ DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
popd
rm -rf ${DIR}
}
trap finish EXIT

View file

@ -17,7 +17,7 @@ for CONFIG in ${CONFIGS}; do
[ "$(basename ${CONFIG})" == "paths.conf" ] ||
[ "$(basename ${CONFIG})" == "tricks.json" ] ||
[ "$(basename ${CONFIG})" == "tricks.conf" ] ||
[ "$(basename ${CONFIG})" == "vc707_ips.conf" ] ||
[ "$(basename ${CONFIG})" == "vc707_ips.conf" ] ||
[ "$(basename ${CONFIG})" == "infiniband.conf" ] ||
[ "$(basename ${CONFIG})" == "global.conf" ]; then
echo "=== Skipping config: ${CONFIG}"

View file

@ -26,30 +26,30 @@ TIMEOUT=${TIMEOUT:-1m}
# Parse command line arguments
while getopts ":f:l:t:vg" OPT; do
case ${OPT} in
f)
FILTER=${OPTARG}
;;
v)
VERBOSE=1
;;
l)
NUM_SAMPLES=${OPTARG}
;;
t)
TIMEOUT=${OPTARG}
;;
g)
FAIL_FAST=1
;;
\?)
echo "Invalid option: -${OPTARG}" >&2
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
case ${OPT} in
f)
FILTER=${OPTARG}
;;
v)
VERBOSE=1
;;
l)
NUM_SAMPLES=${OPTARG}
;;
t)
TIMEOUT=${OPTARG}
;;
g)
FAIL_FAST=1
;;
\?)
echo "Invalid option: -${OPTARG}" >&2
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
export VERBOSE
@ -69,64 +69,64 @@ TIMEDOUT=0
echo -e "Starting integration tests for VILLASnode:\n"
for TEST in ${TESTS}; do
TESTNAME=$(basename -s .sh ${TEST})
TESTNAME=$(basename -s .sh ${TEST})
# Start time measurement
START=$(date +%s.%N)
# Start time measurement
START=$(date +%s.%N)
# Run test
if (( ${VERBOSE} == 0 )); then
timeout ${TIMEOUT} ${TEST} &> ${LOGDIR}/${TESTNAME}.log
RC=$?
else
timeout ${TIMEOUT} ${TEST} | tee ${LOGDIR}/${TESTNAME}.log
RC=${PIPESTATUS[0]}
fi
# Run test
if (( ${VERBOSE} == 0 )); then
timeout ${TIMEOUT} ${TEST} &> ${LOGDIR}/${TESTNAME}.log
RC=$?
else
timeout ${TIMEOUT} ${TEST} | tee ${LOGDIR}/${TESTNAME}.log
RC=${PIPESTATUS[0]}
fi
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
# Show full log in case of an error
if (( ${VERBOSE} == 0 )); then
if (( $RC != 99 )) && (( $RC != 0 )); then
cat ${LOGDIR}/${TESTNAME}.log
fi
fi
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
case $RC in
0)
echo -e "\e[32m[PASS] \e[39m ${TESTNAME} (ran for ${DIFF}s)"
PASSED=$((${PASSED} + 1))
;;
99)
echo -e "\e[93m[SKIP] \e[39m ${TESTNAME}: $(head -n1 ${LOGDIR}/${TESTNAME}.log)"
SKIPPED=$((${SKIPPED} + 1))
;;
124)
echo -e "\e[33m[TIME] \e[39m ${TESTNAME} (ran for more then ${TIMEOUT})"
TIMEDOUT=$((${TIMEDOUT} + 1))
FAILED=$((${FAILED} + 1))
;;
*)
echo -e "\e[31m[FAIL] \e[39m ${TESTNAME} (exited with code $RC, ran for ${DIFF}s)"
FAILED=$((${FAILED} + 1))
;;
esac
# Show full log in case of an error
if (( ${VERBOSE} == 0 )); then
if (( $RC != 99 )) && (( $RC != 0 )); then
cat ${LOGDIR}/${TESTNAME}.log
fi
fi
TOTAL=$((${TOTAL} + 1))
case $RC in
0)
echo -e "\e[32m[PASS] \e[39m ${TESTNAME} (ran for ${DIFF}s)"
PASSED=$((${PASSED} + 1))
;;
99)
echo -e "\e[93m[SKIP] \e[39m ${TESTNAME}: $(head -n1 ${LOGDIR}/${TESTNAME}.log)"
SKIPPED=$((${SKIPPED} + 1))
;;
124)
echo -e "\e[33m[TIME] \e[39m ${TESTNAME} (ran for more then ${TIMEOUT})"
TIMEDOUT=$((${TIMEDOUT} + 1))
FAILED=$((${FAILED} + 1))
;;
*)
echo -e "\e[31m[FAIL] \e[39m ${TESTNAME} (exited with code $RC, ran for ${DIFF}s)"
FAILED=$((${FAILED} + 1))
;;
esac
if (( ${RC} != 0 && ${RC} != 99 && ${FAIL_FAST} > 0 )); then
break
fi
TOTAL=$((${TOTAL} + 1))
if (( ${RC} != 0 && ${RC} != 99 && ${FAIL_FAST} > 0 )); then
break
fi
done
# Show summary
if (( ${FAILED} > 0 )); then
echo -e "\nSummary: ${FAILED} of ${TOTAL} tests failed."
echo -e " Timedout: ${TIMEDOUT}"
echo -e " Skipped: ${SKIPPED}"
exit 1
echo -e "\nSummary: ${FAILED} of ${TOTAL} tests failed."
echo -e " Timedout: ${TIMEDOUT}"
echo -e " Skipped: ${SKIPPED}"
exit 1
else
echo -e "\nSummary: all tests passed!"
exit 0
echo -e "\nSummary: all tests passed!"
exit 0
fi

View file

@ -7,8 +7,8 @@
# SPDX-License-Identifier: Apache-2.0
if [ "$#" -ne 2 ]; then
echo "usage: $0 BUS:DEV:FNC DRIVER"
exit 1
echo "usage: $0 BUS:DEV:FNC DRIVER"
exit 1
fi
BDF=$1
@ -23,7 +23,7 @@ SYSFS_DRIVER=/sys/bus/pci/drivers/${DRIVER}
echo "Device: $VENDOR $DEVICE $BDF"
if [ -L "${SYSFS_DEVICE}/driver" ] && [ -d "${SYSFS_DEVICE}/driver" ]; then
echo ${BDF} > ${SYSFS_DEVICE}/driver/unbind
echo ${BDF} > ${SYSFS_DEVICE}/driver/unbind
fi
echo "${VENDOR} ${DEVICE}" > ${SYSFS_DRIVER}/new_id

View file

@ -9,6 +9,6 @@
IF=$1
for cmd in qdisc filter class; do
echo "======= $IF: $cmd ========"
tc -s -d -p $cmd show dev $IF
echo "======= $IF: $cmd ========"
tc -s -d -p $cmd show dev $IF
done

View file

@ -35,9 +35,9 @@ NETEM_REV=$NETEM
# Tools
TC=/sbin/tc
if [ "$LAYER" -eq "2" ]; then
NF=/sbin/ebtables
NF=/sbin/ebtables
elif [ "$LAYER" -eq "3" ]; then
NF=/sbin/iptables
NF=/sbin/iptables
fi
# Test permissions
@ -72,40 +72,40 @@ $TC qdisc add dev $DST_IF parent 4000:3 handle 4020 netem $NETEM
$TC filter add dev $DST_IF protocol ip handle 123 fw flowid 4000:3
if (( $REVERSE )); then
$NF -t nat -I PREROUTING $FILTER_REV -j mark --mark-set 124 --mark-target CONTINUE
$NF -t nat -I PREROUTING $FILTER_REV -j dnat --to-dst $SRC --dnat-target CONTINUE
$NF -t nat -I PREROUTING $FILTER_REV -j mark --mark-set 124 --mark-target CONTINUE
$NF -t nat -I PREROUTING $FILTER_REV -j dnat --to-dst $SRC --dnat-target CONTINUE
$NF -t nat -I POSTROUTING --mark 123 -j snat --to-src $MY
$NF -t nat -I POSTROUTING --mark 123 -j snat --to-src $MY
# Add classful qdisc to egress (outgoing) network device
$TC qdisc replace dev $SRC_IF root handle 4000 prio bands 4 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
$TC qdisc add dev $SRC_IF parent 4000:4 handle 4021 netem $NETEM_REV
$TC filter add dev $SRC_IF protocol ip handle 124 fw flowid 4000:4
# Add classful qdisc to egress (outgoing) network device
$TC qdisc replace dev $SRC_IF root handle 4000 prio bands 4 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
$TC qdisc add dev $SRC_IF parent 4000:4 handle 4021 netem $NETEM_REV
$TC filter add dev $SRC_IF protocol ip handle 124 fw flowid 4000:4
fi
echo -e "Successfully configured network emulation:\n"
echo -e "Netem Settings for $SRC ($SRC_IF) => $DST ($DST_IF):"
echo -e " $NETEM\n"
if (( $REVERSE )); then
echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):"
echo -e " $NETEM_REV"
echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):"
echo -e " $NETEM_REV"
fi
# Some debug and status output
if [ -n $DEBUG ]; then
if [ "$SRC_IF" == "$DST_IF" ]; then
IFNS="$SRC_IF"
else
IFNS="$SRC_IF $DST_IF"
fi
if [ "$SRC_IF" == "$DST_IF" ]; then
IFNS="$SRC_IF"
else
IFNS="$SRC_IF $DST_IF"
fi
for inf in $IFNS; do
for cmd in qdisc filter class; do
echo -e "\nTC ==> $if: $cmd"
tc -d -p $cmd show dev $inf
done
done
for inf in $IFNS; do
for cmd in qdisc filter class; do
echo -e "\nTC ==> $if: $cmd"
tc -d -p $cmd show dev $inf
done
done
echo -e "\nTABLES ==>"
$NF -t nat -L
echo -e "\nTABLES ==>"
$NF -t nat -L
fi

View file

@ -37,9 +37,9 @@ MARK=$RANDOM
# Tools
TC=/sbin/tc
if [ "$LAYER" -eq "2" ]; then
NF=/sbin/ebtables
NF=/sbin/ebtables
elif [ "$LAYER" -eq "3" ]; then
NF=/sbin/iptables
NF=/sbin/iptables
fi
# Test permissions
@ -82,24 +82,24 @@ echo -e "Successfully configured network emulation:"
echo -e "Netem Settings for $SRC ($SRC_IF) => $DST ($DST_IF):"
echo -e " $NETEM"
if (( $REVERSE )); then
echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):"
echo -e " $NETEM_REV"
echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):"
echo -e " $NETEM_REV"
fi
if [ -n $DEBUG ]; then
if [ "$SRC_IF" == "$DST_IF" ]; then
IFNS="$SRC_IF"
else
IFNS="$SRC_IF $DST_IF"
fi
if [ "$SRC_IF" == "$DST_IF" ]; then
IFNS="$SRC_IF"
else
IFNS="$SRC_IF $DST_IF"
fi
for inf in $IFNS; do
for cmd in qdisc filter class; do
echo -e "\nTC ==> $if: $cmd"
tc -d -p $cmd show dev $inf
done
done
for inf in $IFNS; do
for cmd in qdisc filter class; do
echo -e "\nTC ==> $if: $cmd"
tc -d -p $cmd show dev $inf
done
done
echo -e "\nTABLES ==>"
$NF -t nat -L
echo -e "\nTABLES ==>"
$NF -t nat -L
fi

View file

@ -3,16 +3,16 @@
# SPDX-License-Identifier: Apache-2.0
dnf -y --refresh install \
tuned-utils \
tuned-profiles-realtime
tuned-utils \
tuned-profiles-realtime
# Isolate half of the available cores by default
if [ -z "${ISOLATED_CORES}" ]; then
PROC=$(nproc)
ISOLATED_CORES=
if ((PROC > 4)); then
ISOLATED_CORES+=$(seq -s, $((PROC/2)) $((PROC-1)))
fi
PROC=$(nproc)
ISOLATED_CORES=
if ((PROC > 4)); then
ISOLATED_CORES+=$(seq -s, $((PROC/2)) $((PROC-1)))
fi
fi
echo isolated_cores=${ISOLATED_CORES} >> /etc/tuned/realtime-variables.conf

View file

@ -7,33 +7,33 @@
# SPDX-License-Identifier: Apache-2.0
function villas_format_supports_vectorize() {
local FORMAT=$1
local FORMAT=$1
case ${FORMAT} in
raw*) return 1 ;;
gtnet*) return 1 ;;
esac
case ${FORMAT} in
raw*) return 1 ;;
gtnet*) return 1 ;;
esac
return 0
return 0
}
function villas_format_supports_header() {
local FORMAT=$1
local FORMAT=$1
case $FORMAT in
raw*) return 1 ;;
gtnet) return 1 ;;
esac
case $FORMAT in
raw*) return 1 ;;
gtnet) return 1 ;;
esac
return 0
return 0
}
function colorize() {
RANDOM=${BASHPID}
echo -e "\x1b[0;$((31 + ${RANDOM} % 7))m$1\x1b[0m"
RANDOM=${BASHPID}
echo -e "\x1b[0;$((31 + ${RANDOM} % 7))m$1\x1b[0m"
}
function villas() {
VILLAS_LOG_PREFIX=${VILLAS_LOG_PREFIX:-$(colorize "[$1-$((${RANDOM} % 100))} ")} \
command villas $@
VILLAS_LOG_PREFIX=${VILLAS_LOG_PREFIX:-$(colorize "[$1-$((${RANDOM} % 100))} ")} \
command villas $@
}