blob: 9486976dc8eb5429eb049546907c0a0bedcc6c8e [file] [log] [blame]
Alexey Kodanev18739ff2014-04-03 12:36:23 +04001#!/bin/sh
Alexey Kodanev592ac3c2015-07-01 19:28:46 +03002# Copyright (c) 2014-2015 Oracle and/or its affiliates. All Rights Reserved.
Alexey Kodanev18739ff2014-04-03 12:36:23 +04003#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License as
6# published by the Free Software Foundation; either version 2 of
7# the License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it would be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write the Free Software Foundation,
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
19#
20
21[ -z "$TST_LIB_LOADED" ] && . test.sh
22
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +030023init_ltp_netspace()
24{
25 if [ ! -f /var/run/netns/ltp_ns ]; then
26 ROD ip net add ltp_ns
27 ROD ip li add name ltp_ns_veth1 type veth peer name ltp_ns_veth2
28 ROD ip li set dev ltp_ns_veth1 netns ltp_ns
Alexey Kodanev0a55aff2016-12-21 00:07:46 +030029 ROD ip netns exec ltp_ns ip li set lo up
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +030030 fi
31
Petr Vorelf61ceb42017-01-23 15:02:58 +010032 LHOST_IFACES="${LHOST_IFACES:-ltp_ns_veth2}"
33 RHOST_IFACES="${RHOST_IFACES:-ltp_ns_veth1}"
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +030034
35 export TST_INIT_NETNS="no"
Petr Vorelf61ceb42017-01-23 15:02:58 +010036 export LTP_NETNS="${LTP_NETNS:-ip netns exec ltp_ns}"
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +030037
Alexey Kodanev3224c572017-01-19 19:37:56 +030038 tst_restore_ipaddr
39 tst_restore_ipaddr rhost
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +030040}
41
Alexey Kodanev18739ff2014-04-03 12:36:23 +040042# Run command on remote host.
43# Options:
44# -b run in background
45# -s safe option, if something goes wrong, will exit with TBROK
46# -c specify command to run
47
48tst_rhost_run()
49{
Alexey Kodanev18739ff2014-04-03 12:36:23 +040050 local pre_cmd=
Alexey Kodaneveb92f552015-02-06 12:14:48 +030051 local post_cmd=' || echo RTERR'
Alexey Kodanev18739ff2014-04-03 12:36:23 +040052 local out=
53 local user="root"
54 local cmd=
55 local safe=0
56
57 OPTIND=0
58
59 while getopts :bsc:u: opt; do
60 case "$opt" in
Alexey Kodanev6902dd92016-12-17 15:29:19 +030061 b) [ "$TST_USE_NETNS" ] && pre_cmd="" || pre_cmd="nohup"
62 post_cmd=" > /dev/null 2>&1 &"
63 out="1> /dev/null"
Alexey Kodanev18739ff2014-04-03 12:36:23 +040064 ;;
Alexey Kodaneveb92f552015-02-06 12:14:48 +030065 s) safe=1 ;;
Petr Vorelf61ceb42017-01-23 15:02:58 +010066 c) cmd="$OPTARG" ;;
67 u) user="$OPTARG" ;;
Alexey Kodanev6902dd92016-12-17 15:29:19 +030068 *) tst_brkm TBROK "tst_rhost_run: unknown option: $OPTARG" ;;
Alexey Kodanev18739ff2014-04-03 12:36:23 +040069 esac
70 done
71
72 OPTIND=0
73
Alexey Kodaneveb92f552015-02-06 12:14:48 +030074 if [ -z "$cmd" ]; then
75 [ "$safe" -eq 1 ] && \
76 tst_brkm TBROK "tst_rhost_run: command not defined"
77 tst_resm TWARN "tst_rhost_run: command not defined"
78 return 1
79 fi
Alexey Kodanev18739ff2014-04-03 12:36:23 +040080
81 local output=
Alexey Kodaneveb92f552015-02-06 12:14:48 +030082 local ret=0
Alexey Kodanev18739ff2014-04-03 12:36:23 +040083 if [ -n "$TST_USE_SSH" ]; then
84 output=`ssh -n -q $user@$RHOST "sh -c \
Alexey Kodaneveb92f552015-02-06 12:14:48 +030085 '$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +030086 elif [ -n "$TST_USE_NETNS" ]; then
87 output=`$LTP_NETNS sh -c \
88 "$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
Alexey Kodanev18739ff2014-04-03 12:36:23 +040089 else
90 output=`rsh -n -l $user $RHOST "sh -c \
Alexey Kodaneveb92f552015-02-06 12:14:48 +030091 '$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
Alexey Kodanev18739ff2014-04-03 12:36:23 +040092 fi
Alexey Kodaneveb92f552015-02-06 12:14:48 +030093 echo "$output" | grep -q 'RTERR$' && ret=1
94 if [ $ret -eq 1 ]; then
95 output=$(echo "$output" | sed 's/RTERR//')
96 [ "$safe" -eq 1 ] && \
97 tst_brkm TBROK "'$cmd' failed on '$RHOST': '$output'"
98 fi
Alexey Kodanev18739ff2014-04-03 12:36:23 +040099
100 [ -z "$out" -a -n "$output" ] && echo "$output"
101
102 return $ret
103}
Alexey Kodanev50c8ec32014-09-16 18:15:55 +0400104
105# Get test interface names for local/remote host.
106# tst_get_ifaces [TYPE]
107# TYPE: { lhost | rhost }; Default value is 'lhost'.
108tst_get_ifaces()
109{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100110 local type="${1:-lhost}"
Alexey Kodanev50c8ec32014-09-16 18:15:55 +0400111 if [ "$type" = "lhost" ]; then
112 echo "$LHOST_IFACES"
113 else
114 echo "$RHOST_IFACES"
115 fi
116}
117
118# Get HW addresses from defined test interface names.
119# tst_get_hwaddrs [TYPE]
120# TYPE: { lhost | rhost }; Default value is 'lhost'.
121tst_get_hwaddrs()
122{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100123 local type="${1:-lhost}"
Alexey Kodanev50c8ec32014-09-16 18:15:55 +0400124 local addr=
125 local list=
126
127 for eth in $(tst_get_ifaces $type); do
128
129 local addr_path="/sys/class/net/${eth}/address"
130
131 case $type in
132 lhost) addr=$(cat $addr_path) ;;
133 rhost) addr=$(tst_rhost_run -s -c "cat $addr_path")
134 esac
135
136 [ -z "$list" ] && list="$addr" || list="$list $addr"
137 done
138 echo "$list"
139}
140
141# Get test HW address.
142# tst_hwaddr [TYPE] [LINK]
143# TYPE: { lhost | rhost }; Default value is 'lhost'.
144# LINK: link number starting from 0. Default value is '0'.
145tst_hwaddr()
146{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100147 local type="${1:-lhost}"
148 local link_num="${2:-0}"
Alexey Kodanev50c8ec32014-09-16 18:15:55 +0400149 local hwaddrs=
150 link_num=$(( $link_num + 1 ))
151 [ "$type" = "lhost" ] && hwaddrs=$LHOST_HWADDRS || hwaddrs=$RHOST_HWADDRS
152 echo "$hwaddrs" | awk '{ print $'"$link_num"' }'
153}
154
155# Get test interface name.
156# tst_iface [TYPE] [LINK]
157# TYPE: { lhost | rhost }; Default value is 'lhost'.
158# LINK: link number starting from 0. Default value is '0'.
159tst_iface()
160{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100161 local type="${1:-lhost}"
162 local link_num="${2:-0}"
163 link_num="$(( $link_num + 1 ))"
Alexey Kodanev50c8ec32014-09-16 18:15:55 +0400164 echo "$(tst_get_ifaces $type)" | awk '{ print $'"$link_num"' }'
165}
Alexey Kodaneva9ed4f92014-09-23 14:15:04 +0400166
167# Blank for an IPV4 test; 6 for an IPV6 test.
168TST_IPV6=
169
170tst_read_opts()
171{
172 OPTIND=0
173 while getopts ":6" opt; do
174 case "$opt" in
175 6)
176 TST_IPV6=6;;
177 esac
178 done
179 OPTIND=0
180}
181
182tst_read_opts $*
Alexey Kodanev36bf9862014-09-23 17:49:02 +0400183
184# Get IP address
185# tst_ipaddr [TYPE]
186# TYPE: { lhost | rhost }; Default value is 'lhost'.
187tst_ipaddr()
188{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100189 local type="${1:-lhost}"
190 local ipv="${TST_IPV6:-4}"
Alexey Kodanev36bf9862014-09-23 17:49:02 +0400191 local tst_host=
192
193 if [ "$type" = "lhost" ]; then
194 eval "tst_host=\$LHOST_IPV${ipv}_HOST"
195 else
196 eval "tst_host=\$RHOST_IPV${ipv}_HOST"
197 fi
198
199 if [ "$TST_IPV6" ]; then
200 echo "${IPV6_NETWORK}:${tst_host}"
201 else
202 echo "${IPV4_NETWORK}.${tst_host}"
203 fi
204}
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400205
206# tst_init_iface [TYPE] [LINK]
207# TYPE: { lhost | rhost }; Default value is 'lhost'.
208# LINK: link number starting from 0. Default value is '0'.
209tst_init_iface()
210{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100211 local type="${1:-lhost}"
212 local link_num="${2:-0}"
213 local iface="$(tst_iface $type $link_num)"
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400214 tst_resm TINFO "initialize '$type' '$iface' interface"
215
216 if [ "$type" = "lhost" ]; then
Alexey Kodanev27c93022015-02-02 20:12:47 +0300217 ip link set $iface down || return $?
218 ip route flush dev $iface || return $?
219 ip addr flush dev $iface || return $?
220 ip link set $iface up
221 return $?
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400222 fi
223
Alexey Kodanev27c93022015-02-02 20:12:47 +0300224 tst_rhost_run -c "ip link set $iface down" || return $?
225 tst_rhost_run -c "ip route flush dev $iface" || return $?
226 tst_rhost_run -c "ip addr flush dev $iface" || return $?
227 tst_rhost_run -c "ip link set $iface up"
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400228}
229
230# tst_add_ipaddr [TYPE] [LINK]
231# TYPE: { lhost | rhost }; Default value is 'lhost'.
232# LINK: link number starting from 0. Default value is '0'.
233tst_add_ipaddr()
234{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100235 local type="${1:-lhost}"
236 local link_num="${2:-0}"
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400237
238 local mask=24
239 [ "$TST_IPV6" ] && mask=64
240
Alexey Kodanev910bcd22015-02-02 19:50:39 +0300241 local iface=$(tst_iface $type $link_num)
242
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400243 if [ $type = "lhost" ]; then
244 tst_resm TINFO "set local addr $(tst_ipaddr)/$mask"
Alexey Kodanev27c93022015-02-02 20:12:47 +0300245 ip addr add $(tst_ipaddr)/$mask dev $iface
246 return $?
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400247 fi
248
249 tst_resm TINFO "set remote addr $(tst_ipaddr rhost)/$mask"
Alexey Kodanev27c93022015-02-02 20:12:47 +0300250 tst_rhost_run -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400251}
252
253# tst_restore_ipaddr [TYPE] [LINK]
254# Restore default ip addresses defined in network.sh
255# TYPE: { lhost | rhost }; Default value is 'lhost'.
256# LINK: link number starting from 0. Default value is '0'.
257tst_restore_ipaddr()
258{
Petr Vorelf61ceb42017-01-23 15:02:58 +0100259 local type="${1:-lhost}"
260 local link_num="${2:-0}"
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400261
Alexey Kodanev27c93022015-02-02 20:12:47 +0300262 tst_init_iface $type $link_num || return $?
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400263
Alexey Kodanev27c93022015-02-02 20:12:47 +0300264 local ret=0
Alexey Kodanev910bcd22015-02-02 19:50:39 +0300265 local backup_tst_ipv6=$TST_IPV6
Alexey Kodanev27c93022015-02-02 20:12:47 +0300266 TST_IPV6= tst_add_ipaddr $type $link_num || ret=$?
267 TST_IPV6=6 tst_add_ipaddr $type $link_num || ret=$?
Alexey Kodanev910bcd22015-02-02 19:50:39 +0300268 TST_IPV6=$backup_tst_ipv6
Alexey Kodanev27c93022015-02-02 20:12:47 +0300269
270 return $ret
Alexey Kodanevd7dbcef2014-10-07 15:01:21 +0400271}
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300272
Alexey Kodanev1c6ed102015-08-24 23:15:59 +0300273# tst_netload ADDR [FILE] [TYPE] [OPTS]
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300274# Run network load test
275# ADDR: IP address
276# FILE: file with result time
277# TYPE: PING or TFO (TCP traffic)
Alexey Kodanev1c6ed102015-08-24 23:15:59 +0300278# OPTS: additional options
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300279tst_netload()
280{
281 local ip_addr="$1"
Petr Vorelf61ceb42017-01-23 15:02:58 +0100282 local rfile="${2:-netload.res}"
283 local type="${3:-TFO}"
284 local addopts="${@:4}"
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300285 local ret=0
Petr Vorelf61ceb42017-01-23 15:02:58 +0100286 clients_num="${clients_num:-2}"
287 client_requests="${client_requests:-500000}"
288 max_requests="${max_requests:-3}"
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300289
290 case "$type" in
291 PING)
292 local ipv6=
293 echo "$ip_addr" | grep ":" > /dev/null
294 [ $? -eq 0 ] && ipv6=6
295 tst_resm TINFO "run ping${ipv6} test with rhost '$ip_addr'..."
296 local res=
297 res=$(ping${ipv6} -f -c $client_requests $ip_addr -w 600 2>&1)
298 [ $? -ne 0 ] && return 1
299 echo $res | sed -nE 's/.*time ([0-9]+)ms.*/\1/p' > $rfile
300 ;;
301 TFO)
302 local port=
Petr Vorelf61ceb42017-01-23 15:02:58 +0100303 port="$(tst_rhost_run -c 'tst_get_unused_port ipv6 stream')"
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300304 [ $? -ne 0 ] && tst_brkm TBROK "failed to get unused port"
305
Alexey Kodanev85e298f2016-10-06 10:25:44 +0300306 tst_resm TINFO "run netstress with '$ip_addr', port '$port'"
307 tst_rhost_run -s -b -c "netstress -R $max_requests \
Alexey Kodanev1c6ed102015-08-24 23:15:59 +0300308 -g $port $addopts"
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300309
Alexey Kodanev85e298f2016-10-06 10:25:44 +0300310 # check that netstress on rhost in 'Listening' state
Alexey Kodanevf8d6f192015-08-24 19:53:12 +0300311 local sec_waited=
312 for sec_waited in $(seq 1 60); do
Alexey Kodanev02bbf722016-06-30 18:55:56 +0300313 tst_rhost_run -c "ss -lutn | grep -q $port" && break
Alexey Kodanevf8d6f192015-08-24 19:53:12 +0300314 if [ $sec_waited -eq 60 ]; then
315 tst_resm TINFO "rhost not in LISTEN state"
316 return 1
317 fi
318 sleep 1
319 done
320
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300321 # run local tcp client
Alexey Kodanev85e298f2016-10-06 10:25:44 +0300322 netstress -a $clients_num -r $client_requests -l -H $ip_addr\
Alexey Kodanev6902dd92016-12-17 15:29:19 +0300323 -g $port -d $rfile $addopts || ret=1
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300324
325 if [ $ret -eq 0 -a ! -f $rfile ]; then
326 tst_brkm TBROK "can't read $rfile"
327 fi
328
Alexey Kodanev85e298f2016-10-06 10:25:44 +0300329 tst_rhost_run -c "pkill -9 netstress\$"
Alexey Kodanev592ac3c2015-07-01 19:28:46 +0300330 ;;
331 *) tst_brkm TBROK "invalid net_load type '$type'" ;;
332 esac
333
334 return $ret
335}
Hangbin Liu6c42b442016-04-27 20:54:34 +0800336
337# tst_ping [IFACE] [DST ADDR] [MESSAGE SIZE ARRAY]
338# Check icmp connectivity
339# IFACE: source interface name
340# DST ADDR: destination IPv4 or IPv6 address
341# MESSAGE SIZE ARRAY: message size array
342tst_ping()
343{
344 # The max number of ICMP echo request
Petr Vorelf61ceb42017-01-23 15:02:58 +0100345 PING_MAX="${PING_MAX:-500}"
Hangbin Liu6c42b442016-04-27 20:54:34 +0800346
Petr Vorelf61ceb42017-01-23 15:02:58 +0100347 local src_iface="${1:-$(tst_iface)}"
348 local dst_addr="${2:-$(tst_ipaddr rhost)}"; shift 2
349 local msg_sizes="$@"
Hangbin Liu6c42b442016-04-27 20:54:34 +0800350 local ret=0
351
352 # ping cmd use 56 as default message size
353 for size in ${msg_sizes:-"56"}; do
354 ping$TST_IPV6 -I $src_iface -c $PING_MAX $dst_addr \
Alexey Kodanev9272a232016-09-30 21:32:17 +0300355 -s $size -i 0 > /dev/null 2>&1
Hangbin Liu6c42b442016-04-27 20:54:34 +0800356 ret=$?
357 if [ $ret -eq 0 ]; then
358 tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size pass"
359 else
360 tst_resm TINFO "tst_ping IPv${TST_IPV6:-4} msg_size $size fail"
361 break
362 fi
363 done
364 return $ret
365}
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300366
367# Management Link
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +0300368[ -z "$RHOST" ] && TST_USE_NETNS="yes"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300369export RHOST="$RHOST"
Petr Vorelf61ceb42017-01-23 15:02:58 +0100370export PASSWD="${PASSWD:-}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300371# Don't use it in new tests, use tst_rhost_run() from test_net.sh instead.
Petr Vorelf61ceb42017-01-23 15:02:58 +0100372export LTP_RSH="${LTP_RSH:-rsh -n}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300373
374# Test Links
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300375# Set first three octets of the network address, default is '10.0.0'
Petr Vorelf61ceb42017-01-23 15:02:58 +0100376export IPV4_NETWORK="${IPV4_NETWORK:-10.0.0}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300377# Set local host last octet, default is '2'
Petr Vorelf61ceb42017-01-23 15:02:58 +0100378export LHOST_IPV4_HOST="${LHOST_IPV4_HOST:-2}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300379# Set remote host last octet, default is '1'
Petr Vorelf61ceb42017-01-23 15:02:58 +0100380export RHOST_IPV4_HOST="${RHOST_IPV4_HOST:-1}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300381# Set the reverse of IPV4_NETWORK
Petr Vorelf61ceb42017-01-23 15:02:58 +0100382export IPV4_NET_REV="${IPV4_NET_REV:-0.0.10}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300383# Set first three octets of the network address, default is 'fd00:1:1:1'
Petr Vorelf61ceb42017-01-23 15:02:58 +0100384export IPV6_NETWORK="${IPV6_NETWORK:-fd00:1:1:1}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300385# Set local host last octet, default is '2'
Petr Vorelf61ceb42017-01-23 15:02:58 +0100386export LHOST_IPV6_HOST="${LHOST_IPV6_HOST:-:2}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300387# Set remote host last octet, default is '1'
Petr Vorelf61ceb42017-01-23 15:02:58 +0100388export RHOST_IPV6_HOST="${RHOST_IPV6_HOST:-:1}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300389# Reverse network portion of the IPv6 address
Petr Vorelf61ceb42017-01-23 15:02:58 +0100390export IPV6_NET_REV="${IPV6_NET_REV:-1.0.0.0.1.0.0.0.1.0.0.0.0.0.d.f}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300391# Reverse host portion of the IPv6 address of the local host
Petr Vorelf61ceb42017-01-23 15:02:58 +0100392export LHOST_IPV6_REV="${LHOST_IPV6_REV:-2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300393# Reverse host portion of the IPv6 address of the remote host
Petr Vorelf61ceb42017-01-23 15:02:58 +0100394export RHOST_IPV6_REV="${RHOST_IPV6_REV:-1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300395
396# Networks that aren't reachable through the test links
Petr Vorelf61ceb42017-01-23 15:02:58 +0100397export IPV4_NET16_UNUSED="${IPV4_NET16_UNUSED:-10.23}"
398export IPV6_NET32_UNUSED="${IPV6_NET32_UNUSED:-fd00:23}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300399
Petr Vorelf61ceb42017-01-23 15:02:58 +0100400export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
401export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
402export FTP_UPLOAD_DIR="${FTP_UPLOAD_DIR:-/var/ftp/pub}"
403export FTP_UPLOAD_URLDIR="${FTP_UPLOAD_URLDIR:-pub}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300404
405# network/stress tests require additional parameters
Petr Vorelf61ceb42017-01-23 15:02:58 +0100406export NS_DURATION="${NS_DURATION:-3600}"
407export NS_TIMES="${NS_TIMES:-10000}"
408export CONNECTION_TOTAL="${CONNECTION_TOTAL:-4000}"
409export IP_TOTAL="${IP_TOTAL:-10000}"
410export IP_TOTAL_FOR_TCPIP="${IP_TOTAL_FOR_TCPIP:-100}"
411export ROUTE_TOTAL="${ROUTE_TOTAL:-10000}"
412export MTU_CHANGE_TIMES="${MTU_CHANGE_TIMES:-1000}"
413export IF_UPDOWN_TIMES="${IF_UPDOWN_TIMES:-10000}"
414export DOWNLOAD_BIGFILESIZE="${DOWNLOAD_BIGFILESIZE:-2147483647}"
415export DOWNLOAD_REGFILESIZE="${DOWNLOAD_REGFILESIZE:-1048576}"
416export UPLOAD_BIGFILESIZE="${UPLOAD_BIGFILESIZE:-2147483647}"
417export UPLOAD_REGFILESIZE="${UPLOAD_REGFILESIZE:-1024}"
418export MCASTNUM_NORMAL="${MCASTNUM_NORMAL:-20}"
419export MCASTNUM_HEAVY="${MCASTNUM_HEAVY:-40000}"
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300420
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +0300421[ -n "$TST_USE_NETNS" -a "$TST_INIT_NETNS" != "no" ] && init_ltp_netspace
422
423# Warning: make sure to set valid interface names and IP addresses below.
424# Set names for test interfaces, e.g. "eth0 eth1"
Petr Vorelf61ceb42017-01-23 15:02:58 +0100425export LHOST_IFACES="${LHOST_IFACES:-eth0}"
426export RHOST_IFACES="${RHOST_IFACES:-eth0}"
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +0300427# Set corresponding HW addresses, e.g. "00:00:00:00:00:01 00:00:00:00:00:02"
Petr Vorelf61ceb42017-01-23 15:02:58 +0100428export LHOST_HWADDRS="${LHOST_HWADDRS:-$(tst_get_hwaddrs lhost)}"
429export RHOST_HWADDRS="${RHOST_HWADDRS:-$(tst_get_hwaddrs rhost)}"
Alexey Kodanev5f8ca6c2016-11-11 18:44:08 +0300430
Alexey Kodanev6538f7a2016-05-06 15:52:44 +0300431# More information about network parameters can be found
432# in the following document: testcases/network/stress/README