Skip to content

Commit 8558c59

Browse files
committed
Added test_packetcapture
1 parent 979d3d3 commit 8558c59

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#! /bin/bash
2+
3+
# packetcapture service test
4+
5+
source "${BASH_SOURCE%/*}/../helpers.bash"
6+
7+
set -e
8+
set -x
9+
10+
function cleanup {
11+
set +e
12+
delete_veth 2
13+
echo "FAIL"
14+
}
15+
trap cleanup EXIT
16+
17+
create_veth 2
18+
19+
# namespace ns1 -> veth1 10.0.0.1/24
20+
# namespace ns2 -> veth2 10.0.0.2/24
21+
polycubectl packetcapture add packetcapture_service capture=bidirectional #type=XDP_SKB
22+
polycubectl simplebridge add br1
23+
polycubectl br1 ports add toveth1
24+
polycubectl connect br1:toveth1 veth1
25+
polycubectl br1 ports add toveth2 peer=veth2
26+
sleep 2
27+
polycubectl attach packetcapture_service br1:toveth1
28+
29+
sudo ip netns exec ns1 ping 10.0.0.2 -c 1
30+
31+
rm -f $(polycubectl packetcapture_service show dump | cut -d ' ' -f 4-)
32+
33+
34+
polycubectl detach packetcapture_service br1:toveth1
35+
polycubectl del packetcapture_service
36+
polycubectl del br1
37+
delete_veth 2
38+
39+
set +x
40+
trap - EXIT
41+
echo "SUCCESS"

0 commit comments

Comments
 (0)