Skip to content

Commit 9d15783

Browse files
authored
Merge pull request #32 from opennetworkinglab/subnets
Subnets
2 parents 7bdac81 + f4366c5 commit 9d15783

File tree

13 files changed

+49
-37
lines changed

13 files changed

+49
-37
lines changed

roles/core/tasks/install.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
# TODO: check if interface subnet is valid
1616
- set_fact:
1717
ran_subnet: "{{ result.stdout if (core.ran_subnet == '') else core.ran_subnet }}"
18+
access_gw: "{{ core.upf.access_subnet[:-3] }}"
19+
access_ip: "{{ core.upf.default_upf.ip.access + '/24' }}"
20+
core_gw: "{{ core.upf.core_subnet[:-3] }}"
21+
core_ip: "{{ core.upf.default_upf.ip.core + '/24' }}"
1822
when: inventory_hostname in groups['master_nodes']
1923

2024
- debug:
21-
var: "ran_subnet"
25+
var: ran_subnet
2226
when: inventory_hostname in groups['master_nodes']
2327

2428
- name: remove /tmp/sdcore-5g-values.yaml

roles/core/templates/radio-5g-values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ omec-user-plane:
223223
ipam: static
224224
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
225225
iface: {{ core.data_iface }}
226-
gateway: 192.168.252.1
227-
ip: {{ core.upf.default_upf.ip.access }}
226+
gateway: {{ access_gw }}
227+
ip: {{ access_ip }}
228228
core:
229229
ipam: static
230230
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
231231
iface: {{ core.data_iface }}
232-
gateway: 192.168.250.1
233-
ip: {{ core.upf.default_upf.ip.core }}
232+
gateway: {{ core_gw }}
233+
ip: {{ core_ip }}
234234
cfgFiles:
235235
upf.jsonc:
236236
mode: af_packet # This mode implies no DPDK

roles/core/templates/sdcore-5g-sriov-values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,15 @@ omec-user-plane:
330330
cniPlugin: vfioveth # Can be any other plugin. Dictates how IP address are assigned
331331
iface: {{ core.data_iface }}
332332
resourceName: "intel.com/intel_sriov_vfio_access"
333-
gateway: 192.168.252.1
334-
ip: {{ core.upf.default_upf.ip.access }}
333+
gateway: {{ access_gw }}
334+
ip: {{ access_ip }}
335335
core:
336336
ipam: static
337337
cniPlugin: vfioveth # Can be any other plugin. Dictates how IP address are assigned
338338
iface: {{ core.data_iface }}
339339
resourceName: "intel.com/intel_sriov_vfio_core"
340-
gateway: 192.168.250.1
341-
ip: {{ core.upf.default_upf.ip.core }}
340+
gateway: {{ core_gw }}
341+
ip: {{ core_ip }}
342342
cfgFiles:
343343
upf.jsonc:
344344
mode: dpdk

roles/core/templates/sdcore-5g-values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,14 @@ omec-user-plane:
328328
ipam: static
329329
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
330330
iface: {{ core.data_iface }}
331-
gateway: 192.168.252.1
332-
ip: {{ core.upf.default_upf.ip.access }}
331+
gateway: {{ access_gw }}
332+
ip: {{ access_ip }}
333333
core:
334334
ipam: static
335335
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
336336
iface: {{ core.data_iface }}
337-
gateway: 192.168.250.1
338-
ip: {{ core.upf.default_upf.ip.core }}
337+
gateway: {{ core_gw }}
338+
ip: {{ core_ip }}
339339
cfgFiles:
340340
upf.jsonc:
341341
mode: af_packet # This mode implies no DPDK

roles/router/tasks/uninstall.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
shell: |
111111
ip link del access || true
112112
ip link del core || true
113-
iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o {{ core.data_iface }} -j MASQUERADE || true
113+
iptables -t nat -D POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || true
114114
when: inventory_hostname in groups['master_nodes']
115115
become: true
116116
ignore_errors: yes

roles/router/templates/systemd/20-aether-access.network

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Name=access
66

77
[Network]
88
IPForward=yes
9-
Address=192.168.252.1/24
9+
Address={{ core.upf.access_subnet }}

roles/router/templates/systemd/20-aether-core.network

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Name=core
66

77
[Network]
88
IPForward=yes
9-
Address=192.168.250.1/24
9+
Address={{ core.upf.core_subnet }}
1010

1111
[Route]
12-
Gateway=192.168.250.3
13-
Destination=172.250.0.0/16
12+
Gateway={{ core.upf.default_upf.ip.core }}
13+
Destination={{ core.upf.default_upf.ue_ip_pool }}

roles/router/templates/systemd/aether-ue-nat.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[Service]
55
Type=oneshot
6-
ExecStart=/bin/bash -c "sudo iptables -t nat -C POSTROUTING -s 172.250.0.0/16 -o {{ core.data_iface }} -j MASQUERADE || sudo iptables -t nat -A POSTROUTING -s 172.250.0.0/16 -o {{ core.data_iface }} -j MASQUERADE"
6+
ExecStart=/bin/bash -c "sudo iptables -t nat -C POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || sudo iptables -t nat -A POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE"
77

88
[Install]
99
WantedBy=sys-subsystem-net-devices-core.device

roles/upf/defaults/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ core:
1111
additional_upfs:
1212
"1":
1313
ip:
14-
access: "192.168.252.6/24"
15-
core: "192.168.250.6/24"
14+
access: "192.168.252.6"
15+
core: "192.168.250.6"
1616
ue_ip_pool: "172.248.0.0/16"
1717
# "2":
1818
# ip:
19-
# access: "192.168.252.7/24"
20-
# core: "192.168.250.7/24"
21-
# ue_ip_pool: "172.248.0.0/16"
19+
# access: "192.168.252.7"
20+
# core: "192.168.250.7"
21+
# ue_ip_pool: "172.247.0.0/16"

roles/upf/tasks/install.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
dest: /tmp/upf-{{ item.key }}.yaml
2424
vars:
2525
ran_subnet: "{{ran_subnet}}"
26-
upf_access_ip: "{{ item.value.ip.access }}"
27-
upf_core_ip: "{{ item.value.ip.core }}"
26+
access_gw: "{{ core.upf.access_subnet[:-3] }}"
27+
core_gw: "{{ core.upf.core_subnet[:-3] }}"
28+
upf_access_ip: "{{ item.value.ip.access + '/24' }}"
29+
upf_core_ip: "{{ item.value.ip.core + '/24' }}"
2830
upf_ue_ip_pool: "{{ item.value.ue_ip_pool }}"
2931
with_dict: "{{ core.upf.additional_upfs}}"
3032
when: inventory_hostname in groups['master_nodes']
@@ -52,7 +54,7 @@
5254

5355
- name: configure route for upf traffic on gnbsim node
5456
shell: |
55-
ip route add {{ item.value.ue_ip_pool }} via {{ item.value.ip.core[:-3] }}
57+
ip route add {{ item.value.ue_ip_pool }} via {{ item.value.ip.core }}
5658
when: inventory_hostname in groups['master_nodes']
5759
with_dict: "{{ core.upf.additional_upfs}}"
5860
become: true

0 commit comments

Comments
 (0)