forked from jafingerhut/p4-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunptf.sh
executable file
·71 lines (62 loc) · 1.74 KB
/
runptf.sh
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
66
67
68
69
70
71
#! /bin/bash
T="`realpath ../testlib`"
if [ x"${PYTHONPATH}" == "x" ]
then
P="${T}"
else
P="${T}:${PYTHONPATH}"
fi
#echo "P is: $P"
# Only show a list of tests
#ptf --pypath "$P" --test-dir ptf --list
#exit 0
set -x
p4c --target bmv2 \
--arch v1model \
--p4runtime-files demo2.p4_16.p4info.txtpb \
demo2.p4_16.p4
# Remove any log file written in an earlier run, otherwise
# simple_switch_grpc will append the new log messages to the end of
# the existing file.
/bin/rm -f ss-log.txt
sudo simple_switch_grpc \
--log-file ss-log \
--log-flush \
--dump-packet-data 10000 \
-i 0@veth0 \
-i 1@veth2 \
-i 2@veth4 \
-i 3@veth6 \
-i 4@veth8 \
-i 5@veth10 \
-i 6@veth12 \
-i 7@veth14 \
--no-p4 &
echo ""
echo "Started simple_switch_grpc. Waiting 2 seconds before starting PTF test ..."
sleep 2
# Note that the mapping between switch port number and Linux interface
# names is best to make it correspond with those given when starting
# the simple_switch_grpc process. The `ptf` process has no other way
# of getting this mapping other than by telling it on its command
# line.
sudo ${P4_EXTRA_SUDO_OPTS} `which ptf` \
--pypath "$P" \
-i 0@veth1 \
-i 1@veth3 \
-i 2@veth5 \
-i 3@veth7 \
-i 4@veth9 \
-i 5@veth11 \
-i 6@veth13 \
-i 7@veth15 \
--test-params="grpcaddr='localhost:9559';p4info='demo2.p4_16.p4info.txtpb';config='demo2.p4_16.json'" \
--test-dir ptf
echo ""
echo "PTF test finished. Waiting 2 seconds before killing simple_switch_grpc ..."
sleep 2
sudo pkill --signal 9 --list-name simple_switch
echo ""
echo "Verifying that there are no simple_switch_grpc processes running any longer in 4 seconds ..."
sleep 4
ps axguwww | grep simple_switch