-
Notifications
You must be signed in to change notification settings - Fork 939
Expand file tree
/
Copy pathrunptf.sh
More file actions
executable file
·68 lines (56 loc) · 1.41 KB
/
runptf.sh
File metadata and controls
executable file
·68 lines (56 loc) · 1.41 KB
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
#!/bin/bash
# Run PTF tests for the basic forwarding exercise.
# Tests run against the solution P4 program.
set -e
BINDIR=$(realpath ../../bin)
sudo "${BINDIR}"/veth_setup.sh
set -x
# ---- compile ----
mkdir -p build
p4c --target bmv2 \
--arch v1model \
--p4runtime-files build/basic.p4info.txtpb \
-o build \
solution/basic.p4
/bin/rm -f ss-log.txt
# ---- start switch ----
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
# ---- run tests ----
sudo ${P4_EXTRA_SUDO_OPTS} `which ptf` \
-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='build/basic.p4info.txtpb';config='build/basic.json'" \
--test-dir ptf
echo ""
echo "PTF test finished. Waiting 2 seconds before killing simple_switch_grpc..."
sleep 2
# ---- cleanup ----
sudo pkill --signal 9 --list-name simple_switch
echo ""
echo "Cleaning up veth interfaces..."
sudo "${BINDIR}"/veth_teardown.sh
echo ""
echo "Verifying no simple_switch_grpc processes remain..."
sleep 2
ps axguwww | grep simple_switch