1
- name : Basic Checks
1
+ name : ci
2
2
3
3
on :
4
4
push :
8
8
workflow_dispatch :
9
9
10
10
jobs :
11
- build :
11
+ docker- build :
12
12
runs-on : ubuntu-latest
13
-
14
13
steps :
15
- - name : Set up Python
16
- uses : actions/setup-python@v2
17
- with :
18
- python-version : " 3.10"
19
-
20
- - name : Checkout repo
14
+ - name : Checkout traffic-reproducer
21
15
uses : actions/checkout@v4
22
16
with :
17
+ path : traffic-reproducer
23
18
submodules : recursive
24
19
25
- - name : Install dependencies
20
+ - name : Build traffic-reproducer container
21
+ shell : bash
26
22
run : |
27
- pip install -r requirements.txt
28
-
29
- - name : Set up loopback interfaces
30
- run : |
31
- sudo ifconfig lo:1 192.168.100.1 up
32
- sudo ifconfig lo:2 192.168.100.2 up
23
+ cd traffic-reproducer
24
+ docker build -t traffic-reproducer:latest -f docker/Dockerfile .
33
25
34
- - name : Start Listener
26
+ - name : Save image as artifact
27
+ shell : bash
35
28
run : |
36
- touch nc_output.txt
37
- (nc -u -l -k 9991 | hexdump -C > nc_output.txt & echo $! > listener_pid.txt) &
38
- echo "$!" > listener_pid.txt
39
- sleep 5s
40
- echo "Listener PID:"
41
- cat listener_pid.txt
42
- echo "Listener Output:"
43
- cat nc_output.txt
29
+ mkdir -p /tmp/docker/
30
+ docker save -o /tmp/docker/traffic_reproducer_docker_image.tar traffic-reproducer:latest
44
31
45
- - name : Debug IP Configuration
46
- run : |
47
- ip a
48
-
49
- - name : Run main.py
50
- run : |
51
- sudo env PATH="$PATH" python main.py -v -t examples/ipfix-traffic.yml
32
+ - name : Upload Artifacts
33
+ uses : actions/upload-artifact@v4
34
+ with :
35
+ retention-days : 7
36
+ name : traffic_reproducer_docker_image
37
+ path : /tmp/docker
52
38
53
- - name : Stop Listener
54
- run : |
55
- pid=$(cat listener_pid.txt)
56
- sudo kill -SIGINT $pid
57
- sleep 5s
58
- echo "Listener Output:"
59
- cat nc_output.txt
39
+ # TODO idea: send all messages from all examples and then do some basic check on collector logs / print files (no warnings, no error, line counts, etc...)
60
40
61
- - name : Preprocess Hexdump Output
62
- run : |
63
- awk '{print substr($0, 11, 47)}' nc_output.txt | tr -d ' \n' > nc_output_cleaned.txt
64
- echo "Listener Output Cleaned:"
65
- cat nc_output_cleaned.txt
41
+ regression-tests :
42
+ runs-on : ubuntu-latest
43
+ needs : docker-build
44
+ steps :
45
+ - name : Download Artifacts
46
+ uses : actions/download-artifact@v4
47
+ with :
48
+ pattern : ' *_docker_images'
49
+ path : /tmp/docker
66
50
67
- - name : Count Packets
51
+ - name : Import images in the local registry
68
52
run : |
69
- packet_count=$(grep -o '000a' nc_output_cleaned.txt | wc -l)
70
- echo $packet_count > packet_count.txt
53
+ docker load -i /tmp/docker/traffic_reproducer_docker_image/traffic_reproducer_docker_image.tar
54
+ echo "List Images"
55
+ docker images | grep 'traffic-reproducer'
71
56
72
- - name : Check Packet Count
57
+ - name : Run traffic-reproducer container
73
58
run : |
74
- packet_count=$(cat packet_count.txt)
75
- echo "Packet Count: $packet_count"
76
- if [ "$packet_count" -eq 6 ]; then
77
- echo "Success: 6 packets received."
78
- else
79
- echo "Error: Expected 6 packets but found $packet_count."
80
- exit 1
81
- fi
59
+ docker run --rm --name traffic-reproducer traffic-reproducer:latest
0 commit comments