-
Notifications
You must be signed in to change notification settings - Fork 0
/
free5gc.yml
101 lines (86 loc) · 2.71 KB
/
free5gc.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# - name: Stop 5g core (Ensure previous tested is not running)
# ansible.builtin.shell: systemctl restart free5gc
# register: output
# become: yes
# when:
# - inventory_hostname in groups["az_sut"]
# - ansible.builtin.debug:
# var: output
- name: Create logs directory
file:
state: directory
path: /tmp/core-tg
when:
- inventory_hostname in groups["az_trex"]
- name: Create folder for results on remote servers
file:
path: "/tmp/results/tool={{ tool }}/"
state: directory
become: yes
- name: Start the eBPF scripts to collect results
ansible.builtin.shell: python3 {{ tool_cmd }} > /tmp/results/tool={{ tool }}/{{ tool }}.json
args:
chdir: /home/{{ user }}/bcc/tools
executable: /bin/bash
async: "{{ aduration }}"
poll: 0
become: yes
when:
- inventory_hostname in groups["az_sut"]
- name: Sleep for 2 seconds (to load the eBPF programs) and continue with play
wait_for:
timeout: 2
delegate_to: localhost
- name: Start 5G core traffic generator
ansible.builtin.command:
cmd: ./.venv/bin/python3 run.py -u config/free5gc-ue.yaml -g config/free5gc-gnb.yaml -vv
chdir: /home/{{ user }}/core-tg
when:
- inventory_hostname in groups["az_trex"]
register: trex_command
async: "{{ aduration }}"
poll: 0
# become: yes
ignore_errors: yes
- name: Check on an async task for {{ tool }} (bpftrace)
async_status:
jid: "{{ trex_command.ansible_job_id }}"
when:
- inventory_hostname in groups["az_trex"]
register: job_result
until: job_result.finished
retries: 100
delay: 10
# become: yes
ignore_errors: yes
- name: Create folder for results on host machine
local_action:
module: file
path: ".results/ues={{ ues }}/tool={{ tool }}"
state: directory
- name: Fetch stuff from the remote and save to local
synchronize: src=/tmp/results/ dest=.results/ues={{ ues }} mode=pull
when:
- inventory_hostname in groups["az_sut"]
- file: path=/tmp/results state=absent
become: yes
when:
- inventory_hostname in groups["az_sut"]
# - name: Get results from tracing (bpftrace)
# ansible.builtin.command: journalctl -u free5gc -n 200
# register: tool_command_results
# when:
# - inventory_hostname in groups["az_sut"]
# - local_action: copy content="{{ tool_command_results.stdout }}" dest=.results/ues={{ ues }}/tool={{ tool }}/docker.log
# when:
# - inventory_hostname in groups["az_sut"]
- name: Fetch 5G Core traffic generator logs
synchronize: src=/tmp/core-tg/ dest=.results/ues={{ ues }}/tool={{ tool }} mode=pull
when:
- inventory_hostname in groups["az_trex"]
- name: Delete content & directory
file:
state: absent
path: /tmp/core-tg
when:
- inventory_hostname in groups["az_trex"]