• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3TST_TOTAL=1
4TCID="network_settings"
5
6cd $(dirname $0)
7export LTPROOT=${LTPROOT:-"$PWD"}
8echo $LTPROOT | grep -q testscripts
9if [ $? -eq 0 ]; then
10	cd ..
11	export LTPROOT=${PWD}
12fi
13
14. test_net.sh
15
16export TMPDIR=/tmp/netpan-$$
17mkdir -p $TMPDIR
18CMDFILE=${TMPDIR}/network.tests
19VERBOSE="no"
20
21export PATH="${PATH}:${LTPROOT}/testcases/bin"
22
23# Reset variables.
24# Don't break the tests which are using 'testcases/lib/cmdlib.sh'
25export TCID=
26export TST_LIB_LOADED=
27
28usage()
29{
30	echo "Usage: $0 OPTIONS"
31	echo "  -6    IPv6 tests"
32	echo "  -m    multicast tests"
33	echo "  -n    NFS tests"
34	echo "  -r    RPC tests"
35	echo "  -s    SCTP tests"
36	echo "  -t    TCP/IP command tests"
37	echo "  -a    Application tests (HTTP, SSH, DNS)"
38	echo "  -e    Interface stress tests"
39	echo "  -b    Stress tests with malformed ICMP packets"
40	echo "  -i    IPsec ICMP stress tests"
41	echo "  -T    IPsec TCP stress tests"
42	echo "  -U    IPsec UDP stress tests"
43	echo "  -R    route stress tests"
44	echo "  -M    multicast stress tests"
45	echo "  -F    network features tests (TFO, vxlan, etc.)"
46	echo "  -f x  where x is a runtest file"
47	echo "  -V|v  verbose"
48	echo "  -h    print this help"
49}
50
51TEST_CASES=
52
53while getopts 6mnrstaebiTURMFf:Vvh OPTION
54do
55	case $OPTION in
56	6) TEST_CASES="$TEST_CASES net.ipv6 net.ipv6_lib";;
57	m) TEST_CASES="$TEST_CASES net.multicast" ;;
58	n) TEST_CASES="$TEST_CASES net.nfs" ;;
59	r) TEST_CASES="$TEST_CASES net.rpc" ;;
60	s) TEST_CASES="$TEST_CASES net.sctp" ;;
61	t) TEST_CASES="$TEST_CASES net.tcp_cmds" ;;
62	a) TEST_CASES="$TEST_CASES net_stress.appl";;
63	e) TEST_CASES="$TEST_CASES net_stress.interface";;
64	b) TEST_CASES="$TEST_CASES net_stress.broken_ip";;
65	i) TEST_CASES="$TEST_CASES net_stress.ipsec_icmp";;
66	T) TEST_CASES="$TEST_CASES net_stress.ipsec_tcp";;
67	U) TEST_CASES="$TEST_CASES net_stress.ipsec_udp";;
68	R) TEST_CASES="$TEST_CASES net_stress.route";;
69	M) TEST_CASES="$TEST_CASES net_stress.multicast";;
70	F) TEST_CASES="$TEST_CASES net.features";;
71	f) TEST_CASES=${OPTARG} ;;
72	V|v) VERBOSE="yes";;
73	h) usage; exit 0 ;;
74	*) echo "Error: invalid option..."; usage; exit 1 ;;
75	esac
76done
77
78if [ "$OPTIND" -eq 1 ]; then
79	echo "Error: option is required"
80	usage
81	exit 1
82fi
83
84rm -f $CMDFILE
85
86for t in $TEST_CASES; do
87	cat  ${LTPROOT}/runtest/$t >> $CMDFILE
88done
89
90cd $TMPDIR
91
92if [ ${VERBOSE} = "yes" ]; then
93	echo "Network parameters:"
94	echo " - ${LHOST_IFACES} local interface (MAC address: ${LHOST_HWADDRS})"
95	echo " - ${RHOST_IFACES} remote interface (MAC address: ${RHOST_HWADDRS})"
96
97	cat $TMPDIR/network_stress.tests
98	${LTPROOT}/ver_linux
99	echo ""
100	echo ${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE
101fi
102
103${LTPROOT}/bin/ltp-pan -e -l /tmp/netpan.log -S -a ltpnet -n ltpnet -f $CMDFILE
104
105if [ $? -eq "0" ]; then
106	echo ltp-pan reported PASS
107else
108	echo ltp-pan reported FAIL
109fi
110