Adding tests

/CoreOS/iperf3/Sanity/basic-SCTP
/CoreOS/iperf3/Sanity/basic-ssl
This commit is contained in:
František Hrdina 2023-03-17 11:19:35 +01:00
commit 85f0bc1ada
9 changed files with 336 additions and 0 deletions

View file

@ -0,0 +1,27 @@
summary: Tests SCTP support
description: ''
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1665142
tag:
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro < rhel-8
continue: false
contact: fhrdina@redhat.com
component:
- iperf3
test: ./runtest.sh
framework: beakerlib
recommend:
- iperf3
- kmod
- kernel-modules-extra
- psmisc
- nmap-ncat
duration: 5m
extra-nitrate: TC#0606326
extra-summary: /CoreOS/iperf3/Sanity/basic-SCTP
extra-task: /CoreOS/iperf3/Sanity/basic-SCTP

102
Sanity/basic-SCTP/runtest.sh Executable file
View file

@ -0,0 +1,102 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/iperf3/Sanity/basic-SCTP
# Description: Tests SCTP support
# Author: Patrik Mosko <pmosko@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2020 Red Hat, Inc.
#
# 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 2 of
# the License, or (at your option) 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="iperf3"
function find_free_port() {
for port in `seq $1 $2`; do
if ! nc -z localhost $port &>/dev/null; then
echo "$port"
return 0
fi
done
return 1
}
rlJournalStart
rlPhaseStartSetup
rlRun "rlCheckMakefileRequires"
rlRun -l "iperf3 --version"
rlRun "iperf3 --version | grep SCTP" 0 "iperf3 should be compiled with SCTP support"
# load SCTP kernel module
LSMOD_HASH="$(lsmod|cut -d\ -f1|sha256sum|cut -d\ -f1)"
LSMOD_OLD="$(lsmod|cut -d\ -f1)"
if ! lsmod | grep -q ^sctp; then
rlRun "modprobe sctp --first-time"
SCTP_LOADED="yes"
fi
rlPhaseEnd
#################### TEST PHASE ####################
rlPhaseStartTest "SCTP throughput tests"
rlWaitForCmd "killall $PACKAGE" -r 1 -m 10
PORT=`find_free_port 5201 65535`
rlRun "iperf3 -sDp $PORT" ;sleep 2
rlRun "taskset -cp \$(pidof iperf3)" 0 "Check whether iperf3-server is running"
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT --nstreams 2" ;sleep 1
rlRun "iperf3 --sctp -c localhost -p $PORT --nstreams 10" ;sleep 1
# add xbind tests
#rlRun "iperf3 --sctp -c localhost -p $PORT --xbind <arg>" ;sleep 1
#rlRun "iperf3 --sctp -c localhost -p $PORT --xbind <arg> --nstreams 5" ;sleep 1
# testing specific amount of bytes/blocks/time
# !!! max (65507) and min (16) are valid probably ONLY for UDP, rewrite for SCTP when available!!! (should be same as for TCP)
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT -n 1" ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT --bytes 100K" ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT -k 1" ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT --blockcount 100" ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT -n1 -k1" 1 ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT -t1 -k1" 1 ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT -t1 -n1" 1 ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT -n 2000 --length 1048577" 1 ;sleep 1
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT --bytes 100K --length 16" ;sleep 1
# beware all-angering RISC (ones' complement ?!?) architectures!!! (ppc*, s390*, aarch*)
if [ "$(rlGetPrimaryArch)" = "x86_64" ]; then
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT --bytes 200K --length -1" 1
else
rlRun "iperf3 --sctp -c 127.0.0.1 -p $PORT --bytes 200K --length 0xFFFFFFFFFFFFFFFF" 1
fi
rlRun "rlWatchdog \"iperf3 --sctp -c localhost -p $PORT -t0\" 30" 1 "option '-t0' should run forever so Watchdog should kill it!"
rlPhaseEnd
rlPhaseStartCleanup
rlWaitForCmd "killall $PACKAGE" -r 1 -m 10
[ -n "$SCTP_LOADED" ] && rlRun "modprobe -fr sctp" 0-255
if [ "$LSMOD_HASH" != "$(lsmod|cut -d\ -f1|sha256sum|cut -d\ -f1)" ]; then
diff <(echo "$LSMOD_OLD") <(lsmod | cut -d\ -f1)
rlLogWarning "Amount of kernel modules being loaded differs! (probably issue with removing SCTP module)"
fi
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

26
Sanity/basic-ssl/main.fmf Normal file
View file

@ -0,0 +1,26 @@
summary: Tests basic authentication/authorization capabilities of iperf3
description: ''
enabled: true
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1700497
tag:
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro < rhel-8
continue: false
contact: fhrdina@redhat.com
component:
- iperf3
test: ./runtest.sh
framework: beakerlib
recommend:
- iperf3
- openssl
- expect
- psmisc
duration: 5m
extra-nitrate: TC#0606327
extra-summary: /CoreOS/iperf3/Sanity/basic-ssl
extra-task: /CoreOS/iperf3/Sanity/basic-ssl

95
Sanity/basic-ssl/runtest.sh Executable file
View file

@ -0,0 +1,95 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/iperf3/Sanity/basic-ssl
# Description: Tests basic authentication/authorization capabilities of iperf3
# Author: Patrik Mosko <pmosko@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2020 Red Hat, Inc.
#
# 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 2 of
# the License, or (at your option) 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/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="iperf3"
: ${DEBUG_INFO:="no"}
rlJournalStart
rlPhaseStartSetup
rlRun "rlCheckMakefileRequires"
rlRun -l "iperf3 --version"
rlRun "iperf3 --version | grep authentication" 0 "iperf3 should be compiled with 'auth' support"
rlRun "log_client=\`mktemp\`" 0 "temporary file for storing output of iperf3 client"
rlRun "log_server=\`mktemp\`" 0 "temporary file for storing output of iperf3 server"
rlRun "auth_users=\`mktemp\`" 0 "temporary file for storing map of 'user,hash' values"
rlPhaseEnd
#################### TEST PHASE ####################
rlPhaseStartTest "openssl/crypto tests"
rlRun "pushd ssl_stuff"
rlWaitForCmd "killall $PACKAGE" -r 1 -m 10
# keys in directory 'ssl_stuff' have been generated as follows (example from `man iperf3`):
#rl1Run "openssl genrsa -out private.pem 2048"
#rlRun "openssl rsa -in private.pem -out public.pem -pubout -outform PEM"
#rlRun "openssl rsa -in private.pem -out private_no_enc.pem -outform PEM"
##debug
[ "$DEBUG_INFO" == "yes" ] && {
rlRun "openssl pkey -inform PEM -in public.pem -pubin -text -noout"
rlRun "openssl pkey -inform PEM -in private.pem -text -noout" -passin pass:shadowman
rlRun "openssl pkey -inform PEM -in private_no_enc.pem -text -noout"
}
# create a 'password file' with usernames and their hashes separated by commas
rlRun "touch auth_users" 0 "file storing pairs 'user,password_hash'"
_PASSWD="whats_good"
_USERS="pmosko psklenar omejzlik pdancak kzilkova"
for _u in $_USERS; do
rlRun "echo $_u,\$(echo -n \"{$_u}$_PASSWD\" | sha256sum | awk '{ print \$1 }') >> $auth_users"
done
rlRun -l "cat $auth_users" 0 "final database of users + their password hashes"
rlRun "iperf3 -sD --debug --rsa-private-key-path $(pwd)/private_no_enc.pem --authorized-users-path $auth_users --logfile $log_server"
for _user_ in $_USERS; do
> $log_server; > $log_client;
rlRun "expect password.expect $_user_ > $log_client"
rlRun -l "cat $log_server" 0 "cat logserver"
rlRun -l "cat $log_client" 0 "cat logfile"
if rlIsFedora '>=35'; then
succeeded_str="succeeded"
else
succeeded_str="successed"
fi
rlAssertGrep "Authentication $succeeded_str for user.*$_user_" $log_server -i
rlAssertNotGrep "iperf3: error - test authorization failed" $log_server
done
rlRun "popd"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "rm -r $log_client $log_server $auth_users" 0 "Removing tmp files"
rlWaitForCmd "killall $PACKAGE" -r 1 -m 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,5 @@
pmosko,69be581c601368d026088a1d71028e14e9c88bd9659334acd5a5b10d6694a985
psklenar,7bd3062c84caf6bed9ddf9c9c9d4bf5f18828c699e479248b6a7992166a28520
omejzlik,4626f0fa62cc30209415c5ce7fe4dd18fa5d3f059a85e9db65d3ca820e992025
pdancak,44456e5e35065e1312f9c64a30046a6dffac154d8fdc0363b49994fc40892e2c
kzilkova,a0753b7402dd28130be4026cfc7b5e60d4d214fe23c7861335acb52894eeda69

View file

@ -0,0 +1,15 @@
#!/usr/bin/expect
#exp_internal 1
log_user 1
set timeout 20
set _user_ [lindex $argv 0]
spawn iperf3 -c localhost --rsa-public-key-path public.pem -t3 --username $_user_
#puts "\$expect_out(buffer)"
expect -re "Password: "
send -- "whats_good\r"
expect

View file

@ -0,0 +1,30 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,DFA254ACEB474DE7
abmxwlOosy1dhpaI/64M9vgB+sXjdFaZtaWEd9M/EffkUwXrhMlCeJU9UCvBin85
etbSkSUtHwd8XTzZw+vJmhmC26K/XFwpuPOgyaA95pWcSwKnZBxaJAFiWQAO5dy3
xnMN7oZwXXX2xR6/nV4iMlxFAETAduMtca9cAxbrvWV1DNCL3PxRR/k0hjeH30GV
aD0q1mI+vu4Yb6/NX+iz28rXTilkZJTzrh8SkWGXdQ4+959SSiF6qgHKqv+w+ZWX
wE+e0+oMuWWR6YvP0cvIlVSGlyLXL5Aq6uYtojwhBh3RcHMB5fRyzWqlhx+J8CGK
Qxo9ipXt6YZo4aO1bs6A4jfH+QImuJUUOcYF7BPIv7QoWDGMDmYe8+naA0TbB5pi
UB9K01/KDE81GWARxQmVOtJEoEitJ1TpEfWxdY/9/4BRxH3/kfXNzGae0APUScSd
9GaJoL4xCX+mkMEElpj0DP5qO+u9fFdgfOxQUvgo5BZENuX5ItN3YC3I1UFfAWrX
F9tmGQKnmQ29zJd0JJx+PZ5m5nP4dUm813iwJ47H+S7Cihg5dbEBMLBTlfIVub6u
1kKoFDPvI5znJ68qe5DgVOsHtczNfwI29EoIXQxKrIiqzOaW1FENRxyHJxwD/pqB
3Fli8hI8oW4+8kwCsVuaL8c2rR5Th4CMDgzAB4mLe8A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