aboutsummaryrefslogtreecommitdiff
path: root/example/ipsec_crypto/odp_ipsec_crypto_run_live.sh
blob: 90dda11ecb2314cfa0a76218cd043bc6e304e13b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
# Live router test
#  - 2 interfaces interfaces
#  - Specify API mode on command line

# IPSEC_APP_MODE: 0 - STANDALONE, 1 - LIVE, 2 - ROUTER
IPSEC_APP_MODE=1

if  [ -f ./pktio_env ]; then
	. ./pktio_env
else
	echo "BUG: unable to find pktio_env!"
	echo "pktio_env has to be in current directory"
	exit 1
fi

setup_interfaces

# this just turns off output buffering so that you still get periodic
# output while piping to tee, as long as stdbuf is available.
STDBUF="`which stdbuf 2>/dev/null` -o 0" || STDBUF=
LOG=odp_ipsec_crypto_tmp.log
PID=app_pid

($STDBUF \
 ./odp_ipsec_crypto -i $IF0,$IF1 \
	-r 192.168.111.2/32,$IF0,$NEXT_HOP_MAC0 \
	-r 192.168.222.2/32,$IF1,$NEXT_HOP_MAC1 \
	-p 192.168.111.0/24,192.168.222.0/24,out,both \
	-e 192.168.111.2,192.168.222.2,\
	3des,201,656c8523255ccc23a66c1917aa0cf30991fce83532a4b224 \
	-a 192.168.111.2,192.168.222.2,md5,200,a731649644c5dee92cbd9c2e7e188ee6 \
	-p 192.168.222.0/24,192.168.111.0/24,in,both \
	-e 192.168.222.2,192.168.111.2,\
	3des,301,c966199f24d095f3990a320d749056401e82b26570320292 \
	-a 192.168.222.2,192.168.111.2,md5,300,27f6d123d7077b361662fc6e451f65d8 \
	-c 2 "$@" & echo $! > $PID) | tee -a $LOG &

APP_PID=`cat $PID`

# Wait till application thread starts.
APP_READY="Pktio thread \[..\] starts"

until [ -f $LOG ]
do
	sleep 1
done

tail -f $LOG | grep -qm 1 "$APP_READY"

validate_result
ret=$?

kill -2 ${APP_PID}

# Wait till the application exits
tail --pid=$APP_PID -f /dev/null

rm -f $PID
rm -f $LOG

cleanup_interfaces

exit $ret