From c402c970814193605c03502c770cb02cf7d8d1a5 Mon Sep 17 00:00:00 2001 From: Borjis131 Date: Tue, 23 Apr 2024 15:03:47 +0200 Subject: [PATCH] Update to Open5GS v2.7.1 --- .env | 2 +- README.md | 4 +- configs/basic/smf.yaml | 6 +-- configs/basic/upf.yaml | 3 +- configs/internal/packetrusher/smf.yaml | 6 +-- configs/internal/packetrusher/upf.yaml | 3 +- configs/internal/ueransim/smf.yaml | 6 +-- configs/internal/ueransim/upf.yaml | 3 +- configs/network-slicing/smf1.yaml | 6 +-- configs/network-slicing/smf2.yaml | 6 +-- configs/network-slicing/upf1.yaml | 3 +- configs/network-slicing/upf2.yaml | 23 +----------- configs/roaming/v-smf.yaml | 6 +-- configs/roaming/v-upf.yaml | 3 +- configs/scp-model-d/smf.yaml | 6 +-- configs/scp-model-d/upf.yaml | 3 +- configs/speed-test/smf.yaml | 6 +-- configs/speed-test/upf.yaml | 3 +- docker-bake.hcl | 2 +- images/amf/Dockerfile | 2 +- images/ausf/Dockerfile | 2 +- images/base-open5gs/Dockerfile | 2 +- images/bsf/Dockerfile | 2 +- images/nrf/Dockerfile | 2 +- images/nssf/Dockerfile | 2 +- images/pcf/Dockerfile | 2 +- images/scp/Dockerfile | 2 +- images/sepp/Dockerfile | 2 +- images/smf/Dockerfile | 2 +- images/udm/Dockerfile | 2 +- images/udr/Dockerfile | 2 +- images/upf/Dockerfile | 2 +- images/upf/helper_functions.sh | 51 +++++++++++++++----------- 33 files changed, 79 insertions(+), 98 deletions(-) diff --git a/.env b/.env index 0669aea..4a68a23 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -OPEN5GS_VERSION=v2.7.0 +OPEN5GS_VERSION=v2.7.1 UBUNTU_VERSION=jammy MONGODB_VERSION=6.0 DOCKER_HOST_IP= \ No newline at end of file diff --git a/README.md b/README.md index d76925d..d1dac18 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ All the images depend on the base image. So first, update the `.env` file with t `OPEN5GS_VERSION` is the version of Open5GS to use. - Accepted values are the tags, branches or commit IDs used in the Open5GS project -- Default value: v2.7.0 -- Tested values: v2.5.5, v2.5.6, v2.5.8, v2.6.1, v2.6.2, v2.6.3, v2.6.4, v2.6.6, v2.7.0 +- Default value: v2.7.1 +- Tested values: v2.5.5, v2.5.6, v2.5.8, v2.6.1, v2.6.2, v2.6.3, v2.6.4, v2.6.6, v2.7.0, v2.7.1 `UBUNTU_VERSION` is the version of the ubuntu Docker image used as base for the containers. - Accepted values are the tags used by Ubuntu in Docker Hub diff --git a/configs/basic/smf.yaml b/configs/basic/smf.yaml index baeeadf..fa25273 100644 --- a/configs/basic/smf.yaml +++ b/configs/basic/smf.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf.open5gs.org - gtpc: - server: - - address: smf.open5gs.org gtpu: server: - address: smf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/basic/upf.yaml b/configs/basic/upf.yaml index 56c015b..cae4b76 100644 --- a/configs/basic/upf.yaml +++ b/configs/basic/upf.yaml @@ -15,4 +15,5 @@ upf: - address: upf.open5gs.org advertise: docker-host.external-ip session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 diff --git a/configs/internal/packetrusher/smf.yaml b/configs/internal/packetrusher/smf.yaml index baeeadf..fa25273 100644 --- a/configs/internal/packetrusher/smf.yaml +++ b/configs/internal/packetrusher/smf.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf.open5gs.org - gtpc: - server: - - address: smf.open5gs.org gtpu: server: - address: smf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/internal/packetrusher/upf.yaml b/configs/internal/packetrusher/upf.yaml index b2ec784..9f41249 100644 --- a/configs/internal/packetrusher/upf.yaml +++ b/configs/internal/packetrusher/upf.yaml @@ -14,4 +14,5 @@ upf: server: - address: upf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 diff --git a/configs/internal/ueransim/smf.yaml b/configs/internal/ueransim/smf.yaml index baeeadf..fa25273 100644 --- a/configs/internal/ueransim/smf.yaml +++ b/configs/internal/ueransim/smf.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf.open5gs.org - gtpc: - server: - - address: smf.open5gs.org gtpu: server: - address: smf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/internal/ueransim/upf.yaml b/configs/internal/ueransim/upf.yaml index b2ec784..9f41249 100644 --- a/configs/internal/ueransim/upf.yaml +++ b/configs/internal/ueransim/upf.yaml @@ -14,4 +14,5 @@ upf: server: - address: upf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 diff --git a/configs/network-slicing/smf1.yaml b/configs/network-slicing/smf1.yaml index 67040ff..4e31595 100644 --- a/configs/network-slicing/smf1.yaml +++ b/configs/network-slicing/smf1.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf1.open5gs.org - gtpc: - server: - - address: smf1.open5gs.org gtpu: server: - address: smf1.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/network-slicing/smf2.yaml b/configs/network-slicing/smf2.yaml index 669c1c8..425ffa4 100644 --- a/configs/network-slicing/smf2.yaml +++ b/configs/network-slicing/smf2.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf2.open5gs.org - gtpc: - server: - - address: smf2.open5gs.org gtpu: server: - address: smf2.open5gs.org session: - - subnet: 10.46.0.1/16 + - subnet: 10.46.0.0/16 + gateway: 10.46.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/network-slicing/upf1.yaml b/configs/network-slicing/upf1.yaml index fbc4a70..17218f5 100644 --- a/configs/network-slicing/upf1.yaml +++ b/configs/network-slicing/upf1.yaml @@ -14,5 +14,6 @@ upf: server: - address: upf1.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dnn: internet diff --git a/configs/network-slicing/upf2.yaml b/configs/network-slicing/upf2.yaml index adc19b9..51a9a18 100644 --- a/configs/network-slicing/upf2.yaml +++ b/configs/network-slicing/upf2.yaml @@ -1,23 +1,3 @@ -logger: - file: /open5gs/install/var/log/open5gs/upf.log - -upf: - pfcp: - - addr: upf2.open5gs.org - gtpu: - - addr: upf2.open5gs.org - subnet: - - addr: 10.46.0.1/16 - dnn: internet - -smf: - -parameter: - -max: - -time: - logger: file: /open5gs/install/var/log/open5gs/upf.log @@ -34,5 +14,6 @@ upf: server: - address: upf2.open5gs.org session: - - subnet: 10.46.0.1/16 + - subnet: 10.46.0.0/16 + gateway: 10.46.0.1 dnn: internet diff --git a/configs/roaming/v-smf.yaml b/configs/roaming/v-smf.yaml index 75d9045..af49023 100644 --- a/configs/roaming/v-smf.yaml +++ b/configs/roaming/v-smf.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf.5gc.mnc070.mcc999.3gppnetwork.org - gtpc: - server: - - address: smf.5gc.mnc070.mcc999.3gppnetwork.org gtpu: server: - address: smf.5gc.mnc070.mcc999.3gppnetwork.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/roaming/v-upf.yaml b/configs/roaming/v-upf.yaml index ad61cac..739d110 100644 --- a/configs/roaming/v-upf.yaml +++ b/configs/roaming/v-upf.yaml @@ -14,4 +14,5 @@ upf: server: - address: upf.5gc.mnc070.mcc999.3gppnetwork.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 diff --git a/configs/scp-model-d/smf.yaml b/configs/scp-model-d/smf.yaml index a5445f2..de8a3c7 100644 --- a/configs/scp-model-d/smf.yaml +++ b/configs/scp-model-d/smf.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf.open5gs.org - gtpc: - server: - - address: smf.open5gs.org gtpu: server: - address: smf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/scp-model-d/upf.yaml b/configs/scp-model-d/upf.yaml index 56c015b..cae4b76 100644 --- a/configs/scp-model-d/upf.yaml +++ b/configs/scp-model-d/upf.yaml @@ -15,4 +15,5 @@ upf: - address: upf.open5gs.org advertise: docker-host.external-ip session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 diff --git a/configs/speed-test/smf.yaml b/configs/speed-test/smf.yaml index baeeadf..fa25273 100644 --- a/configs/speed-test/smf.yaml +++ b/configs/speed-test/smf.yaml @@ -19,14 +19,12 @@ smf: client: upf: - address: upf.open5gs.org - gtpc: - server: - - address: smf.open5gs.org gtpu: server: - address: smf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 dns: - 8.8.8.8 - 8.8.4.4 diff --git a/configs/speed-test/upf.yaml b/configs/speed-test/upf.yaml index b2ec784..9f41249 100644 --- a/configs/speed-test/upf.yaml +++ b/configs/speed-test/upf.yaml @@ -14,4 +14,5 @@ upf: server: - address: upf.open5gs.org session: - - subnet: 10.45.0.1/16 + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 diff --git a/docker-bake.hcl b/docker-bake.hcl index 93f9f99..1d5072a 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,5 +1,5 @@ variable "OPEN5GS_VERSION" { - default = "v2.7.0" + default = "v2.7.1" } variable "UBUNTU_VERSION" { diff --git a/images/amf/Dockerfile b/images/amf/Dockerfile index 3acc639..877c36f 100644 --- a/images/amf/Dockerfile +++ b/images/amf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/ausf/Dockerfile b/images/ausf/Dockerfile index 92e4619..7baa7e1 100644 --- a/images/ausf/Dockerfile +++ b/images/ausf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/base-open5gs/Dockerfile b/images/base-open5gs/Dockerfile index 63f85fa..84da459 100644 --- a/images/base-open5gs/Dockerfile +++ b/images/base-open5gs/Dockerfile @@ -8,7 +8,7 @@ ARG UBUNTU_VERSION="jammy" FROM ubuntu:${UBUNTU_VERSION} AS builder # build-time arguments for builder -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG DEBIAN_FRONTEND="noninteractive" # install dependencies diff --git a/images/bsf/Dockerfile b/images/bsf/Dockerfile index 36fef7c..7b394d5 100644 --- a/images/bsf/Dockerfile +++ b/images/bsf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/nrf/Dockerfile b/images/nrf/Dockerfile index 5447138..19ad311 100644 --- a/images/nrf/Dockerfile +++ b/images/nrf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/nssf/Dockerfile b/images/nssf/Dockerfile index 50aaa3f..11ac555 100644 --- a/images/nssf/Dockerfile +++ b/images/nssf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/pcf/Dockerfile b/images/pcf/Dockerfile index e609c45..0bb6043 100644 --- a/images/pcf/Dockerfile +++ b/images/pcf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/scp/Dockerfile b/images/scp/Dockerfile index be3bbef..b835fce 100644 --- a/images/scp/Dockerfile +++ b/images/scp/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/sepp/Dockerfile b/images/sepp/Dockerfile index 716860f..67f9aeb 100644 --- a/images/sepp/Dockerfile +++ b/images/sepp/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/smf/Dockerfile b/images/smf/Dockerfile index b7a4408..a2770d4 100644 --- a/images/smf/Dockerfile +++ b/images/smf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/udm/Dockerfile b/images/udm/Dockerfile index 0de11f6..d771333 100644 --- a/images/udm/Dockerfile +++ b/images/udm/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/udr/Dockerfile b/images/udr/Dockerfile index 435d13f..0d66145 100644 --- a/images/udr/Dockerfile +++ b/images/udr/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/upf/Dockerfile b/images/upf/Dockerfile index b27d1d1..66d1883 100644 --- a/images/upf/Dockerfile +++ b/images/upf/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 # global build-time arguments for FROM statements -ARG OPEN5GS_VERSION="v2.7.0" +ARG OPEN5GS_VERSION="v2.7.1" ARG UBUNTU_VERSION="jammy" FROM base-open5gs:${OPEN5GS_VERSION} AS builder diff --git a/images/upf/helper_functions.sh b/images/upf/helper_functions.sh index e3bf3a4..9faeaf1 100755 --- a/images/upf/helper_functions.sh +++ b/images/upf/helper_functions.sh @@ -8,16 +8,23 @@ function create_tun(){ tun_name="${1}" ip tuntap add name ${tun_name} mode tun - ip link set ogstun up + ip link set ${tun_name} up } # add IP address to device -# add_ip_to_device +# add_ip_to_device function add_ip_to_device(){ - ip_addr="${1}" - device_name="${2}" + subnet="${1}" + ip_addr="${2}" + device_name="${3}" - ip address add ${ip_addr} dev ${device_name} + # keep it backwards compatible + if [[ "${ip_addr}" == "null" ]]; then + ip address add ${subnet} dev ${device_name} + else + ip address add ${ip_addr} dev ${device_name} + ip route add ${subnet} dev ${device_name} + fi } # check if it is IPv4 or IPv6 @@ -37,11 +44,12 @@ function check_ipv4_or_ipv6(){ } # takes care of everything related to TUN and NAT -# setup_subnet +# setup_subnet # Note: could be a valid device name or null function setup_subnet(){ - ip_addr="${1}" - device="${2}" + subnet="${1}" + ip_addr="${2}" + device="${3}" # check TUN device exists ip link show dev "${device}" &> /dev/null @@ -50,34 +58,34 @@ function setup_subnet(){ if [[ "${?}" -ne 0 ]]; then # if it not exists, create it and add IP address create_tun "${device}" - add_ip_to_device "${ip_addr}" "${device}" + add_ip_to_device "${subnet}" "${ip_addr}" "${device}" else # if it exists, add IP address - add_ip_to_device "${ip_addr}" "${device}" + add_ip_to_device "${subnet}" "${ip_addr}" "${device}" fi # NAT configuration section if [[ "${DISABLE_NAT}" != TRUE ]]; then # extract version of IP address provided - ip_version="$(check_ipv4_or_ipv6 "${ip_addr}")" + ip_version="$(check_ipv4_or_ipv6 "${subnet}")" # use iptables or ip6tables depending on type if [[ "${ip_version}" -eq 4 ]]; then # check NAT rule not exists - iptables --wait 30 -t nat -C POSTROUTING -s "${ip_addr}" ! -o "${device}" -j MASQUERADE &> /dev/null + iptables --wait 30 -t nat -C POSTROUTING -s "${subnet}" ! -o "${device}" -j MASQUERADE &> /dev/null if [ "${?}" -ne 0 ]; then # configure NAT for the subnet specified - iptables --wait 30 -t nat -A POSTROUTING -s "${ip_addr}" ! -o "${device}" -j MASQUERADE + iptables --wait 30 -t nat -A POSTROUTING -s "${subnet}" ! -o "${device}" -j MASQUERADE fi elif [[ "${ip_version}" -eq 6 ]]; then # check NAT rule not exists - ip6tables-nft --wait 30 -t nat -C POSTROUTING -s "${ip_addr}" ! -o "${device}" -j MASQUERADE &> /dev/null + ip6tables-nft --wait 30 -t nat -C POSTROUTING -s "${subnet}" ! -o "${device}" -j MASQUERADE &> /dev/null if [ "${?}" -ne 0 ]; then # configure NAT for the subnet specified - ip6tables-nft --wait 30 -t nat -A POSTROUTING -s "${ip_addr}" ! -o "${device}" -j MASQUERADE + ip6tables-nft --wait 30 -t nat -A POSTROUTING -s "${subnet}" ! -o "${device}" -j MASQUERADE fi fi fi @@ -110,21 +118,22 @@ function setup_container_interfaces(){ upf_config_file_path="$(get_config_file_path_from_docker_cmd "${@}")" # parse subnets from Open5GS upf.yaml config file and put it in CSV format: addr,dev - parsed_subnets_csv="$(yq --output-format=csv '.upf.session[] | [ .subnet, .dev ]' "${upf_config_file_path}")" + parsed_subnets_csv="$(yq --output-format=csv '.upf.session[] | [ .subnet, .gateway, .dev ]' "${upf_config_file_path}")" # iterate over parsed subnets in CSV format for subnet_fields_csv in ${parsed_subnets_csv[@]}; do # split string from , delimiter and create array subnet_fields=(${subnet_fields_csv//,/ }) - ip_addr="${subnet_fields[0]}" - device="${subnet_fields[1]}" + subnet="${subnet_fields[0]}" + gateway="${subnet_fields[1]}" + device="${subnet_fields[2]}" # null devices default to ogstun if [[ "${device}" == "null" ]]; then - setup_subnet "${ip_addr}" "ogstun" - else - setup_subnet "${ip_addr}" "${device}" + device="ogstun" fi + + setup_subnet "${subnet}" "${gateway}" "${device}" done }