File tree Expand file tree Collapse file tree 5 files changed +41
-19
lines changed Expand file tree Collapse file tree 5 files changed +41
-19
lines changed Original file line number Diff line number Diff line change 1
- ---
2
-
3
1
# TODO: running on master node for now (fix to run on multiple nodes)
4
2
5
3
- set_fact :
70
68
when : inventory_hostname in groups['master_nodes']
71
69
become : true
72
70
73
- - name : Disable GRO flag on the {{ core.data_iface }} interface
74
- shell : ethtool -K {{ core.data_iface }} gro off
75
- when : inventory_hostname in groups['master_nodes']
76
- become : true
77
-
78
71
- name : find {{ core.data_iface }}'s netplan network directory
79
72
shell : basename $(find /*/systemd/network -maxdepth 1 -not -type d -name '*{{ core.data_iface }}.network' -print)
80
73
register : result
95
88
when : inventory_hostname in groups['master_nodes']
96
89
become : true
97
90
98
- - name : copy aether-ue-nat.service to {{ systemd_system_dir }}/aether-ue-nat.service
91
+ # Use Jinja template for `aether-ue-nat.service`
92
+ - name : Generate aether-ue-nat.service dynamically
99
93
template :
100
- src : roles/router/templates/systemd/aether-ue-nat.service
94
+ src : roles/router/templates/systemd/aether-ue-nat.service.j2
101
95
dest : " {{ systemd_system_dir }}/aether-ue-nat.service"
96
+ mode : " 0644"
102
97
when : inventory_hostname in groups['master_nodes']
103
98
become : true
104
99
122
117
when : inventory_hostname in groups['master_nodes']
123
118
become : true
124
119
125
- - name : restart systemd-networkd
120
+ - name : Restart systemd-networkd
126
121
systemd :
127
122
name : systemd-networkd
128
123
state : restarted
Original file line number Diff line number Diff line change @@ -8,6 +8,16 @@ Name=core
8
8
IPForward=yes
9
9
Address={{ core.upf.core_subnet }}
10
10
11
+ # Default UPF Route
11
12
[Route]
12
13
Gateway={{ core.upf.default_upf.ip.core }}
13
14
Destination={{ core.upf.default_upf.ue_ip_pool }}
15
+
16
+ # Additional UPFs - Dynamically Generated Routes
17
+ {% if core.upf.additional_upfs is defined and core.upf.additional_upfs %}
18
+ {% for upf in core.upf.additional_upfs.values() %}
19
+ [Route]
20
+ Gateway={{ upf.ip.core }}
21
+ Destination={{ upf.ue_ip_pool }}
22
+ {% endfor %}
23
+ {% endif %}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # Copyright 2022-present Open Networking Foundation
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ [Unit]
5
+ Description=Aether UE NAT Setup
6
+ After=network.target
7
+
8
+ [Service]
9
+ Type=oneshot
10
+ ExecStart=/bin/bash -c "\
11
+ sudo iptables -t nat -C POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
12
+ sudo iptables -t nat -A POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
13
+ {% if '1' in core .upf .additional_upfs %} \
14
+ sudo iptables -t nat -C POSTROUTING -s {{ core.upf.additional_upfs['1'] .ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
15
+ sudo iptables -t nat -A POSTROUTING -s {{ core.upf.additional_upfs['1'] .ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
16
+ {% endif %} \
17
+ {% if '2' in core .upf .additional_upfs %} \
18
+ sudo iptables -t nat -C POSTROUTING -s {{ core.upf.additional_upfs['2'] .ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || \
19
+ sudo iptables -t nat -A POSTROUTING -s {{ core.upf.additional_upfs['2'] .ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE; \
20
+ {% endif %} \
21
+ "
22
+
23
+ [Install]
24
+ WantedBy=multi-user.target
Original file line number Diff line number Diff line change 54
54
55
55
- name : configure route for upf traffic on gnbsim node
56
56
shell : |
57
+ ip route show | grep -q "{{ item.value.ue_ip_pool }} via {{ item.value.ip.core }}" || \
57
58
ip route add {{ item.value.ue_ip_pool }} via {{ item.value.ip.core }}
58
59
when : inventory_hostname in groups['master_nodes']
59
60
with_dict : " {{ core.upf.additional_upfs}}"
60
61
become : true
62
+
61
63
# ignore_errors: yes
You can’t perform that action at this time.
0 commit comments