Compare commits

..

21 Commits

Author SHA1 Message Date
Sukchan Lee
de72ccaf91 Release v2.2.0 2021-03-08 21:55:43 +09:00
Sukchan Lee
9af4268bab arch: DB schema Changes (#796)
- New function : NSSF
- New feature : SMF selection
2021-03-08 21:25:09 +09:00
Sukchan Lee
c6bfbed922 Modify not to limit the length of DB URI (#827) 2021-03-03 23:13:20 +09:00
Charlie Lewis
0790674c14 mask mongo credentials when logging (#827) 2021-03-03 23:06:31 +09:00
Sukchan Lee
2f2178595d doc: update troubleshooting (#818) 2021-02-25 23:01:48 -05:00
Paweł
515b5d2b17 Changed the branch name (#811) 2021-02-22 10:24:18 -05:00
Sukchan Lee
31977bf30a SMF: fix the bug for DataForwardingNotPossible
DataForwardingNotPossible should only be included
if Data Path is not available during N2-Handover.

However, there is a bug that always includes
DataFowardingNotPossible regardless of Handover.

So, I've fixed it!
2021-02-18 23:15:36 -05:00
Sukchan Lee
d1400897e0 update: Cause of UEContextReleaseCommand (#789)
When AMF receives UEContextReleaseRequest,
AMF sends UEContextReleaseCommand with Cause received from gNB.
2021-02-17 12:19:20 -05:00
Sukchan Lee
b6bcbac3e3 fix: Add the exception handling (#804)
When UE/gNB repeatedly sends NGAP message repeatedly, AMF crashed.
Exception routines have been added to resolve this issue.
2021-02-15 12:17:33 -05:00
Sukchan Lee
9b5cc4a568 Release v2.1.7 2021-02-08 22:37:01 -05:00
Sukchan Lee
094d40b073 fix: 256 pool num increased to 16,384 (#753) 2021-02-08 14:32:04 -05:00
Sukchan Lee
852756f902 test: Porting FreeBSD 2021-02-08 14:25:40 -05:00
Miguel
fea48f5a44 Update list of eNB/gNB - Added Accelleran's SC (#800) 2021-02-08 07:24:59 -05:00
Sukchan Lee
b19b3e9dd1 Add missing files 2021-02-06 00:15:25 -05:00
Sukchan Lee
7901a1164f mac: Support Apple M1 chips
See https://open5gs.org/open5gs/docs/platform/05-macosx-apple-silicon/
2021-02-06 00:13:48 -05:00
Sukchan Lee
950c4c0a12 Release v2.1.6 2021-02-04 09:27:58 -05:00
Sukchan Lee
5e839e25fe fix: amf crash bug (#793) 2021-02-03 23:49:16 -05:00
Sukchan Lee
d3fa7619bf update document v2.1.5 2021-02-02 15:29:24 -05:00
Sukchan Lee
6cd755ac97 doc: Update document v2.1.5 2021-02-02 15:22:50 -05:00
Sukchan Lee
f597c9e899 doc: update document for v2.1.5 2021-02-02 15:18:01 -05:00
Sukchan Lee
9e8303762c Update document for v2.1.5 2021-02-02 15:07:18 -05:00
761 changed files with 42759 additions and 19088 deletions

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -139,7 +140,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -200,6 +201,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -106,7 +107,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -173,7 +174,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -234,6 +235,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@@ -39,7 +39,7 @@ example_conf = '''
csfb.yaml
volte.yaml
vonr.yaml
minimal.yaml
slice.yaml
srslte.yaml
sample.yaml
'''.split()

View File

@@ -143,7 +143,7 @@ logger:
# mnc: 70
# s_nssai:
# - sst: 1
# - sd: 010000
# sd: 010000
# - plmn_id:
# mcc: 901
# mnc: 70
@@ -268,7 +268,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -276,7 +276,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -140,7 +140,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -148,7 +148,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -66,7 +66,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -74,7 +74,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -33,6 +33,7 @@ open5gs_conf = '''
udm.yaml
udr.yaml
pcf.yaml
nssf.yaml
'''.split()
foreach file : open5gs_conf

View File

@@ -377,7 +377,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -385,7 +385,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -112,7 +112,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -120,7 +120,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -0,0 +1,187 @@
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,nssf,event,tlv,mem,sock
#
logger:
file: @localstatedir@/log/open5gs/nssf.log
#
# nssf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: nssf.key
# pem: nssf.pem
#
# o SBI Server(https://127.0.0.14:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.14
# tls:
# key: nssf.key
# pem: nssf.pem
# - addr: ::1
#
# o SBI Server(http://nssf.open5gs.org:80)
# sbi:
# name: nssf.open5gs.org
#
# o SBI Server(http://127.0.0.14:7777)
# sbi:
# - addr: 127.0.0.14
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%@loopback_devname@]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%@loopback_devname@
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:

View File

@@ -142,7 +142,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -150,7 +150,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -69,7 +69,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -77,7 +77,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -147,7 +147,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -155,7 +155,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -138,7 +138,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -146,7 +146,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -83,61 +83,48 @@ logger:
# - addr: 127.0.0.4
# - addr: fe80::3%@loopback_devname@
#
# <PDN Configuration with UE Pool>
# <Subnet for UE Pool>
#
# o IPv4 Pool
# pdn:
# subnet:
# addr: 10.45.0.1/16
#
# o IPv4/IPv6 Pool
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# - addr: cafe:1::1/64
#
#
# o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, cafe:2::1/64
# pdn:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
# dnn: internet
# - addr: 10.46.0.1/16
# dnn: ims
# - addr: cafe:2::1/64
# dnn: ims
#
# o Multiple Devices (default: ogstun)
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
# dnn: internet
# dev: ogstun2
# - addr: 10.46.0.1/16
# dnn: ims
# dev: ogstun3
# - addr: cafe:2::1/64
# dnn: ims
# dev: ogstun3
#
# o Pool Range Sample
# pdn:
# subnet:
# - addr: 10.45.0.1/24
# range: 10.45.0.100-10.45.0.200
#
# pdn:
# subnet:
# - addr: 10.45.0.1/24
# range:
# - 10.45.0.5-10.45.0.50
# - 10.45.0.100-
#
# pdn:
# subnet:
# - addr: 10.45.0.1/24
# range:
# - -10.45.0.200
# - 10.45.0.210-10.45.0.220
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# range:
# - 10.45.0.100-10.45.0.200
@@ -151,6 +138,12 @@ logger:
#
# o Primary/Secondary can be configured. Others are ignored.
#
# dns:
# - 8.8.8.8
# - 8.8.4.4
# - 2001:4860:4860::8888
# - 2001:4860:4860::8844
#
# <MTU Size>
#
# o Provisioning a limit on the size of the packets sent by the MS
@@ -167,6 +160,136 @@ logger:
# - 127.0.0.1
# - ::1
#
# <SMF Selection - 5G Core only>
# 1. SMF sends SmfInfo(S-NSSAI, DNN, TAI) to the NRF
# 2. NRF responds to AMF with SmfInfo during NF-Discovery.
# 3. AMF selects SMF based on S-NSSAI, DNN and TAI in SmfInfo.
#
# Note that if there is no SmfInfo, any AMF can select this SMF.
#
# o S-NSSAI[SST:1] and DNN[internet] - At least 1 DNN is required in S-NSSAI
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
#
# o S-NSSAI[SST:1 SD:009000] and DNN[internet or ims]
# info:
# - s_nssai:
# - sst: 1
# sd: 009000
# dnn:
# - internet
# - ims
#
# o S-NSSAI[SST:1] and DNN[internet] and TAI[PLMN-ID:90170 TAC:1]
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: 1
#
# o If any of conditions below are met:
# - S-NSSAI[SST:1] and DNN[internet] and TAI[PLMN-ID:90170 TAC:1-9]
# - S-NSSAI[SST:2 SD:000080] and DNN[internet or ims]
# - S-NSSAI[SST:4] and DNN[internet] and TAI[PLMN-ID:90170 TAC:10-20,30-40]
#
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 1-9
# - s_nssai:
# - sst: 2
# sd: 000080
# dnn:
# - internet
# - ims
# - s_nssai:
# - sst: 4
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 10-20
# - 30-40
#
# o Complex Example
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
# - sst: 1
# sd: 000080
# dnn:
# - internet
# - ims
# - sst: 1
# sd: 009000
# dnn:
# [internet, ims]
# - sst: 2
# dnn:
# - internet
# - sst: 3
# sd: 123456
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: [1, 2, 3]
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: 4
# - plmn_id:
# mcc: 901
# mnc: 70
# tac:
# - 5
# - 6
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 100-200
# - 300-400
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 500-600
# - 700-800
# - 900-1000
# - s_nssai:
# - sst: 4
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: 99
#
smf:
sbi:
- addr: 127.0.0.4
@@ -177,7 +300,7 @@ smf:
pfcp:
- addr: 127.0.0.4
- addr: ::1
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -231,10 +354,10 @@ nrf:
# pfcp:
# addr: 127.0.0.7
#
# <UPF_SELECTION_MODE - EPC only>
# <UPF Selection>
#
# o Round-Robin
# (note that round robin can be disabled for a particular node
# o Round-Robin
# (note that round robin can be disabled for a particular node
# by setting flag 'rr' to 0)
#
# upf:
@@ -244,8 +367,8 @@ nrf:
# rr: 0
# - addr: 127.0.0.19
#
# o UPF selection by eNodeB TAC
# (either single TAC or multiple TACs, DECIMAL representation)
# o UPF selection by eNodeB TAC
# (either single TAC or multiple TACs, DECIMAL representation)
#
# upf:
# pfcp:
@@ -254,7 +377,7 @@ nrf:
# - addr: 127.0.0.12
# tac: [3,5,8]
#
# o UPF selection by UE's DNN/APN (either single DNN/APN or multiple DNNs/APNs)
# o UPF selection by UE's DNN/APN (either single DNN/APN or multiple DNNs/APNs)
#
# upf:
# pfcp:
@@ -263,8 +386,8 @@ nrf:
# - addr: 127.0.0.12
# dnn: [internet, web]
#
# o UPF selection by CellID(e_cell_id: 28bit, nr_cell_id: 36bit)
# (either single enb_id or multiple enb_ids, HEX representation)
# o UPF selection by CellID(e_cell_id: 28bit, nr_cell_id: 36bit)
# (either single enb_id or multiple enb_ids, HEX representation)
#
# upf:
# pfcp:
@@ -317,7 +440,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -325,7 +448,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -140,7 +140,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -148,7 +148,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -142,7 +142,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -150,7 +150,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -81,19 +81,22 @@ logger:
# advertise_name: upf1.5gc.mnc001.mcc001.3gppnetwork.org
#
#
# <PDN Configuration with UE Pool>
# <Subnet for UE network>
#
# Note that you need to setup your UE network using TUN device.
# (ogstun, ogstun2, ogstunX, ..)
#
# o IPv4 Pool
# $ sudo ip addr add 10.45.0.1/16 dev ogstun
#
# pdn:
# subnet:
# addr: 10.45.0.1/16
#
# o IPv4/IPv6 Pool
# $ sudo ip addr add 10.45.0.1/16 dev ogstun
# $ sudo ip addr add cafe:1::1/64 dev ogstun
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# - addr: cafe:1::1/64
#
@@ -105,7 +108,7 @@ logger:
# $ sudo ip addr add cafe:1::1/64 dev ogstun
# $ sudo ip addr add cafe:2::1/64 dev ogstun
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
@@ -121,7 +124,7 @@ logger:
# $ sudo ip addr add 10.46.0.1/16 dev ogstun3
# $ sudo ip addr add cafe:2::1/64 dev ogstun3
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
@@ -134,39 +137,12 @@ logger:
# dnn: ims
# dev: ogstun3
#
# o Pool Range Sample
# pdn:
# - addr: 10.45.0.1/24
# range: 10.45.0.100-10.45.0.200
#
# pdn:
# - addr: 10.45.0.1/24
# range:
# - 10.45.0.5-10.45.0.50
# - 10.45.0.100-
#
# pdn:
# - addr: 10.45.0.1/24
# range:
# - -10.45.0.200
# - 10.45.0.210-10.45.0.220
#
# pdn:
# - addr: 10.45.0.1/16
# range:
# - 10.45.0.100-10.45.0.200
# - 10.45.1.100-10.45.1.200
# - addr: cafe::1/64
# range:
# - cafe::a0-cafe:b0
# - cafe::c0-cafe:d0
#
upf:
pfcp:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -223,7 +199,7 @@ max:
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
@@ -231,7 +207,7 @@ max:
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -139,7 +140,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -200,6 +201,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -105,25 +106,26 @@ amf:
- addr: 127.0.0.5
guami:
- plmn_id:
mcc: 208
mnc: 93
mcc: 901
mnc: 70
amf_id:
region: 202
set: 1016
tai:
- plmn_id:
mcc: 208
mnc: 93
mcc: 901
mnc: 70
tac: 1
plmn_support:
- plmn_id:
mcc: 208
mnc: 93
mcc: 901
mnc: 70
s_nssai:
- sst: 1
sd: 010203
- sst: 1
sd: 112233
sd: 000080
- sst: 1
sd: 009000
security:
integrity_order : [ NIA2, NIA1 ]
ciphering_order : [ NEA0, NEA1, NEA2 ]
@@ -142,7 +144,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -203,6 +205,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -139,7 +140,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -200,6 +201,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@@ -28,6 +28,7 @@ systemd_conf_in = '''
open5gs-ausfd.service
open5gs-udmd.service
open5gs-pcfd.service
open5gs-nssfd.service
open5gs-udrd.service
'''.split()

View File

@@ -0,0 +1,18 @@
[Unit]
Description=Open5GS NSSF Daemon
After=networking.service
[Service]
Type=simple
User=open5gs
Group=open5gs
Restart=always
ExecStart=@bindir@/open5gs-nssfd -c @sysconfdir@/open5gs/nssf.yaml
RestartSec=2
RestartPreventExitStatus=1
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -142,7 +143,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -205,6 +206,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@@ -142,7 +143,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@@ -205,6 +206,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

54
debian/changelog vendored
View File

@@ -1,3 +1,57 @@
open5gs (2.2.0) unstable; urgency=medium
* DB Schame Changes
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Mar 2021 21:31:35 +0900
open5gs (2.2.0~bionic) bionic; urgency=medium
* DB Schame Changes
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Mar 2021 21:30:31 +0900
open5gs (2.2.0~focal) focal; urgency=medium
* DB Schame Changes
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Mar 2021 21:29:03 +0900
open5gs (2.1.7) unstable; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Feb 2021 22:27:23 -0500
open5gs (2.1.7~bionic) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Feb 2021 22:26:08 -0500
open5gs (2.1.7~focal) focal; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Feb 2021 22:23:55 -0500
open5gs (2.1.6) unstable; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 04 Feb 2021 09:18:13 -0500
open5gs (2.1.6~bionic1) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 04 Feb 2021 09:17:04 -0500
open5gs (2.1.6~focal1) focal; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 04 Feb 2021 09:14:17 -0500
open5gs (2.1.5) unstable; urgency=medium
* Bug Fixed

13
debian/control vendored
View File

@@ -199,6 +199,18 @@ Description: PCF (Policy Control Function)
.
This package provides the PCF (Policy Control Function)
Package: open5gs-nssf
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
open5gs-common (= ${binary:Version})
Description: NSSF (Network Slice Selection Function)
Open5GS is a C-language implementation of 5G Core and EPC
Packet Core, i.e. the core network of an NR/LTE network (Release-16)
.
This package provides the NSSF (Network Slice Selection Function)
Package: open5gs-udr
Architecture: any
Multi-Arch: same
@@ -228,6 +240,7 @@ Depends: ${misc:Depends},
open5gs-ausf (= ${binary:Version}),
open5gs-udm (= ${binary:Version}),
open5gs-pcf (= ${binary:Version}),
open5gs-nssf (= ${binary:Version}),
open5gs-udr (= ${binary:Version})
Description: 5G Core and EPC (metapackage)
Open5GS is a C-language implementation of 5G Core and EPC

View File

@@ -3,4 +3,4 @@ usr/lib/*/libfd*.so*
usr/lib/*/freeDiameter/*.fdx
configs/freeDiameter/cacert.pem /etc/freeDiameter
configs/logrotate/open5gs /etc/logrotate.d
misc/db/open5gs-dbctl /usr/bin
#misc/db/open5gs-dbctl /usr/bin

3
debian/open5gs-nssf.install vendored Normal file
View File

@@ -0,0 +1,3 @@
usr/bin/open5gs-nssfd
configs/open5gs/nssf.yaml etc/open5gs
configs/systemd/open5gs-nssfd.service lib/systemd/system

View File

@@ -10,7 +10,7 @@ COPY setup.sh /root
ARG USER=open5gs
ARG REPO=open5gs
ARG BRANCH=master
ARG BRANCH=main
RUN git clone https://github.com/$USER/$REPO
ADD https://api.github.com/repos/$USER/$REPO/git/refs/heads/$BRANCH /root/open5gs-ver.json

View File

@@ -52,8 +52,9 @@ The Open5GS 5G SA Core contains the following functions:
* UDM - Unified Data Management
* UDR - Unified Data Repository
* PCF - Policy and Charging Function
* NSSF - Network Slice Selection Function
The 5G SA core works in a different way to the 4G core - it uses a **Service Based Architecture** (SBI). **Control plane** functions are configured to register with the NRF, and the NRF then helps them discover the other core functions. Running through the other functions: The AMF handles connection and mobility management; a subset of what the 4G MME is tasked with. gNBs (5G basestations) connect to the AMF. The UDM, AUSF and UDR carry out similar operations as the 4G HSS, generating SIM authentication vectors and holding the subscriber profile. Session management is all handled by the SMF (previously the responsibility of the 4G MME/ SGWC/ PGWC). Finally there is the PCF, used for charging and enforcing subscriber policies.
The 5G SA core works in a different way to the 4G core - it uses a **Service Based Architecture** (SBI). **Control plane** functions are configured to register with the NRF, and the NRF then helps them discover the other core functions. Running through the other functions: The AMF handles connection and mobility management; a subset of what the 4G MME is tasked with. gNBs (5G basestations) connect to the AMF. The UDM, AUSF and UDR carry out similar operations as the 4G HSS, generating SIM authentication vectors and holding the subscriber profile. Session management is all handled by the SMF (previously the responsibility of the 4G MME/ SGWC/ PGWC). The NSSF provides a way to select the network slice. Finally there is the PCF, used for charging and enforcing subscriber policies.
The 5G SA core **user plane** is much simpler, as it only contains a single function. The UPF carries user data packets between the gNB and the external WAN. It connects back to the SMF too.
@@ -153,7 +154,7 @@ https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_20.
## 3. Install the WebUI of Open5GS
---
The WebUI allows you to interactively edit subscriber data. While it is not essential to use this, it makes things easier when you are just starting out on your Open5GS adventure. (A [command line tool](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/db/open5gs-dbctl) is available for advanced users).
The WebUI allows you to interactively edit subscriber data. While it is not essential to use this, it makes things easier when you are just starting out on your Open5GS adventure. (A [command line tool](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/db/open5gs-dbctl) is available for advanced users).
[Node.js](https://nodejs.org/) is required to install the WebUI of Open5GS
@@ -218,6 +219,7 @@ NRF-sbi = 127.0.0.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
NSSF-sbi = 127.0.0.14:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
@@ -228,7 +230,7 @@ You will need to modify your 4G MME config to support your PLMN and TAC. The int
If you are aiming to connect an external eNB to your core, you will also need to change the S1AP bind address of the MME **and** the GTP-U bind address of the SGWU. If you are running an eNB stack locally, you will not need to make these changes.
Modify [/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@@ -260,7 +262,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
```
Modify [/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
Modify [/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
@@ -287,7 +289,7 @@ You will need to modify your 5G AMF config to support your PLMN and TAC. The int
If you are aiming to connect an external gNB to your core, you will also need to change the NGAP bind address of the AMF **and** the GTPU bind address of the UPF. If you are running an gNB stack locally, you will not need to make these changes.
Modify [/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
Modify [/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@@ -328,7 +330,7 @@ amf:
```
Modify [/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U address.
Modify [/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
@@ -414,11 +416,13 @@ target prot opt source destination
To enable forwarding and add the NAT rule, enter
```bash
### Enable IPv4 Forwarding
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
### Enable IPv4/IPv6 Forwarding
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
### Add NAT Rule
$ sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
$ sudo ip6tables -t nat -A POSTROUTING -s cafe::/64 ! -o ogstun -j MASQUERADE
```
@@ -461,6 +465,7 @@ $ sudo systemctl stop open5gs-nrfd
$ sudo systemctl stop open5gs-ausfd
$ sudo systemctl stop open5gs-udmd
$ sudo systemctl stop open5gs-pcfd
$ sudo systemctl stop open5gs-nssfd
$ sudo systemctl stop open5gs-udrd
$ sudo systemctl stop open5gs-webui
```
@@ -478,6 +483,7 @@ $ sudo systemctl restart open5gs-nrfd
$ sudo systemctl restart open5gs-ausfd
$ sudo systemctl restart open5gs-udmd
$ sudo systemctl restart open5gs-pcfd
$ sudo systemctl restart open5gs-nssfd
$ sudo systemctl restart open5gs-udrd
$ sudo systemctl restart open5gs-webui
```

View File

@@ -34,7 +34,7 @@ $ sudo ip addr add cafe::1/64 dev ogstun
$ sudo ip link set ogstun up
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
@@ -93,7 +93,7 @@ $ cd ../
##### 5G Core
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@@ -133,7 +133,7 @@ $ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
security:
```
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
--- upf.yaml 2020-09-05 20:52:28.652234967 -0400
@@ -152,7 +152,7 @@ $ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
```
##### 4G EPC
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@@ -187,7 +187,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml 2020-09-05 20:50:39.393022566 -0400
@@ -211,7 +211,7 @@ If you modify the config files while Open5GS daemons are running, please restart
```bash
$ cd install/bin/
$ ./install/bin/open5gs-mmed
$ ./install/bin/open5gs-mmed
Open5GS daemon v2.1.0
08/21 22:53:47.328: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' (../src/main.c:54)
@@ -221,7 +221,7 @@ Open5GS daemon v2.1.0
08/21 22:53:47.365: [gtp] INFO: gtp_connect() [127.0.0.3]:2123 (../lib/gtp/path.c:59)
08/21 22:53:47.366: [mme] INFO: s1ap_server() [127.0.0.2]:36412 (../src/mme/s1ap-sctp.c:57)
$ ./install/bin/open5gs-sgwcd
$ ./install/bin/open5gs-sgwcd
Open5GS daemon v2.1.0
08/21 22:54:43.059: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwc.yaml' (../src/main.c:54)
@@ -253,7 +253,7 @@ Open5GS daemon v2.1.0
08/21 22:55:14.040: [sbi] INFO: sbi_server() [127.0.0.5]:7777 (../lib/sbi/server.c:298)
08/21 22:55:14.040: [amf] INFO: ngap_server() [127.0.0.5]:38412 (../src/amf/ngap-sctp.c:56)
$ ./install/bin/open5gs-sgwud
$ ./install/bin/open5gs-sgwud
Open5GS daemon v2.1.0
08/21 22:54:10.357: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwu.yaml' (../src/main.c:54)
@@ -262,7 +262,7 @@ Open5GS daemon v2.1.0
08/21 22:54:10.360: [app] INFO: SGW-U initialize...done (../src/sgwu/app.c:31)
08/21 22:54:10.361: [gtp] INFO: gtp_server() [127.0.0.6]:2152 (../lib/gtp/path.c:32)
$ ./install/bin/open5gs-upfd
$ ./install/bin/open5gs-upfd
Open5GS daemon v2.1.0
08/21 22:54:21.596: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/upf.yaml' (../src/main.c:54)
@@ -280,7 +280,7 @@ Open5GS daemon v2.1.0
08/21 22:57:17.451: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:99)
08/21 22:57:17.519: [app] INFO: HSS initialize...done (../src/hss/app-init.c:31)
$ ./install/bin/open5gs-pcrfd
$ ./install/bin/open5gs-pcrfd
Open5GS daemon v2.1.0
08/21 22:57:45.894: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcrf.yaml' (../src/main.c:54)
@@ -305,7 +305,7 @@ Open5GS daemon v2.1.0
08/21 22:55:41.900: [app] INFO: AUSF initialize...done (../src/ausf/app.c:31)
08/21 22:55:41.900: [sbi] INFO: sbi_server() [127.0.0.11]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udmd
$ ./install/bin/open5gs-udmd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udm.yaml' (../src/main.c:54)
@@ -313,7 +313,7 @@ Open5GS daemon v2.1.0
08/21 22:56:02.155: [app] INFO: UDM initialize...done (../src/udm/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-pcfd
$ ./install/bin/open5gs-pcfd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcf.yaml' (../src/main.c:54)
@@ -321,7 +321,15 @@ Open5GS daemon v2.1.0
08/21 22:56:02.155: [app] INFO: PCF initialize...done (../src/pcf/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udrd
$ ./install/bin/open5gs-nssfd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nssfd.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nssfd.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: NSSF initialize...done (../src/nssfd/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udrd
Open5GS daemon v2.1.0
08/21 22:56:15.810: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udr.yaml' (../src/main.c:54)
@@ -444,11 +452,13 @@ target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
### Enable IPv4 Forwarding
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
### Enable IPv4/IPv6 Forwarding
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
### Add NAT Rule
$ sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
$ sudo ip6tables -t nat -A POSTROUTING -s cafe::/64 ! -o ogstun -j MASQUERADE
```
**Note:** The above assumes you do not have any existing rules in the filter and nat tables. If a program such as docker has already set up rules, you may need to add the Open5GS related rules differently.

View File

@@ -33,7 +33,8 @@ PCRF-frDi = 127.0.0.9 :3868 for Gx auth
NRF-sbi = 127.0.0.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
NSSF-sbi = 127.0.0.14:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
@@ -50,7 +51,7 @@ You can refer to the network settings at
[{{ site.url }}{{ site.baseurl }}/assets/Open5GS-Diagram.pdf]({{ site.url }}{{ site.baseurl }}/assets/Open5GS-Diagram.pdf) provided by [@kbarlee](https://github.com/kbarlee) in issue [#528](https://github.com/{{ site.github_username }}/open5gs/issues/528)
{: .notice--danger}
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@@ -85,7 +86,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwc.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwc.yaml.in) to set the PFCP IP address.
Modify [install/etc/open5gs/sgwc.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwc.yaml.in) to set the PFCP IP address.
```diff
$ diff -u /etc/open5gs/sgwc.yaml.old /etc/open5gs/sgwc.yaml
@@ -49,7 +49,7 @@
@@ -108,7 +109,7 @@ $ diff -u /etc/open5gs/sgwc.yaml.old /etc/open5gs/sgwc.yaml
# parameter:
```
Modify [install/etc/open5gs/smf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/smf.yaml.in) to set the PFCP IP address.
Modify [install/etc/open5gs/smf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/smf.yaml.in) to set the PFCP IP address.
```diff
$ diff -u /etc/open5gs/smf.yaml.old /etc/open5gs/smf.yaml
--- smf.yaml.old 2020-08-22 11:37:39.990816411 -0400
@@ -135,7 +136,7 @@ $ diff -u /etc/open5gs/smf.yaml.old /etc/open5gs/smf.yaml
```
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@@ -178,7 +179,7 @@ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
ciphering_order : [ NEA0, NEA1, NEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U and PFCP IP address.
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml.old 2020-08-22 11:41:09.214670723 -0400
@@ -197,7 +198,7 @@ $ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
# sgwc:
```
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
--- upf.yaml.old 2020-08-22 11:42:57.781750067 -0400

View File

@@ -31,6 +31,7 @@ If you have tested radio hardware from a vendor not listed with Open5GS, please
* Gemtek WLTGFC-101 (S/W version 2.1.1746.1116)
* NOKIA FW2PC BC28 Flexi Zone G2 Outdoor Micro FDD LTE 700 MHz High Power
* NOKIA FWH1 B38 Flexi Zone Outdoor Micro TD LTE 2600 MHz
* Accelleran E1010 (LTE TDD B42)
### OpenRAN Hardware
---

View File

@@ -247,7 +247,7 @@ $ ip link show
**Notice:** This configuration is not persistent after rebooting. The
script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{
site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy
site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy
to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
@@ -325,7 +325,7 @@ $ cd ../
$ ls install/bin
open5gs-amfd open5gs-hssd open5gs-nrfd open5gs-sgwcd open5gs-smfd open5gs-udrd
open5gs-ausfd open5gs-mmed open5gs-pcrfd open5gs-sgwud open5gs-udmd open5gs-pcfd
open5gs-upfd
open5gs-upfd open5gs-nssfd
```
## Building WebUI of Open5GS

View File

@@ -61,7 +61,7 @@ $ sudo ip link set ogstun up
$ ip link show
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}

View File

@@ -1,29 +1,53 @@
---
title: FreeBSD
title: Mac OS X
head_inline: "<style> .blue { color: blue; } </style>"
---
This guide is based on **FreeBSD Relase 11.1**.
This guide is based on macOS Big Sur 11.2 on a Macbook Air(Apple M1 Chips) computer.
{: .blue}
### Install Xcode Command-Line Tools
---
Homebrew requires the Xcode command-line tools from Apple's Xcode.
```bash
$ xcode-select --install
```
### Installing Homebrew
---
Install brew using the official Homebrew installation instructions.
```bash
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
### Getting MongoDB
---
Install MongoDB with package manager.
Install MongoDB with Package Manager.
```bash
$ sudo pkg install mongodb
$ brew tap mongodb/brew
$ brew install mongodb-community
```
Run MongoDB server.
```bash
$ mkdir -p ./data/db
$ mongod --dbpath ./data/db
$ mongod --config /usr/local/etc/mongod.conf
```
### Setting up TUN device (No persistent after rebooting)
**Tip:** MongoDB is persistent after rebooting with the following commands:
`$ brew services start mongodb-community`
{: .notice--info}
### Setting up network (No persistent after rebooting)
---
Configure the TUN device.
Note that Open5GS uses built-in "utun" device driver. So, You don't have to install external TUN/TAP driver.
{: .blue}
Configure the loopback interface.
```bash
$ sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
@@ -38,15 +62,26 @@ $ sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
```
Enable IP forwarding
Enable IP forwarding & Masquerading
```bash
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo sysctl -w net.inet6.ip6.forwarding=1
$ sudo sh -c "echo 'nat on {en0} from 10.45.0.0/16 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
$ sudo sh -c "echo 'nat on {en0} from cafe::1/64 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
$ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
```
**Tip:** The script provided in [$GIT_REPO/support/network/restart.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/support/network/restart.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./support/network/restart.sh`
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
### Building Open5GS
@@ -54,13 +89,19 @@ $ sudo sysctl -w net.inet.ip.forwarding=1
Install the depedencies for building the source code.
```bash
$ sudo pkg install py36-pip ninja gcc bison gsed pkgconf git mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd curl
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2 pkg-config bison
```
Install Meson using Python.
Configure Homebrew PATH
```bash
$ sudo pip install --upgrade pip
$ sudo pip install meson
$ export PATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/bin:$PATH"
$ export LIBRARY_PATH=/opt/homebrew/lib
$ export C_INCLUDE_PATH=/opt/homebrew/include
```
Install Meson using Homebrew.
```bash
$ brew install meson
```
Git clone.
@@ -73,7 +114,7 @@ To compile with meson:
```bash
$ cd open5gs
$ meson build --prefix=`pwd`/install
$ meson build --prefix=`pwd`/install -D c_std=c99
$ ninja -C build
```
@@ -107,13 +148,14 @@ $ ninja install
$ cd ../
```
### Building WebUI of Open5GS
---
[Node.js](https://nodejs.org/) is required to build WebUI of Open5GS
```bash
$ sudo pkg install node
$ brew install node
```
Install the dependencies to run WebUI
@@ -128,4 +170,3 @@ The WebUI runs as an [npm](https://www.npmjs.com/) script.
```bash
$ npm run dev
```

View File

@@ -3,14 +3,23 @@ title: Mac OS X
head_inline: "<style> .blue { color: blue; } </style>"
---
This guide is based on **macOS Big Sur 11.0.1**.
This guide is based on macOS Big Sur 11.2 on a Macbook Pro(Intel Chips) computer.
{: .blue}
### Install Xcode Command-Line Tools
---
Homebrew requires the Xcode command-line tools from Apple's Xcode.
```bash
$ xcode-select --install
```
### Installing Homebrew
---
Install brew using the official Homebrew installation instructions.
```bash
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
### Getting MongoDB
@@ -32,14 +41,13 @@ $ mongod --config /usr/local/etc/mongod.conf
{: .notice--info}
### Setting up TUN device (No persistent after rebooting)
### Setting up network (No persistent after rebooting)
---
Install TUN/TAP driver
- You can download it from [http://tuntaposx.sourceforge.net/](http://tuntaposx.sourceforge.net/)
- And then, run tuntap_20150118.pkg to install TUN/TAP driver.
Note that Open5GS uses built-in "utun" device driver. So, You don't have to install external TUN/TAP driver.
{: .blue}
Configure the TUN device.
Configure the loopback interface.
```bash
$ sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
@@ -54,16 +62,25 @@ $ sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
```
Enable IP forwarding & Masquerading
```bash
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo sysctl -w net.inet6.ip6.forwarding=1
$ sudo sh -c "echo 'nat on {en0} from 10.45.0.0/16 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
$ sudo sh -c "echo 'nat on {en0} from cafe::1/64 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
$ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
@@ -152,4 +169,3 @@ The WebUI runs as an [npm](https://www.npmjs.com/) script.
```bash
$ npm run dev
```

View File

@@ -0,0 +1,216 @@
---
title: FreeBSD
head_inline: "<style> .blue { color: blue; } </style>"
---
This guide is based on **FreeBSD-11.4-STABLE**.
{: .blue}
## Install **FreeBSD-11.4-STABLE** from Vagrant box (optional)
---
Vagrant provides a simple way to create and deploy Virtual Machines from
pre-built images using VirtualBox, libvirt, or VMWare as a hypervisor engine.
This allows the user to quickly create a virtual machine without the hassle
of installing the operating system by hand.
### Install Vagrant
---
The instructions to install Vagrant are provided at
[vagrantup.com](https://www.vagrantup.com/).
### Create a FreeBSD-11.4-STABLE Virtual Machine using Vagrant
---
Use the supplied `Vagrantfile` in the `vagrant` directory to create the
virtual machine.
Note that this Vagrantfile is identical to the base FreeBSD 11 box, with
the exception that the amount of virtual memory has been increased to 1GB:
```bash
cd vagrant/freebsd
vagrant up --provider virtualbox
```
### Log into the newly created FreeBSD VM
---
Use SSH to log into the FreeBSD 11 VM:
```bash
vagrant ssh
```
Note that the Open5GS source is *not* copied into the VM. The instructions
below provide the step by step instructions for setting up Open5GS for
either a bare metal or virtual FreeBSD 11 system.
The rest of the commands below are performed inside the FreeBSD VM as the
user 'vagrant', or on your bare metal FreeBSD 11 system as any normal user.
### Getting MongoDB
---
Install MongoDB with package manager.
```bash
$ sudo pkg install mongodb44
```
Run MongoDB server.
```bash
$ mkdir -p ./data/db
$ mongod --dbpath ./data/db
```
### Setting up network (No persistent after rebooting)
---
Configure the loopback interface.
```bash
$ sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.6 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.7 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.8 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.9 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
```
Enable IP forwarding
```bash
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo sysctl -w net.inet6.ip6.forwarding=1
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
### Building Open5GS
---
Install the depedencies for building the source code.
```bash
$ sudo pkg install meson ninja gcc bison gsed pkgconf git mongo-c-driver gnutls libgcrypt libidn libyaml libmicrohttpd nghttp2
```
Configure gcc PATH
```bash
$ setenv LIBRARY_PATH /usr/local/lib
$ setenv C_INCLUDE_PATH /usr/local/include
```
If you are using BASH instead of default CSH,
```bash
$ export LIBRARY_PATH=/usr/local/lib
$ export C_INCLUDE_PATH=/usr/local/include
```
Git clone.
```bash
$ git clone https://github.com/{{ site.github_username }}/open5gs
```
To compile with meson:
```bash
$ cd open5gs
$ meson build --prefix=`pwd`/install
$ ninja -C build
```
**Note:** No source code changes are required for FreeBSD 11.x version. However, in FreeBSD 12.x version, we'll getting a crash with segmentation fault when calling basename(3). To avoid this, you need to change the freeDiameter source code as below.
{: .blue}
```diff
$ cd open5gs/subprojects/freeDiameter
$ diff --git a/include/freeDiameter/libfdproto.h b/include/freeDiameter/libfdproto.h
index 52c11ef..cd7f383 100644
--- a/include/freeDiameter/libfdproto.h
+++ b/include/freeDiameter/libfdproto.h
@@ -293,7 +293,7 @@ extern int fd_g_debug_lvl;
/* A version of __FILE__ without the full path. This is specific to each C file being compiled */
static char * file_bname = NULL;
-static char * file_bname_init(char * full) { file_bname = basename(full); return file_bname; }
+static char * file_bname_init(char * full) { file_bname = __old_basename(full); return file_bname; }
#define __STRIPPED_FILE__ (file_bname ?: file_bname_init((char *)__FILE__))
```
Now, compile again:
{: .blue}
```bash
$ cd open5gs
$ ninja -C build
```
Check whether the compilation is correct.
**Note:** This should require *sudo* due to access `/dev/tun0`.
{: .notice--danger}
```bash
$ sudo ./build/tests/attach/attach ## EPC Only
$ sudo ./build/tests/registration/registration ## 5G Core Only
```
Run all test programs as below.
**Note:** This should require *sudo* due to access `/dev/tun0`.
{: .notice--danger}
```bash
$ cd build
$ sudo meson test -v
```
**Tip:** You can also check the result of `ninja -C build test` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http2.data.data || http2.headers`. You can see the virtually created packets. [testattach.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testattach.pcapng)/[testregistration.pcapng]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testregistration.pcapng)
{: .notice--info}
You need to perform the **installation process**.
```bash
$ cd build
$ ninja install
$ cd ../
```
### Building WebUI of Open5GS
---
[Node.js](https://nodejs.org/) is required to build WebUI of Open5GS
```bash
$ sudo pkg install node
```
Install the dependencies to run WebUI
```bash
$ cd webui
$ npm install
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.
```bash
$ npm run dev
```

View File

@@ -24,10 +24,11 @@ open5gs 27485 0.0 0.0 243816 15064 ? Ssl 12:13 0:00 /usr/bin/open5g
open5gs 27543 0.0 0.0 222416 9672 ? Ssl 12:13 0:00 /usr/bin/open5gs-ausfd -c /etc/open5gs/ausf.yaml
open5gs 27600 0.0 0.0 222328 9668 ? Ssl 12:13 0:00 /usr/bin/open5gs-udmd -c /etc/open5gs/udm.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-pcfd -c /etc/open5gs/pcf.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-nssfd -c /etc/open5gs/nssf.yaml
open5gs 27697 0.0 0.0 243976 13716 ? Ssl 12:13 0:00 /usr/bin/open5gs-udrd -c /etc/open5gs/udr.yaml
```
You should see each of the above services, MME, SGW-C, SMF, AMF, SGW-U, UPF, HSS, PCRF, NRF, AUSF, UDM, PCF & UDR are all running.
You should see each of the above services, MME, SGW-C, SMF, AMF, SGW-U, UPF, HSS, PCRF, NRF, AUSF, UDM, PCF, NSSF & UDR are all running.
If your instance doesn't show this make sure you're started each service:
```bash
@@ -43,6 +44,7 @@ $ systemctl start open5gs-nrfd.service
$ systemctl start open5gs-ausfd.service
$ systemctl start open5gs-udmd.service
$ systemctl start open5gs-pcfd.service
$ systemctl start open5gs-nssfd.service
$ systemctl start open5gs-udrd.service
```

View File

@@ -64,6 +64,7 @@ $ open5gs-amfd
$ open5gs-ausfd
$ open5gs-udmd
$ open5gs-pcfd
$ open5gs-nssfd
$ open5gs-udrd
```
@@ -141,6 +142,11 @@ Restart systemd-networkd
$ sudo systemctl restart systemd-networkd
```
And then, you need to chanage NAT table as below.
```
$ sudo iptables -t nat -A POSTROUTING -s 10.46.0.0/16 ! -o ogstun -j MASQUERADE
```
Now, you need to modify the configuration file of Open5GS to adjust the UE IP Pool. UE IP Pool can be allocated by SMF or UPF, but in this tutorial, we will modify both configuration files.
```diff
@@ -263,6 +269,7 @@ $ sudo pkill -9 open5gs-nrfd
$ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
$ sudo pkill -9 open5gs-nssfd
$ sudo pkill -9 open5gs-udrd
```
@@ -357,9 +364,10 @@ Timeout: 0
#### Is it possible to setup IP/NAT table along with Docker?
Enable IP Forward.
Enable IPv4/IPv6 Forward.
```
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
```
The following is the default docker IP/NAT table.
@@ -435,6 +443,11 @@ And then, apply **newtables** as below.
$ sudo iptables-restore < newtables
```
Docker doesn't have IPv6 NAT rules. In this case, you just add the NAT rule as below.
```
$ sudo ip6tables -t nat -A POSTROUTING -s cafe::/64 ! -o ogstun -j MASQUERADE
```
The above operation is the same as described in the following manuals.
```
### Check IP Tables
@@ -462,11 +475,13 @@ target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
### Enable IPv4 Forwarding
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
### Enable IPv4/IPv6 Forwarding
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
### Add NAT Rule
$ sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
$ sudo ip6tables -t nat -A POSTROUTING -s cafe::/64 ! -o ogstun -j MASQUERADE
```
#### How to use a different DNN/APN for each SMF
@@ -693,7 +708,7 @@ You should configure the domain name on your computer. Otherwise, freeDiameter r
#### How many of UEs can Open5GS support?
See the [lib/core/ogs-3gpp-types.h](https://github.com/{{ site.github_username }}/open5gs/blob/master/lib/core/ogs-3gpp-types.h).
See the [lib/core/ogs-3gpp-types.h](https://github.com/{{ site.github_username }}/open5gs/blob/main/lib/core/ogs-3gpp-types.h).
```
#define MAX_NUM_OF_ENB 128
@@ -731,6 +746,7 @@ Currently, the number of UE is limited to `128*128`.
* AUSF : 127.0.0.11
* UDM : 127.0.0.12
* PCF : 127.0.0.13
* NSSF : 127.0.0.14
* UDR : 127.0.0.20
```

View File

@@ -222,7 +222,7 @@ Then proceed as follows:
3. Fill the IMSI, security context(K, OPc, AMF), and APN of the subscriber.
4. Click `SAVE` Button
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@@ -257,7 +257,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml.old 2020-08-22 12:08:44.782880778 -0400
@@ -308,11 +308,13 @@ target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
### Enable IPv4 Forwarding
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
### Enable IPv4/IPv6 Forwarding
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1
### Add NAT Rule
$ sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
$ sudo ip6tables -t nat -A POSTROUTING -s cafe::/64 ! -o ogstun -j MASQUERADE
```
**Note:** For the first time, it is a good condition if you do not have any rules in the IP/NAT tables. If a program such as docker has already set up a rule, you will need to add a rule differently.

View File

@@ -754,8 +754,8 @@ Below startup script can be used for setting up interfaces:
```
#!/bin/bash
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sh -c "echo 1 > /proc/sys/net/ipv6/ip_forward"
sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl -w net.ipv6.conf.all.forwarding=1
ip tuntap add name ogstun mode tun
ip addr add 192.168.100.1/24 dev ogstun

View File

@@ -14,15 +14,17 @@ Open5GS is a C-language Open Source implementation of 5GC and EPC, i.e. the core
- Support of USIM cards using Milenage
- IPv6 support
- Multiple PDU session
- S1/X2 and Xn Handover
- Handover(5GC Xn/N2 and EPC S1/X2)
- CSFB(Circuit Switched Fall Back) and SMSoS(SMS Over SGs)
- VoLTE(Voice over LTE)
#### Known Limitations
---
- No OCS/OFCS
- No VoNR(Voice over NR)
- No Interworking with EPC
- No NB-IoT
- No OCS/OFCS
- No eMBMS
- No SRVCC
- No Roaming

View File

@@ -30,7 +30,9 @@ head_inline: "<style> ul { padding-bottom: 1em; } </style>"
- [Debian/Ubuntu](platform/01-debian-ubuntu)
- [CentOS](platform/02-centos)
- [Fedora](platform/03-fedora)
- [MacOSX](platform/05-macosx)
- [MacOSX(Apple Silicon)](platform/05-macosx-apple-silicon)
- [MacOSX(Intel)](platform/06-macosx-intel)
- [FreeBSD](platform/07-freebsd)
- Hardware Specific Notes
- [Tested e/gNodeBs](hardware/01-genodebs)

View File

@@ -0,0 +1,29 @@
---
title: "v2.1.5 - 5G Core N2 based handover"
date: 2021-02-02 14:52:00 -0500
categories:
- Release
tags:
- News
- Release
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
---
#### New feature
- [5GC] N2 Handver ([49a9e58](https://github.com/open5gs/open5gs/commit/49a9e58efe3f6ecd482c3b77b98cd0841688b647), [ff5236f](https://github.com/open5gs/open5gs/commit/ff5236f3e01ee6984bc78eaacc7d84e08c321266))
#### Enhancement
- [AMF/MME] Check IMEISV length == 16 digits ([388e642](https://github.com/open5gs/open5gs/commit/388e64213fcebc257eb7bd0223105c3055c56252))
- [AMF] Add Handling Duplicated PDU Session ID ([d9417be](https://github.com/open5gs/open5gs/commit/d9417be9a62255efa91a11ee2c424ec1e739b919))
- [ASN] S1AP/NGAP update to v16.4.0(2021-01-04) ([ada01fc](https://github.com/open5gs/open5gs/commit/ada01fca8ffaea029d2ae04e6bc1bb499ab37894))
- [AMF/MME] Add UserLocation Handling in UplinkNASTransport ([#772](https://github.com/open5gs/open5gs/pull/772)) -- [zhonglin6666](https://github.com/zhonglin6666)
#### Bug Fixes
- [UDR] Modify SmfSelectionSubscriptionData ([#785](https://github.com/open5gs/open5gs/pull/785)) -- [zhonglin6666](https://github.com/zhonglin6666)
- [MME] ENBDirectInformationTransfer decoding problem ([#783](https://github.com/open5gs/open5gs/issues/783)) -- [kuanghanqian](https://github.com/kuanghanqian)
- [AMF] PartOfNG-Interface in NGReset decoding problem ([#773](https://github.com/open5gs/open5gs/issues/773)) -- [acetcom](https://github.com/acetcom)
- [AMF] Fix UE Context Request IE Handling ([#771](https://github.com/open5gs/open5gs/issues/771)) -- [kuanghanqian](https://github.com/kuanghanqian)
- [5GC] Fix the AMF/SMF/UDM crash issues ([#770](https://github.com/open5gs/open5gs/issues/770), [#771](https://github.com/open5gs/open5gs/issues/771)) -- [kuanghanqian](https://github.com/kuanghanqian)
Download -- [v2.1.5.tar.gz](https://github.com/open5gs/open5gs/archive/v2.1.5.tar.gz)
{: .notice--info}

View File

@@ -0,0 +1,22 @@
---
title: "v2.1.7 - 5G Core Hotfix"
date: 2021-02-07 22:31:00 -0500
categories:
- Release
tags:
- News
- Release
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
---
#### Bug Fixes
- [5GC/EPC] Pool size adjusted to support 1,024 UEs ([#753](https://github.com/open5gs/open5gs/issues/753)) -- [zhouxiang93123](https://github.com/zhouxiang93123)
- [AMF] Crash during handling Duplicated PDU Session ID ([#793](https://github.com/open5gs/open5gs/issues/783)) -- [kuanghanqian](https://github.com/kuanghanqian)
#### New Platform
- MacOSX with Apple M1 Silicon ([7901a1](https://github.com/open5gs/open5gs/commit/7901a1164fdaa04cf72a5a944f50474d569f619d))
- FreeBSD ([852756](https://github.com/open5gs/open5gs/commit/852756f90222a8e0821f6e1994baa32eafbdc47c))
Download -- [v2.1.7.tar.gz](https://github.com/open5gs/open5gs/archive/v2.1.7.tar.gz)
{: .notice--info}

View File

@@ -0,0 +1,30 @@
---
title: "v2.2.0 - DB Schema Changes"
date: 2021-03-08 21:35:00 +0900
categories:
- Release
tags:
- News
- Release
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
---
#### DB Schema Changes
- No backward compatibility. If you are using an old subscription DB, you should change to the new DB schema.
#### New features
- NSSF(Network Slice Selection Function) is added.
- SMF selection is added.
#### Enhancement
- [DB] Masking MongoDB credentials when logging ([#827](https://github.com/open5gs/open5gs/pull/827)) -- [cglewis](https://github.com/cglewis)
- [EPC/5GC] Branch name changes from master to main ([#811](https://github.com/open5gs/open5gs/pull/811)) -- [PawelMack](https://github.com/PawelMack)
- [AMF] Cause of UEContextRelaseCommand uses Cause of UEContextReleaseRequest ([#789](https://github.com/open5gs/open5gs/issues/789)) -- [PawelMack](https://github.com/PawelMack)
#### Bug Fixes
- [SMF] Fix the bug for DataForwardingNotPossible ([31977bf](https://github.com/open5gs/open5gs/commit/31977bf30a396389557c8be0f82cfdfb8152d580))
- [AMF] Fix the exception handling routine when UE/gNB repeatedly sends NGAP messages ([#804](https://github.com/open5gs/open5gs/issues/804)) -- [strongcourage](https://github.com/strongcourage)
Download -- [v2.2.0.tar.gz](https://github.com/open5gs/open5gs/archive/v2.2.0.tar.gz)
{: .notice--info}

View File

@@ -10,7 +10,7 @@
#
PACKAGE="open5gs"
VERSION="2.0.0"
VERSION="2.2.0"
print_status() {
echo

View File

@@ -78,6 +78,9 @@ void ausf_terminate(void);
int pcf_initialize(void);
void pcf_terminate(void);
int nssf_initialize(void);
void nssf_terminate(void);
int upf_initialize(void);
void upf_terminate(void);

View File

@@ -86,7 +86,7 @@ static void recalculate_pool_size(void)
self.pool.pfcp_node = self.pool.nf;
#define MAX_NUM_OF_NF_SERVICE 16 /* Num of NF Service per NF Instance */
#define MAX_NUM_OF_SBI_MESSAGE 8 /* Num of HTTP(s) Request/Response per NF */
#define MAX_NUM_OF_SBI_MESSAGE 4 /* Num of HTTP(s) Request/Response per NF */
#define MAX_NUM_OF_NF_SUBSCRIPTION 4 /* Num of Subscription per NF */
self.pool.nf_service = self.pool.nf * MAX_NUM_OF_NF_SERVICE;
self.pool.sbi_message = self.pool.nf * MAX_NUM_OF_SBI_MESSAGE;

View File

@@ -63,6 +63,7 @@ typedef struct ogs_app_context_s {
int no_ausf;
int no_udm;
int no_pcf;
int no_nssf;
int no_udr;
int no_nrf;

View File

@@ -245,7 +245,6 @@ libcore_sources = files('''
ogs-socknode.h
ogs-udp.h
ogs-tcp.h
ogs-tun.h
ogs-queue.h
ogs-poll.h
ogs-notify.h
@@ -280,7 +279,6 @@ libcore_sources = files('''
ogs-socknode.c
ogs-udp.c
ogs-tcp.c
ogs-tun.c
ogs-queue.c
ogs-select.c
ogs-poll.c

View File

@@ -473,12 +473,64 @@ char *ogs_ipv6_to_string(uint8_t *addr6)
return (char *)OGS_INET6_NTOP(addr6, buf);
}
ogs_slice_data_t *ogs_slice_find_by_s_nssai(
ogs_slice_data_t *slice_data, int num_of_slice_data,
ogs_s_nssai_t *s_nssai)
{
int i;
ogs_assert(slice_data);
ogs_assert(num_of_slice_data);
ogs_assert(s_nssai);
/* Compare S-NSSAI */
for (i = 0; i < num_of_slice_data; i++) {
if (s_nssai->sst == slice_data[i].s_nssai.sst &&
s_nssai->sd.v == slice_data[i].s_nssai.sd.v) {
return slice_data + i;
}
}
/* Compare Only SST if DefaultSingleNSSAI */
for (i = 0; i < num_of_slice_data; i++) {
if (slice_data[i].default_indicator == true &&
s_nssai->sst == slice_data[i].s_nssai.sst) {
return slice_data + i;
}
}
return NULL;
}
void ogs_subscription_data_free(ogs_subscription_data_t *subscription_data)
{
int i, j;
ogs_assert(subscription_data);
for (i = 0; i < subscription_data->num_of_slice; i++) {
ogs_slice_data_t *slice_data = &subscription_data->slice[i];
for (j = 0; j < slice_data->num_of_session; j++) {
if (slice_data->session[j].name)
ogs_free(slice_data->session[j].name);
}
slice_data->num_of_session = 0;
}
subscription_data->num_of_slice = 0;
}
void ogs_session_data_free(ogs_session_data_t *session_data)
{
int i;
ogs_assert(session_data);
if (session_data->session.name)
ogs_free(session_data->session.name);
for (i = 0; i < session_data->num_of_pcc_rule; i++)
OGS_PCC_RULE_FREE(&session_data->pcc_rule[i]);
}

View File

@@ -178,13 +178,11 @@ typedef struct ogs_nr_cgi_s {
/************************************
* S-NSSAI Structure */
#define OGS_MAX_NUM_OF_S_NSSAI 16
#define OGS_MAX_NUM_OF_SLICE 8
#define OGS_S_NSSAI_NO_SD_VALUE 0xffffff
typedef struct ogs_s_nssai_s {
uint8_t sst;
ogs_uint24_t sd;
uint8_t mapped_hplmn_sst;
ogs_uint24_t mapped_hplmn_sd;
} __attribute__ ((packed)) ogs_s_nssai_t;
char *ogs_s_nssai_sd_to_string(ogs_uint24_t sd);
@@ -220,26 +218,17 @@ char *ogs_ipv6_to_string(uint8_t *addr6);
typedef struct ogs_paa_s {
ED2(uint8_t spare:5;,
/* 8.34 PDN Type */
#define OGS_GTP_PDN_TYPE_IPV4 OGS_PDU_SESSION_TYPE_IPV4
#define OGS_GTP_PDN_TYPE_IPV6 OGS_PDU_SESSION_TYPE_IPV6
#define OGS_GTP_PDN_TYPE_IPV4V6 OGS_PDU_SESSION_TYPE_IPV4V6
#define OGS_GTP_PDN_TYPE_NON_IP OGS_PDU_SESSION_TYPE_NONIP
#define OGS_PFCP_PDN_TYPE_IPV4 OGS_PDU_SESSION_TYPE_IPV4
#define OGS_PFCP_PDN_TYPE_IPV6 OGS_PDU_SESSION_TYPE_IPV6
#define OGS_PFCP_PDN_TYPE_IPV4V6 OGS_PDU_SESSION_TYPE_IPV4V6
#define OGS_PFCP_PDN_TYPE_NONIP OGS_PDU_SESSION_TYPE_NONIP
#define OGS_PDU_SESSION_TYPE_IS_VALID(x) \
((x) == OGS_PDU_SESSION_TYPE_IPV4 || \
(x) == OGS_PDU_SESSION_TYPE_IPV6 || \
(x) == OGS_PDU_SESSION_TYPE_IPV4V6) \
#define OGS_GTP_PDN_TYPE_IS_VALID(x) \
((x) == OGS_GTP_PDN_TYPE_IPV4 || \
(x) == OGS_GTP_PDN_TYPE_IPV6 || \
(x) == OGS_GTP_PDN_TYPE_IPV4V6) \
uint8_t pdn_type:3;)
uint8_t session_type:3;)
union {
/* GTP_PDN_TYPE_IPV4 */
/* PDU_SESSION_TYPE_IPV4 */
uint32_t addr;
/* GTP_PDN_TYPE_IPV6 */
/* PDU_SESSION_TYPE_IPV6 */
struct {
/* the IPv6 Prefix Length */
uint8_t len;
@@ -247,7 +236,7 @@ ED2(uint8_t spare:5;,
uint8_t addr6[OGS_IPV6_LEN];
};
/* GTP_PDN_TYPE_BOTH */
/* PDU_SESSION_TYPE_IPV4V6 */
struct {
struct {
/* the IPv6 Prefix Length */
@@ -270,20 +259,10 @@ typedef struct ogs_bitrate_s {
/**********************************
* QoS Structure */
typedef struct ogs_qos_s {
#define OGS_PDN_QCI_1 1
#define OGS_PDN_QCI_2 2
#define OGS_PDN_QCI_3 3
#define OGS_PDN_QCI_4 4
#define OGS_PDN_QCI_5 5
#define OGS_PDN_QCI_6 6
#define OGS_PDN_QCI_7 7
#define OGS_PDN_QCI_8 8
#define OGS_PDN_QCI_9 9
#define OGS_PDN_QCI_65 65
#define OGS_PDN_QCI_66 66
#define OGS_PDN_QCI_69 69
#define OGS_PDN_QCI_70 70
uint8_t qci;
#define OGS_QOS_INDEX_1 1
#define OGS_QOS_INDEX_2 2
#define OGS_QOS_INDEX_5 5
uint8_t index;
struct {
/* Values 1 to 8 should only be assigned for services that are
@@ -291,12 +270,27 @@ typedef struct ogs_qos_s {
* Values 9 to 15 may be assigned to resources that are authorized
* by the home network and thus applicable when a UE is roaming. */
uint8_t priority_level;
/*
* Ch 7.3.40 Allocation-Retenion-Proirty in TS 29.272 V15.9.0
*
* If the Pre-emption-Capability AVP is not present in the
* Allocation-Retention-Priority AVP, the default value shall be
* PRE-EMPTION_CAPABILITY_DISABLED (1).
*
* If the Pre-emption-Vulnerability AVP is not present in the
* Allocation-Retention-Priority AVP, the default value shall be
* PRE-EMPTION_VULNERABILITY_ENABLED (0).
*
* However, to easily set up VoLTE service,
* enable Pre-emption Capability/Vulnerablility
* in Default Bearer
*/
#define OGS_EPC_PRE_EMPTION_DISABLED 1
#define OGS_EPC_PRE_EMPTION_ENABLED 0
#define OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED 0
#define OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED 1
#define OGS_5GC_PRE_EMPTION_DISABLED 1
#define OGS_5GC_PRE_EMPTION_ENABLED 2
uint8_t pre_emption_capability;
#define OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED 0
#define OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED 1
uint8_t pre_emption_vulnerability;
} arp;
@@ -394,22 +388,21 @@ typedef struct ogs_pcc_rule_s {
/**********************************
* PDN Structure */
typedef struct ogs_pdn_s {
uint32_t context_identifier;
union {
char apn[OGS_MAX_APN_LEN+1];
char dnn[OGS_MAX_DNN_LEN+1];
};
#define OGS_DIAM_PDN_TYPE_IPV4 0
#define OGS_DIAM_PDN_TYPE_IPV6 1
#define OGS_DIAM_PDN_TYPE_IPV4V6 2
#define OGS_DIAM_PDN_TYPE_IPV4_OR_IPV6 3
typedef struct ogs_session_s {
char *name;
uint32_t context_identifier; /* EPC */
bool default_dnn_indicator; /* 5GC */
#define OGS_PDU_SESSION_TYPE_IPV4 1
#define OGS_PDU_SESSION_TYPE_IPV6 2
#define OGS_PDU_SESSION_TYPE_IPV4V6 3
#define OGS_PDU_SESSION_TYPE_UNSTRUCTURED 4
#define OGS_PDU_SESSION_TYPE_ETHERNET 5
uint8_t pdn_type;
#define OGS_PDU_SESSION_TYPE_TO_DIAMETER(x) ((x)-1)
#define OGS_PDU_SESSION_TYPE_FROM_DIAMETER(x) ((x)+1)
uint8_t session_type;
#define OGS_SSC_MODE_1 1
#define OGS_SSC_MODE_2 2
@@ -421,8 +414,8 @@ typedef struct ogs_pdn_s {
ogs_paa_t paa;
ogs_ip_t ue_ip;
ogs_ip_t pgw_ip;
} ogs_pdn_t;
ogs_ip_t smf_ip;
} ogs_session_t;
int ogs_fqdn_build(char *dst, char *src, int len);
int ogs_fqdn_parse(char *dst, char *src, int len);
@@ -478,6 +471,20 @@ ED3(uint8_t ext:1;,
int ogs_pco_parse(ogs_pco_t *pco, unsigned char *data, int data_len);
int ogs_pco_build(unsigned char *data, int data_len, ogs_pco_t *pco);
typedef struct ogs_slice_data_s {
ogs_s_nssai_t s_nssai;
bool default_indicator;
uint32_t context_identifier; /* EPC for checking default APN */
int num_of_session;
ogs_session_t session[OGS_MAX_NUM_OF_SESS];
} ogs_slice_data_t;
ogs_slice_data_t *ogs_slice_find_by_s_nssai(
ogs_slice_data_t *slice_data, int num_of_slice_data,
ogs_s_nssai_t *s_nssai);
typedef struct ogs_subscription_data_s {
#define OGS_ACCESS_RESTRICTION_UTRAN_NOT_ALLOWED (1)
#define OGS_ACCESS_RESTRICTION_GERAN_NOT_ALLOWED (1<<1)
@@ -500,9 +507,8 @@ typedef struct ogs_subscription_data_s {
#define OGS_RAU_TAU_DEFAULT_TIME (12*60) /* 12 min */
uint32_t subscribed_rau_tau_timer; /* unit : seconds */
uint32_t context_identifier; /* default APN */
ogs_pdn_t pdn[OGS_MAX_NUM_OF_SESS];
int num_of_pdn;
int num_of_slice;
ogs_slice_data_t slice[OGS_MAX_NUM_OF_SLICE];
#define OGS_MAX_NUM_OF_MSISDN 4
int num_of_msisdn;
@@ -513,11 +519,13 @@ typedef struct ogs_subscription_data_s {
} msisdn[OGS_MAX_NUM_OF_MSISDN];
} ogs_subscription_data_t;
void ogs_subscription_data_free(ogs_subscription_data_t *subscription_data);
typedef struct ogs_session_data_s {
ogs_pdn_t pdn;
ogs_session_t session;
#define OGS_MAX_NUM_OF_PCC_RULE 8 /* Num of PCC Rule */
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
int num_of_pcc_rule;
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
int num_of_pcc_rule;
} ogs_session_data_t;
void ogs_session_data_free(ogs_session_data_t *session_data);

View File

@@ -57,6 +57,9 @@
#include <errno.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <sys/socket.h>
#endif

View File

@@ -49,7 +49,6 @@
#include "core/ogs-socknode.h"
#include "core/ogs-udp.h"
#include "core/ogs-tcp.h"
#include "core/ogs-tun.h"
#include "core/ogs-queue.h"
#include "core/ogs-poll.h"
#include "core/ogs-notify.h"

View File

@@ -108,14 +108,7 @@ extern "C" {
#define be64toh(x) OSSwapBigToHostInt64((x))
#elif defined(__FreeBSD__)
#define le16toh(x) letoh16(x)
#define le32toh(x) letoh32(x)
#define le64toh(x) letoh64(x)
#define be16toh(x) betoh16(x)
#define be32toh(x) betoh32(x)
#define be64toh(x) betoh64(x)
#include <sys/endian.h>
#endif
#ifndef WORDS_BIGENDIAN

View File

@@ -93,7 +93,7 @@ void ogs_pkbuf_default_init(ogs_pkbuf_config_t *config)
memset(config, 0, sizeof *config);
config->cluster_128_pool = 65536;
config->cluster_256_pool = 8192;
config->cluster_256_pool = 16384;
config->cluster_512_pool = 4096;
config->cluster_1024_pool = 1024;
config->cluster_2048_pool = 512;

View File

@@ -60,15 +60,10 @@
#include <mach/clock.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <sys/time.h>
#endif
#include "core-config-private.h"
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include "ogs-core.h"
/*

View File

@@ -48,6 +48,34 @@ ogs_mongoc_mongoc_client_get_server_status (mongoc_client_t *client, /* IN */
return ret;
}
static char *masked_db_uri(const char *db_uri)
{
char *tmp;
char *array[2], *saveptr = NULL;
char *masked = NULL;
ogs_assert(db_uri);
tmp = ogs_strdup(db_uri);
memset(array, 0, sizeof(array));
array[0] = strtok_r(tmp, "@", &saveptr);
if (array[0])
array[1] = strtok_r(NULL, "@", &saveptr);
if (array[1]) {
masked = ogs_msprintf("mongodb://*****:*****@%s", array[1]);
ogs_assert(masked);
} else {
masked = ogs_strdup(array[0]);
ogs_assert(masked);
}
ogs_free(tmp);
return masked;
}
int ogs_mongoc_init(const char *db_uri)
{
bson_t reply;
@@ -63,13 +91,15 @@ int ogs_mongoc_init(const char *db_uri)
memset(&self, 0, sizeof(ogs_mongoc_t));
self.masked_db_uri = masked_db_uri(db_uri);
mongoc_init();
self.initialized = true;
self.client = mongoc_client_new(db_uri);
if (!self.client) {
ogs_error("Failed to parse DB URI [%s]", db_uri);
ogs_error("Failed to parse DB URI [%s]", self.masked_db_uri);
return OGS_ERROR;
}
@@ -88,7 +118,7 @@ int ogs_mongoc_init(const char *db_uri)
if (!ogs_mongoc_mongoc_client_get_server_status(
self.client, NULL, &reply, &error)) {
ogs_warn("Failed to connect to server [%s]", db_uri);
ogs_warn("Failed to connect to server [%s]", self.masked_db_uri);
return OGS_RETRY;
}
@@ -96,7 +126,7 @@ int ogs_mongoc_init(const char *db_uri)
bson_destroy(&reply);
ogs_info("MongoDB URI: '%s'", db_uri);
ogs_info("MongoDB URI: '%s'", self.masked_db_uri);
return OGS_OK;
}
@@ -111,6 +141,10 @@ void ogs_mongoc_final(void)
mongoc_client_destroy(self.client);
self.client = NULL;
}
if (self.masked_db_uri) {
ogs_free(self.masked_db_uri);
self.masked_db_uri = NULL;
}
if (self.initialized) {
mongoc_cleanup();

View File

@@ -37,6 +37,8 @@ typedef struct ogs_mongoc_s {
void *client;
void *database;
char *masked_db_uri;
struct {
void *subscriber;
} collection;

View File

@@ -19,7 +19,7 @@
#include "ogs-dbi.h"
int ogs_dbi_session_data(char *supi, char *dnn,
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
int rv = OGS_OK;
@@ -29,10 +29,13 @@ int ogs_dbi_session_data(char *supi, char *dnn,
bson_error_t error;
const bson_t *document;
bson_iter_t iter;
bson_iter_t child1_iter, child2_iter, child3_iter;
bson_iter_t child4_iter, child5_iter, child6_iter;
bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter, child5_iter;
bson_iter_t child6_iter, child7_iter, child8_iter, child9_iter;
const char *utf8 = NULL;
uint32_t length = 0;
bool found = false;
ogs_session_t *session = NULL;
char *supi_type = NULL;
char *supi_id = NULL;
@@ -40,6 +43,7 @@ int ogs_dbi_session_data(char *supi, char *dnn,
ogs_session_data_t zero_data;
ogs_assert(supi);
ogs_assert(s_nssai);
ogs_assert(dnn);
ogs_assert(session_data);
@@ -53,30 +57,17 @@ int ogs_dbi_session_data(char *supi, char *dnn,
supi_id = ogs_id_get_value(supi);
ogs_assert(supi_id);
query = BCON_NEW(
supi_type, BCON_UTF8(supi_id),
"pdn.apn", BCON_UTF8(dnn));
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
opts = BCON_NEW(
"projection", "{",
supi_type, BCON_INT64(1),
"pdn.$", BCON_INT64(1),
"}"
);
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, opts, NULL);
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else
asdklfjasdf
opts = BCON_NEW(
supi_type, BCON_INT64(1),
"pdn.$", BCON_INT64(1)
);
cursor = mongoc_collection_find(self.subscriberCollection,
MONGOC_QUERY_NONE, 0, 0, 0, query, opts, NULL);
cursor = mongoc_collection_find(ogs_mongoc()->collection.subscriber,
MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
#endif
if (!mongoc_cursor_next(cursor, &document)) {
ogs_error("Cannot find IMSI(%s)+APN(%s) in DB", supi_id, dnn);
ogs_error("[%s] Cannot find IMSI in DB", supi);
rv = OGS_ERROR;
goto out;
@@ -89,6 +80,7 @@ int ogs_dbi_session_data(char *supi, char *dnn,
goto out;
}
/* Finding Session for S_NSSAI+DNN */
if (!bson_iter_init(&iter, document)) {
ogs_error("bson_iter_init failed in this document");
@@ -98,279 +90,409 @@ int ogs_dbi_session_data(char *supi, char *dnn,
while (bson_iter_next(&iter)) {
const char *key = bson_iter_key(&iter);
if (!strcmp(key, "pdn") &&
BSON_ITER_HOLDS_ARRAY(&iter)) {
int pdn_index = 0;
if (!strcmp(key, "slice") && BSON_ITER_HOLDS_ARRAY(&iter)) {
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_pdn_t *pdn = NULL;
uint8_t sst;
ogs_uint24_t sd;
ogs_assert(child1_key);
pdn_index = atoi(child1_key);
ogs_assert(pdn_index == 0);
sst = 0;
sd.v = OGS_S_NSSAI_NO_SD_VALUE;
pdn = &session_data->pdn;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if ((!strcmp(child2_key, "apn") ||
!strcmp(child2_key, "dnn")) &&
if (!strcmp(child2_key, "sst") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
sst = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "sd") &&
BSON_ITER_HOLDS_UTF8(&child2_iter)) {
utf8 = bson_iter_utf8(&child2_iter, &length);
ogs_cpystrn(pdn->dnn, utf8,
ogs_min(length, OGS_MAX_APN_LEN)+1);
} else if (!strcmp(child2_key, "type") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
pdn->pdn_type = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "qci") &&
BSON_ITER_HOLDS_INT32(&child3_iter)) {
pdn->qos.qci = bson_iter_int32(&child3_iter);
} else if (!strcmp(child3_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.priority_level =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_capability =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child4_iter);
}
}
}
}
} else if (!strcmp(child2_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.uplink =
bson_iter_int64(&child3_iter) * 1024;
} else if (!strcmp(child3_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.downlink =
bson_iter_int64(&child3_iter) * 1024;
}
}
} else if (!strcmp(child2_key, "pcc_rule") &&
ogs_assert(utf8);
sd = ogs_s_nssai_sd_from_string(utf8);
} else if (!strcmp(child2_key, "session") &&
BSON_ITER_HOLDS_ARRAY(&child2_iter)) {
int pcc_rule_index = 0;
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
ogs_pcc_rule_t *pcc_rule = NULL;
}
}
ogs_assert(child3_key);
pcc_rule_index = atoi(child3_key);
ogs_assert(pcc_rule_index <
OGS_MAX_NUM_OF_PCC_RULE);
if (!sst) {
ogs_error("No SST");
continue;
}
pcc_rule = &session_data->pcc_rule[pcc_rule_index];
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (s_nssai->sst != sst) continue;
if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "qci") &&
BSON_ITER_HOLDS_INT32(
&child5_iter)) {
pcc_rule->qos.qci =
bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"priority_level") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
priority_level =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
pre_emption_capability =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability")
&& BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(
&child6_iter);
}
}
} else if (!strcmp(child5_key, "mbr") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"downlink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.mbr.downlink =
bson_iter_int64(
&child6_iter) * 1024;
} else if (!strcmp(child6_key,
"uplink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.mbr.uplink =
bson_iter_int64(
&child6_iter) * 1024;
}
}
} else if (!strcmp(child5_key, "gbr") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(&child5_iter,
&child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"downlink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.gbr.downlink =
bson_iter_int64(
&child6_iter) * 1024;
} else if (!strcmp(child6_key,
"uplink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.gbr.uplink =
bson_iter_int64(
&child6_iter) * 1024;
}
}
}
}
} else if (!strcmp(child4_key, "flow") &&
BSON_ITER_HOLDS_ARRAY(&child4_iter)) {
int flow_index = 0;
if (s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE &&
sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
if (s_nssai->sd.v != sd.v) continue;
}
bson_iter_recurse(&child4_iter,
&child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
ogs_flow_t *flow = NULL;
ogs_assert(child5_key);
flow_index = atoi(child5_key);
ogs_assert(
flow_index < OGS_MAX_NUM_OF_FLOW);
flow = &pcc_rule->flow[flow_index];
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"direction") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
flow->direction =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"description") &&
BSON_ITER_HOLDS_UTF8(
&child6_iter)) {
utf8 = bson_iter_utf8(
&child6_iter, &length);
flow->description =
ogs_malloc(length+1);
ogs_cpystrn(
(char*)flow->description,
utf8, length+1);
}
}
flow_index++;
}
pcc_rule->num_of_flow = flow_index;
}
while (bson_iter_next(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key = bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "name") &&
BSON_ITER_HOLDS_UTF8(&child4_iter)) {
utf8 = bson_iter_utf8(&child4_iter, &length);
if (ogs_strncasecmp(utf8, dnn, length) == 0) {
found = true;
goto done;
}
/* EPC: Charing-Rule-Name */
if (pcc_rule->name) {
ogs_error(
"PCC Rule Name has already been defined");
ogs_free(pcc_rule->name);
}
pcc_rule->name = ogs_msprintf(
"%s%d", dnn, pcc_rule_index+1);
ogs_assert(pcc_rule->name);
/* 5GC: PCC-Rule-Id */
if (pcc_rule->id) {
ogs_error(
"PCC Rule Id has already been defined");
ogs_free(pcc_rule->id);
}
pcc_rule->id = ogs_msprintf("%d", pcc_rule_index+1);
ogs_assert(pcc_rule->id);
pcc_rule->precedence = pcc_rule_index+1;
pcc_rule->flow_status = OGS_FLOW_STATUS_ENABLED;
pcc_rule_index++;
}
session_data->num_of_pcc_rule = pcc_rule_index;
}
}
}
}
}
done:
if (found == false) {
ogs_error("Cannot find SUPI[%s] S_NSSAI[SST:%d SD:0x%x] DNN[%s] in DB",
supi_id, s_nssai->sst, s_nssai->sd.v, dnn);
rv = OGS_ERROR;
goto out;
}
session = &session_data->session;
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key = bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "name") &&
BSON_ITER_HOLDS_UTF8(&child4_iter)) {
utf8 = bson_iter_utf8(&child4_iter, &length);
session->name = ogs_strndup(utf8, length);
ogs_assert(session->name);
} else if (!strcmp(child4_key, "type") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
session->session_type = bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key = bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "index") &&
BSON_ITER_HOLDS_INT32(&child5_iter)) {
session->qos.index = bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child5_iter)) {
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->qos.arp.priority_level =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->qos.arp.pre_emption_capability =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child6_iter);
}
}
}
}
} else if (!strcmp(child4_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key = bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "value") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->ambr.downlink =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
unit = bson_iter_int32(&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.downlink *= 1024;
} else if (!strcmp(child5_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "value") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->ambr.uplink =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
unit = bson_iter_int32(&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.uplink *= 1024;
}
}
} else if (!strcmp(child4_key, "pcc_rule") &&
BSON_ITER_HOLDS_ARRAY(&child4_iter)) {
int pcc_rule_index = 0;
bson_iter_recurse(&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key = bson_iter_key(&child5_iter);
ogs_pcc_rule_t *pcc_rule = NULL;
ogs_assert(child5_key);
pcc_rule_index = atoi(child5_key);
ogs_assert(pcc_rule_index < OGS_MAX_NUM_OF_PCC_RULE);
pcc_rule = &session_data->pcc_rule[pcc_rule_index];
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child6_iter)) {
bson_iter_recurse(&child6_iter, &child7_iter);
while (bson_iter_next(&child7_iter)) {
const char *child7_key =
bson_iter_key(&child7_iter);
if (!strcmp(child7_key, "index") &&
BSON_ITER_HOLDS_INT32(&child7_iter)) {
pcc_rule->qos.index =
bson_iter_int32(&child7_iter);
} else if (!strcmp(child7_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child7_iter)) {
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
pcc_rule->qos.arp.priority_level =
bson_iter_int32(&child8_iter);
} else if (!strcmp(child8_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
pcc_rule->qos.arp.
pre_emption_capability =
bson_iter_int32(&child8_iter);
} else if (!strcmp(child8_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
pcc_rule->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(&child8_iter);
}
}
} else if (!strcmp(child7_key, "mbr") &&
BSON_ITER_HOLDS_DOCUMENT(&child7_iter)) {
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.mbr.downlink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.mbr.downlink *= 1024;
} else if (!strcmp(child8_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.mbr.uplink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.mbr.uplink *= 1024;
}
}
} else if (!strcmp(child7_key, "gbr") &&
BSON_ITER_HOLDS_DOCUMENT(&child7_iter)) {
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.gbr.downlink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.gbr.downlink *= 1024;
} else if (!strcmp(child8_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.gbr.uplink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.gbr.uplink *= 1024;
}
}
}
}
} else if (!strcmp(child6_key, "flow") &&
BSON_ITER_HOLDS_ARRAY(&child6_iter)) {
int flow_index = 0;
bson_iter_recurse(&child6_iter, &child7_iter);
while (bson_iter_next(&child7_iter)) {
const char *child7_key =
bson_iter_key(&child7_iter);
ogs_flow_t *flow = NULL;
ogs_assert(child7_key);
flow_index = atoi(child7_key);
ogs_assert(flow_index < OGS_MAX_NUM_OF_FLOW);
flow = &pcc_rule->flow[flow_index];
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "direction") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
flow->direction =
bson_iter_int32(&child8_iter);
} else if (!strcmp(child8_key, "description") &&
BSON_ITER_HOLDS_UTF8(&child8_iter)) {
utf8 = bson_iter_utf8(
&child8_iter, &length);
flow->description = ogs_malloc(length+1);
ogs_cpystrn((char*)flow->description,
utf8, length+1);
}
}
flow_index++;
}
pcc_rule->num_of_flow = flow_index;
}
}
/* EPC: Charing-Rule-Name */
if (pcc_rule->name) {
ogs_error("PCC Rule Name has already been defined");
ogs_free(pcc_rule->name);
}
pcc_rule->name = ogs_msprintf("%s%d", dnn, pcc_rule_index+1);
ogs_assert(pcc_rule->name);
/* 5GC: PCC-Rule-Id */
if (pcc_rule->id) {
ogs_error("PCC Rule Id has already been defined");
ogs_free(pcc_rule->id);
}
pcc_rule->id = ogs_msprintf("%d", pcc_rule_index+1);
ogs_assert(pcc_rule->id);
pcc_rule->precedence = pcc_rule_index+1;
pcc_rule->flow_status = OGS_FLOW_STATUS_ENABLED;
pcc_rule_index++;
}
session_data->num_of_pcc_rule = pcc_rule_index;
}
}
out:
if (query) bson_destroy(query);
if (opts) bson_destroy(opts);

View File

@@ -28,7 +28,7 @@
extern "C" {
#endif
int ogs_dbi_session_data(char *supi, char *dnn,
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data);
#ifdef __cplusplus

View File

@@ -211,16 +211,24 @@ int ogs_dbi_subscription_data(char *supi,
bson_error_t error;
const bson_t *document;
bson_iter_t iter;
bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter;
bson_iter_t child1_iter, child2_iter, child3_iter;
bson_iter_t child4_iter, child5_iter, child6_iter;
const char *utf8 = NULL;
uint32_t length = 0;
char *supi_type = NULL;
char *supi_id = NULL;
ogs_subscription_data_t zero_data;
ogs_assert(subscription_data);
ogs_assert(supi);
memset(&zero_data, 0, sizeof(zero_data));
/* subscription_data should be initialized to zero */
ogs_assert(memcmp(subscription_data, &zero_data, sizeof(zero_data)) == 0);
supi_type = ogs_id_get_type(supi);
ogs_assert(supi_type);
supi_id = ogs_id_get_value(supi);
@@ -256,7 +264,6 @@ int ogs_dbi_subscription_data(char *supi,
goto out;
}
memset(subscription_data, 0, sizeof(ogs_subscription_data_t));
while (bson_iter_next(&iter)) {
const char *key = bson_iter_key(&iter);
if (!strcmp(key, "msisdn") &&
@@ -265,10 +272,6 @@ int ogs_dbi_subscription_data(char *supi,
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_assert(child1_key);
msisdn_index = atoi(child1_key);
ogs_assert(msisdn_index < OGS_MAX_NUM_OF_MSISDN);
if (BSON_ITER_HOLDS_UTF8(&child1_iter)) {
@@ -301,160 +304,310 @@ int ogs_dbi_subscription_data(char *supi,
BSON_ITER_HOLDS_INT32(&iter)) {
subscription_data->subscribed_rau_tau_timer =
bson_iter_int32(&iter);
} else if (!strcmp(key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&iter)) {
} else if (!strcmp(key, "ambr") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
if (!strcmp(child1_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child1_iter)) {
subscription_data->ambr.uplink =
bson_iter_int64(&child1_iter) * 1024;
} else if (!strcmp(child1_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child1_iter)) {
subscription_data->ambr.downlink =
bson_iter_int64(&child1_iter) * 1024;
if (!strcmp(child1_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(&child1_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if (!strcmp(child2_key, "value") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
subscription_data->ambr.downlink =
bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
unit = bson_iter_int32(&child2_iter);
}
}
for (n = 0; n < unit; n++)
subscription_data->ambr.downlink *= 1024;
} else if (!strcmp(child1_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(&child1_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if (!strcmp(child2_key, "value") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
subscription_data->ambr.uplink =
bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
unit = bson_iter_int32(&child2_iter);
}
}
for (n = 0; n < unit; n++)
subscription_data->ambr.uplink *= 1024;
}
}
} else if (!strcmp(key, "pdn") &&
BSON_ITER_HOLDS_ARRAY(&iter)) {
int pdn_index = 0;
} else if (!strcmp(key, "slice") && BSON_ITER_HOLDS_ARRAY(&iter)) {
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_pdn_t *pdn = NULL;
ogs_slice_data_t *slice_data = NULL;
ogs_assert(child1_key);
pdn_index = atoi(child1_key);
ogs_assert(pdn_index < OGS_MAX_NUM_OF_SESS);
ogs_assert(
subscription_data->num_of_slice < OGS_MAX_NUM_OF_SLICE);
pdn = &subscription_data->pdn[pdn_index];
slice_data = &subscription_data->slice[
subscription_data->num_of_slice];
slice_data->s_nssai.sst = 0;
slice_data->s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if (!strcmp(child2_key, "apn") &&
if (!strcmp(child2_key, "sst") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
slice_data->s_nssai.sst = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "sd") &&
BSON_ITER_HOLDS_UTF8(&child2_iter)) {
utf8 = bson_iter_utf8(&child2_iter, &length);
ogs_cpystrn(pdn->apn, utf8,
ogs_min(length, OGS_MAX_APN_LEN)+1);
} else if (!strcmp(child2_key, "type") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
pdn->pdn_type = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
ogs_assert(utf8);
slice_data->s_nssai.sd =
ogs_s_nssai_sd_from_string(utf8);
} else if (!strcmp(child2_key, "default_indicator") &&
BSON_ITER_HOLDS_BOOL(&child2_iter)) {
slice_data->default_indicator =
bson_iter_bool(&child2_iter);
} else if (!strcmp(child2_key, "session") &&
BSON_ITER_HOLDS_ARRAY(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "qci") &&
BSON_ITER_HOLDS_INT32(&child3_iter)) {
pdn->qos.qci = bson_iter_int32(&child3_iter);
} else if (!strcmp(child3_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.priority_level =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_capability =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
ogs_session_t *session = NULL;
ogs_assert(
slice_data->num_of_session <
OGS_MAX_NUM_OF_SESS);
session = &slice_data->session
[slice_data->num_of_session];
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "name") &&
BSON_ITER_HOLDS_UTF8(&child4_iter)) {
utf8 = bson_iter_utf8(
&child4_iter, &length);
session->name = ogs_strndup(utf8, length);
ogs_assert(session->name);
} else if (!strcmp(child4_key, "type") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
session->session_type =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "index") &&
BSON_ITER_HOLDS_INT32(
&child5_iter)) {
session->qos.index =
bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"priority_level") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->qos.arp.
priority_level =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->qos.arp.
pre_emption_capability =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child4_iter);
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(
&child6_iter);
}
}
}
}
} else if (!strcmp(child4_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"value") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->ambr.downlink =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"unit") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
unit = bson_iter_int32(
&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.downlink *= 1024;
} else if (!strcmp(child5_key,
"uplink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"value") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->ambr.uplink =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"unit") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
unit = bson_iter_int32(
&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.uplink *= 1024;
}
}
} else if (!strcmp(child4_key, "smf") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "addr") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->smf_ip.ipv4 = 1;
session->smf_ip.addr =
ipsub.sub[0];
}
} else if (!strcmp(
child5_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->smf_ip.ipv6 = 1;
memcpy(session->smf_ip.addr6,
ipsub.sub,
sizeof(ipsub.sub));
}
}
}
} else if (!strcmp(child4_key, "ue") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "addr") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->ue_ip.ipv4 = true;
session->ue_ip.addr =
ipsub.sub[0];
}
} else if (!strcmp(
child5_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->ue_ip.ipv6 = true;
memcpy(session->ue_ip.addr6,
ipsub.sub, OGS_IPV6_LEN);
}
}
}
}
}
}
} else if (!strcmp(child2_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.uplink =
bson_iter_int64(&child3_iter) * 1024;
} else if (!strcmp(child3_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.downlink =
bson_iter_int64(&child3_iter) * 1024;
}
}
} else if (!strcmp(child2_key, "pgw") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "addr") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->pgw_ip.ipv4 = 1;
pdn->pgw_ip.addr = ipsub.sub[0];
}
} else if (!strcmp(child3_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->pgw_ip.ipv6 = 1;
memcpy(pdn->pgw_ip.addr6,
ipsub.sub, sizeof(ipsub.sub));
}
}
}
} else if (!strcmp(child2_key, "ue") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "addr") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->ue_ip.ipv4 = true;
pdn->ue_ip.addr = ipsub.sub[0];
}
} else if (!strcmp(child3_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->ue_ip.ipv6 = true;
memcpy(pdn->ue_ip.addr6,
ipsub.sub, OGS_IPV6_LEN);
}
}
slice_data->num_of_session++;
}
}
}
pdn_index++;
subscription_data->num_of_slice++;
}
subscription_data->num_of_pdn = pdn_index;
}
}

View File

@@ -27,6 +27,10 @@
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#endif
#if defined(__FreeBSD__)
#define HAVE_NTOHLL 1
#endif
#include "freeDiameter/libfdcore.h"
#if defined(__GNUC__)

View File

@@ -147,16 +147,16 @@ int ogs_gtp_paa_to_ip(ogs_paa_t *paa, ogs_ip_t *ip)
memset(ip, 0, sizeof *ip);
if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
ip->ipv4 = 1;
ip->addr = paa->both.addr;
ip->ipv6 = 1;
memcpy(ip->addr6, paa->both.addr6, OGS_IPV6_LEN);
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4) {
ip->ipv4 = 1;
ip->ipv6 = 0;
ip->addr = paa->addr;
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV6) {
ip->ipv4 = 0;
ip->ipv6 = 1;
memcpy(ip->addr6, paa->addr6, OGS_IPV6_LEN);

View File

@@ -110,7 +110,15 @@ strlcpy(dst, src, siz)
}
#endif /* __linux__ */
/********************************************************
* modifed by acetcom
*
* move down to remove sysctlbyname() in MacOSX and FreeBSD
*/
/* #endif */ /* __linux__ */
/********************************************************/
#if defined (EMULATE_SYSCTL)
@@ -359,6 +367,16 @@ skip: ;
#endif /* __linux__ */
}
/********************************************************
* modifed by acetcom
*
* move down to remove sysctlbyname in MacOSX and FreeBSD
*/
#endif /* __linux__ */
/********************************************************/
/*
* The following two functions implement getsockopt/setsockopt
* replacements to talk over a TCP socket.

View File

@@ -52,6 +52,8 @@ ipfw_cc_flags = ['-D_DEFAULT_SOURCE', '-D_BSD_SOURCE', '-DUSERSPACE',
if host_system == 'linux'
ipfw_cc_flags += ['-DNEED_SYSCTLBYNAME', '-DNEED_SIN_LEN']
elif host_system == 'freebsd'
ipfw_cc_flags += ['-DNEED_SYSCTLBYNAME']
endif
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'

View File

@@ -24,11 +24,11 @@
#endif
#endif
#include "ogs-ipfw.h"
#include "ipfw2.h"
#include "objs/include_e/netinet/ip_fw.h"
#include "ogs-ipfw.h"
#define MAX_NUM_OF_TOKEN 32
#define MAX_NUM_OF_RULE_BUFFER 1024

View File

@@ -22,6 +22,7 @@ subdir('ipfw')
subdir('crypt')
subdir('app')
subdir('sctp')
subdir('tun')
subdir('dbi')
subdir('diameter')
subdir('asn1c')

View File

@@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.448896 by acetcom
* Created on: 2021-02-22 09:29:55.336137 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.459717 by acetcom
* Created on: 2021-02-22 09:29:55.346343 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.431932 by acetcom
* Created on: 2021-02-22 09:29:55.319953 by acetcom
* from 24501-g41.docx
******************************************************************************/
@@ -2987,8 +2987,8 @@ int ogs_nas_5gs_decode_session_ambr(ogs_nas_session_ambr_t *session_ambr, ogs_pk
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(session_ambr, pkbuf->data - size, size);
session_ambr->downlink.bitrate = be16toh(source->downlink.bitrate);
session_ambr->uplink.bitrate = be16toh(source->uplink.bitrate);
session_ambr->downlink.value = be16toh(source->downlink.value);
session_ambr->uplink.value = be16toh(source->uplink.value);
ogs_trace(" SESSION_AMBR - ");
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
@@ -3002,8 +3002,8 @@ int ogs_nas_5gs_encode_session_ambr(ogs_pkbuf_t *pkbuf, ogs_nas_session_ambr_t *
ogs_nas_session_ambr_t target;
memcpy(&target, session_ambr, sizeof(ogs_nas_session_ambr_t));
target.downlink.bitrate = htobe16(session_ambr->downlink.bitrate);
target.uplink.bitrate = htobe16(session_ambr->uplink.bitrate);
target.downlink.value = htobe16(session_ambr->downlink.value);
target.uplink.value = htobe16(session_ambr->uplink.value);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &target, size);

View File

@@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.429071 by acetcom
* Created on: 2021-02-22 09:29:55.317282 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.441307 by acetcom
* Created on: 2021-02-22 09:29:55.328800 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@@ -38,12 +38,12 @@ type_list["DNN"]["encode"] = \
" size = target.length + sizeof(target.length);\n\n"
type_list["Session-AMBR"]["decode"] = \
" session_ambr->downlink.bitrate = be16toh(source->downlink.bitrate);\n" \
" session_ambr->uplink.bitrate = be16toh(source->uplink.bitrate);\n\n"
" session_ambr->downlink.value = be16toh(source->downlink.value);\n" \
" session_ambr->uplink.value = be16toh(source->uplink.value);\n\n"
type_list["Session-AMBR"]["encode"] = \
" target.downlink.bitrate = htobe16(session_ambr->downlink.bitrate);\n" \
" target.uplink.bitrate = htobe16(session_ambr->uplink.bitrate);\n\n"
" target.downlink.value = htobe16(session_ambr->downlink.value);\n" \
" target.uplink.value = htobe16(session_ambr->uplink.value);\n\n"
type_list["Uplink data status"]["decode"] = \
" uplink_data_status->psi = be16toh(uplink_data_status->psi);\n\n"

View File

@@ -92,30 +92,42 @@ void ogs_nas_5gs_tai_list_build(
}
void ogs_nas_build_s_nssai(
ogs_nas_s_nssai_t *nas_s_nssai, ogs_s_nssai_t *s_nssai)
ogs_nas_s_nssai_t *nas_s_nssai, ogs_nas_s_nssai_ie_t *nas_s_nssai_ie)
{
int pos;
ogs_uint24_t v;
ogs_assert(nas_s_nssai);
ogs_assert(s_nssai);
ogs_assert(nas_s_nssai_ie);
pos = 0;
if (s_nssai->sst)
nas_s_nssai->buffer[pos++] = s_nssai->sst;
if (nas_s_nssai_ie->sst)
nas_s_nssai->buffer[pos++] = nas_s_nssai_ie->sst;
if (s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
v = ogs_htobe24(s_nssai->sd);
if (nas_s_nssai_ie->sd.v != OGS_S_NSSAI_NO_SD_VALUE ||
/*
* If the SST encoded in octet 3 is not associated
* with a valid SD value, and the sender needs to include
* a mapped HPLMN SST (octet 7) and a mapped HPLMN SD (octets 8 to 10),
* then the sender shall set the SD value (octets 4 to 6) to
* "no SD value associated with the SST".
*/
(nas_s_nssai_ie->sd.v == OGS_S_NSSAI_NO_SD_VALUE &&
nas_s_nssai_ie->mapped_hplmn_sst &&
nas_s_nssai_ie->mapped_hplmn_sd.v != OGS_S_NSSAI_NO_SD_VALUE)) {
v = ogs_htobe24(nas_s_nssai_ie->sd);
memcpy(nas_s_nssai->buffer+pos, &v, 3);
pos += 3;
}
if (s_nssai->mapped_hplmn_sst)
nas_s_nssai->buffer[pos++] = s_nssai->mapped_hplmn_sst;
if (nas_s_nssai_ie->mapped_hplmn_sst)
nas_s_nssai->buffer[pos++] = nas_s_nssai_ie->mapped_hplmn_sst;
if (s_nssai->mapped_hplmn_sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
v = ogs_htobe24(s_nssai->mapped_hplmn_sd);
if (nas_s_nssai_ie->mapped_hplmn_sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
v = ogs_htobe24(nas_s_nssai_ie->mapped_hplmn_sd);
memcpy(nas_s_nssai->buffer+pos, &v, 3);
pos += 3;
}
@@ -123,19 +135,39 @@ void ogs_nas_build_s_nssai(
nas_s_nssai->length = pos;
}
void ogs_nas_build_s_nssai2(
ogs_nas_s_nssai_t *nas_s_nssai,
ogs_s_nssai_t *s_nssai, ogs_s_nssai_t *mapped_hplmn)
{
ogs_nas_s_nssai_ie_t ie;
ogs_assert(nas_s_nssai);
ogs_assert(s_nssai);
ogs_assert(mapped_hplmn);
memset(&ie, 0, sizeof(ie));
ie.sst = s_nssai->sst;
ie.sd.v = s_nssai->sd.v;
ie.mapped_hplmn_sst = mapped_hplmn->sst;
ie.mapped_hplmn_sd.v = mapped_hplmn->sd.v;
ogs_nas_build_s_nssai(nas_s_nssai, &ie);
}
int ogs_nas_parse_s_nssai(
ogs_s_nssai_t *s_nssai, ogs_nas_s_nssai_t *nas_s_nssai)
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_s_nssai_t *nas_s_nssai)
{
ogs_uint24_t v;
int pos = 0;
bool sst, sd, mapped_hplmn_sst, mapped_hplmn_sd;
ogs_assert(nas_s_nssai);
ogs_assert(s_nssai);
ogs_assert(nas_s_nssai_ie);
memset(s_nssai, 0, sizeof(*s_nssai));
s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE;
s_nssai->mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE;
memset(nas_s_nssai_ie, 0, sizeof(*nas_s_nssai_ie));
nas_s_nssai_ie->sd.v = OGS_S_NSSAI_NO_SD_VALUE;
nas_s_nssai_ie->mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE;
if (nas_s_nssai->length == OGS_NAS_S_NSSAI_SST_LEN) {
sst = true;
@@ -174,20 +206,20 @@ int ogs_nas_parse_s_nssai(
pos = 0;
if (sst)
s_nssai->sst = nas_s_nssai->buffer[pos++];
nas_s_nssai_ie->sst = nas_s_nssai->buffer[pos++];
if (sd) {
memcpy(&v, nas_s_nssai->buffer+pos, 3);
s_nssai->sd = ogs_htobe24(v);
nas_s_nssai_ie->sd = ogs_htobe24(v);
pos += 3;
}
if (mapped_hplmn_sst)
s_nssai->mapped_hplmn_sst = nas_s_nssai->buffer[pos++];
nas_s_nssai_ie->mapped_hplmn_sst = nas_s_nssai->buffer[pos++];
if (mapped_hplmn_sd) {
memcpy(&v, nas_s_nssai->buffer+pos, 3);
s_nssai->mapped_hplmn_sd = ogs_htobe24(v);
nas_s_nssai_ie->mapped_hplmn_sd = ogs_htobe24(v);
pos += 3;
}
@@ -195,18 +227,18 @@ int ogs_nas_parse_s_nssai(
}
void ogs_nas_build_nssai(ogs_nas_nssai_t *nas_nssai,
ogs_s_nssai_t *s_nssai, int num_of_s_nssai)
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, int num_of_nas_s_nssai_ie)
{
int i;
ogs_nas_s_nssai_t nas_s_nssai;
ogs_assert(nas_nssai);
ogs_assert(s_nssai);
ogs_assert(num_of_s_nssai);
ogs_assert(nas_s_nssai_ie);
ogs_assert(num_of_nas_s_nssai_ie);
for (i = 0; i < num_of_s_nssai; i++) {
for (i = 0; i < num_of_nas_s_nssai_ie; i++) {
if (nas_nssai->length < OGS_NAS_MAX_NSSAI_LEN) {
ogs_nas_build_s_nssai(&nas_s_nssai, s_nssai + i);
ogs_nas_build_s_nssai(&nas_s_nssai, nas_s_nssai_ie + i);
memcpy(nas_nssai->buffer + nas_nssai->length, &nas_s_nssai,
sizeof(nas_s_nssai.length) + nas_s_nssai.length);
nas_nssai->length +=
@@ -215,13 +247,14 @@ void ogs_nas_build_nssai(ogs_nas_nssai_t *nas_nssai,
}
}
int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
int ogs_nas_parse_nssai(
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_nssai_t *nas_nssai)
{
int num_of_s_nssai = 0;
int num_of_nas_s_nssai_ie = 0;
int pos = 0, len;
ogs_assert(nas_nssai);
ogs_assert(s_nssai);
ogs_assert(nas_s_nssai_ie);
if (!nas_nssai->length) {
ogs_error("No NSSAI [%p:%d]", nas_nssai->buffer, nas_nssai->length);
@@ -229,9 +262,9 @@ int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
}
while (pos < nas_nssai->length &&
num_of_s_nssai < OGS_MAX_NUM_OF_S_NSSAI) {
num_of_nas_s_nssai_ie < OGS_MAX_NUM_OF_SLICE) {
len = ogs_nas_parse_s_nssai(s_nssai + num_of_s_nssai,
len = ogs_nas_parse_s_nssai(nas_s_nssai_ie + num_of_nas_s_nssai_ie,
(ogs_nas_s_nssai_t *)(nas_nssai->buffer + pos));
if (len == 0) {
ogs_error("Cannot parse NSSAI [%d]", nas_nssai->length);
@@ -240,10 +273,97 @@ int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
pos += len;
num_of_s_nssai++;
num_of_nas_s_nssai_ie++;
}
return num_of_s_nssai;
return num_of_nas_s_nssai_ie;
}
void ogs_nas_build_rejected_nssai(
ogs_nas_rejected_nssai_t *rejected_nssai,
ogs_nas_rejected_s_nssai_t *rejected_s_nssai,
int num_of_rejected_s_nssai)
{
int i;
ogs_assert(rejected_nssai);
ogs_assert(rejected_s_nssai);
ogs_assert(num_of_rejected_s_nssai);
for (i = 0; i < num_of_rejected_s_nssai; i++) {
if (rejected_nssai->length < OGS_NAS_MAX_REJECTED_NSSAI_LEN) {
memcpy(rejected_nssai->buffer + rejected_nssai->length,
rejected_s_nssai + i, 1);
rejected_nssai->length += 1;
ogs_assert(
rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4);
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
rejected_nssai->buffer[rejected_nssai->length] =
rejected_s_nssai[i].sst;
rejected_nssai->length += 1;
}
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
ogs_uint24_t v;
v = ogs_htobe24(rejected_s_nssai[i].sd);
memcpy(rejected_nssai->buffer + rejected_nssai->length, &v, 3);
rejected_nssai->length += 3;
}
}
}
}
int ogs_nas_parse_rejected_nssai(
ogs_nas_rejected_s_nssai_t *rejected_s_nssai,
ogs_nas_rejected_nssai_t *rejected_nssai)
{
int i, pos;
ogs_assert(rejected_nssai);
ogs_assert(rejected_s_nssai);
if (!rejected_nssai->length) {
ogs_error("No NSSAI [%p:%d]",
rejected_nssai->buffer, rejected_nssai->length);
return OGS_ERROR;
}
i = 0;
pos = 0;
while (pos < rejected_nssai->length && i < OGS_MAX_NUM_OF_SLICE) {
ogs_assert((pos + 1) <= rejected_nssai->length);
memcpy(rejected_s_nssai + i, rejected_nssai->buffer + pos, 1);
pos += 1;
ogs_assert(
rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4);
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
ogs_assert((pos + 1) <= rejected_nssai->length);
rejected_s_nssai[i].sst = rejected_nssai->buffer[pos];
pos += 1;
}
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
ogs_uint24_t v;
ogs_assert((pos + 3) <= rejected_nssai->length);
memcpy(&v, rejected_nssai->buffer + pos, 3);
rejected_s_nssai[i].sd = ogs_be24toh(v);
pos += 3;
}
i++;
}
return i;
}
void ogs_nas_build_qos_flow_descriptions(
@@ -290,7 +410,7 @@ void ogs_nas_build_qos_flow_descriptions(
ogs_assert(target.param[j].len == 1);
ogs_assert(length + target.param[j].len <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
memcpy(buffer + length, &target.param[j].qci,
memcpy(buffer + length, &target.param[j].qos_index,
target.param[j].len);
length += target.param[j].len;
break;
@@ -302,8 +422,8 @@ void ogs_nas_build_qos_flow_descriptions(
ogs_assert(target.param[j].len == 3);
ogs_assert(length + target.param[j].len <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
target.param[j].br.bitrate =
htobe16(target.param[j].br.bitrate);
target.param[j].br.value =
htobe16(target.param[j].br.value);
memcpy(buffer + length, &target.param[j].br,
target.param[j].len);
length += target.param[j].len;

View File

@@ -62,10 +62,20 @@ typedef struct ogs_nas_s_nssai_s {
uint8_t buffer[OGS_NAS_S_NSSAI_SST_SD_AND_MAPPED_HPLMN_SST_SD_LEN];
} __attribute__ ((packed)) ogs_nas_s_nssai_t;
typedef struct ogs_nas_s_nssai_ie_s {
uint8_t sst;
ogs_uint24_t sd;
uint8_t mapped_hplmn_sst;
ogs_uint24_t mapped_hplmn_sd;
} __attribute__ ((packed)) ogs_nas_s_nssai_ie_t;
void ogs_nas_build_s_nssai(
ogs_nas_s_nssai_t *nas_s_nssai, ogs_s_nssai_t *s_nssai);
ogs_nas_s_nssai_t *nas_s_nssai, ogs_nas_s_nssai_ie_t *nas_s_nssai_ie);
void ogs_nas_build_s_nssai2(
ogs_nas_s_nssai_t *nas_s_nssai,
ogs_s_nssai_t *s_nssai, ogs_s_nssai_t *mapped_hplmn);
int ogs_nas_parse_s_nssai(
ogs_s_nssai_t *s_nssai, ogs_nas_s_nssai_t *nas_s_nssai);
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_s_nssai_t *nas_s_nssai);
/* 9.11.3.1 5GMM capability
* O TLV 3-15 */
typedef struct ogs_nas_5gmm_capability_s {
@@ -443,8 +453,9 @@ typedef struct ogs_nas_nssai_s {
} __attribute__ ((packed)) ogs_nas_nssai_t;
void ogs_nas_build_nssai(ogs_nas_nssai_t *nas_nssai,
ogs_s_nssai_t *s_nssai, int num_of_s_nssai);
int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai);
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, int num_of_nas_s_nssai_ie);
int ogs_nas_parse_nssai(
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_nssai_t *nas_nssai);
/* 9.11.3.37A NSSAI inclusion mode
* O TV 1 */
@@ -513,6 +524,24 @@ typedef struct ogs_nas_rejected_nssai_s {
char buffer[OGS_NAS_MAX_REJECTED_NSSAI_LEN];
} ogs_nas_rejected_nssai_t;
typedef struct ogs_nas_rejected_s_nssai_s {
#define OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_IN_PLMN 0
#define OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_IN_TAI 1
#define OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_DUE_TO_AUTH_FAILURE 22
ED2(uint8_t length_of_rejected_s_nssai:4;,
uint8_t cause_value:4;)
uint8_t sst;
ogs_uint24_t sd;
} __attribute__ ((packed)) ogs_nas_rejected_s_nssai_t;
void ogs_nas_build_rejected_nssai(
ogs_nas_rejected_nssai_t *nas_rejected_nssai,
ogs_nas_rejected_s_nssai_t *nas_rejected_s_nssai,
int num_of_nas_rejected_s_nssai);
int ogs_nas_parse_rejected_nssai(
ogs_nas_rejected_s_nssai_t *nas_rejected_s_nssai,
ogs_nas_rejected_nssai_t *nas_rejected_nssai);
/* 9.11.3.49 Service area list
* O TLV 6-114 */
#define OGS_NAS_MAX_SERVICE_AREA_LIST_LEN 112
@@ -708,7 +737,7 @@ typedef struct ogs_nas_qos_flow_parameter_s {
uint8_t identifier;
uint8_t len;
union {
uint8_t qci;
uint8_t qos_index;
ogs_nas_bitrate_t br;
};
} ogs_nas_qos_flow_parameter_t;

View File

@@ -444,5 +444,5 @@ void ogs_nas_bitrate_from_uint64(ogs_nas_bitrate_t *nas, uint64_t bitrate)
}
bitrate >>= 2;
}
nas->bitrate = bitrate;
nas->value = bitrate;
}

View File

@@ -951,7 +951,7 @@ ED8(uint8_t ebi15:1;,
#define OGS_NAS_BR_UNIT_256P 25
typedef struct ogs_nas_bitrate_s {
uint8_t unit;
uint16_t bitrate;
uint16_t value;
} __attribute__ ((packed)) ogs_nas_bitrate_t;
void ogs_nas_bitrate_from_uint64(

View File

@@ -231,7 +231,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@@ -292,9 +292,9 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
NULL, self.pfcp_port);
ogs_assert(rv == OGS_OK);
}
} else if (!strcmp(local_key, "pdn")) {
ogs_yaml_iter_t pdn_array, pdn_iter;
ogs_yaml_iter_recurse(&local_iter, &pdn_array);
} else if (!strcmp(local_key, "subnet")) {
ogs_yaml_iter_t subnet_array, subnet_iter;
ogs_yaml_iter_recurse(&local_iter, &subnet_array);
do {
ogs_pfcp_subnet_t *subnet = NULL;
@@ -306,41 +306,41 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
const char *high[MAX_NUM_OF_SUBNET_RANGE];
int i, num = 0;
if (ogs_yaml_iter_type(&pdn_array) ==
if (ogs_yaml_iter_type(&subnet_array) ==
YAML_MAPPING_NODE) {
memcpy(&pdn_iter, &pdn_array,
memcpy(&subnet_iter, &subnet_array,
sizeof(ogs_yaml_iter_t));
} else if (ogs_yaml_iter_type(&pdn_array) ==
} else if (ogs_yaml_iter_type(&subnet_array) ==
YAML_SEQUENCE_NODE) {
if (!ogs_yaml_iter_next(&pdn_array))
if (!ogs_yaml_iter_next(&subnet_array))
break;
ogs_yaml_iter_recurse(&pdn_array, &pdn_iter);
} else if (ogs_yaml_iter_type(&pdn_array) ==
ogs_yaml_iter_recurse(&subnet_array, &subnet_iter);
} else if (ogs_yaml_iter_type(&subnet_array) ==
YAML_SCALAR_NODE) {
break;
} else
ogs_assert_if_reached();
while (ogs_yaml_iter_next(&pdn_iter)) {
const char *pdn_key = ogs_yaml_iter_key(&pdn_iter);
ogs_assert(pdn_key);
if (!strcmp(pdn_key, "addr")) {
while (ogs_yaml_iter_next(&subnet_iter)) {
const char *subnet_key = ogs_yaml_iter_key(&subnet_iter);
ogs_assert(subnet_key);
if (!strcmp(subnet_key, "addr")) {
char *v =
(char *)ogs_yaml_iter_value(&pdn_iter);
(char *)ogs_yaml_iter_value(&subnet_iter);
if (v) {
ipstr = (const char *)strsep(&v, "/");
if (ipstr) {
mask_or_numbits = (const char *)v;
}
}
} else if (!strcmp(pdn_key, "apn") ||
!strcmp(pdn_key, "dnn")) {
dnn = ogs_yaml_iter_value(&pdn_iter);
} else if (!strcmp(pdn_key, "dev")) {
dev = ogs_yaml_iter_value(&pdn_iter);
} else if (!strcmp(pdn_key, "range")) {
} else if (!strcmp(subnet_key, "apn") ||
!strcmp(subnet_key, "dnn")) {
dnn = ogs_yaml_iter_value(&subnet_iter);
} else if (!strcmp(subnet_key, "dev")) {
dev = ogs_yaml_iter_value(&subnet_iter);
} else if (!strcmp(subnet_key, "range")) {
ogs_yaml_iter_t range_iter;
ogs_yaml_iter_recurse(&pdn_iter, &range_iter);
ogs_yaml_iter_recurse(&subnet_iter, &range_iter);
ogs_assert(ogs_yaml_iter_type(&range_iter) !=
YAML_MAPPING_NODE);
do {
@@ -355,7 +355,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
v = (char *)
ogs_yaml_iter_value(&range_iter);
if (v) {
ogs_assert(num <=
ogs_assert(num <
MAX_NUM_OF_SUBNET_RANGE);
low[num] =
(const char *)strsep(&v, "-");
@@ -372,7 +372,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
ogs_yaml_iter_type(&range_iter) ==
YAML_SEQUENCE_NODE);
} else
ogs_warn("unknown key `%s`", pdn_key);
ogs_warn("unknown key `%s`", subnet_key);
}
subnet = ogs_pfcp_subnet_add(
@@ -385,7 +385,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
subnet->range[i].high = high[i];
}
} while (ogs_yaml_iter_type(&pdn_array) ==
} while (ogs_yaml_iter_type(&subnet_array) ==
YAML_SEQUENCE_NODE);
}
}
@@ -462,7 +462,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@@ -480,7 +480,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_tac <=
ogs_assert(num_of_tac <
OGS_MAX_NUM_OF_TAI);
if (ogs_yaml_iter_type(&tac_iter) ==
YAML_SEQUENCE_NODE) {
@@ -506,7 +506,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_dnn <=
ogs_assert(num_of_dnn <
OGS_MAX_NUM_OF_DNN);
if (ogs_yaml_iter_type(&dnn_iter) ==
YAML_SEQUENCE_NODE) {
@@ -532,7 +532,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_e_cell_id <=
ogs_assert(num_of_e_cell_id <
OGS_MAX_NUM_OF_ENB_ID);
if (ogs_yaml_iter_type(&e_cell_id_iter) ==
YAML_SEQUENCE_NODE) {
@@ -560,7 +560,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_nr_cell_id <=
ogs_assert(num_of_nr_cell_id <
OGS_MAX_NUM_OF_ENB_ID);
if (ogs_yaml_iter_type(&nr_cell_id_iter) ==
YAML_SEQUENCE_NODE) {
@@ -1555,7 +1555,7 @@ ogs_pfcp_ue_ip_t *ogs_pfcp_ue_ip_alloc(
ogs_error("CHECK CONFIGURATION: Cannot find subnet [family:%d, dnn:%s]",
family, dnn ? dnn : "No DNN");
ogs_error("smf");
ogs_error(" pdn:");
ogs_error(" subnet:");
if (family == AF_INET)
ogs_error(" - addr: 10.45.0.1/16");
else if (family == AF_INET6)

View File

@@ -331,18 +331,18 @@ int ogs_pfcp_paa_to_ue_ip_addr(
memset(addr, 0, sizeof *addr);
if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
addr->ipv4 = 1;
addr->both.addr = paa->both.addr;
addr->ipv6 = 1;
memcpy(addr->both.addr6, paa->both.addr6, OGS_IPV6_LEN);
*len = OGS_IPV4V6_LEN + hdr_len;
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4) {
addr->ipv4 = 1;
addr->ipv6 = 0;
addr->addr = paa->addr;
*len = OGS_IPV4_LEN + hdr_len;
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV6) {
addr->ipv4 = 0;
addr->ipv6 = 1;
memcpy(addr->addr6, paa->addr6, OGS_IPV6_LEN);

View File

@@ -44,11 +44,11 @@ libpfcp = library('ogspfcp',
version : libogslib_version,
c_args : '-DOGS_PFCP_COMPILATION',
include_directories : [libpfcp_inc, libinc],
dependencies : [libipfw_dep, libcore_dep, libapp_dep, libgtp_dep],
dependencies : [libcore_dep, libipfw_dep, libapp_dep, libgtp_dep],
install_rpath : libdir,
install : true)
libpfcp_dep = declare_dependency(
link_with : libpfcp,
include_directories : [libpfcp_inc, libinc],
dependencies : [libipfw_dep, libcore_dep, libapp_dep, libgtp_dep])
dependencies : [libcore_dep, libipfw_dep, libapp_dep, libgtp_dep])

View File

@@ -26,6 +26,8 @@ static OGS_POOL(nf_instance_pool, ogs_sbi_nf_instance_t);
static OGS_POOL(nf_service_pool, ogs_sbi_nf_service_t);
static OGS_POOL(xact_pool, ogs_sbi_xact_t);
static OGS_POOL(subscription_pool, ogs_sbi_subscription_t);
static OGS_POOL(smf_info_pool, ogs_sbi_smf_info_t);
static OGS_POOL(nf_info_pool, ogs_sbi_nf_info_t);
static ogs_sbi_context_t self;
@@ -54,6 +56,10 @@ void ogs_sbi_context_init(void)
ogs_list_init(&self.subscription_list);
ogs_pool_init(&subscription_pool, ogs_app()->pool.nf_subscription);
ogs_pool_init(&smf_info_pool, ogs_app()->pool.nf);
ogs_pool_init(&nf_info_pool, ogs_app()->pool.nf * OGS_MAX_NUM_OF_NF_INFO);
ogs_uuid_get(&self.uuid);
ogs_uuid_format(self.nf_instance_id, &self.uuid);
@@ -70,8 +76,14 @@ void ogs_sbi_context_final(void)
ogs_pool_final(&xact_pool);
ogs_sbi_nf_instance_remove_all();
ogs_sbi_nf_info_remove_all(&self.nf_info_list);
ogs_pool_final(&nf_instance_pool);
ogs_pool_final(&nf_service_pool);
ogs_pool_final(&smf_info_pool);
ogs_pool_final(&nf_info_pool);
ogs_sbi_client_final();
ogs_sbi_server_final();
@@ -191,7 +203,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@@ -360,7 +372,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@@ -499,6 +511,8 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
ogs_trace("ogs_sbi_nf_instance_remove()");
ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance);
ogs_sbi_nf_info_remove_all(&nf_instance->nf_info_list);
ogs_sbi_subscription_remove_all_by_nf_instance_id(nf_instance->id);
ogs_sbi_nf_service_remove_all(nf_instance);
@@ -690,6 +704,72 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_name(
return nf_service;
}
ogs_sbi_nf_info_t *ogs_sbi_nf_info_add(
ogs_list_t *list, OpenAPI_nf_type_e nf_type)
{
ogs_sbi_nf_info_t *nf_info = NULL;
ogs_assert(list);
ogs_assert(nf_type);
ogs_pool_alloc(&nf_info_pool, &nf_info);
ogs_assert(nf_info);
memset(nf_info, 0, sizeof(*nf_info));
nf_info->nf_type = nf_type;
ogs_list_add(list, nf_info);
return nf_info;
}
static void smf_info_free(ogs_sbi_smf_info_t *smf_info)
{
int i, j;
ogs_assert(smf_info);
for (i = 0; i < smf_info->num_of_slice; i++) {
for (j = 0; j < smf_info->slice[i].num_of_dnn; j++)
ogs_free(smf_info->slice[i].dnn[j]);
smf_info->slice[i].num_of_dnn = 0;
}
smf_info->num_of_slice = 0;
smf_info->num_of_nr_tai = 0;
smf_info->num_of_nr_tai_range = 0;
ogs_pool_free(&smf_info_pool, smf_info);
}
void ogs_sbi_nf_info_remove(ogs_list_t *list, ogs_sbi_nf_info_t *nf_info)
{
ogs_assert(list);
ogs_assert(nf_info);
ogs_list_remove(list, nf_info);
switch(nf_info->nf_type) {
case OpenAPI_nf_type_SMF:
smf_info_free(&nf_info->smf);
break;
default:
ogs_fatal("Not implemented NF-type[%s]",
OpenAPI_nf_type_ToString(nf_info->nf_type));
ogs_assert_if_reached();
}
ogs_pool_free(&nf_info_pool, nf_info);
}
void ogs_sbi_nf_info_remove_all(ogs_list_t *list)
{
ogs_sbi_nf_info_t *nf_info = NULL, *next_nf_info = NULL;
ogs_assert(list);
ogs_list_for_each_safe(list, next_nf_info, nf_info)
ogs_sbi_nf_info_remove(list, nf_info);
}
void ogs_sbi_nf_instance_build_default(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type)
{
@@ -730,6 +810,9 @@ void ogs_sbi_nf_instance_build_default(
if (hostname)
strcpy(nf_instance->fqdn, hostname);
nf_instance->time.heartbeat_interval =
ogs_app()->time.nf_instance.heartbeat_interval;
}
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
@@ -893,48 +976,34 @@ static void nf_service_associate_client_all(ogs_sbi_nf_instance_t *nf_instance)
nf_service_associate_client(nf_service);
}
bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
OpenAPI_nf_type_e nf_type, void *state)
void ogs_sbi_select_nrf(ogs_sbi_object_t *sbi_object, void *state)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
if (nf_type == OpenAPI_nf_type_NRF) {
nf_instance = ogs_sbi_nf_instance_find(ogs_sbi_self()->nf_instance_id);
if (nf_instance) {
if (OGS_FSM_CHECK(&nf_instance->sm, state)) {
if (OGS_SBI_NF_INSTANCE_GET(
nf_type_array, OpenAPI_nf_type_NRF)) {
ogs_warn("UE %s-EndPoint updated [%s]",
OpenAPI_nf_type_ToString(OpenAPI_nf_type_NRF),
nf_instance->id);
ogs_sbi_nf_instance_remove(
nf_type_array[OpenAPI_nf_type_NRF].nf_instance);
}
OGS_SETUP_SBI_NF_INSTANCE(
&nf_type_array[OpenAPI_nf_type_NRF], nf_instance);
return true;
}
}
}
ogs_assert(sbi_object);
/* SELF NF Instace is used for NRF Instance */
nf_instance = ogs_sbi_nf_instance_find(ogs_sbi_self()->nf_instance_id);
if (nf_instance && OGS_FSM_CHECK(&nf_instance->sm, state))
OGS_SBI_SETUP_NF(sbi_object, OpenAPI_nf_type_NRF, nf_instance);
}
void ogs_sbi_select_first_nf(
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(sbi_object);
ogs_assert(nf_type);
ogs_assert(state);
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (nf_instance->nf_type == nf_type) {
if (OGS_FSM_CHECK(&nf_instance->sm, state)) {
if (OGS_SBI_NF_INSTANCE_GET(nf_type_array, nf_type)) {
ogs_warn("%s-EndPoint updated [%s]",
OpenAPI_nf_type_ToString(nf_type),
nf_instance->id);
ogs_sbi_nf_instance_remove(
nf_type_array[nf_type].nf_instance);
}
OGS_SETUP_SBI_NF_INSTANCE(
&nf_type_array[nf_type], nf_instance);
return true;
}
if (OGS_FSM_CHECK(&nf_instance->sm, state) &&
nf_instance->nf_type == nf_type) {
OGS_SBI_SETUP_NF(sbi_object, nf_type, nf_instance);
break;
}
}
return false;
}
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
@@ -983,19 +1052,6 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
return nf_instance->client;
}
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type(
OpenAPI_nf_type_e nf_type)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (nf_instance->nf_type == nf_type)
break;
}
return nf_instance;
}
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
{
int i;
@@ -1006,9 +1062,8 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list));
for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) {
if (sbi_object->nf_type_array[i].nf_instance)
ogs_sbi_nf_instance_remove(
sbi_object->nf_type_array[i].nf_instance);
if (OGS_SBI_NF_INSTANCE(sbi_object, i))
ogs_sbi_nf_instance_remove(OGS_SBI_NF_INSTANCE(sbi_object, i));
}
}
@@ -1022,7 +1077,7 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
ogs_assert(sbi_object);
ogs_pool_alloc(&xact_pool, &xact);
ogs_assert(xact);
if (!xact) return NULL;
memset(xact, 0, sizeof(ogs_sbi_xact_t));
xact->target_nf_type = target_nf_type;

View File

@@ -30,7 +30,11 @@ extern "C" {
#define OGS_SBI_MAX_NF_TYPE 64
#define OGS_MAX_NUM_OF_NF_INFO 8
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
typedef struct ogs_sbi_smf_info_s ogs_sbi_smf_info_t;
typedef struct ogs_sbi_context_s {
uint32_t http_port; /* SBI HTTP local port */
uint32_t https_port; /* SBI HTTPS local port */
@@ -44,16 +48,17 @@ typedef struct ogs_sbi_context_s {
ogs_list_t nf_instance_list;
ogs_list_t subscription_list;
ogs_list_t nf_info_list;
const char *content_encoding;
} ogs_sbi_context_t;
#define OGS_SETUP_SBI_NF_INSTANCE(__cTX, __pNF_INSTANCE) \
do { \
ogs_assert((__cTX)); \
ogs_assert((__pNF_INSTANCE)); \
if ((__cTX)->nf_instance != __pNF_INSTANCE) \
if ((__cTX) != __pNF_INSTANCE) \
__pNF_INSTANCE->reference_count++; \
(__cTX)->nf_instance = __pNF_INSTANCE; \
(__cTX) = __pNF_INSTANCE; \
ogs_trace("nf_instance->reference_count = %d", \
__pNF_INSTANCE->reference_count); \
} while(0)
@@ -95,11 +100,11 @@ typedef struct ogs_sbi_nf_instance_s {
void *client; /* only used in CLIENT */
unsigned int reference_count; /* reference count for memory free */
ogs_list_t nf_info_list;
OpenAPI_nf_profile_t *nf_profile; /* stored NF Profile */
} ogs_sbi_nf_instance_t;
#define OGS_SBI_NF_INSTANCE_GET(__aRRAY, __nFType) \
((__aRRAY)[__nFType].nf_instance)
typedef struct ogs_sbi_nf_type_array_s {
ogs_sbi_nf_instance_t *nf_instance;
} ogs_sbi_nf_type_array_t[OGS_SBI_MAX_NF_TYPE];
@@ -193,6 +198,41 @@ typedef struct ogs_sbi_subscription_s {
void *client; /* only used in SERVER */
} ogs_sbi_subscription_t;
typedef struct ogs_sbi_smf_info_s {
int num_of_slice;
struct {
ogs_s_nssai_t s_nssai;
int num_of_dnn;
char *dnn[OGS_MAX_NUM_OF_DNN];
} slice[OGS_MAX_NUM_OF_SLICE];
int num_of_nr_tai;
ogs_5gs_tai_t nr_tai[OGS_MAX_NUM_OF_TAI];
int num_of_nr_tai_range;
struct {
ogs_plmn_id_t plmn_id;
/*
* TS29.510 6.1.6.2.28 Type: TacRange
*
* Either the start and end attributes, or
* the pattern attribute, shall be present.
*/
int num_of_tac_range;
ogs_uint24_t start[OGS_MAX_NUM_OF_TAI], end[OGS_MAX_NUM_OF_TAI];
} nr_tai_range[OGS_MAX_NUM_OF_TAI];
} ogs_sbi_smf_info_t;
typedef struct ogs_sbi_nf_info_s {
ogs_lnode_t lnode;
OpenAPI_nf_type_e nf_type;
union {
ogs_sbi_smf_info_t smf;
};
} ogs_sbi_nf_info_t;
void ogs_sbi_context_init(void);
void ogs_sbi_context_final(void);
ogs_sbi_context_t *ogs_sbi_self(void);
@@ -203,8 +243,6 @@ void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_instance_remove_all(void);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type(
OpenAPI_nf_type_e nf_type);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(ogs_sbi_nf_instance_t *nf_instance,
char *id, char *name, OpenAPI_uri_scheme_e scheme);
@@ -218,6 +256,11 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_id(
ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_name(
ogs_sbi_nf_instance_t *nf_instance, char *name);
ogs_sbi_nf_info_t *ogs_sbi_nf_info_add(
ogs_list_t *list, OpenAPI_nf_type_e nf_type);
void ogs_sbi_nf_info_remove(ogs_list_t *list, ogs_sbi_nf_info_t *nf_info);
void ogs_sbi_nf_info_remove_all(ogs_list_t *list);
void ogs_sbi_nf_instance_build_default(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
@@ -227,8 +270,36 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
ogs_sbi_nf_instance_t *nf_instance, char *name, char *version);
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
OpenAPI_nf_type_e nf_type, void *state);
#define OGS_SBI_NF_INSTANCE(__sBIObject, __nFType) \
(((__sBIObject)->nf_type_array)[__nFType].nf_instance)
#define OGS_SBI_SETUP_NF(__sBIObject, __nFType, __nFInstance) \
do { \
ogs_assert((__sBIObject)); \
ogs_assert((__nFType)); \
ogs_assert((__nFInstance)); \
\
if (OGS_SBI_NF_INSTANCE((__sBIObject), (__nFType))) { \
ogs_warn("UE %s-EndPoint updated [%s]", \
OpenAPI_nf_type_ToString((__nFType)), \
(__nFInstance)->id); \
ogs_sbi_nf_instance_remove( \
OGS_SBI_NF_INSTANCE((__sBIObject), (__nFType))); \
} \
\
if (OGS_SBI_NF_INSTANCE( \
(__sBIObject), (__nFType)) != (__nFInstance)) { \
(__nFInstance)->reference_count++; \
} \
OGS_SBI_NF_INSTANCE((__sBIObject), (__nFType)) = (__nFInstance); \
ogs_trace("nf_instance->reference_count = %d", \
(__nFInstance)->reference_count); \
} while(0)
void ogs_sbi_select_nrf(ogs_sbi_object_t *sbi_object, void *state);
void ogs_sbi_select_first_nf(
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state);
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);

View File

@@ -20,7 +20,7 @@
#include "ogs-sbi.h"
#include "yuarel.h"
static char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h)
char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h)
{
char buf[OGS_ADDRSTRLEN];
char uri[OGS_HUGE_LEN];
@@ -310,7 +310,7 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str)
{
int rv, i, j, k;
struct tm tm;
bool is_seconds;
bool is_subsecs, is_time, timezone_found;
char seconds[MAX_TIMESTR_LEN];
char subsecs[MAX_TIMESTR_LEN];
ogs_time_t usecs;
@@ -321,18 +321,25 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str)
memset(seconds, 0, sizeof seconds);
memset(subsecs, 0, sizeof subsecs);
is_seconds = true;
is_subsecs = false;
is_time = false;
timezone_found = false;
i = 0; j = 0, k = 0;
while(str[i]) {
if (is_seconds == true && str[i] == '.')
is_seconds = false;
else if (is_seconds == false && (str[i] < '0' || str[i] > '9'))
is_seconds = true;
if (is_subsecs == false && str[i] == '.')
is_subsecs = true;
else if (is_subsecs == false && str[i] == 'T')
is_time = true;
else if (is_subsecs == true && (str[i] < '0' || str[i] > '9'))
is_subsecs = false;
if (is_seconds == true) {
if (is_time == true && (str[i] == '+' || str[i] == '-'))
timezone_found = true;
if (is_subsecs == false) {
if (str[i] == ':' && i >= 3 &&
(str[i-3] == '+' || str[i-3] == '-')) {
/* skip timezone ':' character */
/* remove ':' character in timezone string range */
} else {
seconds[j++] = str[i];
}
@@ -344,7 +351,10 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str)
}
memset(&tm, 0, sizeof(tm));
ogs_strptime(seconds, "%Y-%m-%dT%H:%M:%S%z", &tm);
if (timezone_found == true)
ogs_strptime(seconds, "%Y-%m-%dT%H:%M:%S%z", &tm);
else
ogs_strptime(seconds, "%Y-%m-%dT%H:%M:%S", &tm);
#if USE_MATH
usecs = (ogs_time_t)floor(atof(subsecs) * 1000000.0 + 0.5);
#else
@@ -505,7 +515,7 @@ OpenAPI_guami_t *ogs_sbi_build_guami(ogs_guami_t *guami)
Guami = ogs_calloc(1, sizeof(*Guami));
ogs_assert(Guami);
Guami->plmn_id = ogs_sbi_build_plmn_id(&guami->plmn_id);
Guami->plmn_id = ogs_sbi_build_plmn_id_nid(&guami->plmn_id);
ogs_assert(Guami->plmn_id);
Guami->amf_id = ogs_amf_id_to_string(&guami->amf_id);
ogs_assert(Guami->amf_id);
@@ -521,7 +531,7 @@ bool ogs_sbi_parse_guami(ogs_guami_t *guami, OpenAPI_guami_t *Guami)
ogs_assert(Guami->plmn_id);
ogs_amf_id_from_string(&guami->amf_id, Guami->amf_id);
ogs_sbi_parse_plmn_id(&guami->plmn_id, Guami->plmn_id);
ogs_sbi_parse_plmn_id_nid(&guami->plmn_id, Guami->plmn_id);
return true;
}
@@ -531,7 +541,7 @@ void ogs_sbi_free_guami(OpenAPI_guami_t *Guami)
ogs_assert(Guami);
if (Guami->plmn_id)
ogs_sbi_free_plmn_id(Guami->plmn_id);
ogs_sbi_free_plmn_id_nid(Guami->plmn_id);
if (Guami->amf_id)
ogs_free(Guami->amf_id);
ogs_free(Guami);

View File

@@ -32,6 +32,7 @@ typedef struct ogs_sbi_server_s ogs_sbi_server_t;
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
typedef struct ogs_sbi_header_s ogs_sbi_header_t;
char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h);
char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h);
char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h);

View File

@@ -152,6 +152,9 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message)
OpenAPI_sm_policy_decision_free(message->SmPolicyDecision);
if (message->SmPolicyData)
OpenAPI_sm_policy_data_free(message->SmPolicyData);
if (message->AuthorizedNetworkSliceInfo)
OpenAPI_authorized_network_slice_info_free(
message->AuthorizedNetworkSliceInfo);
for (i = 0; i < message->num_of_part; i++) {
if (message->part[i].pkbuf)
@@ -164,8 +167,7 @@ ogs_sbi_request_t *ogs_sbi_request_new(void)
ogs_sbi_request_t *request = NULL;
ogs_pool_alloc(&request_pool, &request);
ogs_assert(request);
if (!request) return NULL;
memset(request, 0, sizeof(ogs_sbi_request_t));
request->http.params = ogs_hash_make();
@@ -221,7 +223,7 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
ogs_assert(message);
request = ogs_sbi_request_new();
ogs_assert(request);
if (!request) return NULL;
ogs_assert(message->h.method);
request->h.method = ogs_strdup(message->h.method);
@@ -243,6 +245,10 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
}
/* URL Param */
if (message->param.nf_id) {
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_NF_ID, message->param.nf_id);
}
if (message->param.nf_type) {
char *v = OpenAPI_nf_type_ToString(message->param.nf_type);
ogs_assert(v);
@@ -267,10 +273,8 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
ogs_free(v);
}
if (message->param.dnn) {
char *v = ogs_msprintf("%s", message->param.dnn);
ogs_assert(v);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_DNN, v);
ogs_free(v);
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_DNN, message->param.dnn);
}
if (message->param.plmn_id_presence) {
OpenAPI_plmn_id_t plmn_id;
@@ -296,15 +300,73 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
}
}
if (message->param.single_nssai_presence) {
char *v = ogs_sbi_s_nssai_to_string(&message->param.single_nssai);
char *v = ogs_sbi_s_nssai_to_string(&message->param.s_nssai);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SINGLE_NSSAI, v);
ogs_free(v);
}
if (message->param.snssai_presence) {
char *v = ogs_sbi_s_nssai_to_string(&message->param.snssai);
char *v = ogs_sbi_s_nssai_to_string(&message->param.s_nssai);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SNSSAI, v);
ogs_free(v);
}
if (message->param.plmn_id_presence) {
OpenAPI_plmn_id_t plmn_id;
plmn_id.mnc = ogs_plmn_id_mnc_string(&message->param.plmn_id);
plmn_id.mcc = ogs_plmn_id_mcc_string(&message->param.plmn_id);
if (plmn_id.mnc && plmn_id.mcc) {
char *v = NULL;
cJSON *item = NULL;
item = OpenAPI_plmn_id_convertToJSON(&plmn_id);
ogs_assert(item);
if (plmn_id.mnc) ogs_free(plmn_id.mnc);
if (plmn_id.mcc) ogs_free(plmn_id.mcc);
v = cJSON_Print(item);
ogs_assert(v);
cJSON_Delete(item);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_PLMN_ID, v);
ogs_free(v);
}
}
if (message->param.slice_info_request_for_pdu_session_presence) {
OpenAPI_slice_info_for_pdu_session_t SliceInfoForPDUSession;
OpenAPI_snssai_t sNSSAI;
char *v = NULL;
cJSON *item = NULL;
ogs_assert(message->param.s_nssai.sst);
ogs_assert(message->param.roaming_indication);
memset(&sNSSAI, 0, sizeof(sNSSAI));
sNSSAI.sst = message->param.s_nssai.sst;
sNSSAI.sd = ogs_s_nssai_sd_to_string(message->param.s_nssai.sd);
memset(&SliceInfoForPDUSession, 0, sizeof(SliceInfoForPDUSession));
SliceInfoForPDUSession.s_nssai = &sNSSAI;
SliceInfoForPDUSession.roaming_indication =
message->param.roaming_indication;
item = OpenAPI_slice_info_for_pdu_session_convertToJSON(
&SliceInfoForPDUSession);
ogs_assert(item);
v = cJSON_Print(item);
ogs_assert(v);
cJSON_Delete(item);
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_SLICE_INFO_REQUEST_FOR_PDU_SESSION, v);
ogs_free(v);
if (sNSSAI.sd)
ogs_free(sNSSAI.sd);
}
build_content(&request->http, message);
@@ -375,7 +437,9 @@ int ogs_sbi_parse_request(
for (hi = ogs_hash_first(request->http.params);
hi; hi = ogs_hash_next(hi)) {
if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_TYPE)) {
if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_ID)) {
message->param.nf_id = ogs_hash_this_val(hi);
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_TYPE)) {
message->param.nf_type =
OpenAPI_nf_type_FromString(ogs_hash_this_val(hi));
} else if (!strcmp(ogs_hash_this_key(hi),
@@ -414,7 +478,7 @@ int ogs_sbi_parse_request(
char *v = ogs_hash_this_val(hi);
if (v) {
bool rc = ogs_sbi_s_nssai_from_string(
&message->param.single_nssai, v);
&message->param.s_nssai, v);
if (rc == true)
message->param.single_nssai_presence = true;
}
@@ -422,10 +486,42 @@ int ogs_sbi_parse_request(
char *v = ogs_hash_this_val(hi);
if (v) {
bool rc = ogs_sbi_s_nssai_from_string(
&message->param.snssai, v);
&message->param.s_nssai, v);
if (rc == true)
message->param.snssai_presence = true;
}
} else if (!strcmp(ogs_hash_this_key(hi),
OGS_SBI_PARAM_SLICE_INFO_REQUEST_FOR_PDU_SESSION)) {
char *v = NULL;
cJSON *item = NULL;
OpenAPI_slice_info_for_pdu_session_t *SliceInfoForPduSession = NULL;
v = ogs_hash_this_val(hi);
if (v) {
item = cJSON_Parse(v);
if (item) {
SliceInfoForPduSession =
OpenAPI_slice_info_for_pdu_session_parseFromJSON(item);
if (SliceInfoForPduSession) {
OpenAPI_snssai_t *s_nssai =
SliceInfoForPduSession->s_nssai;
if (s_nssai) {
message->param.s_nssai.sst = s_nssai->sst;
message->param.s_nssai.sd =
ogs_s_nssai_sd_from_string(s_nssai->sd);
}
message->param.roaming_indication =
SliceInfoForPduSession->roaming_indication;
message->param.
slice_info_request_for_pdu_session_presence = true;
OpenAPI_slice_info_for_pdu_session_free(
SliceInfoForPduSession);
}
cJSON_Delete(item);
}
}
}
}
@@ -745,6 +841,10 @@ static char *build_json(ogs_sbi_message_t *message)
} else if (message->SmPolicyData) {
item = OpenAPI_sm_policy_data_convertToJSON(message->SmPolicyData);
ogs_assert(item);
} else if (message->AuthorizedNetworkSliceInfo) {
item = OpenAPI_authorized_network_slice_info_convertToJSON(
message->AuthorizedNetworkSliceInfo);
ogs_assert(item);
}
if (item) {
@@ -1370,6 +1470,27 @@ static int parse_json(ogs_sbi_message_t *message,
END
break;
CASE(OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION)
SWITCH(message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION)
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
message->AuthorizedNetworkSliceInfo =
OpenAPI_authorized_network_slice_info_parseFromJSON(
item);
if (!message->AuthorizedNetworkSliceInfo) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[0]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NAMF_CALLBACK)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS)

View File

@@ -144,6 +144,10 @@ extern "C" {
#define OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL "npcf-smpolicycontrol"
#define OGS_SBI_RESOURCE_NAME_SM_POLICIES "sm-policies"
#define OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION "nnssf-nsselection"
#define OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION \
"network-slice-information"
#define OGS_SBI_FEATURES_IS_SET(__fEATURES, __n) \
(__fEATURES & (1 << ((__n)-1)))
#define OGS_SBI_FEATURES_SET(__fEATURES, __n) \
@@ -195,6 +199,7 @@ extern "C" {
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DDN_EVENT_POLICY_CONTROL 37
#define OGS_SBI_NPCF_SMPOLICYCONTROL_REALLOCATION_OF_CREDIT 38
#define OGS_SBI_PARAM_NF_ID "nf-id"
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"
@@ -203,6 +208,8 @@ extern "C" {
#define OGS_SBI_PARAM_PLMN_ID "plmn-id"
#define OGS_SBI_PARAM_SINGLE_NSSAI "single-nssai"
#define OGS_SBI_PARAM_SNSSAI "snssai"
#define OGS_SBI_PARAM_SLICE_INFO_REQUEST_FOR_PDU_SESSION \
"slice-info-request-for-pdu-session"
#define OGS_SBI_ACCEPT "Accept"
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
@@ -279,16 +286,20 @@ typedef struct ogs_sbi_message_s {
struct {
OpenAPI_nf_type_e target_nf_type;
OpenAPI_nf_type_e requester_nf_type;
char *nf_id;
OpenAPI_nf_type_e nf_type;
int limit;
char *dnn;
bool plmn_id_presence;
ogs_plmn_id_t plmn_id;
/* Shared memory */
ogs_plmn_id_t plmn_id;
ogs_s_nssai_t s_nssai;
bool plmn_id_presence;
bool single_nssai_presence;
ogs_s_nssai_t single_nssai;
bool snssai_presence;
ogs_s_nssai_t snssai;
bool slice_info_request_for_pdu_session_presence;
OpenAPI_roaming_indication_e roaming_indication;
} param;
int res_status;
@@ -334,6 +345,7 @@ typedef struct ogs_sbi_message_s {
OpenAPI_sm_policy_context_data_t *SmPolicyContextData;
OpenAPI_sm_policy_decision_t *SmPolicyDecision;
OpenAPI_sm_policy_data_t *SmPolicyData;
OpenAPI_authorized_network_slice_info_t *AuthorizedNetworkSliceInfo;
ogs_sbi_links_t *links;

View File

@@ -50,6 +50,9 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
OpenAPI_nf_status_ToString(nf_instance->nf_status),
nf_instance->num_of_ipv4, nf_instance->num_of_ipv6);
NFProfile->heart_beat_timer = nf_instance->time.heartbeat_interval;
NFProfile->nf_profile_changes_support_ind = true;
if (strlen(nf_instance->fqdn)) {
memset(fqdn, 0, sizeof(fqdn));
fqdn_len = ogs_fqdn_build(fqdn,
@@ -234,46 +237,6 @@ void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile)
ogs_free(NFProfile);
}
ogs_sbi_request_t *ogs_nnrf_nfm_build_register(
ogs_sbi_nf_instance_t *nf_instance)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
OpenAPI_nf_profile_t *NFProfile = NULL;
ogs_assert(nf_instance);
client = nf_instance->client;
ogs_assert(client);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES;
message.h.resource.component[1] = ogs_sbi_self()->nf_instance_id;
message.http.content_encoding = (char*)ogs_sbi_self()->content_encoding;
NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance);
ogs_assert(NFProfile);
NFProfile->nf_profile_changes_support_ind = true;
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer =
ogs_app()->time.nf_instance.heartbeat_interval;
message.NFProfile = NFProfile;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_sbi_nnrf_free_nf_profile(NFProfile);
return request;
}
ogs_sbi_request_t *ogs_nnrf_nfm_build_update(ogs_sbi_nf_instance_t *nf_instance)
{
ogs_sbi_message_t message;
@@ -306,7 +269,6 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_update(ogs_sbi_nf_instance_t *nf_instance)
message.PatchItemList = PatchItemList;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
OpenAPI_list_free(PatchItemList);
@@ -330,7 +292,6 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(
message.h.resource.component[1] = nf_instance->id;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
return request;
}
@@ -383,7 +344,6 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
message.SubscriptionData = SubscriptionData;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_free(SubscriptionData->nf_status_notification_uri);
ogs_free(SubscriptionData);
@@ -408,7 +368,6 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
message.h.resource.component[1] = subscription->id;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
return request;
}
@@ -433,7 +392,6 @@ ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
message.param.requester_nf_type = requester_nf_type;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
return request;
}

View File

@@ -28,8 +28,6 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile);
ogs_sbi_request_t *ogs_nnrf_nfm_build_register(
ogs_sbi_nf_instance_t *nf_instance);
ogs_sbi_request_t *ogs_nnrf_nfm_build_update(
ogs_sbi_nf_instance_t *nf_instance);
ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(

View File

@@ -20,6 +20,163 @@
#include "ogs-sbi.h"
#include "ogs-app.h"
static void handle_smf_info(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_smf_info_t *SmfInfo)
{
ogs_sbi_nf_info_t *nf_info = NULL;
OpenAPI_list_t *sNssaiSmfInfoList = NULL;
OpenAPI_snssai_smf_info_item_t *sNssaiSmfInfoItem = NULL;
OpenAPI_snssai_t *sNssai = NULL;
OpenAPI_list_t *DnnSmfInfoList = NULL;
OpenAPI_dnn_smf_info_item_t *DnnSmfInfoItem = NULL;
OpenAPI_list_t *TaiList = NULL;
OpenAPI_tai_t *TaiItem = NULL;
OpenAPI_list_t *TaiRangeList = NULL;
OpenAPI_tai_range_t *TaiRangeItem = NULL;
OpenAPI_list_t *TacRangeList = NULL;
OpenAPI_tac_range_t *TacRangeItem = NULL;
OpenAPI_lnode_t *node = NULL, *node2 = NULL;
ogs_assert(nf_instance);
ogs_assert(SmfInfo);
nf_info = ogs_sbi_nf_info_add(
&nf_instance->nf_info_list, OpenAPI_nf_type_SMF);
ogs_assert(nf_info);
sNssaiSmfInfoList = SmfInfo->s_nssai_smf_info_list;
OpenAPI_list_for_each(sNssaiSmfInfoList, node) {
sNssaiSmfInfoItem = node->data;
if (sNssaiSmfInfoItem) {
ogs_assert(nf_info->smf.num_of_slice < OGS_MAX_NUM_OF_SLICE);
DnnSmfInfoList = sNssaiSmfInfoItem->dnn_smf_info_list;
OpenAPI_list_for_each(DnnSmfInfoList, node2) {
DnnSmfInfoItem = node2->data;
if (DnnSmfInfoItem && DnnSmfInfoItem->dnn) {
int dnn_index = nf_info->smf.slice
[nf_info->smf.num_of_slice].num_of_dnn;
ogs_assert(dnn_index < OGS_MAX_NUM_OF_DNN);
nf_info->smf.slice[nf_info->smf.num_of_slice].
dnn[dnn_index] = ogs_strdup(DnnSmfInfoItem->dnn);
nf_info->smf.slice[nf_info->smf.num_of_slice].
num_of_dnn++;
}
}
if (!nf_info->smf.slice[nf_info->smf.num_of_slice].num_of_dnn) {
ogs_error("No DNN");
continue;
}
sNssai = sNssaiSmfInfoItem->s_nssai;
if (sNssai) {
ogs_s_nssai_t *s_nssai = NULL;
s_nssai = &nf_info->smf.
slice[nf_info->smf.num_of_slice].s_nssai;
s_nssai->sst = sNssai->sst;
s_nssai->sd = ogs_s_nssai_sd_from_string(sNssai->sd);
nf_info->smf.num_of_slice++;
}
}
}
if (nf_info->smf.num_of_slice == 0) {
ogs_error("No S-NSSAI(DNN) in smfInfo");
ogs_sbi_nf_info_remove(&nf_instance->nf_info_list, nf_info);
return;
}
TaiList = SmfInfo->tai_list;
OpenAPI_list_for_each(TaiList, node) {
TaiItem = node->data;
if (TaiItem && TaiItem->plmn_id && TaiItem->tac) {
ogs_5gs_tai_t *nr_tai = NULL;
ogs_assert(nf_info->smf.num_of_nr_tai < OGS_MAX_NUM_OF_TAI);
nr_tai = &nf_info->smf.nr_tai[nf_info->smf.num_of_nr_tai];
ogs_assert(nr_tai);
ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id);
nr_tai->tac = ogs_uint24_from_string(TaiItem->tac);
nf_info->smf.num_of_nr_tai++;
}
}
TaiRangeList = SmfInfo->tai_range_list;
OpenAPI_list_for_each(TaiRangeList, node) {
TaiRangeItem = node->data;
if (TaiRangeItem && TaiRangeItem->plmn_id &&
TaiRangeItem->tac_range_list) {
ogs_assert(nf_info->smf.num_of_nr_tai_range <
OGS_MAX_NUM_OF_TAI);
ogs_sbi_parse_plmn_id(
&nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].plmn_id,
TaiRangeItem->plmn_id);
TacRangeList = TaiRangeItem->tac_range_list;
OpenAPI_list_for_each(TacRangeList, node2) {
TacRangeItem = node2->data;
if (TacRangeItem &&
TacRangeItem->start && TacRangeItem->end) {
int tac_index = nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].num_of_tac_range;
ogs_assert(tac_index < OGS_MAX_NUM_OF_TAI);
nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].
start[tac_index] =
ogs_uint24_from_string(TacRangeItem->start);
nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].
end[tac_index] =
ogs_uint24_from_string(TacRangeItem->end);
nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].
num_of_tac_range++;
}
}
nf_info->smf.num_of_nr_tai_range++;
}
}
#if 0
ogs_sbi_smf_info_t *smf_info = &nf_info->smf;
int i, j;
for (i = 0; i < smf_info->num_of_slice; i++) {
ogs_fatal("%d, %x", smf_info->slice[i].s_nssai.sst,
smf_info->slice[i].s_nssai.sd.v);
for (j = 0; j < smf_info->slice[i].num_of_dnn; j++)
ogs_fatal(" %s", smf_info->slice[i].dnn[j]);
}
for (i = 0; i < smf_info->num_of_nr_tai; i++) {
ogs_fatal("%d, %d, %x",
ogs_plmn_id_mcc(&smf_info->nr_tai[i].plmn_id),
ogs_plmn_id_mnc(&smf_info->nr_tai[i].plmn_id),
smf_info->nr_tai[i].tac.v);
}
for (i = 0; i < smf_info->num_of_nr_tai_range; i++) {
ogs_fatal("%d, %d",
ogs_plmn_id_mcc(&smf_info->nr_tai[i].plmn_id),
ogs_plmn_id_mnc(&smf_info->nr_tai[i].plmn_id));
for (j = 0; j < smf_info->nr_tai_range[i].num_of_tac_range; j++) {
ogs_fatal(" %d-%d",
smf_info->nr_tai_range[i].start[j].v,
smf_info->nr_tai_range[i].end[j].v);
}
}
#endif
}
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_profile_t *NFProfile,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
@@ -222,5 +379,16 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
}
}
ogs_sbi_nf_info_remove_all(&nf_instance->nf_info_list);
if (NFProfile->smf_info)
handle_smf_info(nf_instance, NFProfile->smf_info);
OpenAPI_list_for_each(NFProfile->smf_info_list, node) {
OpenAPI_map_t *SmfInfoMap = node->data;
if (SmfInfoMap && SmfInfoMap->value)
handle_smf_info(nf_instance, SmfInfoMap->value);
}
return true;
}

View File

@@ -65,6 +65,8 @@
#include "model/sm_policy_context_data.h"
#include "model/sm_policy_decision.h"
#include "model/sm_policy_data.h"
#include "model/slice_info_for_pdu_session.h"
#include "model/authorized_network_slice_info.h"
#include "custom/links.h"

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
char *supported_features,
OpenAPI_list_t *gpsis,
OpenAPI_list_t *internal_group_ids,
OpenAPI_list_t* vn_group_info,
OpenAPI_list_t* shared_vn_group_data_ids,
OpenAPI_ambr_rm_t *subscribed_ue_ambr,
OpenAPI_nssai_t *nssai,
@@ -22,7 +21,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int mps_priority,
int mcs_priority,
int active_time,
int dl_packet_count,
OpenAPI_sor_info_t *sor_info,
int sor_info_expect_ind,
int soraf_retrieval,
@@ -30,9 +28,11 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
OpenAPI_upu_info_t *upu_info,
int mico_allowed,
OpenAPI_list_t *shared_am_data_ids,
OpenAPI_odb_packet_services_t *odb_packet_services,
OpenAPI_odb_packet_services_e odb_packet_services,
OpenAPI_list_t *subscribed_dnn_list,
int service_gap_time,
OpenAPI_mdt_user_consent_e mdt_user_consent,
OpenAPI_mdt_configuration_t *mdt_configuration,
OpenAPI_trace_data_t *trace_data,
OpenAPI_cag_data_t *cag_data,
char *stn_sr,
@@ -40,20 +40,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int nb_io_t_ue_priority,
int nssai_inclusion_allowed,
char rg_wireline_characteristics,
OpenAPI_tmbr_t *rg_tmbr,
OpenAPI_ec_restriction_data_t *ec_restriction_data,
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb,
int ec_restriction_data_nb,
OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_list,
OpenAPI_list_t *maximum_response_time_list,
OpenAPI_list_t *maximum_latency_list,
OpenAPI_list_t *primary_rat_restrictions,
OpenAPI_list_t *secondary_rat_restrictions,
OpenAPI_list_t *edrx_parameters_list,
OpenAPI_list_t *ptw_parameters_list,
int iab_operation_allowed,
OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth,
OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth,
char *nr_ue_pc5_ambr,
char *lte_pc5_ambr
OpenAPI_list_t *wireline_forbidden_areas,
OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction
)
{
OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_access_and_mobility_subscription_data_t));
@@ -63,7 +59,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->supported_features = supported_features;
access_and_mobility_subscription_data_local_var->gpsis = gpsis;
access_and_mobility_subscription_data_local_var->internal_group_ids = internal_group_ids;
access_and_mobility_subscription_data_local_var->vn_group_info = vn_group_info;
access_and_mobility_subscription_data_local_var->shared_vn_group_data_ids = shared_vn_group_data_ids;
access_and_mobility_subscription_data_local_var->subscribed_ue_ambr = subscribed_ue_ambr;
access_and_mobility_subscription_data_local_var->nssai = nssai;
@@ -77,7 +72,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->mps_priority = mps_priority;
access_and_mobility_subscription_data_local_var->mcs_priority = mcs_priority;
access_and_mobility_subscription_data_local_var->active_time = active_time;
access_and_mobility_subscription_data_local_var->dl_packet_count = dl_packet_count;
access_and_mobility_subscription_data_local_var->sor_info = sor_info;
access_and_mobility_subscription_data_local_var->sor_info_expect_ind = sor_info_expect_ind;
access_and_mobility_subscription_data_local_var->soraf_retrieval = soraf_retrieval;
@@ -88,6 +82,8 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->odb_packet_services = odb_packet_services;
access_and_mobility_subscription_data_local_var->subscribed_dnn_list = subscribed_dnn_list;
access_and_mobility_subscription_data_local_var->service_gap_time = service_gap_time;
access_and_mobility_subscription_data_local_var->mdt_user_consent = mdt_user_consent;
access_and_mobility_subscription_data_local_var->mdt_configuration = mdt_configuration;
access_and_mobility_subscription_data_local_var->trace_data = trace_data;
access_and_mobility_subscription_data_local_var->cag_data = cag_data;
access_and_mobility_subscription_data_local_var->stn_sr = stn_sr;
@@ -95,20 +91,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->nb_io_t_ue_priority = nb_io_t_ue_priority;
access_and_mobility_subscription_data_local_var->nssai_inclusion_allowed = nssai_inclusion_allowed;
access_and_mobility_subscription_data_local_var->rg_wireline_characteristics = rg_wireline_characteristics;
access_and_mobility_subscription_data_local_var->rg_tmbr = rg_tmbr;
access_and_mobility_subscription_data_local_var->ec_restriction_data = ec_restriction_data;
access_and_mobility_subscription_data_local_var->ec_restriction_data_wb = ec_restriction_data_wb;
access_and_mobility_subscription_data_local_var->ec_restriction_data_nb = ec_restriction_data_nb;
access_and_mobility_subscription_data_local_var->expected_ue_behaviour_list = expected_ue_behaviour_list;
access_and_mobility_subscription_data_local_var->maximum_response_time_list = maximum_response_time_list;
access_and_mobility_subscription_data_local_var->maximum_latency_list = maximum_latency_list;
access_and_mobility_subscription_data_local_var->primary_rat_restrictions = primary_rat_restrictions;
access_and_mobility_subscription_data_local_var->secondary_rat_restrictions = secondary_rat_restrictions;
access_and_mobility_subscription_data_local_var->edrx_parameters_list = edrx_parameters_list;
access_and_mobility_subscription_data_local_var->ptw_parameters_list = ptw_parameters_list;
access_and_mobility_subscription_data_local_var->iab_operation_allowed = iab_operation_allowed;
access_and_mobility_subscription_data_local_var->nr_v2x_services_auth = nr_v2x_services_auth;
access_and_mobility_subscription_data_local_var->lte_v2x_services_auth = lte_v2x_services_auth;
access_and_mobility_subscription_data_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr;
access_and_mobility_subscription_data_local_var->lte_pc5_ambr = lte_pc5_ambr;
access_and_mobility_subscription_data_local_var->wireline_forbidden_areas = wireline_forbidden_areas;
access_and_mobility_subscription_data_local_var->wireline_service_area_restriction = wireline_service_area_restriction;
return access_and_mobility_subscription_data_local_var;
}
@@ -128,12 +120,6 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
ogs_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->internal_group_ids);
OpenAPI_list_for_each(access_and_mobility_subscription_data->vn_group_info, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_vn_group_data_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(access_and_mobility_subscription_data->vn_group_info);
OpenAPI_list_for_each(access_and_mobility_subscription_data->shared_vn_group_data_ids, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
ogs_free(localKeyValue->value);
@@ -156,26 +142,17 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
ogs_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->shared_am_data_ids);
OpenAPI_odb_packet_services_free(access_and_mobility_subscription_data->odb_packet_services);
OpenAPI_list_for_each(access_and_mobility_subscription_data->subscribed_dnn_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->subscribed_dnn_list);
OpenAPI_mdt_configuration_free(access_and_mobility_subscription_data->mdt_configuration);
OpenAPI_trace_data_free(access_and_mobility_subscription_data->trace_data);
OpenAPI_cag_data_free(access_and_mobility_subscription_data->cag_data);
ogs_free(access_and_mobility_subscription_data->stn_sr);
ogs_free(access_and_mobility_subscription_data->c_msisdn);
OpenAPI_tmbr_free(access_and_mobility_subscription_data->rg_tmbr);
OpenAPI_ec_restriction_data_free(access_and_mobility_subscription_data->ec_restriction_data);
OpenAPI_ec_restriction_data_wb_free(access_and_mobility_subscription_data->ec_restriction_data_wb);
OpenAPI_expected_ue_behaviour_data_free(access_and_mobility_subscription_data->expected_ue_behaviour_list);
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_response_time_list, node) {
OpenAPI_maximum_response_time_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->maximum_response_time_list);
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_latency_list, node) {
OpenAPI_maximum_latency_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->maximum_latency_list);
OpenAPI_list_free(access_and_mobility_subscription_data->primary_rat_restrictions);
OpenAPI_list_free(access_and_mobility_subscription_data->secondary_rat_restrictions);
OpenAPI_list_for_each(access_and_mobility_subscription_data->edrx_parameters_list, node) {
@@ -186,10 +163,11 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
OpenAPI_ptw_parameters_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->ptw_parameters_list);
OpenAPI_nr_v2x_auth_free(access_and_mobility_subscription_data->nr_v2x_services_auth);
OpenAPI_lte_v2x_auth_free(access_and_mobility_subscription_data->lte_v2x_services_auth);
ogs_free(access_and_mobility_subscription_data->nr_ue_pc5_ambr);
ogs_free(access_and_mobility_subscription_data->lte_pc5_ambr);
OpenAPI_list_for_each(access_and_mobility_subscription_data->wireline_forbidden_areas, node) {
OpenAPI_wireline_area_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->wireline_forbidden_areas);
OpenAPI_wireline_service_area_restriction_free(access_and_mobility_subscription_data->wireline_service_area_restriction);
ogs_free(access_and_mobility_subscription_data);
}
@@ -242,27 +220,6 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->vn_group_info) {
cJSON *vn_group_info = cJSON_AddObjectToObject(item, "vnGroupInfo");
if (vn_group_info == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [vn_group_info]");
goto end;
}
cJSON *localMapObject = vn_group_info;
OpenAPI_lnode_t *vn_group_info_node;
if (access_and_mobility_subscription_data->vn_group_info) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->vn_group_info, vn_group_info_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)vn_group_info_node->data;
cJSON *itemLocal = OpenAPI_vn_group_data_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [vn_group_info]");
goto end;
}
cJSON_AddItemToObject(vn_group_info, localKeyValue->key, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->shared_vn_group_data_ids) {
cJSON *shared_vn_group_data_ids = cJSON_AddObjectToObject(item, "sharedVnGroupDataIds");
if (shared_vn_group_data_ids == NULL) {
@@ -409,13 +366,6 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->dl_packet_count) {
if (cJSON_AddNumberToObject(item, "dlPacketCount", access_and_mobility_subscription_data->dl_packet_count) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [dl_packet_count]");
goto end;
}
}
if (access_and_mobility_subscription_data->sor_info) {
cJSON *sor_info_local_JSON = OpenAPI_sor_info_convertToJSON(access_and_mobility_subscription_data->sor_info);
if (sor_info_local_JSON == NULL) {
@@ -495,13 +445,7 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
if (access_and_mobility_subscription_data->odb_packet_services) {
cJSON *odb_packet_services_local_JSON = OpenAPI_odb_packet_services_convertToJSON(access_and_mobility_subscription_data->odb_packet_services);
if (odb_packet_services_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [odb_packet_services]");
goto end;
}
cJSON_AddItemToObject(item, "odbPacketServices", odb_packet_services_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "odbPacketServices", OpenAPI_odb_packet_services_ToString(access_and_mobility_subscription_data->odb_packet_services)) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [odb_packet_services]");
goto end;
}
@@ -530,6 +474,26 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->mdt_user_consent) {
if (cJSON_AddStringToObject(item, "mdtUserConsent", OpenAPI_mdt_user_consent_ToString(access_and_mobility_subscription_data->mdt_user_consent)) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mdt_user_consent]");
goto end;
}
}
if (access_and_mobility_subscription_data->mdt_configuration) {
cJSON *mdt_configuration_local_JSON = OpenAPI_mdt_configuration_convertToJSON(access_and_mobility_subscription_data->mdt_configuration);
if (mdt_configuration_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mdt_configuration]");
goto end;
}
cJSON_AddItemToObject(item, "mdtConfiguration", mdt_configuration_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mdt_configuration]");
goto end;
}
}
if (access_and_mobility_subscription_data->trace_data) {
cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(access_and_mobility_subscription_data->trace_data);
if (trace_data_local_JSON == NULL) {
@@ -591,28 +555,22 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->rg_tmbr) {
cJSON *rg_tmbr_local_JSON = OpenAPI_tmbr_convertToJSON(access_and_mobility_subscription_data->rg_tmbr);
if (rg_tmbr_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rg_tmbr]");
if (access_and_mobility_subscription_data->ec_restriction_data_wb) {
cJSON *ec_restriction_data_wb_local_JSON = OpenAPI_ec_restriction_data_wb_convertToJSON(access_and_mobility_subscription_data->ec_restriction_data_wb);
if (ec_restriction_data_wb_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data_wb]");
goto end;
}
cJSON_AddItemToObject(item, "rgTMBR", rg_tmbr_local_JSON);
cJSON_AddItemToObject(item, "ecRestrictionDataWb", ec_restriction_data_wb_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rg_tmbr]");
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data_wb]");
goto end;
}
}
if (access_and_mobility_subscription_data->ec_restriction_data) {
cJSON *ec_restriction_data_local_JSON = OpenAPI_ec_restriction_data_convertToJSON(access_and_mobility_subscription_data->ec_restriction_data);
if (ec_restriction_data_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data]");
goto end;
}
cJSON_AddItemToObject(item, "ecRestrictionData", ec_restriction_data_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data]");
if (access_and_mobility_subscription_data->ec_restriction_data_nb) {
if (cJSON_AddBoolToObject(item, "ecRestrictionDataNb", access_and_mobility_subscription_data->ec_restriction_data_nb) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data_nb]");
goto end;
}
}
@@ -630,46 +588,6 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->maximum_response_time_list) {
cJSON *maximum_response_time_listList = cJSON_AddArrayToObject(item, "maximumResponseTimeList");
if (maximum_response_time_listList == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_response_time_list]");
goto end;
}
OpenAPI_lnode_t *maximum_response_time_list_node;
if (access_and_mobility_subscription_data->maximum_response_time_list) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_response_time_list, maximum_response_time_list_node) {
cJSON *itemLocal = OpenAPI_maximum_response_time_convertToJSON(maximum_response_time_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_response_time_list]");
goto end;
}
cJSON_AddItemToArray(maximum_response_time_listList, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->maximum_latency_list) {
cJSON *maximum_latency_listList = cJSON_AddArrayToObject(item, "maximumLatencyList");
if (maximum_latency_listList == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_latency_list]");
goto end;
}
OpenAPI_lnode_t *maximum_latency_list_node;
if (access_and_mobility_subscription_data->maximum_latency_list) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_latency_list, maximum_latency_list_node) {
cJSON *itemLocal = OpenAPI_maximum_latency_convertToJSON(maximum_latency_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_latency_list]");
goto end;
}
cJSON_AddItemToArray(maximum_latency_listList, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->primary_rat_restrictions) {
cJSON *primary_rat_restrictions = cJSON_AddArrayToObject(item, "primaryRatRestrictions");
if (primary_rat_restrictions == NULL) {
@@ -747,42 +665,35 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->nr_v2x_services_auth) {
cJSON *nr_v2x_services_auth_local_JSON = OpenAPI_nr_v2x_auth_convertToJSON(access_and_mobility_subscription_data->nr_v2x_services_auth);
if (nr_v2x_services_auth_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nr_v2x_services_auth]");
if (access_and_mobility_subscription_data->wireline_forbidden_areas) {
cJSON *wireline_forbidden_areasList = cJSON_AddArrayToObject(item, "wirelineForbiddenAreas");
if (wireline_forbidden_areasList == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_forbidden_areas]");
goto end;
}
cJSON_AddItemToObject(item, "nrV2xServicesAuth", nr_v2x_services_auth_local_JSON);
OpenAPI_lnode_t *wireline_forbidden_areas_node;
if (access_and_mobility_subscription_data->wireline_forbidden_areas) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->wireline_forbidden_areas, wireline_forbidden_areas_node) {
cJSON *itemLocal = OpenAPI_wireline_area_convertToJSON(wireline_forbidden_areas_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_forbidden_areas]");
goto end;
}
cJSON_AddItemToArray(wireline_forbidden_areasList, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->wireline_service_area_restriction) {
cJSON *wireline_service_area_restriction_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(access_and_mobility_subscription_data->wireline_service_area_restriction);
if (wireline_service_area_restriction_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_service_area_restriction]");
goto end;
}
cJSON_AddItemToObject(item, "wirelineServiceAreaRestriction", wireline_service_area_restriction_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nr_v2x_services_auth]");
goto end;
}
}
if (access_and_mobility_subscription_data->lte_v2x_services_auth) {
cJSON *lte_v2x_services_auth_local_JSON = OpenAPI_lte_v2x_auth_convertToJSON(access_and_mobility_subscription_data->lte_v2x_services_auth);
if (lte_v2x_services_auth_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [lte_v2x_services_auth]");
goto end;
}
cJSON_AddItemToObject(item, "lteV2xServicesAuth", lte_v2x_services_auth_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [lte_v2x_services_auth]");
goto end;
}
}
if (access_and_mobility_subscription_data->nr_ue_pc5_ambr) {
if (cJSON_AddStringToObject(item, "nrUePc5Ambr", access_and_mobility_subscription_data->nr_ue_pc5_ambr) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nr_ue_pc5_ambr]");
goto end;
}
}
if (access_and_mobility_subscription_data->lte_pc5_ambr) {
if (cJSON_AddStringToObject(item, "ltePc5Ambr", access_and_mobility_subscription_data->lte_pc5_ambr) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [lte_pc5_ambr]");
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_service_area_restriction]");
goto end;
}
}
@@ -843,29 +754,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *vn_group_info = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "vnGroupInfo");
OpenAPI_list_t *vn_group_infoList;
if (vn_group_info) {
cJSON *vn_group_info_local_map;
if (!cJSON_IsObject(vn_group_info)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [vn_group_info]");
goto end;
}
vn_group_infoList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(vn_group_info_local_map, vn_group_info) {
cJSON *localMapObject = vn_group_info_local_map;
if (!cJSON_IsObject(vn_group_info_local_map)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [vn_group_info]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_vn_group_data_parseFromJSON(localMapObject));
OpenAPI_list_add(vn_group_infoList, localMapKeyPair);
}
}
cJSON *shared_vn_group_data_ids = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "sharedVnGroupDataIds");
OpenAPI_list_t *shared_vn_group_data_idsList;
@@ -1025,15 +913,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *dl_packet_count = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "dlPacketCount");
if (dl_packet_count) {
if (!cJSON_IsNumber(dl_packet_count)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [dl_packet_count]");
goto end;
}
}
cJSON *sor_info = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "sorInfo");
OpenAPI_sor_info_t *sor_info_local_nonprim = NULL;
@@ -1119,9 +998,13 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
cJSON *odb_packet_services = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "odbPacketServices");
OpenAPI_odb_packet_services_t *odb_packet_services_local_nonprim = NULL;
OpenAPI_odb_packet_services_e odb_packet_servicesVariable;
if (odb_packet_services) {
odb_packet_services_local_nonprim = OpenAPI_odb_packet_services_parseFromJSON(odb_packet_services);
if (!cJSON_IsString(odb_packet_services)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [odb_packet_services]");
goto end;
}
odb_packet_servicesVariable = OpenAPI_odb_packet_services_FromString(odb_packet_services->valuestring);
}
cJSON *subscribed_dnn_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "subscribedDnnList");
@@ -1153,6 +1036,24 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *mdt_user_consent = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "mdtUserConsent");
OpenAPI_mdt_user_consent_e mdt_user_consentVariable;
if (mdt_user_consent) {
if (!cJSON_IsString(mdt_user_consent)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [mdt_user_consent]");
goto end;
}
mdt_user_consentVariable = OpenAPI_mdt_user_consent_FromString(mdt_user_consent->valuestring);
}
cJSON *mdt_configuration = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "mdtConfiguration");
OpenAPI_mdt_configuration_t *mdt_configuration_local_nonprim = NULL;
if (mdt_configuration) {
mdt_configuration_local_nonprim = OpenAPI_mdt_configuration_parseFromJSON(mdt_configuration);
}
cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "traceData");
OpenAPI_trace_data_t *trace_data_local_nonprim = NULL;
@@ -1212,18 +1113,20 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "rgTMBR");
cJSON *ec_restriction_data_wb = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ecRestrictionDataWb");
OpenAPI_tmbr_t *rg_tmbr_local_nonprim = NULL;
if (rg_tmbr) {
rg_tmbr_local_nonprim = OpenAPI_tmbr_parseFromJSON(rg_tmbr);
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_nonprim = NULL;
if (ec_restriction_data_wb) {
ec_restriction_data_wb_local_nonprim = OpenAPI_ec_restriction_data_wb_parseFromJSON(ec_restriction_data_wb);
}
cJSON *ec_restriction_data = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ecRestrictionData");
cJSON *ec_restriction_data_nb = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ecRestrictionDataNb");
OpenAPI_ec_restriction_data_t *ec_restriction_data_local_nonprim = NULL;
if (ec_restriction_data) {
ec_restriction_data_local_nonprim = OpenAPI_ec_restriction_data_parseFromJSON(ec_restriction_data);
if (ec_restriction_data_nb) {
if (!cJSON_IsBool(ec_restriction_data_nb)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [ec_restriction_data_nb]");
goto end;
}
}
cJSON *expected_ue_behaviour_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "expectedUeBehaviourList");
@@ -1233,52 +1136,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
expected_ue_behaviour_list_local_nonprim = OpenAPI_expected_ue_behaviour_data_parseFromJSON(expected_ue_behaviour_list);
}
cJSON *maximum_response_time_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "maximumResponseTimeList");
OpenAPI_list_t *maximum_response_time_listList;
if (maximum_response_time_list) {
cJSON *maximum_response_time_list_local_nonprimitive;
if (!cJSON_IsArray(maximum_response_time_list)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_response_time_list]");
goto end;
}
maximum_response_time_listList = OpenAPI_list_create();
cJSON_ArrayForEach(maximum_response_time_list_local_nonprimitive, maximum_response_time_list ) {
if (!cJSON_IsObject(maximum_response_time_list_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_response_time_list]");
goto end;
}
OpenAPI_maximum_response_time_t *maximum_response_time_listItem = OpenAPI_maximum_response_time_parseFromJSON(maximum_response_time_list_local_nonprimitive);
OpenAPI_list_add(maximum_response_time_listList, maximum_response_time_listItem);
}
}
cJSON *maximum_latency_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "maximumLatencyList");
OpenAPI_list_t *maximum_latency_listList;
if (maximum_latency_list) {
cJSON *maximum_latency_list_local_nonprimitive;
if (!cJSON_IsArray(maximum_latency_list)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_latency_list]");
goto end;
}
maximum_latency_listList = OpenAPI_list_create();
cJSON_ArrayForEach(maximum_latency_list_local_nonprimitive, maximum_latency_list ) {
if (!cJSON_IsObject(maximum_latency_list_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_latency_list]");
goto end;
}
OpenAPI_maximum_latency_t *maximum_latency_listItem = OpenAPI_maximum_latency_parseFromJSON(maximum_latency_list_local_nonprimitive);
OpenAPI_list_add(maximum_latency_listList, maximum_latency_listItem);
}
}
cJSON *primary_rat_restrictions = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "primaryRatRestrictions");
OpenAPI_list_t *primary_rat_restrictionsList;
@@ -1378,43 +1235,40 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *nr_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "nrV2xServicesAuth");
cJSON *wireline_forbidden_areas = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "wirelineForbiddenAreas");
OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth_local_nonprim = NULL;
if (nr_v2x_services_auth) {
nr_v2x_services_auth_local_nonprim = OpenAPI_nr_v2x_auth_parseFromJSON(nr_v2x_services_auth);
}
cJSON *lte_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "lteV2xServicesAuth");
OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth_local_nonprim = NULL;
if (lte_v2x_services_auth) {
lte_v2x_services_auth_local_nonprim = OpenAPI_lte_v2x_auth_parseFromJSON(lte_v2x_services_auth);
}
cJSON *nr_ue_pc5_ambr = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "nrUePc5Ambr");
if (nr_ue_pc5_ambr) {
if (!cJSON_IsString(nr_ue_pc5_ambr)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [nr_ue_pc5_ambr]");
OpenAPI_list_t *wireline_forbidden_areasList;
if (wireline_forbidden_areas) {
cJSON *wireline_forbidden_areas_local_nonprimitive;
if (!cJSON_IsArray(wireline_forbidden_areas)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [wireline_forbidden_areas]");
goto end;
}
wireline_forbidden_areasList = OpenAPI_list_create();
cJSON_ArrayForEach(wireline_forbidden_areas_local_nonprimitive, wireline_forbidden_areas ) {
if (!cJSON_IsObject(wireline_forbidden_areas_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [wireline_forbidden_areas]");
goto end;
}
OpenAPI_wireline_area_t *wireline_forbidden_areasItem = OpenAPI_wireline_area_parseFromJSON(wireline_forbidden_areas_local_nonprimitive);
OpenAPI_list_add(wireline_forbidden_areasList, wireline_forbidden_areasItem);
}
}
cJSON *lte_pc5_ambr = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ltePc5Ambr");
cJSON *wireline_service_area_restriction = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "wirelineServiceAreaRestriction");
if (lte_pc5_ambr) {
if (!cJSON_IsString(lte_pc5_ambr)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [lte_pc5_ambr]");
goto end;
}
OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction_local_nonprim = NULL;
if (wireline_service_area_restriction) {
wireline_service_area_restriction_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wireline_service_area_restriction);
}
access_and_mobility_subscription_data_local_var = OpenAPI_access_and_mobility_subscription_data_create (
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
gpsis ? gpsisList : NULL,
internal_group_ids ? internal_group_idsList : NULL,
vn_group_info ? vn_group_infoList : NULL,
shared_vn_group_data_ids ? shared_vn_group_data_idsList : NULL,
subscribed_ue_ambr ? subscribed_ue_ambr_local_nonprim : NULL,
nssai ? nssai_local_nonprim : NULL,
@@ -1428,7 +1282,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
mps_priority ? mps_priority->valueint : 0,
mcs_priority ? mcs_priority->valueint : 0,
active_time ? active_time->valuedouble : 0,
dl_packet_count ? dl_packet_count->valuedouble : 0,
sor_info ? sor_info_local_nonprim : NULL,
sor_info_expect_ind ? sor_info_expect_ind->valueint : 0,
soraf_retrieval ? soraf_retrieval->valueint : 0,
@@ -1436,9 +1289,11 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
upu_info ? upu_info_local_nonprim : NULL,
mico_allowed ? mico_allowed->valueint : 0,
shared_am_data_ids ? shared_am_data_idsList : NULL,
odb_packet_services ? odb_packet_services_local_nonprim : NULL,
odb_packet_services ? odb_packet_servicesVariable : 0,
subscribed_dnn_list ? subscribed_dnn_listList : NULL,
service_gap_time ? service_gap_time->valuedouble : 0,
mdt_user_consent ? mdt_user_consentVariable : 0,
mdt_configuration ? mdt_configuration_local_nonprim : NULL,
trace_data ? trace_data_local_nonprim : NULL,
cag_data ? cag_data_local_nonprim : NULL,
stn_sr ? ogs_strdup(stn_sr->valuestring) : NULL,
@@ -1446,20 +1301,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
nb_io_t_ue_priority ? nb_io_t_ue_priority->valuedouble : 0,
nssai_inclusion_allowed ? nssai_inclusion_allowed->valueint : 0,
rg_wireline_characteristics ? rg_wireline_characteristics->valueint : 0,
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
ec_restriction_data ? ec_restriction_data_local_nonprim : NULL,
ec_restriction_data_wb ? ec_restriction_data_wb_local_nonprim : NULL,
ec_restriction_data_nb ? ec_restriction_data_nb->valueint : 0,
expected_ue_behaviour_list ? expected_ue_behaviour_list_local_nonprim : NULL,
maximum_response_time_list ? maximum_response_time_listList : NULL,
maximum_latency_list ? maximum_latency_listList : NULL,
primary_rat_restrictions ? primary_rat_restrictionsList : NULL,
secondary_rat_restrictions ? secondary_rat_restrictionsList : NULL,
edrx_parameters_list ? edrx_parameters_listList : NULL,
ptw_parameters_list ? ptw_parameters_listList : NULL,
iab_operation_allowed ? iab_operation_allowed->valueint : 0,
nr_v2x_services_auth ? nr_v2x_services_auth_local_nonprim : NULL,
lte_v2x_services_auth ? lte_v2x_services_auth_local_nonprim : NULL,
nr_ue_pc5_ambr ? ogs_strdup(nr_ue_pc5_ambr->valuestring) : NULL,
lte_pc5_ambr ? ogs_strdup(lte_pc5_ambr->valuestring) : NULL
wireline_forbidden_areas ? wireline_forbidden_areasList : NULL,
wireline_service_area_restriction ? wireline_service_area_restriction_local_nonprim : NULL
);
return access_and_mobility_subscription_data_local_var;

View File

@@ -16,13 +16,11 @@
#include "area.h"
#include "cag_data.h"
#include "core_network_type.h"
#include "ec_restriction_data.h"
#include "ec_restriction_data_wb.h"
#include "edrx_parameters.h"
#include "expected_ue_behaviour_data.h"
#include "lte_v2x_auth.h"
#include "maximum_latency.h"
#include "maximum_response_time.h"
#include "nr_v2x_auth.h"
#include "mdt_configuration.h"
#include "mdt_user_consent.h"
#include "nssai.h"
#include "odb_packet_services.h"
#include "ptw_parameters.h"
@@ -30,10 +28,10 @@
#include "service_area_restriction.h"
#include "sor_info.h"
#include "sor_update_indicator.h"
#include "tmbr.h"
#include "trace_data.h"
#include "upu_info.h"
#include "vn_group_data.h"
#include "wireline_area.h"
#include "wireline_service_area_restriction.h"
#ifdef __cplusplus
extern "C" {
@@ -44,7 +42,6 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
char *supported_features;
OpenAPI_list_t *gpsis;
OpenAPI_list_t *internal_group_ids;
OpenAPI_list_t* vn_group_info;
OpenAPI_list_t* shared_vn_group_data_ids;
struct OpenAPI_ambr_rm_s *subscribed_ue_ambr;
struct OpenAPI_nssai_s *nssai;
@@ -58,7 +55,6 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
int mps_priority;
int mcs_priority;
int active_time;
int dl_packet_count;
struct OpenAPI_sor_info_s *sor_info;
int sor_info_expect_ind;
int soraf_retrieval;
@@ -66,9 +62,11 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
struct OpenAPI_upu_info_s *upu_info;
int mico_allowed;
OpenAPI_list_t *shared_am_data_ids;
struct OpenAPI_odb_packet_services_s *odb_packet_services;
OpenAPI_odb_packet_services_e odb_packet_services;
OpenAPI_list_t *subscribed_dnn_list;
int service_gap_time;
OpenAPI_mdt_user_consent_e mdt_user_consent;
struct OpenAPI_mdt_configuration_s *mdt_configuration;
struct OpenAPI_trace_data_s *trace_data;
struct OpenAPI_cag_data_s *cag_data;
char *stn_sr;
@@ -76,27 +74,22 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
int nb_io_t_ue_priority;
int nssai_inclusion_allowed;
char rg_wireline_characteristics;
struct OpenAPI_tmbr_s *rg_tmbr;
struct OpenAPI_ec_restriction_data_s *ec_restriction_data;
struct OpenAPI_ec_restriction_data_wb_s *ec_restriction_data_wb;
int ec_restriction_data_nb;
struct OpenAPI_expected_ue_behaviour_data_s *expected_ue_behaviour_list;
OpenAPI_list_t *maximum_response_time_list;
OpenAPI_list_t *maximum_latency_list;
OpenAPI_list_t *primary_rat_restrictions;
OpenAPI_list_t *secondary_rat_restrictions;
OpenAPI_list_t *edrx_parameters_list;
OpenAPI_list_t *ptw_parameters_list;
int iab_operation_allowed;
struct OpenAPI_nr_v2x_auth_s *nr_v2x_services_auth;
struct OpenAPI_lte_v2x_auth_s *lte_v2x_services_auth;
char *nr_ue_pc5_ambr;
char *lte_pc5_ambr;
OpenAPI_list_t *wireline_forbidden_areas;
struct OpenAPI_wireline_service_area_restriction_s *wireline_service_area_restriction;
} OpenAPI_access_and_mobility_subscription_data_t;
OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_create(
char *supported_features,
OpenAPI_list_t *gpsis,
OpenAPI_list_t *internal_group_ids,
OpenAPI_list_t* vn_group_info,
OpenAPI_list_t* shared_vn_group_data_ids,
OpenAPI_ambr_rm_t *subscribed_ue_ambr,
OpenAPI_nssai_t *nssai,
@@ -110,7 +103,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int mps_priority,
int mcs_priority,
int active_time,
int dl_packet_count,
OpenAPI_sor_info_t *sor_info,
int sor_info_expect_ind,
int soraf_retrieval,
@@ -118,9 +110,11 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
OpenAPI_upu_info_t *upu_info,
int mico_allowed,
OpenAPI_list_t *shared_am_data_ids,
OpenAPI_odb_packet_services_t *odb_packet_services,
OpenAPI_odb_packet_services_e odb_packet_services,
OpenAPI_list_t *subscribed_dnn_list,
int service_gap_time,
OpenAPI_mdt_user_consent_e mdt_user_consent,
OpenAPI_mdt_configuration_t *mdt_configuration,
OpenAPI_trace_data_t *trace_data,
OpenAPI_cag_data_t *cag_data,
char *stn_sr,
@@ -128,20 +122,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int nb_io_t_ue_priority,
int nssai_inclusion_allowed,
char rg_wireline_characteristics,
OpenAPI_tmbr_t *rg_tmbr,
OpenAPI_ec_restriction_data_t *ec_restriction_data,
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb,
int ec_restriction_data_nb,
OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_list,
OpenAPI_list_t *maximum_response_time_list,
OpenAPI_list_t *maximum_latency_list,
OpenAPI_list_t *primary_rat_restrictions,
OpenAPI_list_t *secondary_rat_restrictions,
OpenAPI_list_t *edrx_parameters_list,
OpenAPI_list_t *ptw_parameters_list,
int iab_operation_allowed,
OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth,
OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth,
char *nr_ue_pc5_ambr,
char *lte_pc5_ambr
OpenAPI_list_t *wireline_forbidden_areas,
OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction
);
void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data);
OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_parseFromJSON(cJSON *access_and_mobility_subscription_dataJSON);

View File

@@ -0,0 +1,30 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "access_network_id.h"
char* OpenAPI_access_network_id_ToString(OpenAPI_access_network_id_e access_network_id)
{
const char *access_network_idArray[] = { "NULL", "HRPD", "WIMAX", "WLAN", "ETHERNET" };
size_t sizeofArray = sizeof(access_network_idArray) / sizeof(access_network_idArray[0]);
if (access_network_id < sizeofArray)
return (char *)access_network_idArray[access_network_id];
else
return (char *)"Unknown";
}
OpenAPI_access_network_id_e OpenAPI_access_network_id_FromString(char* access_network_id)
{
int stringToReturn = 0;
const char *access_network_idArray[] = { "NULL", "HRPD", "WIMAX", "WLAN", "ETHERNET" };
size_t sizeofArray = sizeof(access_network_idArray) / sizeof(access_network_idArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(access_network_id, access_network_idArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
return 0;
}

View File

@@ -0,0 +1,31 @@
/*
* access_network_id.h
*
*
*/
#ifndef _OpenAPI_access_network_id_H_
#define _OpenAPI_access_network_id_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum { OpenAPI_access_network_id_NULL = 0, OpenAPI_access_network_id_HRPD, OpenAPI_access_network_id_WIMAX, OpenAPI_access_network_id_WLAN, OpenAPI_access_network_id_ETHERNET } OpenAPI_access_network_id_e;
char* OpenAPI_access_network_id_ToString(OpenAPI_access_network_id_e access_network_id);
OpenAPI_access_network_id_e OpenAPI_access_network_id_FromString(char* access_network_id);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_access_network_id_H_ */

View File

@@ -4,82 +4,27 @@
#include <stdio.h>
#include "additional_qos_flow_info.h"
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_create(
)
char* OpenAPI_additional_qos_flow_info_ToString(OpenAPI_additional_qos_flow_info_e additional_qos_flow_info)
{
OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_additional_qos_flow_info_t));
if (!additional_qos_flow_info_local_var) {
return NULL;
}
return additional_qos_flow_info_local_var;
const char *additional_qos_flow_infoArray[] = { "NULL", "MORE_LIKELY" };
size_t sizeofArray = sizeof(additional_qos_flow_infoArray) / sizeof(additional_qos_flow_infoArray[0]);
if (additional_qos_flow_info < sizeofArray)
return (char *)additional_qos_flow_infoArray[additional_qos_flow_info];
else
return (char *)"Unknown";
}
void OpenAPI_additional_qos_flow_info_free(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info)
OpenAPI_additional_qos_flow_info_e OpenAPI_additional_qos_flow_info_FromString(char* additional_qos_flow_info)
{
if (NULL == additional_qos_flow_info) {
return;
int stringToReturn = 0;
const char *additional_qos_flow_infoArray[] = { "NULL", "MORE_LIKELY" };
size_t sizeofArray = sizeof(additional_qos_flow_infoArray) / sizeof(additional_qos_flow_infoArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(additional_qos_flow_info, additional_qos_flow_infoArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(additional_qos_flow_info);
}
cJSON *OpenAPI_additional_qos_flow_info_convertToJSON(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info)
{
cJSON *item = NULL;
if (additional_qos_flow_info == NULL) {
ogs_error("OpenAPI_additional_qos_flow_info_convertToJSON() failed [AdditionalQosFlowInfo]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_parseFromJSON(cJSON *additional_qos_flow_infoJSON)
{
OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_var = NULL;
additional_qos_flow_info_local_var = OpenAPI_additional_qos_flow_info_create (
);
return additional_qos_flow_info_local_var;
end:
return NULL;
}
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_copy(OpenAPI_additional_qos_flow_info_t *dst, OpenAPI_additional_qos_flow_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_additional_qos_flow_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_additional_qos_flow_info_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_additional_qos_flow_info_free(dst);
dst = OpenAPI_additional_qos_flow_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

Some files were not shown because too many files have changed in this diff Show More