Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subnets #32

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion roles/core/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
# TODO: check if interface subnet is valid
- set_fact:
ran_subnet: "{{ result.stdout if (core.ran_subnet == '') else core.ran_subnet }}"
access_gw: "{{ core.upf.access_subnet[:-3] }}"
access_ip: "{{ core.upf.default_upf.ip.access + '/24' }}"
core_gw: "{{ core.upf.core_subnet[:-3] }}"
core_ip: "{{ core.upf.default_upf.ip.core + '/24' }}"
when: inventory_hostname in groups['master_nodes']

- debug:
var: "ran_subnet"
var: ran_subnet
when: inventory_hostname in groups['master_nodes']

- name: remove /tmp/sdcore-5g-values.yaml
Expand Down
8 changes: 4 additions & 4 deletions roles/core/templates/radio-5g-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ omec-user-plane:
ipam: static
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
gateway: 192.168.252.1
ip: {{ core.upf.default_upf.ip.access }}
gateway: {{ access_gw }}
ip: {{ access_ip }}
core:
ipam: static
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
gateway: 192.168.250.1
ip: {{ core.upf.default_upf.ip.core }}
gateway: {{ core_gw }}
ip: {{ core_ip }}
cfgFiles:
upf.jsonc:
mode: af_packet # This mode implies no DPDK
Expand Down
8 changes: 4 additions & 4 deletions roles/core/templates/sdcore-5g-sriov-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,15 @@ omec-user-plane:
cniPlugin: vfioveth # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
resourceName: "intel.com/intel_sriov_vfio_access"
gateway: 192.168.252.1
ip: {{ core.upf.default_upf.ip.access }}
gateway: {{ access_gw }}
ip: {{ access_ip }}
core:
ipam: static
cniPlugin: vfioveth # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
resourceName: "intel.com/intel_sriov_vfio_core"
gateway: 192.168.250.1
ip: {{ core.upf.default_upf.ip.core }}
gateway: {{ core_gw }}
ip: {{ core_ip }}
cfgFiles:
upf.jsonc:
mode: dpdk
Expand Down
8 changes: 4 additions & 4 deletions roles/core/templates/sdcore-5g-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ omec-user-plane:
ipam: static
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
gateway: 192.168.252.1
ip: {{ core.upf.default_upf.ip.access }}
gateway: {{ access_gw }}
ip: {{ access_ip }}
core:
ipam: static
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
gateway: 192.168.250.1
ip: {{ core.upf.default_upf.ip.core }}
gateway: {{ core_gw }}
ip: {{ core_ip }}
cfgFiles:
upf.jsonc:
mode: af_packet # This mode implies no DPDK
Expand Down
2 changes: 1 addition & 1 deletion roles/router/tasks/uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
shell: |
ip link del access || true
ip link del core || true
iptables -t nat -D POSTROUTING -s 172.250.0.0/16 -o {{ core.data_iface }} -j MASQUERADE || true
iptables -t nat -D POSTROUTING -s {{ core.upf.default_upf.ue_ip_pool }} -o {{ core.data_iface }} -j MASQUERADE || true
when: inventory_hostname in groups['master_nodes']
become: true
ignore_errors: yes
Expand Down
2 changes: 1 addition & 1 deletion roles/router/templates/systemd/20-aether-access.network
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Name=access

[Network]
IPForward=yes
Address=192.168.252.1/24
Address={{ core.upf.access_subnet }}
6 changes: 3 additions & 3 deletions roles/router/templates/systemd/20-aether-core.network
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Name=core

[Network]
IPForward=yes
Address=192.168.250.1/24
Address={{ core.upf.core_subnet }}

[Route]
Gateway=192.168.250.3
Destination=172.250.0.0/16
Gateway={{ core.upf.default_upf.ip.core }}
Destination={{ core.upf.default_upf.ue_ip_pool }}
2 changes: 1 addition & 1 deletion roles/router/templates/systemd/aether-ue-nat.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[Service]
Type=oneshot
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"
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"

[Install]
WantedBy=sys-subsystem-net-devices-core.device
10 changes: 5 additions & 5 deletions roles/upf/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ core:
additional_upfs:
"1":
ip:
access: "192.168.252.6/24"
core: "192.168.250.6/24"
access: "192.168.252.6"
core: "192.168.250.6"
ue_ip_pool: "172.248.0.0/16"
# "2":
# ip:
# access: "192.168.252.7/24"
# core: "192.168.250.7/24"
# ue_ip_pool: "172.248.0.0/16"
# access: "192.168.252.7"
# core: "192.168.250.7"
# ue_ip_pool: "172.247.0.0/16"
8 changes: 5 additions & 3 deletions roles/upf/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
dest: /tmp/upf-{{ item.key }}.yaml
vars:
ran_subnet: "{{ran_subnet}}"
upf_access_ip: "{{ item.value.ip.access }}"
upf_core_ip: "{{ item.value.ip.core }}"
access_gw: "{{ core.upf.access_subnet[:-3] }}"
core_gw: "{{ core.upf.core_subnet[:-3] }}"
upf_access_ip: "{{ item.value.ip.access + '/24' }}"
upf_core_ip: "{{ item.value.ip.core + '/24' }}"
upf_ue_ip_pool: "{{ item.value.ue_ip_pool }}"
with_dict: "{{ core.upf.additional_upfs}}"
when: inventory_hostname in groups['master_nodes']
Expand Down Expand Up @@ -52,7 +54,7 @@

- name: configure route for upf traffic on gnbsim node
shell: |
ip route add {{ item.value.ue_ip_pool }} via {{ item.value.ip.core[:-3] }}
ip route add {{ item.value.ue_ip_pool }} via {{ item.value.ip.core }}
when: inventory_hostname in groups['master_nodes']
with_dict: "{{ core.upf.additional_upfs}}"
become: true
Expand Down
2 changes: 1 addition & 1 deletion roles/upf/tasks/uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: delete route for upf to UE
shell: |
ip route del {{ item.value.ue_ip_pool }} via {{ item.value.ip.core[:-3] }}
ip route del {{ item.value.ue_ip_pool }} via {{ item.value.ip.core }}
when: inventory_hostname in groups['master_nodes']
with_dict: "{{ core.upf.additional_upfs}}"
become: true
Expand Down
4 changes: 2 additions & 2 deletions roles/upf/templates/upf-5g-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ config:
ipam: static
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
gateway: 192.168.252.1
gateway: {{ access_gw }}
ip: {{ upf_access_ip }}
core:
ipam: static
cniPlugin: macvlan # Can be any other plugin. Dictates how IP address are assigned
iface: {{ core.data_iface }}
gateway: 192.168.250.1
gateway: {{ core_gw }}
ip: {{ upf_core_ip }}
cfgFiles:
upf.jsonc:
Expand Down
20 changes: 13 additions & 7 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@ core:
standalone: true
data_iface: ens18
values_file: "roles/core/templates/sdcore-5g-values.yaml"
ran_subnet: "172.20.0.0/16" # set it to empty to get subnet from 'data_iface'
ran_subnet: "172.20.0.0/16" # set it to empty to get subnet from 'data_iface'

helm:
local_charts: false
chart_ref: aether/sd-core
chart_version: 2.0.0

upf:
ip_prefix: "192.168.252.0/24"
iface: "access"
access_subnet: "192.168.252.1/24" # access subnet & gateway
core_subnet: "192.168.250.1/24" # core subnet & gateway
mode: af_packet # Options: af_packet or dpdk
default_upf:
ip:
access: "192.168.252.3"
core: "192.168.250.3"
ue_ip_pool: "172.250.0.0/16"

additional_upfs:
"1":
ip:
access: "192.168.252.6/24"
core: "192.168.250.6/24"
access: "192.168.252.6"
core: "192.168.250.6"
ue_ip_pool: "172.248.0.0/16"
# "2":
# ip:
# access: "192.168.252.7/24"
# core: "192.168.250.7/24"
# access: "192.168.252.7"
# core: "192.168.250.7"
# ue_ip_pool: "172.248.0.0/16"